{ "version": 3, "sources": ["../../rrweb-snapshot/dist/rrweb-snapshot.js", "../../rrdom/dist/rrdom.js", "../../utils/dist/utils.js", "../src/utils.ts", "../../types/dist/types.js", "../src/record/mutation.ts", "../src/record/error-handler.ts", "../src/record/observer.ts", "../src/record/cross-origin-iframe-mirror.ts", "../src/record/iframe-manager.ts", "../src/record/shadow-dom-manager.ts", "../../../node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js", "../src/record/observers/canvas/serialize-args.ts", "../src/record/observers/canvas/2d.ts", "../src/record/observers/canvas/canvas.ts", "../src/record/observers/canvas/webgl.ts", "../src/record/observers/canvas/canvas-manager.ts", "../src/record/stylesheet-manager.ts", "../src/record/processed-node-manager.ts", "../src/record/index.ts", "../../../node_modules/mitt/dist/mitt.mjs", "../src/replay/smoothscroll.ts", "../src/replay/timer.ts", "../../../node_modules/@xstate/fsm/es/index.js", "../src/replay/machine.ts", "../src/replay/styles/inject-style.ts", "../src/replay/canvas/deserialize-args.ts", "../src/replay/canvas/webgl.ts", "../src/replay/canvas/2d.ts", "../src/replay/canvas/index.ts", "../src/replay/media/index.ts", "../src/replay/dialog/index.ts", "../src/replay/index.ts", "../src/index.ts"], "sourcesContent": ["var __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 NodeType = /* @__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 || {});\nconst testableAccessors = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\nconst untaintedBasePrototype = {};\nconst isAngularZonePresent = () => {\n return !!globalThis.Zone;\n};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a, _b;\n return Boolean(\n (_b = (_a = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a;\n return typeof defaultPrototype[method] === \"function\" && ((_a = defaultPrototype[method]) == null ? void 0 : _a.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n) {\n return getUntaintedAccessor(\"Node\", n, \"childNodes\");\n}\nfunction parentNode(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentNode\");\n}\nfunction parentElement(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentElement\");\n}\nfunction textContent(n) {\n return getUntaintedAccessor(\"Node\", n, \"textContent\");\n}\nfunction contains(n, other) {\n return getUntaintedMethod(\"Node\", n, \"contains\")(other);\n}\nfunction getRootNode(n) {\n return getUntaintedMethod(\"Node\", n, \"getRootNode\")();\n}\nfunction host(n) {\n if (!n || !(\"host\" in n)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n, \"host\");\n}\nfunction styleSheets(n) {\n return n.styleSheets;\n}\nfunction shadowRoot(n) {\n if (!n || !(\"shadowRoot\" in n)) return null;\n return getUntaintedAccessor(\"Element\", n, \"shadowRoot\");\n}\nfunction querySelector(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype(\"MutationObserver\").constructor;\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor\n};\nfunction isElement(n) {\n return n.nodeType === n.ELEMENT_NODE;\n}\nfunction isShadowRoot(n) {\n const hostEl = (\n // anchor and textarea elements also have a `host` property\n // but only shadow roots have a `mode` property\n n && \"host\" in n && \"mode\" in n && index.host(n) || null\n );\n return Boolean(\n hostEl && \"shadowRoot\" in hostEl && index.shadowRoot(hostEl) === n\n );\n}\nfunction isNativeShadowDom(shadowRoot2) {\n return Object.prototype.toString.call(shadowRoot2) === \"[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(rule2) {\n const { cssText } = rule2;\n if (cssText.split('\"').length < 3) return cssText;\n const statement = [\"@import\", `url(${JSON.stringify(rule2.href)})`];\n if (rule2.layerName === \"\") {\n statement.push(`layer`);\n } else if (rule2.layerName) {\n statement.push(`layer(${rule2.layerName})`);\n }\n if (rule2.supportsText) {\n statement.push(`supports(${rule2.supportsText})`);\n }\n if (rule2.media.length) {\n statement.push(rule2.media.mediaText);\n }\n return statement.join(\" \") + \";\";\n}\nfunction stringifyStylesheet(s) {\n try {\n const rules = s.rules || s.cssRules;\n if (!rules) {\n return null;\n }\n let sheetHref = s.href;\n if (!sheetHref && s.ownerNode && s.ownerNode.ownerDocument) {\n sheetHref = s.ownerNode.ownerDocument.location.href;\n }\n const stringifiedRules = Array.from(\n rules,\n (rule2) => stringifyRule(rule2, sheetHref)\n ).join(\"\");\n return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);\n } catch (error) {\n return null;\n }\n}\nfunction stringifyRule(rule2, sheetHref) {\n if (isCSSImportRule(rule2)) {\n let importStringified;\n try {\n importStringified = // for same-origin stylesheets,\n // we can access the imported stylesheet rules directly\n stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement\n escapeImportStatement(rule2);\n } catch (error) {\n importStringified = rule2.cssText;\n }\n if (rule2.styleSheet.href) {\n return absolutifyURLs(importStringified, rule2.styleSheet.href);\n }\n return importStringified;\n } else {\n let ruleStringified = rule2.cssText;\n if (isCSSStyleRule(rule2) && rule2.selectorText.includes(\":\")) {\n ruleStringified = fixSafariColons(ruleStringified);\n }\n if (sheetHref) {\n return absolutifyURLs(ruleStringified, sheetHref);\n }\n return ruleStringified;\n }\n}\nfunction fixSafariColons(cssStringified) {\n const regex = /(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;\n return cssStringified.replace(regex, \"$1\\\\$2\");\n}\nfunction isCSSImportRule(rule2) {\n return \"styleSheet\" in rule2;\n}\nfunction isCSSStyleRule(rule2) {\n return \"selectorText\" in rule2;\n}\nclass Mirror {\n constructor() {\n __publicField(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n) {\n var _a;\n if (!n) return -1;\n const id = (_a = this.getMeta(n)) == null ? void 0 : _a.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(n) {\n return this.nodeMetaMap.get(n) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n) {\n const id = this.getId(n);\n this.idNodeMap.delete(id);\n if (n.childNodes) {\n n.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n);\n this.nodeMetaMap.set(n, meta);\n }\n replace(id, n) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n, meta);\n }\n this.idNodeMap.set(id, n);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror() {\n return new Mirror();\n}\nfunction maskInputValue({\n element,\n maskInputOptions,\n tagName,\n type,\n value,\n maskInputFn\n}) {\n let text = value || \"\";\n const actualType = type && toLowerCase(type);\n if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {\n if (maskInputFn) {\n text = maskInputFn(text, element);\n } else {\n text = \"*\".repeat(text.length);\n }\n }\n return text;\n}\nfunction toLowerCase(str) {\n return str.toLowerCase();\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 x2 = 0; x2 < canvas.width; x2 += 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 x2,\n y,\n Math.min(chunkSize, canvas.width - x2),\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(a, b) {\n if (!a || !b || a.type !== b.type) return false;\n if (a.type === NodeType.Document)\n return a.compatMode === b.compatMode;\n else if (a.type === NodeType.DocumentType)\n return a.name === b.name && a.publicId === b.publicId && a.systemId === b.systemId;\n else if (a.type === NodeType.Comment || a.type === NodeType.Text || a.type === NodeType.CDATA)\n return a.textContent === b.textContent;\n else if (a.type === NodeType.Element)\n return a.tagName === b.tagName && JSON.stringify(a.attributes) === JSON.stringify(b.attributes) && a.isSVG === b.isSVG && a.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 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 == null ? void 0 : match[1]) ?? null;\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}\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 absolutifyURLs(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}\nfunction normalizeCssString(cssText) {\n return cssText.replace(/(\\/\\*[^*]*\\*\\/)|[\\s;]/g, \"\");\n}\nfunction splitCssText(cssText, style) {\n const childNodes2 = Array.from(style.childNodes);\n const splits = [];\n if (childNodes2.length > 1 && cssText && typeof cssText === \"string\") {\n const cssTextNorm = normalizeCssString(cssText);\n for (let i = 1; i < childNodes2.length; i++) {\n if (childNodes2[i].textContent && typeof childNodes2[i].textContent === \"string\") {\n const textContentNorm = normalizeCssString(childNodes2[i].textContent);\n for (let j = 3; j < textContentNorm.length; j++) {\n const bit = textContentNorm.substring(0, j);\n if (cssTextNorm.split(bit).length === 2) {\n const splitNorm = cssTextNorm.indexOf(bit);\n for (let k = splitNorm; k < cssText.length; k++) {\n if (normalizeCssString(cssText.substring(0, k)).length === splitNorm) {\n splits.push(cssText.substring(0, k));\n cssText = cssText.substring(k);\n break;\n }\n }\n break;\n }\n }\n }\n }\n }\n splits.push(cssText);\n return splits;\n}\nfunction markCssSplits(cssText, style) {\n return splitCssText(cssText, style).join(\"/* rr_split */\");\n}\nlet _id = 1;\nconst tagNameRegex = new RegExp(\"[^a-z0-9-_:]\");\nconst IGNORED_NODE = -2;\nfunction genId() {\n return _id++;\n}\nfunction getValidTagName(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}\nlet canvasService;\nlet canvasCtx;\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 chars;\n const match = regEx.exec(attributeValue.substring(pos));\n if (match) {\n chars = match[0];\n pos += chars.length;\n return chars;\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 c = attributeValue.charAt(pos);\n if (c === \"\") {\n output.push((url + descriptorsStr).trim());\n break;\n } else if (!inParens) {\n if (c === \",\") {\n pos += 1;\n output.push((url + descriptorsStr).trim());\n break;\n } else if (c === \"(\") {\n inParens = true;\n }\n } else {\n if (c === \")\") {\n inParens = false;\n }\n }\n descriptorsStr += c;\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 a = cachedDocument.get(doc);\n if (!a) {\n a = doc.createElement(\"a\");\n cachedDocument.set(doc, a);\n }\n if (!customHref) {\n customHref = \"\";\n } else if (customHref.startsWith(\"blob:\") || customHref.startsWith(\"data:\")) {\n return customHref;\n }\n a.setAttribute(\"href\", customHref);\n return a.href;\n}\nfunction transformAttribute(doc, tagName, name, value) {\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 return absolutifyURLs(value, getHref(doc));\n } else if (tagName === \"object\" && name === \"data\") {\n return absoluteToDoc(doc, value);\n }\n return value;\n}\nfunction ignoreAttribute(tagName, name, _value) {\n return (tagName === \"video\" || tagName === \"audio\") && name === \"autoplay\";\n}\nfunction _isBlockedElement(element, blockClass, blockSelector) {\n try {\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 (e) {\n }\n return false;\n}\nfunction classMatchesRegex(node2, regex, checkAncestors) {\n if (!node2) return false;\n if (node2.nodeType !== node2.ELEMENT_NODE) {\n if (!checkAncestors) return false;\n return classMatchesRegex(index.parentNode(node2), regex, checkAncestors);\n }\n for (let eIndex = node2.classList.length; eIndex--; ) {\n const className = node2.classList[eIndex];\n if (regex.test(className)) {\n return true;\n }\n }\n if (!checkAncestors) return false;\n return classMatchesRegex(index.parentNode(node2), regex, checkAncestors);\n}\nfunction needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {\n let el;\n if (isElement(node2)) {\n el = node2;\n if (!index.childNodes(el).length) {\n return false;\n }\n } else if (index.parentElement(node2) === null) {\n return false;\n } else {\n el = index.parentElement(node2);\n }\n try {\n if (typeof maskTextClass === \"string\") {\n if (checkAncestors) {\n if (el.closest(`.${maskTextClass}`)) return true;\n } else {\n if (el.classList.contains(maskTextClass)) return true;\n }\n } else {\n if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;\n }\n if (maskTextSelector) {\n if (checkAncestors) {\n if (el.closest(maskTextSelector)) return true;\n } else {\n if (el.matches(maskTextSelector)) return true;\n }\n }\n } catch (e) {\n }\n return false;\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(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, iframeLoadTimeout);\n iframeEl.addEventListener(\"load\", () => {\n clearTimeout(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(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(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, styleSheetLoadTimeout);\n link.addEventListener(\"load\", () => {\n clearTimeout(timer);\n fired = true;\n listener();\n });\n}\nfunction serializeNode(n, options) {\n const {\n doc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n inlineStylesheet,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n cssCaptured = false\n } = options;\n const rootId = getRootId(doc, mirror);\n switch (n.nodeType) {\n case n.DOCUMENT_NODE:\n if (n.compatMode !== \"CSS1Compat\") {\n return {\n type: NodeType.Document,\n childNodes: [],\n compatMode: n.compatMode\n // probably \"BackCompat\"\n };\n } else {\n return {\n type: NodeType.Document,\n childNodes: []\n };\n }\n case n.DOCUMENT_TYPE_NODE:\n return {\n type: NodeType.DocumentType,\n name: n.name,\n publicId: n.publicId,\n systemId: n.systemId,\n rootId\n };\n case n.ELEMENT_NODE:\n return serializeElementNode(n, {\n doc,\n blockClass,\n blockSelector,\n inlineStylesheet,\n maskInputOptions,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n rootId\n });\n case n.TEXT_NODE:\n return serializeTextNode(n, {\n doc,\n needsMask,\n maskTextFn,\n rootId,\n cssCaptured\n });\n case n.CDATA_SECTION_NODE:\n return {\n type: NodeType.CDATA,\n textContent: \"\",\n rootId\n };\n case n.COMMENT_NODE:\n return {\n type: NodeType.Comment,\n textContent: index.textContent(n) || \"\",\n rootId\n };\n default:\n return false;\n }\n}\nfunction getRootId(doc, mirror) {\n if (!mirror.hasNode(doc)) return void 0;\n const docId = mirror.getId(doc);\n return docId === 1 ? void 0 : docId;\n}\nfunction serializeTextNode(n, options) {\n const { needsMask, maskTextFn, rootId, cssCaptured } = options;\n const parent = index.parentNode(n);\n const parentTagName = parent && parent.tagName;\n let textContent2 = \"\";\n const isStyle = parentTagName === \"STYLE\" ? true : void 0;\n const isScript = parentTagName === \"SCRIPT\" ? true : void 0;\n if (isScript) {\n textContent2 = \"SCRIPT_PLACEHOLDER\";\n } else if (!cssCaptured) {\n textContent2 = index.textContent(n);\n if (isStyle && textContent2) {\n textContent2 = absolutifyURLs(textContent2, getHref(options.doc));\n }\n }\n if (!isStyle && !isScript && textContent2 && needsMask) {\n textContent2 = maskTextFn ? maskTextFn(textContent2, index.parentElement(n)) : textContent2.replace(/[\\S]/g, \"*\");\n }\n return {\n type: NodeType.Text,\n textContent: textContent2 || \"\",\n rootId\n };\n}\nfunction serializeElementNode(n, options) {\n const {\n doc,\n blockClass,\n blockSelector,\n inlineStylesheet,\n maskInputOptions = {},\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n rootId\n } = options;\n const needBlock = _isBlockedElement(n, blockClass, blockSelector);\n const tagName = getValidTagName(n);\n let attributes = {};\n const len = n.attributes.length;\n for (let i = 0; i < len; i++) {\n const attr = n.attributes[i];\n if (!ignoreAttribute(tagName, attr.name, attr.value)) {\n attributes[attr.name] = transformAttribute(\n doc,\n tagName,\n toLowerCase(attr.name),\n attr.value\n );\n }\n }\n if (tagName === \"link\" && inlineStylesheet) {\n const stylesheet = Array.from(doc.styleSheets).find((s) => {\n return s.href === n.href;\n });\n let cssText = null;\n if (stylesheet) {\n cssText = stringifyStylesheet(stylesheet);\n }\n if (cssText) {\n delete attributes.rel;\n delete attributes.href;\n attributes._cssText = cssText;\n }\n }\n if (tagName === \"style\" && n.sheet) {\n let cssText = stringifyStylesheet(\n n.sheet\n );\n if (cssText) {\n if (n.childNodes.length > 1) {\n cssText = markCssSplits(cssText, n);\n }\n attributes._cssText = cssText;\n }\n }\n if (tagName === \"input\" || tagName === \"textarea\" || tagName === \"select\") {\n const value = n.value;\n const checked = n.checked;\n if (attributes.type !== \"radio\" && attributes.type !== \"checkbox\" && attributes.type !== \"submit\" && attributes.type !== \"button\" && value) {\n attributes.value = maskInputValue({\n element: n,\n type: getInputType(n),\n tagName,\n value,\n maskInputOptions,\n maskInputFn\n });\n } else if (checked) {\n attributes.checked = checked;\n }\n }\n if (tagName === \"option\") {\n if (n.selected && !maskInputOptions[\"select\"]) {\n attributes.selected = true;\n } else {\n delete attributes.selected;\n }\n }\n if (tagName === \"dialog\" && n.open) {\n attributes.rr_open_mode = n.matches(\"dialog:modal\") ? \"modal\" : \"non-modal\";\n }\n if (tagName === \"canvas\" && recordCanvas) {\n if (n.__context === \"2d\") {\n if (!is2DCanvasBlank(n)) {\n attributes.rr_dataURL = n.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n }\n } else if (!(\"__context\" in n)) {\n const canvasDataURL = n.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n const blankCanvas = doc.createElement(\"canvas\");\n blankCanvas.width = n.width;\n blankCanvas.height = n.height;\n const blankCanvasDataURL = blankCanvas.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n if (canvasDataURL !== blankCanvasDataURL) {\n attributes.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 = n;\n const imageSrc = image.currentSrc || image.getAttribute(\"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 attributes.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 ? attributes.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 const mediaAttributes = attributes;\n mediaAttributes.rr_mediaState = n.paused ? \"paused\" : \"played\";\n mediaAttributes.rr_mediaCurrentTime = n.currentTime;\n mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;\n mediaAttributes.rr_mediaMuted = n.muted;\n mediaAttributes.rr_mediaLoop = n.loop;\n mediaAttributes.rr_mediaVolume = n.volume;\n }\n if (!newlyAddedElement) {\n if (n.scrollLeft) {\n attributes.rr_scrollLeft = n.scrollLeft;\n }\n if (n.scrollTop) {\n attributes.rr_scrollTop = n.scrollTop;\n }\n }\n if (needBlock) {\n const { width, height } = n.getBoundingClientRect();\n attributes = {\n class: attributes.class,\n rr_width: `${width}px`,\n rr_height: `${height}px`\n };\n }\n if (tagName === \"iframe\" && !keepIframeSrcFn(attributes.src)) {\n if (!n.contentDocument) {\n attributes.rr_src = attributes.src;\n }\n delete attributes.src;\n }\n let isCustomElement;\n try {\n if (customElements.get(tagName)) isCustomElement = true;\n } catch (e) {\n }\n return {\n type: NodeType.Element,\n tagName,\n attributes,\n childNodes: [],\n isSVG: isSVGElement(n) || 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.Comment) {\n return true;\n } else if (sn.type === NodeType.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\") && sn.attributes.as === \"script\" || // 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(n, options) {\n const {\n doc,\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n skipChild = false,\n inlineStylesheet = true,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions = {},\n inlineImages = false,\n recordCanvas = false,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout = 5e3,\n onStylesheetLoad,\n stylesheetLoadTimeout = 5e3,\n keepIframeSrcFn = () => false,\n newlyAddedElement = false,\n cssCaptured = false\n } = options;\n let { needsMask } = options;\n let { preserveWhiteSpace = true } = options;\n if (!needsMask) {\n const checkAncestors = needsMask === void 0;\n needsMask = needMaskingText(\n n,\n maskTextClass,\n maskTextSelector,\n checkAncestors\n );\n }\n const _serializedNode = serializeNode(n, {\n doc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n cssCaptured\n });\n if (!_serializedNode) {\n console.warn(n, \"not serialized\");\n return null;\n }\n let id;\n if (mirror.hasNode(n)) {\n id = mirror.getId(n);\n } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.textContent.replace(/^\\s+|\\s+$/gm, \"\").length) {\n id = IGNORED_NODE;\n } else {\n id = genId();\n }\n const serializedNode = Object.assign(_serializedNode, { id });\n mirror.add(n, serializedNode);\n if (id === IGNORED_NODE) {\n return null;\n }\n if (onSerialize) {\n onSerialize(n);\n }\n let recordChild = !skipChild;\n if (serializedNode.type === NodeType.Element) {\n recordChild = recordChild && !serializedNode.needBlock;\n delete serializedNode.needBlock;\n const shadowRootEl = index.shadowRoot(n);\n if (shadowRootEl && isNativeShadowDom(shadowRootEl))\n serializedNode.isShadowHost = true;\n }\n if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {\n if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType.Element && serializedNode.tagName === \"head\") {\n preserveWhiteSpace = false;\n }\n const bypassOptions = {\n doc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild,\n inlineStylesheet,\n maskInputOptions,\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 cssCaptured: false\n };\n if (serializedNode.type === NodeType.Element && serializedNode.tagName === \"textarea\" && serializedNode.attributes.value !== void 0) ;\n else {\n if (serializedNode.type === NodeType.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === \"string\") {\n bypassOptions.cssCaptured = true;\n }\n for (const childN of Array.from(index.childNodes(n))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n let shadowRootEl = null;\n if (isElement(n) && (shadowRootEl = index.shadowRoot(n))) {\n for (const childN of Array.from(index.childNodes(shadowRootEl))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n }\n const parent = index.parentNode(n);\n if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {\n serializedNode.isShadow = true;\n }\n if (serializedNode.type === NodeType.Element && serializedNode.tagName === \"iframe\") {\n onceIframeLoaded(\n n,\n () => {\n const iframeDoc = n.contentDocument;\n if (iframeDoc && onIframeLoad) {\n const serializedIframeNode = serializeNodeWithId(iframeDoc, {\n doc: iframeDoc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\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 });\n if (serializedIframeNode) {\n onIframeLoad(\n n,\n serializedIframeNode\n );\n }\n }\n },\n iframeLoadTimeout\n );\n }\n if (serializedNode.type === NodeType.Element && serializedNode.tagName === \"link\" && typeof serializedNode.attributes.rel === \"string\" && (serializedNode.attributes.rel === \"stylesheet\" || serializedNode.attributes.rel === \"preload\" && typeof serializedNode.attributes.href === \"string\" && extractFileExtension(serializedNode.attributes.href) === \"css\")) {\n onceStylesheetLoaded(\n n,\n () => {\n if (onStylesheetLoad) {\n const serializedLinkNode = serializeNodeWithId(n, {\n doc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\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 });\n if (serializedLinkNode) {\n onStylesheetLoad(\n n,\n serializedLinkNode\n );\n }\n }\n },\n stylesheetLoadTimeout\n );\n }\n return serializedNode;\n}\nfunction snapshot(n, options) {\n const {\n mirror = new Mirror(),\n blockClass = \"rr-block\",\n blockSelector = null,\n maskTextClass = \"rr-mask\",\n maskTextSelector = null,\n inlineStylesheet = true,\n inlineImages = false,\n recordCanvas = false,\n maskAllInputs = false,\n maskTextFn,\n maskInputFn,\n slimDOM = false,\n dataURLOptions,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn = () => false\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 password: true\n } : maskAllInputs === false ? {\n password: true\n } : 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(n, {\n doc: n,\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\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 newlyAddedElement: false\n });\n}\nfunction visitSnapshot(node2, onVisit) {\n function walk(current) {\n onVisit(current);\n if (current.type === NodeType.Document || current.type === NodeType.Element) {\n current.childNodes.forEach(walk);\n }\n }\n walk(node2);\n}\nfunction cleanupSnapshot() {\n _id = 1;\n}\nconst MEDIA_SELECTOR = /(max|min)-device-(width|height)/;\nconst MEDIA_SELECTOR_GLOBAL = new RegExp(MEDIA_SELECTOR.source, \"g\");\nconst mediaSelectorPlugin = {\n postcssPlugin: \"postcss-custom-selectors\",\n prepare() {\n return {\n postcssPlugin: \"postcss-custom-selectors\",\n AtRule: function(atrule) {\n if (atrule.params.match(MEDIA_SELECTOR_GLOBAL)) {\n atrule.params = atrule.params.replace(MEDIA_SELECTOR_GLOBAL, \"$1-$2\");\n }\n }\n };\n }\n};\nconst pseudoClassPlugin = {\n postcssPlugin: \"postcss-hover-classes\",\n prepare: function() {\n const fixed = [];\n return {\n Rule: function(rule2) {\n if (fixed.indexOf(rule2) !== -1) {\n return;\n }\n fixed.push(rule2);\n rule2.selectors.forEach(function(selector) {\n if (selector.includes(\":hover\")) {\n rule2.selector += \",\\n\" + selector.replace(/:hover/g, \".\\\\:hover\");\n }\n });\n }\n };\n }\n};\nfunction getDefaultExportFromCjs(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, \"default\") ? x2[\"default\"] : x2;\n}\nfunction getAugmentedNamespace(n) {\n if (n.__esModule) return n;\n var f = n.default;\n if (typeof f == \"function\") {\n var a = function a2() {\n if (this instanceof a2) {\n return Reflect.construct(f, arguments, this.constructor);\n }\n return f.apply(this, arguments);\n };\n a.prototype = f.prototype;\n } else a = {};\n Object.defineProperty(a, \"__esModule\", { value: true });\n Object.keys(n).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n, k);\n Object.defineProperty(a, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n[k];\n }\n });\n });\n return a;\n}\nvar picocolors_browser = { exports: {} };\nvar x = String;\nvar create = function() {\n return { isColorSupported: false, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x };\n};\npicocolors_browser.exports = create();\npicocolors_browser.exports.createColors = create;\nvar picocolors_browserExports = picocolors_browser.exports;\nconst __viteBrowserExternal = {};\nconst __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n default: __viteBrowserExternal\n}, Symbol.toStringTag, { value: \"Module\" }));\nconst require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);\nlet pico = picocolors_browserExports;\nlet terminalHighlight$1 = require$$2;\nlet CssSyntaxError$3 = class CssSyntaxError extends Error {\n constructor(message, line, column, source, file, plugin2) {\n super(message);\n this.name = \"CssSyntaxError\";\n this.reason = message;\n if (file) {\n this.file = file;\n }\n if (source) {\n this.source = source;\n }\n if (plugin2) {\n this.plugin = plugin2;\n }\n if (typeof line !== \"undefined\" && typeof column !== \"undefined\") {\n if (typeof line === \"number\") {\n this.line = line;\n this.column = column;\n } else {\n this.line = line.line;\n this.column = line.column;\n this.endLine = column.line;\n this.endColumn = column.column;\n }\n }\n this.setMessage();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CssSyntaxError);\n }\n }\n setMessage() {\n this.message = this.plugin ? this.plugin + \": \" : \"\";\n this.message += this.file ? this.file : \"\";\n if (typeof this.line !== \"undefined\") {\n this.message += \":\" + this.line + \":\" + this.column;\n }\n this.message += \": \" + this.reason;\n }\n showSourceCode(color) {\n if (!this.source) return \"\";\n let css = this.source;\n if (color == null) color = pico.isColorSupported;\n if (terminalHighlight$1) {\n if (color) css = terminalHighlight$1(css);\n }\n let lines = css.split(/\\r?\\n/);\n let start = Math.max(this.line - 3, 0);\n let end = Math.min(this.line + 2, lines.length);\n let maxWidth = String(end).length;\n let mark, aside;\n if (color) {\n let { bold, gray, red } = pico.createColors(true);\n mark = (text) => bold(red(text));\n aside = (text) => gray(text);\n } else {\n mark = aside = (str) => str;\n }\n return lines.slice(start, end).map((line, index2) => {\n let number = start + 1 + index2;\n let gutter = \" \" + (\" \" + number).slice(-maxWidth) + \" | \";\n if (number === this.line) {\n let spacing = aside(gutter.replace(/\\d/g, \" \")) + line.slice(0, this.column - 1).replace(/[^\\t]/g, \" \");\n return mark(\">\") + aside(gutter) + line + \"\\n \" + spacing + mark(\"^\");\n }\n return \" \" + aside(gutter) + line;\n }).join(\"\\n\");\n }\n toString() {\n let code = this.showSourceCode();\n if (code) {\n code = \"\\n\\n\" + code + \"\\n\";\n }\n return this.name + \": \" + this.message + code;\n }\n};\nvar cssSyntaxError = CssSyntaxError$3;\nCssSyntaxError$3.default = CssSyntaxError$3;\nvar symbols = {};\nsymbols.isClean = Symbol(\"isClean\");\nsymbols.my = Symbol(\"my\");\nconst DEFAULT_RAW = {\n after: \"\\n\",\n beforeClose: \"\\n\",\n beforeComment: \"\\n\",\n beforeDecl: \"\\n\",\n beforeOpen: \" \",\n beforeRule: \"\\n\",\n colon: \": \",\n commentLeft: \" \",\n commentRight: \" \",\n emptyBody: \"\",\n indent: \" \",\n semicolon: false\n};\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1);\n}\nlet Stringifier$2 = class Stringifier {\n constructor(builder) {\n this.builder = builder;\n }\n atrule(node2, semicolon) {\n let name = \"@\" + node2.name;\n let params = node2.params ? this.rawValue(node2, \"params\") : \"\";\n if (typeof node2.raws.afterName !== \"undefined\") {\n name += node2.raws.afterName;\n } else if (params) {\n name += \" \";\n }\n if (node2.nodes) {\n this.block(node2, name + params);\n } else {\n let end = (node2.raws.between || \"\") + (semicolon ? \";\" : \"\");\n this.builder(name + params + end, node2);\n }\n }\n beforeAfter(node2, detect) {\n let value;\n if (node2.type === \"decl\") {\n value = this.raw(node2, null, \"beforeDecl\");\n } else if (node2.type === \"comment\") {\n value = this.raw(node2, null, \"beforeComment\");\n } else if (detect === \"before\") {\n value = this.raw(node2, null, \"beforeRule\");\n } else {\n value = this.raw(node2, null, \"beforeClose\");\n }\n let buf = node2.parent;\n let depth = 0;\n while (buf && buf.type !== \"root\") {\n depth += 1;\n buf = buf.parent;\n }\n if (value.includes(\"\\n\")) {\n let indent = this.raw(node2, null, \"indent\");\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent;\n }\n }\n return value;\n }\n block(node2, start) {\n let between = this.raw(node2, \"between\", \"beforeOpen\");\n this.builder(start + between + \"{\", node2, \"start\");\n let after;\n if (node2.nodes && node2.nodes.length) {\n this.body(node2);\n after = this.raw(node2, \"after\");\n } else {\n after = this.raw(node2, \"after\", \"emptyBody\");\n }\n if (after) this.builder(after);\n this.builder(\"}\", node2, \"end\");\n }\n body(node2) {\n let last = node2.nodes.length - 1;\n while (last > 0) {\n if (node2.nodes[last].type !== \"comment\") break;\n last -= 1;\n }\n let semicolon = this.raw(node2, \"semicolon\");\n for (let i = 0; i < node2.nodes.length; i++) {\n let child = node2.nodes[i];\n let before = this.raw(child, \"before\");\n if (before) this.builder(before);\n this.stringify(child, last !== i || semicolon);\n }\n }\n comment(node2) {\n let left = this.raw(node2, \"left\", \"commentLeft\");\n let right = this.raw(node2, \"right\", \"commentRight\");\n this.builder(\"/*\" + left + node2.text + right + \"*/\", node2);\n }\n decl(node2, semicolon) {\n let between = this.raw(node2, \"between\", \"colon\");\n let string = node2.prop + between + this.rawValue(node2, \"value\");\n if (node2.important) {\n string += node2.raws.important || \" !important\";\n }\n if (semicolon) string += \";\";\n this.builder(string, node2);\n }\n document(node2) {\n this.body(node2);\n }\n raw(node2, own, detect) {\n let value;\n if (!detect) detect = own;\n if (own) {\n value = node2.raws[own];\n if (typeof value !== \"undefined\") return value;\n }\n let parent = node2.parent;\n if (detect === \"before\") {\n if (!parent || parent.type === \"root\" && parent.first === node2) {\n return \"\";\n }\n if (parent && parent.type === \"document\") {\n return \"\";\n }\n }\n if (!parent) return DEFAULT_RAW[detect];\n let root2 = node2.root();\n if (!root2.rawCache) root2.rawCache = {};\n if (typeof root2.rawCache[detect] !== \"undefined\") {\n return root2.rawCache[detect];\n }\n if (detect === \"before\" || detect === \"after\") {\n return this.beforeAfter(node2, detect);\n } else {\n let method = \"raw\" + capitalize(detect);\n if (this[method]) {\n value = this[method](root2, node2);\n } else {\n root2.walk((i) => {\n value = i.raws[own];\n if (typeof value !== \"undefined\") return false;\n });\n }\n }\n if (typeof value === \"undefined\") value = DEFAULT_RAW[detect];\n root2.rawCache[detect] = value;\n return value;\n }\n rawBeforeClose(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== \"undefined\") {\n value = i.raws.after;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, \"\");\n return value;\n }\n rawBeforeComment(root2, node2) {\n let value;\n root2.walkComments((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.raws.before;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n });\n if (typeof value === \"undefined\") {\n value = this.raw(node2, null, \"beforeDecl\");\n } else if (value) {\n value = value.replace(/\\S/g, \"\");\n }\n return value;\n }\n rawBeforeDecl(root2, node2) {\n let value;\n root2.walkDecls((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.raws.before;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n });\n if (typeof value === \"undefined\") {\n value = this.raw(node2, null, \"beforeRule\");\n } else if (value) {\n value = value.replace(/\\S/g, \"\");\n }\n return value;\n }\n rawBeforeOpen(root2) {\n let value;\n root2.walk((i) => {\n if (i.type !== \"decl\") {\n value = i.raws.between;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawBeforeRule(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && (i.parent !== root2 || root2.first !== i)) {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.raws.before;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, \"\");\n return value;\n }\n rawColon(root2) {\n let value;\n root2.walkDecls((i) => {\n if (typeof i.raws.between !== \"undefined\") {\n value = i.raws.between.replace(/[^\\s:]/g, \"\");\n return false;\n }\n });\n return value;\n }\n rawEmptyBody(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.raws.after;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawIndent(root2) {\n if (root2.raws.indent) return root2.raws.indent;\n let value;\n root2.walk((i) => {\n let p = i.parent;\n if (p && p !== root2 && p.parent && p.parent === root2) {\n if (typeof i.raws.before !== \"undefined\") {\n let parts = i.raws.before.split(\"\\n\");\n value = parts[parts.length - 1];\n value = value.replace(/\\S/g, \"\");\n return false;\n }\n }\n });\n return value;\n }\n rawSemicolon(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length && i.last.type === \"decl\") {\n value = i.raws.semicolon;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawValue(node2, prop) {\n let value = node2[prop];\n let raw = node2.raws[prop];\n if (raw && raw.value === value) {\n return raw.raw;\n }\n return value;\n }\n root(node2) {\n this.body(node2);\n if (node2.raws.after) this.builder(node2.raws.after);\n }\n rule(node2) {\n this.block(node2, this.rawValue(node2, \"selector\"));\n if (node2.raws.ownSemicolon) {\n this.builder(node2.raws.ownSemicolon, node2, \"end\");\n }\n }\n stringify(node2, semicolon) {\n if (!this[node2.type]) {\n throw new Error(\n \"Unknown AST node type \" + node2.type + \". Maybe you need to change PostCSS stringifier.\"\n );\n }\n this[node2.type](node2, semicolon);\n }\n};\nvar stringifier = Stringifier$2;\nStringifier$2.default = Stringifier$2;\nlet Stringifier$1 = stringifier;\nfunction stringify$4(node2, builder) {\n let str = new Stringifier$1(builder);\n str.stringify(node2);\n}\nvar stringify_1 = stringify$4;\nstringify$4.default = stringify$4;\nlet { isClean: isClean$2, my: my$2 } = symbols;\nlet CssSyntaxError$2 = cssSyntaxError;\nlet Stringifier2 = stringifier;\nlet stringify$3 = stringify_1;\nfunction cloneNode(obj, parent) {\n let cloned = new obj.constructor();\n for (let i in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i)) {\n continue;\n }\n if (i === \"proxyCache\") continue;\n let value = obj[i];\n let type = typeof value;\n if (i === \"parent\" && type === \"object\") {\n if (parent) cloned[i] = parent;\n } else if (i === \"source\") {\n cloned[i] = value;\n } else if (Array.isArray(value)) {\n cloned[i] = value.map((j) => cloneNode(j, cloned));\n } else {\n if (type === \"object\" && value !== null) value = cloneNode(value);\n cloned[i] = value;\n }\n }\n return cloned;\n}\nlet Node$4 = class Node {\n constructor(defaults = {}) {\n this.raws = {};\n this[isClean$2] = false;\n this[my$2] = true;\n for (let name in defaults) {\n if (name === \"nodes\") {\n this.nodes = [];\n for (let node2 of defaults[name]) {\n if (typeof node2.clone === \"function\") {\n this.append(node2.clone());\n } else {\n this.append(node2);\n }\n }\n } else {\n this[name] = defaults[name];\n }\n }\n }\n addToError(error) {\n error.postcssNode = this;\n if (error.stack && this.source && /\\n\\s{4}at /.test(error.stack)) {\n let s = this.source;\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s.input.from}:${s.start.line}:${s.start.column}$&`\n );\n }\n return error;\n }\n after(add) {\n this.parent.insertAfter(this, add);\n return this;\n }\n assign(overrides = {}) {\n for (let name in overrides) {\n this[name] = overrides[name];\n }\n return this;\n }\n before(add) {\n this.parent.insertBefore(this, add);\n return this;\n }\n cleanRaws(keepBetween) {\n delete this.raws.before;\n delete this.raws.after;\n if (!keepBetween) delete this.raws.between;\n }\n clone(overrides = {}) {\n let cloned = cloneNode(this);\n for (let name in overrides) {\n cloned[name] = overrides[name];\n }\n return cloned;\n }\n cloneAfter(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertAfter(this, cloned);\n return cloned;\n }\n cloneBefore(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertBefore(this, cloned);\n return cloned;\n }\n error(message, opts = {}) {\n if (this.source) {\n let { end, start } = this.rangeBy(opts);\n return this.source.input.error(\n message,\n { column: start.column, line: start.line },\n { column: end.column, line: end.line },\n opts\n );\n }\n return new CssSyntaxError$2(message);\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === \"proxyOf\") {\n return node2;\n } else if (prop === \"root\") {\n return () => node2.root().toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === \"prop\" || prop === \"value\" || prop === \"name\" || prop === \"params\" || prop === \"important\" || /* c8 ignore next */\n prop === \"text\") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n markDirty() {\n if (this[isClean$2]) {\n this[isClean$2] = false;\n let next = this;\n while (next = next.parent) {\n next[isClean$2] = false;\n }\n }\n }\n next() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 + 1];\n }\n positionBy(opts, stringRepresentation) {\n let pos = this.source.start;\n if (opts.index) {\n pos = this.positionInside(opts.index, stringRepresentation);\n } else if (opts.word) {\n stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) pos = this.positionInside(index2, stringRepresentation);\n }\n return pos;\n }\n positionInside(index2, stringRepresentation) {\n let string = stringRepresentation || this.toString();\n let column = this.source.start.column;\n let line = this.source.start.line;\n for (let i = 0; i < index2; i++) {\n if (string[i] === \"\\n\") {\n column = 1;\n line += 1;\n } else {\n column += 1;\n }\n }\n return { column, line };\n }\n prev() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 - 1];\n }\n rangeBy(opts) {\n let start = {\n column: this.source.start.column,\n line: this.source.start.line\n };\n let end = this.source.end ? {\n column: this.source.end.column + 1,\n line: this.source.end.line\n } : {\n column: start.column + 1,\n line: start.line\n };\n if (opts.word) {\n let stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) {\n start = this.positionInside(index2, stringRepresentation);\n end = this.positionInside(index2 + opts.word.length, stringRepresentation);\n }\n } else {\n if (opts.start) {\n start = {\n column: opts.start.column,\n line: opts.start.line\n };\n } else if (opts.index) {\n start = this.positionInside(opts.index);\n }\n if (opts.end) {\n end = {\n column: opts.end.column,\n line: opts.end.line\n };\n } else if (typeof opts.endIndex === \"number\") {\n end = this.positionInside(opts.endIndex);\n } else if (opts.index) {\n end = this.positionInside(opts.index + 1);\n }\n }\n if (end.line < start.line || end.line === start.line && end.column <= start.column) {\n end = { column: start.column + 1, line: start.line };\n }\n return { end, start };\n }\n raw(prop, defaultType) {\n let str = new Stringifier2();\n return str.raw(this, prop, defaultType);\n }\n remove() {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n this.parent = void 0;\n return this;\n }\n replaceWith(...nodes) {\n if (this.parent) {\n let bookmark = this;\n let foundSelf = false;\n for (let node2 of nodes) {\n if (node2 === this) {\n foundSelf = true;\n } else if (foundSelf) {\n this.parent.insertAfter(bookmark, node2);\n bookmark = node2;\n } else {\n this.parent.insertBefore(bookmark, node2);\n }\n }\n if (!foundSelf) {\n this.remove();\n }\n }\n return this;\n }\n root() {\n let result2 = this;\n while (result2.parent && result2.parent.type !== \"document\") {\n result2 = result2.parent;\n }\n return result2;\n }\n toJSON(_, inputs) {\n let fixed = {};\n let emitInputs = inputs == null;\n inputs = inputs || /* @__PURE__ */ new Map();\n let inputsNextIndex = 0;\n for (let name in this) {\n if (!Object.prototype.hasOwnProperty.call(this, name)) {\n continue;\n }\n if (name === \"parent\" || name === \"proxyCache\") continue;\n let value = this[name];\n if (Array.isArray(value)) {\n fixed[name] = value.map((i) => {\n if (typeof i === \"object\" && i.toJSON) {\n return i.toJSON(null, inputs);\n } else {\n return i;\n }\n });\n } else if (typeof value === \"object\" && value.toJSON) {\n fixed[name] = value.toJSON(null, inputs);\n } else if (name === \"source\") {\n let inputId = inputs.get(value.input);\n if (inputId == null) {\n inputId = inputsNextIndex;\n inputs.set(value.input, inputsNextIndex);\n inputsNextIndex++;\n }\n fixed[name] = {\n end: value.end,\n inputId,\n start: value.start\n };\n } else {\n fixed[name] = value;\n }\n }\n if (emitInputs) {\n fixed.inputs = [...inputs.keys()].map((input2) => input2.toJSON());\n }\n return fixed;\n }\n toProxy() {\n if (!this.proxyCache) {\n this.proxyCache = new Proxy(this, this.getProxyProcessor());\n }\n return this.proxyCache;\n }\n toString(stringifier2 = stringify$3) {\n if (stringifier2.stringify) stringifier2 = stringifier2.stringify;\n let result2 = \"\";\n stringifier2(this, (i) => {\n result2 += i;\n });\n return result2;\n }\n warn(result2, text, opts) {\n let data = { node: this };\n for (let i in opts) data[i] = opts[i];\n return result2.warn(text, data);\n }\n get proxyOf() {\n return this;\n }\n};\nvar node = Node$4;\nNode$4.default = Node$4;\nlet Node$3 = node;\nlet Declaration$4 = class Declaration extends Node$3 {\n constructor(defaults) {\n if (defaults && typeof defaults.value !== \"undefined\" && typeof defaults.value !== \"string\") {\n defaults = { ...defaults, value: String(defaults.value) };\n }\n super(defaults);\n this.type = \"decl\";\n }\n get variable() {\n return this.prop.startsWith(\"--\") || this.prop[0] === \"$\";\n }\n};\nvar declaration = Declaration$4;\nDeclaration$4.default = Declaration$4;\nlet urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nlet customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += alphabet[Math.random() * alphabet.length | 0];\n }\n return id;\n };\n};\nlet nanoid$1 = (size = 21) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += urlAlphabet[Math.random() * 64 | 0];\n }\n return id;\n};\nvar nonSecure = { nanoid: nanoid$1, customAlphabet };\nlet { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;\nlet { existsSync, readFileSync } = require$$2;\nlet { dirname: dirname$1, join } = require$$2;\nfunction fromBase64(str) {\n if (Buffer) {\n return Buffer.from(str, \"base64\").toString();\n } else {\n return window.atob(str);\n }\n}\nlet PreviousMap$2 = class PreviousMap {\n constructor(css, opts) {\n if (opts.map === false) return;\n this.loadAnnotation(css);\n this.inline = this.startWith(this.annotation, \"data:\");\n let prev = opts.map ? opts.map.prev : void 0;\n let text = this.loadMap(opts.from, prev);\n if (!this.mapFile && opts.from) {\n this.mapFile = opts.from;\n }\n if (this.mapFile) this.root = dirname$1(this.mapFile);\n if (text) this.text = text;\n }\n consumer() {\n if (!this.consumerCache) {\n this.consumerCache = new SourceMapConsumer$2(this.text);\n }\n return this.consumerCache;\n }\n decodeInline(text) {\n let baseCharsetUri = /^data:application\\/json;charset=utf-?8;base64,/;\n let baseUri = /^data:application\\/json;base64,/;\n let charsetUri = /^data:application\\/json;charset=utf-?8,/;\n let uri = /^data:application\\/json,/;\n if (charsetUri.test(text) || uri.test(text)) {\n return decodeURIComponent(text.substr(RegExp.lastMatch.length));\n }\n if (baseCharsetUri.test(text) || baseUri.test(text)) {\n return fromBase64(text.substr(RegExp.lastMatch.length));\n }\n let encoding = text.match(/data:application\\/json;([^,]+),/)[1];\n throw new Error(\"Unsupported source map encoding \" + encoding);\n }\n getAnnotationURL(sourceMapString) {\n return sourceMapString.replace(/^\\/\\*\\s*# sourceMappingURL=/, \"\").trim();\n }\n isMap(map) {\n if (typeof map !== \"object\") return false;\n return typeof map.mappings === \"string\" || typeof map._mappings === \"string\" || Array.isArray(map.sections);\n }\n loadAnnotation(css) {\n let comments = css.match(/\\/\\*\\s*# sourceMappingURL=/gm);\n if (!comments) return;\n let start = css.lastIndexOf(comments.pop());\n let end = css.indexOf(\"*/\", start);\n if (start > -1 && end > -1) {\n this.annotation = this.getAnnotationURL(css.substring(start, end));\n }\n }\n loadFile(path) {\n this.root = dirname$1(path);\n if (existsSync(path)) {\n this.mapFile = path;\n return readFileSync(path, \"utf-8\").toString().trim();\n }\n }\n loadMap(file, prev) {\n if (prev === false) return false;\n if (prev) {\n if (typeof prev === \"string\") {\n return prev;\n } else if (typeof prev === \"function\") {\n let prevPath = prev(file);\n if (prevPath) {\n let map = this.loadFile(prevPath);\n if (!map) {\n throw new Error(\n \"Unable to load previous source map: \" + prevPath.toString()\n );\n }\n return map;\n }\n } else if (prev instanceof SourceMapConsumer$2) {\n return SourceMapGenerator$2.fromSourceMap(prev).toString();\n } else if (prev instanceof SourceMapGenerator$2) {\n return prev.toString();\n } else if (this.isMap(prev)) {\n return JSON.stringify(prev);\n } else {\n throw new Error(\n \"Unsupported previous source map format: \" + prev.toString()\n );\n }\n } else if (this.inline) {\n return this.decodeInline(this.annotation);\n } else if (this.annotation) {\n let map = this.annotation;\n if (file) map = join(dirname$1(file), map);\n return this.loadFile(map);\n }\n }\n startWith(string, start) {\n if (!string) return false;\n return string.substr(0, start.length) === start;\n }\n withContent() {\n return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);\n }\n};\nvar previousMap = PreviousMap$2;\nPreviousMap$2.default = PreviousMap$2;\nlet { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;\nlet { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;\nlet { isAbsolute, resolve: resolve$1 } = require$$2;\nlet { nanoid } = nonSecure;\nlet terminalHighlight = require$$2;\nlet CssSyntaxError$1 = cssSyntaxError;\nlet PreviousMap$1 = previousMap;\nlet fromOffsetCache = Symbol(\"fromOffsetCache\");\nlet sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);\nlet pathAvailable$1 = Boolean(resolve$1 && isAbsolute);\nlet Input$4 = class Input {\n constructor(css, opts = {}) {\n if (css === null || typeof css === \"undefined\" || typeof css === \"object\" && !css.toString) {\n throw new Error(`PostCSS received ${css} instead of CSS string`);\n }\n this.css = css.toString();\n if (this.css[0] === \"\\uFEFF\" || this.css[0] === \"￾\") {\n this.hasBOM = true;\n this.css = this.css.slice(1);\n } else {\n this.hasBOM = false;\n }\n if (opts.from) {\n if (!pathAvailable$1 || /^\\w+:\\/\\//.test(opts.from) || isAbsolute(opts.from)) {\n this.file = opts.from;\n } else {\n this.file = resolve$1(opts.from);\n }\n }\n if (pathAvailable$1 && sourceMapAvailable$1) {\n let map = new PreviousMap$1(this.css, opts);\n if (map.text) {\n this.map = map;\n let file = map.consumer().file;\n if (!this.file && file) this.file = this.mapResolve(file);\n }\n }\n if (!this.file) {\n this.id = \"\";\n }\n if (this.map) this.map.file = this.from;\n }\n error(message, line, column, opts = {}) {\n let result2, endLine, endColumn;\n if (line && typeof line === \"object\") {\n let start = line;\n let end = column;\n if (typeof start.offset === \"number\") {\n let pos = this.fromOffset(start.offset);\n line = pos.line;\n column = pos.col;\n } else {\n line = start.line;\n column = start.column;\n }\n if (typeof end.offset === \"number\") {\n let pos = this.fromOffset(end.offset);\n endLine = pos.line;\n endColumn = pos.col;\n } else {\n endLine = end.line;\n endColumn = end.column;\n }\n } else if (!column) {\n let pos = this.fromOffset(line);\n line = pos.line;\n column = pos.col;\n }\n let origin = this.origin(line, column, endLine, endColumn);\n if (origin) {\n result2 = new CssSyntaxError$1(\n message,\n origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },\n origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },\n origin.source,\n origin.file,\n opts.plugin\n );\n } else {\n result2 = new CssSyntaxError$1(\n message,\n endLine === void 0 ? line : { column, line },\n endLine === void 0 ? column : { column: endColumn, line: endLine },\n this.css,\n this.file,\n opts.plugin\n );\n }\n result2.input = { column, endColumn, endLine, line, source: this.css };\n if (this.file) {\n if (pathToFileURL$1) {\n result2.input.url = pathToFileURL$1(this.file).toString();\n }\n result2.input.file = this.file;\n }\n return result2;\n }\n fromOffset(offset) {\n let lastLine, lineToIndex;\n if (!this[fromOffsetCache]) {\n let lines = this.css.split(\"\\n\");\n lineToIndex = new Array(lines.length);\n let prevIndex = 0;\n for (let i = 0, l = lines.length; i < l; i++) {\n lineToIndex[i] = prevIndex;\n prevIndex += lines[i].length + 1;\n }\n this[fromOffsetCache] = lineToIndex;\n } else {\n lineToIndex = this[fromOffsetCache];\n }\n lastLine = lineToIndex[lineToIndex.length - 1];\n let min = 0;\n if (offset >= lastLine) {\n min = lineToIndex.length - 1;\n } else {\n let max = lineToIndex.length - 2;\n let mid;\n while (min < max) {\n mid = min + (max - min >> 1);\n if (offset < lineToIndex[mid]) {\n max = mid - 1;\n } else if (offset >= lineToIndex[mid + 1]) {\n min = mid + 1;\n } else {\n min = mid;\n break;\n }\n }\n }\n return {\n col: offset - lineToIndex[min] + 1,\n line: min + 1\n };\n }\n mapResolve(file) {\n if (/^\\w+:\\/\\//.test(file)) {\n return file;\n }\n return resolve$1(this.map.consumer().sourceRoot || this.map.root || \".\", file);\n }\n origin(line, column, endLine, endColumn) {\n if (!this.map) return false;\n let consumer = this.map.consumer();\n let from = consumer.originalPositionFor({ column, line });\n if (!from.source) return false;\n let to;\n if (typeof endLine === \"number\") {\n to = consumer.originalPositionFor({ column: endColumn, line: endLine });\n }\n let fromUrl;\n if (isAbsolute(from.source)) {\n fromUrl = pathToFileURL$1(from.source);\n } else {\n fromUrl = new URL(\n from.source,\n this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)\n );\n }\n let result2 = {\n column: from.column,\n endColumn: to && to.column,\n endLine: to && to.line,\n line: from.line,\n url: fromUrl.toString()\n };\n if (fromUrl.protocol === \"file:\") {\n if (fileURLToPath) {\n result2.file = fileURLToPath(fromUrl);\n } else {\n throw new Error(`file: protocol is not available in this PostCSS build`);\n }\n }\n let source = consumer.sourceContentFor(from.source);\n if (source) result2.source = source;\n return result2;\n }\n toJSON() {\n let json = {};\n for (let name of [\"hasBOM\", \"css\", \"file\", \"id\"]) {\n if (this[name] != null) {\n json[name] = this[name];\n }\n }\n if (this.map) {\n json.map = { ...this.map };\n if (json.map.consumerCache) {\n json.map.consumerCache = void 0;\n }\n }\n return json;\n }\n get from() {\n return this.file || this.id;\n }\n};\nvar input = Input$4;\nInput$4.default = Input$4;\nif (terminalHighlight && terminalHighlight.registerInput) {\n terminalHighlight.registerInput(Input$4);\n}\nlet { SourceMapConsumer, SourceMapGenerator } = require$$2;\nlet { dirname, relative, resolve, sep } = require$$2;\nlet { pathToFileURL } = require$$2;\nlet Input$3 = input;\nlet sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);\nlet pathAvailable = Boolean(dirname && resolve && relative && sep);\nlet MapGenerator$2 = class MapGenerator {\n constructor(stringify2, root2, opts, cssString) {\n this.stringify = stringify2;\n this.mapOpts = opts.map || {};\n this.root = root2;\n this.opts = opts;\n this.css = cssString;\n this.originalCSS = cssString;\n this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;\n this.memoizedFileURLs = /* @__PURE__ */ new Map();\n this.memoizedPaths = /* @__PURE__ */ new Map();\n this.memoizedURLs = /* @__PURE__ */ new Map();\n }\n addAnnotation() {\n let content;\n if (this.isInline()) {\n content = \"data:application/json;base64,\" + this.toBase64(this.map.toString());\n } else if (typeof this.mapOpts.annotation === \"string\") {\n content = this.mapOpts.annotation;\n } else if (typeof this.mapOpts.annotation === \"function\") {\n content = this.mapOpts.annotation(this.opts.to, this.root);\n } else {\n content = this.outputFile() + \".map\";\n }\n let eol = \"\\n\";\n if (this.css.includes(\"\\r\\n\")) eol = \"\\r\\n\";\n this.css += eol + \"/*# sourceMappingURL=\" + content + \" */\";\n }\n applyPrevMaps() {\n for (let prev of this.previous()) {\n let from = this.toUrl(this.path(prev.file));\n let root2 = prev.root || dirname(prev.file);\n let map;\n if (this.mapOpts.sourcesContent === false) {\n map = new SourceMapConsumer(prev.text);\n if (map.sourcesContent) {\n map.sourcesContent = null;\n }\n } else {\n map = prev.consumer();\n }\n this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));\n }\n }\n clearAnnotation() {\n if (this.mapOpts.annotation === false) return;\n if (this.root) {\n let node2;\n for (let i = this.root.nodes.length - 1; i >= 0; i--) {\n node2 = this.root.nodes[i];\n if (node2.type !== \"comment\") continue;\n if (node2.text.indexOf(\"# sourceMappingURL=\") === 0) {\n this.root.removeChild(i);\n }\n }\n } else if (this.css) {\n this.css = this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm, \"\");\n }\n }\n generate() {\n this.clearAnnotation();\n if (pathAvailable && sourceMapAvailable && this.isMap()) {\n return this.generateMap();\n } else {\n let result2 = \"\";\n this.stringify(this.root, (i) => {\n result2 += i;\n });\n return [result2];\n }\n }\n generateMap() {\n if (this.root) {\n this.generateString();\n } else if (this.previous().length === 1) {\n let prev = this.previous()[0].consumer();\n prev.file = this.outputFile();\n this.map = SourceMapGenerator.fromSourceMap(prev, {\n ignoreInvalidMapping: true\n });\n } else {\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n this.map.addMapping({\n generated: { column: 0, line: 1 },\n original: { column: 0, line: 1 },\n source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : \"\"\n });\n }\n if (this.isSourcesContent()) this.setSourcesContent();\n if (this.root && this.previous().length > 0) this.applyPrevMaps();\n if (this.isAnnotation()) this.addAnnotation();\n if (this.isInline()) {\n return [this.css];\n } else {\n return [this.css, this.map];\n }\n }\n generateString() {\n this.css = \"\";\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n let line = 1;\n let column = 1;\n let noSource = \"\";\n let mapping = {\n generated: { column: 0, line: 0 },\n original: { column: 0, line: 0 },\n source: \"\"\n };\n let lines, last;\n this.stringify(this.root, (str, node2, type) => {\n this.css += str;\n if (node2 && type !== \"end\") {\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n if (node2.source && node2.source.start) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.start.line;\n mapping.original.column = node2.source.start.column - 1;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n this.map.addMapping(mapping);\n }\n }\n lines = str.match(/\\n/g);\n if (lines) {\n line += lines.length;\n last = str.lastIndexOf(\"\\n\");\n column = str.length - last;\n } else {\n column += str.length;\n }\n if (node2 && type !== \"start\") {\n let p = node2.parent || { raws: {} };\n let childless = node2.type === \"decl\" || node2.type === \"atrule\" && !node2.nodes;\n if (!childless || node2 !== p.last || p.raws.semicolon) {\n if (node2.source && node2.source.end) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.end.line;\n mapping.original.column = node2.source.end.column - 1;\n mapping.generated.line = line;\n mapping.generated.column = column - 2;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n this.map.addMapping(mapping);\n }\n }\n }\n });\n }\n isAnnotation() {\n if (this.isInline()) {\n return true;\n }\n if (typeof this.mapOpts.annotation !== \"undefined\") {\n return this.mapOpts.annotation;\n }\n if (this.previous().length) {\n return this.previous().some((i) => i.annotation);\n }\n return true;\n }\n isInline() {\n if (typeof this.mapOpts.inline !== \"undefined\") {\n return this.mapOpts.inline;\n }\n let annotation = this.mapOpts.annotation;\n if (typeof annotation !== \"undefined\" && annotation !== true) {\n return false;\n }\n if (this.previous().length) {\n return this.previous().some((i) => i.inline);\n }\n return true;\n }\n isMap() {\n if (typeof this.opts.map !== \"undefined\") {\n return !!this.opts.map;\n }\n return this.previous().length > 0;\n }\n isSourcesContent() {\n if (typeof this.mapOpts.sourcesContent !== \"undefined\") {\n return this.mapOpts.sourcesContent;\n }\n if (this.previous().length) {\n return this.previous().some((i) => i.withContent());\n }\n return true;\n }\n outputFile() {\n if (this.opts.to) {\n return this.path(this.opts.to);\n } else if (this.opts.from) {\n return this.path(this.opts.from);\n } else {\n return \"to.css\";\n }\n }\n path(file) {\n if (this.mapOpts.absolute) return file;\n if (file.charCodeAt(0) === 60) return file;\n if (/^\\w+:\\/\\//.test(file)) return file;\n let cached = this.memoizedPaths.get(file);\n if (cached) return cached;\n let from = this.opts.to ? dirname(this.opts.to) : \".\";\n if (typeof this.mapOpts.annotation === \"string\") {\n from = dirname(resolve(from, this.mapOpts.annotation));\n }\n let path = relative(from, file);\n this.memoizedPaths.set(file, path);\n return path;\n }\n previous() {\n if (!this.previousMaps) {\n this.previousMaps = [];\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source && node2.source.input.map) {\n let map = node2.source.input.map;\n if (!this.previousMaps.includes(map)) {\n this.previousMaps.push(map);\n }\n }\n });\n } else {\n let input2 = new Input$3(this.originalCSS, this.opts);\n if (input2.map) this.previousMaps.push(input2.map);\n }\n }\n return this.previousMaps;\n }\n setSourcesContent() {\n let already = {};\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source) {\n let from = node2.source.input.from;\n if (from && !already[from]) {\n already[from] = true;\n let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));\n this.map.setSourceContent(fromUrl, node2.source.input.css);\n }\n }\n });\n } else if (this.css) {\n let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : \"\";\n this.map.setSourceContent(from, this.css);\n }\n }\n sourcePath(node2) {\n if (this.mapOpts.from) {\n return this.toUrl(this.mapOpts.from);\n } else if (this.usesFileUrls) {\n return this.toFileUrl(node2.source.input.from);\n } else {\n return this.toUrl(this.path(node2.source.input.from));\n }\n }\n toBase64(str) {\n if (Buffer) {\n return Buffer.from(str).toString(\"base64\");\n } else {\n return window.btoa(unescape(encodeURIComponent(str)));\n }\n }\n toFileUrl(path) {\n let cached = this.memoizedFileURLs.get(path);\n if (cached) return cached;\n if (pathToFileURL) {\n let fileURL = pathToFileURL(path).toString();\n this.memoizedFileURLs.set(path, fileURL);\n return fileURL;\n } else {\n throw new Error(\n \"`map.absolute` option is not available in this PostCSS build\"\n );\n }\n }\n toUrl(path) {\n let cached = this.memoizedURLs.get(path);\n if (cached) return cached;\n if (sep === \"\\\\\") {\n path = path.replace(/\\\\/g, \"/\");\n }\n let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);\n this.memoizedURLs.set(path, url);\n return url;\n }\n};\nvar mapGenerator = MapGenerator$2;\nlet Node$2 = node;\nlet Comment$4 = class Comment extends Node$2 {\n constructor(defaults) {\n super(defaults);\n this.type = \"comment\";\n }\n};\nvar comment = Comment$4;\nComment$4.default = Comment$4;\nlet { isClean: isClean$1, my: my$1 } = symbols;\nlet Declaration$3 = declaration;\nlet Comment$3 = comment;\nlet Node$1 = node;\nlet parse$4, Rule$4, AtRule$4, Root$6;\nfunction cleanSource(nodes) {\n return nodes.map((i) => {\n if (i.nodes) i.nodes = cleanSource(i.nodes);\n delete i.source;\n return i;\n });\n}\nfunction markDirtyUp(node2) {\n node2[isClean$1] = false;\n if (node2.proxyOf.nodes) {\n for (let i of node2.proxyOf.nodes) {\n markDirtyUp(i);\n }\n }\n}\nlet Container$7 = class Container extends Node$1 {\n append(...children) {\n for (let child of children) {\n let nodes = this.normalize(child, this.last);\n for (let node2 of nodes) this.proxyOf.nodes.push(node2);\n }\n this.markDirty();\n return this;\n }\n cleanRaws(keepBetween) {\n super.cleanRaws(keepBetween);\n if (this.nodes) {\n for (let node2 of this.nodes) node2.cleanRaws(keepBetween);\n }\n }\n each(callback) {\n if (!this.proxyOf.nodes) return void 0;\n let iterator = this.getIterator();\n let index2, result2;\n while (this.indexes[iterator] < this.proxyOf.nodes.length) {\n index2 = this.indexes[iterator];\n result2 = callback(this.proxyOf.nodes[index2], index2);\n if (result2 === false) break;\n this.indexes[iterator] += 1;\n }\n delete this.indexes[iterator];\n return result2;\n }\n every(condition) {\n return this.nodes.every(condition);\n }\n getIterator() {\n if (!this.lastEach) this.lastEach = 0;\n if (!this.indexes) this.indexes = {};\n this.lastEach += 1;\n let iterator = this.lastEach;\n this.indexes[iterator] = 0;\n return iterator;\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === \"proxyOf\") {\n return node2;\n } else if (!node2[prop]) {\n return node2[prop];\n } else if (prop === \"each\" || typeof prop === \"string\" && prop.startsWith(\"walk\")) {\n return (...args) => {\n return node2[prop](\n ...args.map((i) => {\n if (typeof i === \"function\") {\n return (child, index2) => i(child.toProxy(), index2);\n } else {\n return i;\n }\n })\n );\n };\n } else if (prop === \"every\" || prop === \"some\") {\n return (cb) => {\n return node2[prop](\n (child, ...other) => cb(child.toProxy(), ...other)\n );\n };\n } else if (prop === \"root\") {\n return () => node2.root().toProxy();\n } else if (prop === \"nodes\") {\n return node2.nodes.map((i) => i.toProxy());\n } else if (prop === \"first\" || prop === \"last\") {\n return node2[prop].toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === \"name\" || prop === \"params\" || prop === \"selector\") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n index(child) {\n if (typeof child === \"number\") return child;\n if (child.proxyOf) child = child.proxyOf;\n return this.proxyOf.nodes.indexOf(child);\n }\n insertAfter(exist, add) {\n let existIndex = this.index(exist);\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex < index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n insertBefore(exist, add) {\n let existIndex = this.index(exist);\n let type = existIndex === 0 ? \"prepend\" : false;\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex <= index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n normalize(nodes, sample) {\n if (typeof nodes === \"string\") {\n nodes = cleanSource(parse$4(nodes).nodes);\n } else if (typeof nodes === \"undefined\") {\n nodes = [];\n } else if (Array.isArray(nodes)) {\n nodes = nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"ignore\");\n }\n } else if (nodes.type === \"root\" && this.type !== \"document\") {\n nodes = nodes.nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"ignore\");\n }\n } else if (nodes.type) {\n nodes = [nodes];\n } else if (nodes.prop) {\n if (typeof nodes.value === \"undefined\") {\n throw new Error(\"Value field is missed in node creation\");\n } else if (typeof nodes.value !== \"string\") {\n nodes.value = String(nodes.value);\n }\n nodes = [new Declaration$3(nodes)];\n } else if (nodes.selector) {\n nodes = [new Rule$4(nodes)];\n } else if (nodes.name) {\n nodes = [new AtRule$4(nodes)];\n } else if (nodes.text) {\n nodes = [new Comment$3(nodes)];\n } else {\n throw new Error(\"Unknown node type in node creation\");\n }\n let processed = nodes.map((i) => {\n if (!i[my$1]) Container.rebuild(i);\n i = i.proxyOf;\n if (i.parent) i.parent.removeChild(i);\n if (i[isClean$1]) markDirtyUp(i);\n if (typeof i.raws.before === \"undefined\") {\n if (sample && typeof sample.raws.before !== \"undefined\") {\n i.raws.before = sample.raws.before.replace(/\\S/g, \"\");\n }\n }\n i.parent = this.proxyOf;\n return i;\n });\n return processed;\n }\n prepend(...children) {\n children = children.reverse();\n for (let child of children) {\n let nodes = this.normalize(child, this.first, \"prepend\").reverse();\n for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);\n for (let id in this.indexes) {\n this.indexes[id] = this.indexes[id] + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n push(child) {\n child.parent = this;\n this.proxyOf.nodes.push(child);\n return this;\n }\n removeAll() {\n for (let node2 of this.proxyOf.nodes) node2.parent = void 0;\n this.proxyOf.nodes = [];\n this.markDirty();\n return this;\n }\n removeChild(child) {\n child = this.index(child);\n this.proxyOf.nodes[child].parent = void 0;\n this.proxyOf.nodes.splice(child, 1);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (index2 >= child) {\n this.indexes[id] = index2 - 1;\n }\n }\n this.markDirty();\n return this;\n }\n replaceValues(pattern, opts, callback) {\n if (!callback) {\n callback = opts;\n opts = {};\n }\n this.walkDecls((decl) => {\n if (opts.props && !opts.props.includes(decl.prop)) return;\n if (opts.fast && !decl.value.includes(opts.fast)) return;\n decl.value = decl.value.replace(pattern, callback);\n });\n this.markDirty();\n return this;\n }\n some(condition) {\n return this.nodes.some(condition);\n }\n walk(callback) {\n return this.each((child, i) => {\n let result2;\n try {\n result2 = callback(child, i);\n } catch (e) {\n throw child.addToError(e);\n }\n if (result2 !== false && child.walk) {\n result2 = child.walk(callback);\n }\n return result2;\n });\n }\n walkAtRules(name, callback) {\n if (!callback) {\n callback = name;\n return this.walk((child, i) => {\n if (child.type === \"atrule\") {\n return callback(child, i);\n }\n });\n }\n if (name instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && name.test(child.name)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && child.name === name) {\n return callback(child, i);\n }\n });\n }\n walkComments(callback) {\n return this.walk((child, i) => {\n if (child.type === \"comment\") {\n return callback(child, i);\n }\n });\n }\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop;\n return this.walk((child, i) => {\n if (child.type === \"decl\") {\n return callback(child, i);\n }\n });\n }\n if (prop instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"decl\" && prop.test(child.prop)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"decl\" && child.prop === prop) {\n return callback(child, i);\n }\n });\n }\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector;\n return this.walk((child, i) => {\n if (child.type === \"rule\") {\n return callback(child, i);\n }\n });\n }\n if (selector instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"rule\" && selector.test(child.selector)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"rule\" && child.selector === selector) {\n return callback(child, i);\n }\n });\n }\n get first() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[0];\n }\n get last() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];\n }\n};\nContainer$7.registerParse = (dependant) => {\n parse$4 = dependant;\n};\nContainer$7.registerRule = (dependant) => {\n Rule$4 = dependant;\n};\nContainer$7.registerAtRule = (dependant) => {\n AtRule$4 = dependant;\n};\nContainer$7.registerRoot = (dependant) => {\n Root$6 = dependant;\n};\nvar container = Container$7;\nContainer$7.default = Container$7;\nContainer$7.rebuild = (node2) => {\n if (node2.type === \"atrule\") {\n Object.setPrototypeOf(node2, AtRule$4.prototype);\n } else if (node2.type === \"rule\") {\n Object.setPrototypeOf(node2, Rule$4.prototype);\n } else if (node2.type === \"decl\") {\n Object.setPrototypeOf(node2, Declaration$3.prototype);\n } else if (node2.type === \"comment\") {\n Object.setPrototypeOf(node2, Comment$3.prototype);\n } else if (node2.type === \"root\") {\n Object.setPrototypeOf(node2, Root$6.prototype);\n }\n node2[my$1] = true;\n if (node2.nodes) {\n node2.nodes.forEach((child) => {\n Container$7.rebuild(child);\n });\n }\n};\nlet Container$6 = container;\nlet LazyResult$4, Processor$3;\nlet Document$3 = class Document extends Container$6 {\n constructor(defaults) {\n super({ type: \"document\", ...defaults });\n if (!this.nodes) {\n this.nodes = [];\n }\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$4(new Processor$3(), this, opts);\n return lazy.stringify();\n }\n};\nDocument$3.registerLazyResult = (dependant) => {\n LazyResult$4 = dependant;\n};\nDocument$3.registerProcessor = (dependant) => {\n Processor$3 = dependant;\n};\nvar document$1 = Document$3;\nDocument$3.default = Document$3;\nlet printed = {};\nvar warnOnce$2 = function warnOnce(message) {\n if (printed[message]) return;\n printed[message] = true;\n if (typeof console !== \"undefined\" && console.warn) {\n console.warn(message);\n }\n};\nlet Warning$2 = class Warning {\n constructor(text, opts = {}) {\n this.type = \"warning\";\n this.text = text;\n if (opts.node && opts.node.source) {\n let range = opts.node.rangeBy(opts);\n this.line = range.start.line;\n this.column = range.start.column;\n this.endLine = range.end.line;\n this.endColumn = range.end.column;\n }\n for (let opt in opts) this[opt] = opts[opt];\n }\n toString() {\n if (this.node) {\n return this.node.error(this.text, {\n index: this.index,\n plugin: this.plugin,\n word: this.word\n }).message;\n }\n if (this.plugin) {\n return this.plugin + \": \" + this.text;\n }\n return this.text;\n }\n};\nvar warning = Warning$2;\nWarning$2.default = Warning$2;\nlet Warning$1 = warning;\nlet Result$3 = class Result {\n constructor(processor2, root2, opts) {\n this.processor = processor2;\n this.messages = [];\n this.root = root2;\n this.opts = opts;\n this.css = void 0;\n this.map = void 0;\n }\n toString() {\n return this.css;\n }\n warn(text, opts = {}) {\n if (!opts.plugin) {\n if (this.lastPlugin && this.lastPlugin.postcssPlugin) {\n opts.plugin = this.lastPlugin.postcssPlugin;\n }\n }\n let warning2 = new Warning$1(text, opts);\n this.messages.push(warning2);\n return warning2;\n }\n warnings() {\n return this.messages.filter((i) => i.type === \"warning\");\n }\n get content() {\n return this.css;\n }\n};\nvar result = Result$3;\nResult$3.default = Result$3;\nconst SINGLE_QUOTE = \"'\".charCodeAt(0);\nconst DOUBLE_QUOTE = '\"'.charCodeAt(0);\nconst BACKSLASH = \"\\\\\".charCodeAt(0);\nconst SLASH = \"/\".charCodeAt(0);\nconst NEWLINE = \"\\n\".charCodeAt(0);\nconst SPACE = \" \".charCodeAt(0);\nconst FEED = \"\\f\".charCodeAt(0);\nconst TAB = \"\t\".charCodeAt(0);\nconst CR = \"\\r\".charCodeAt(0);\nconst OPEN_SQUARE = \"[\".charCodeAt(0);\nconst CLOSE_SQUARE = \"]\".charCodeAt(0);\nconst OPEN_PARENTHESES = \"(\".charCodeAt(0);\nconst CLOSE_PARENTHESES = \")\".charCodeAt(0);\nconst OPEN_CURLY = \"{\".charCodeAt(0);\nconst CLOSE_CURLY = \"}\".charCodeAt(0);\nconst SEMICOLON = \";\".charCodeAt(0);\nconst ASTERISK = \"*\".charCodeAt(0);\nconst COLON = \":\".charCodeAt(0);\nconst AT = \"@\".charCodeAt(0);\nconst RE_AT_END = /[\\t\\n\\f\\r \"#'()/;[\\\\\\]{}]/g;\nconst RE_WORD_END = /[\\t\\n\\f\\r !\"#'():;@[\\\\\\]{}]|\\/(?=\\*)/g;\nconst RE_BAD_BRACKET = /.[\\r\\n\"'(/\\\\]/;\nconst RE_HEX_ESCAPE = /[\\da-f]/i;\nvar tokenize = function tokenizer(input2, options = {}) {\n let css = input2.css.valueOf();\n let ignore = options.ignoreErrors;\n let code, next, quote, content, escape;\n let escaped, escapePos, prev, n, currentToken;\n let length = css.length;\n let pos = 0;\n let buffer = [];\n let returned = [];\n function position() {\n return pos;\n }\n function unclosed(what) {\n throw input2.error(\"Unclosed \" + what, pos);\n }\n function endOfFile() {\n return returned.length === 0 && pos >= length;\n }\n function nextToken(opts) {\n if (returned.length) return returned.pop();\n if (pos >= length) return;\n let ignoreUnclosed = opts ? opts.ignoreUnclosed : false;\n code = css.charCodeAt(pos);\n switch (code) {\n case NEWLINE:\n case SPACE:\n case TAB:\n case CR:\n case FEED: {\n next = pos;\n do {\n next += 1;\n code = css.charCodeAt(next);\n } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);\n currentToken = [\"space\", css.slice(pos, next)];\n pos = next - 1;\n break;\n }\n case OPEN_SQUARE:\n case CLOSE_SQUARE:\n case OPEN_CURLY:\n case CLOSE_CURLY:\n case COLON:\n case SEMICOLON:\n case CLOSE_PARENTHESES: {\n let controlChar = String.fromCharCode(code);\n currentToken = [controlChar, controlChar, pos];\n break;\n }\n case OPEN_PARENTHESES: {\n prev = buffer.length ? buffer.pop()[1] : \"\";\n n = css.charCodeAt(pos + 1);\n if (prev === \"url\" && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(\")\", next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos;\n break;\n } else {\n unclosed(\"bracket\");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = [\"brackets\", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n next = css.indexOf(\")\", pos + 1);\n content = css.slice(pos, next + 1);\n if (next === -1 || RE_BAD_BRACKET.test(content)) {\n currentToken = [\"(\", \"(\", pos];\n } else {\n currentToken = [\"brackets\", content, pos, next];\n pos = next;\n }\n }\n break;\n }\n case SINGLE_QUOTE:\n case DOUBLE_QUOTE: {\n quote = code === SINGLE_QUOTE ? \"'\" : '\"';\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(quote, next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos + 1;\n break;\n } else {\n unclosed(\"string\");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = [\"string\", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case AT: {\n RE_AT_END.lastIndex = pos + 1;\n RE_AT_END.test(css);\n if (RE_AT_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_AT_END.lastIndex - 2;\n }\n currentToken = [\"at-word\", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case BACKSLASH: {\n next = pos;\n escape = true;\n while (css.charCodeAt(next + 1) === BACKSLASH) {\n next += 1;\n escape = !escape;\n }\n code = css.charCodeAt(next + 1);\n if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {\n next += 1;\n if (RE_HEX_ESCAPE.test(css.charAt(next))) {\n while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {\n next += 1;\n }\n if (css.charCodeAt(next + 1) === SPACE) {\n next += 1;\n }\n }\n }\n currentToken = [\"word\", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n default: {\n if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {\n next = css.indexOf(\"*/\", pos + 2) + 1;\n if (next === 0) {\n if (ignore || ignoreUnclosed) {\n next = css.length;\n } else {\n unclosed(\"comment\");\n }\n }\n currentToken = [\"comment\", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n RE_WORD_END.lastIndex = pos + 1;\n RE_WORD_END.test(css);\n if (RE_WORD_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_WORD_END.lastIndex - 2;\n }\n currentToken = [\"word\", css.slice(pos, next + 1), pos, next];\n buffer.push(currentToken);\n pos = next;\n }\n break;\n }\n }\n pos++;\n return currentToken;\n }\n function back(token) {\n returned.push(token);\n }\n return {\n back,\n endOfFile,\n nextToken,\n position\n };\n};\nlet Container$5 = container;\nlet AtRule$3 = class AtRule extends Container$5 {\n constructor(defaults) {\n super(defaults);\n this.type = \"atrule\";\n }\n append(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.append(...children);\n }\n prepend(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.prepend(...children);\n }\n};\nvar atRule = AtRule$3;\nAtRule$3.default = AtRule$3;\nContainer$5.registerAtRule(AtRule$3);\nlet Container$4 = container;\nlet LazyResult$3, Processor$2;\nlet Root$5 = class Root extends Container$4 {\n constructor(defaults) {\n super(defaults);\n this.type = \"root\";\n if (!this.nodes) this.nodes = [];\n }\n normalize(child, sample, type) {\n let nodes = super.normalize(child);\n if (sample) {\n if (type === \"prepend\") {\n if (this.nodes.length > 1) {\n sample.raws.before = this.nodes[1].raws.before;\n } else {\n delete sample.raws.before;\n }\n } else if (this.first !== sample) {\n for (let node2 of nodes) {\n node2.raws.before = sample.raws.before;\n }\n }\n }\n return nodes;\n }\n removeChild(child, ignore) {\n let index2 = this.index(child);\n if (!ignore && index2 === 0 && this.nodes.length > 1) {\n this.nodes[1].raws.before = this.nodes[index2].raws.before;\n }\n return super.removeChild(child);\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$3(new Processor$2(), this, opts);\n return lazy.stringify();\n }\n};\nRoot$5.registerLazyResult = (dependant) => {\n LazyResult$3 = dependant;\n};\nRoot$5.registerProcessor = (dependant) => {\n Processor$2 = dependant;\n};\nvar root = Root$5;\nRoot$5.default = Root$5;\nContainer$4.registerRoot(Root$5);\nlet list$2 = {\n comma(string) {\n return list$2.split(string, [\",\"], true);\n },\n space(string) {\n let spaces = [\" \", \"\\n\", \"\t\"];\n return list$2.split(string, spaces);\n },\n split(string, separators, last) {\n let array = [];\n let current = \"\";\n let split = false;\n let func = 0;\n let inQuote = false;\n let prevQuote = \"\";\n let escape = false;\n for (let letter of string) {\n if (escape) {\n escape = false;\n } else if (letter === \"\\\\\") {\n escape = true;\n } else if (inQuote) {\n if (letter === prevQuote) {\n inQuote = false;\n }\n } else if (letter === '\"' || letter === \"'\") {\n inQuote = true;\n prevQuote = letter;\n } else if (letter === \"(\") {\n func += 1;\n } else if (letter === \")\") {\n if (func > 0) func -= 1;\n } else if (func === 0) {\n if (separators.includes(letter)) split = true;\n }\n if (split) {\n if (current !== \"\") array.push(current.trim());\n current = \"\";\n split = false;\n } else {\n current += letter;\n }\n }\n if (last || current !== \"\") array.push(current.trim());\n return array;\n }\n};\nvar list_1 = list$2;\nlist$2.default = list$2;\nlet Container$3 = container;\nlet list$1 = list_1;\nlet Rule$3 = class Rule extends Container$3 {\n constructor(defaults) {\n super(defaults);\n this.type = \"rule\";\n if (!this.nodes) this.nodes = [];\n }\n get selectors() {\n return list$1.comma(this.selector);\n }\n set selectors(values) {\n let match = this.selector ? this.selector.match(/,\\s*/) : null;\n let sep2 = match ? match[0] : \",\" + this.raw(\"between\", \"beforeOpen\");\n this.selector = values.join(sep2);\n }\n};\nvar rule = Rule$3;\nRule$3.default = Rule$3;\nContainer$3.registerRule(Rule$3);\nlet Declaration$2 = declaration;\nlet tokenizer2 = tokenize;\nlet Comment$2 = comment;\nlet AtRule$2 = atRule;\nlet Root$4 = root;\nlet Rule$2 = rule;\nconst SAFE_COMMENT_NEIGHBOR = {\n empty: true,\n space: true\n};\nfunction findLastWithPosition(tokens) {\n for (let i = tokens.length - 1; i >= 0; i--) {\n let token = tokens[i];\n let pos = token[3] || token[2];\n if (pos) return pos;\n }\n}\nlet Parser$1 = class Parser {\n constructor(input2) {\n this.input = input2;\n this.root = new Root$4();\n this.current = this.root;\n this.spaces = \"\";\n this.semicolon = false;\n this.createTokenizer();\n this.root.source = { input: input2, start: { column: 1, line: 1, offset: 0 } };\n }\n atrule(token) {\n let node2 = new AtRule$2();\n node2.name = token[1].slice(1);\n if (node2.name === \"\") {\n this.unnamedAtrule(node2, token);\n }\n this.init(node2, token[2]);\n let type;\n let prev;\n let shift;\n let last = false;\n let open = false;\n let params = [];\n let brackets = [];\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n type = token[0];\n if (type === \"(\" || type === \"[\") {\n brackets.push(type === \"(\" ? \")\" : \"]\");\n } else if (type === \"{\" && brackets.length > 0) {\n brackets.push(\"}\");\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n }\n if (brackets.length === 0) {\n if (type === \";\") {\n node2.source.end = this.getPosition(token[2]);\n node2.source.end.offset++;\n this.semicolon = true;\n break;\n } else if (type === \"{\") {\n open = true;\n break;\n } else if (type === \"}\") {\n if (params.length > 0) {\n shift = params.length - 1;\n prev = params[shift];\n while (prev && prev[0] === \"space\") {\n prev = params[--shift];\n }\n if (prev) {\n node2.source.end = this.getPosition(prev[3] || prev[2]);\n node2.source.end.offset++;\n }\n }\n this.end(token);\n break;\n } else {\n params.push(token);\n }\n } else {\n params.push(token);\n }\n if (this.tokenizer.endOfFile()) {\n last = true;\n break;\n }\n }\n node2.raws.between = this.spacesAndCommentsFromEnd(params);\n if (params.length) {\n node2.raws.afterName = this.spacesAndCommentsFromStart(params);\n this.raw(node2, \"params\", params);\n if (last) {\n token = params[params.length - 1];\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n this.spaces = node2.raws.between;\n node2.raws.between = \"\";\n }\n } else {\n node2.raws.afterName = \"\";\n node2.params = \"\";\n }\n if (open) {\n node2.nodes = [];\n this.current = node2;\n }\n }\n checkMissedSemicolon(tokens) {\n let colon = this.colon(tokens);\n if (colon === false) return;\n let founded = 0;\n let token;\n for (let j = colon - 1; j >= 0; j--) {\n token = tokens[j];\n if (token[0] !== \"space\") {\n founded += 1;\n if (founded === 2) break;\n }\n }\n throw this.input.error(\n \"Missed semicolon\",\n token[0] === \"word\" ? token[3] + 1 : token[2]\n );\n }\n colon(tokens) {\n let brackets = 0;\n let token, type, prev;\n for (let [i, element] of tokens.entries()) {\n token = element;\n type = token[0];\n if (type === \"(\") {\n brackets += 1;\n }\n if (type === \")\") {\n brackets -= 1;\n }\n if (brackets === 0 && type === \":\") {\n if (!prev) {\n this.doubleColon(token);\n } else if (prev[0] === \"word\" && prev[1] === \"progid\") {\n continue;\n } else {\n return i;\n }\n }\n prev = token;\n }\n return false;\n }\n comment(token) {\n let node2 = new Comment$2();\n this.init(node2, token[2]);\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n let text = token[1].slice(2, -2);\n if (/^\\s*$/.test(text)) {\n node2.text = \"\";\n node2.raws.left = text;\n node2.raws.right = \"\";\n } else {\n let match = text.match(/^(\\s*)([^]*\\S)(\\s*)$/);\n node2.text = match[2];\n node2.raws.left = match[1];\n node2.raws.right = match[3];\n }\n }\n createTokenizer() {\n this.tokenizer = tokenizer2(this.input);\n }\n decl(tokens, customProperty) {\n let node2 = new Declaration$2();\n this.init(node2, tokens[0][2]);\n let last = tokens[tokens.length - 1];\n if (last[0] === \";\") {\n this.semicolon = true;\n tokens.pop();\n }\n node2.source.end = this.getPosition(\n last[3] || last[2] || findLastWithPosition(tokens)\n );\n node2.source.end.offset++;\n while (tokens[0][0] !== \"word\") {\n if (tokens.length === 1) this.unknownWord(tokens);\n node2.raws.before += tokens.shift()[1];\n }\n node2.source.start = this.getPosition(tokens[0][2]);\n node2.prop = \"\";\n while (tokens.length) {\n let type = tokens[0][0];\n if (type === \":\" || type === \"space\" || type === \"comment\") {\n break;\n }\n node2.prop += tokens.shift()[1];\n }\n node2.raws.between = \"\";\n let token;\n while (tokens.length) {\n token = tokens.shift();\n if (token[0] === \":\") {\n node2.raws.between += token[1];\n break;\n } else {\n if (token[0] === \"word\" && /\\w/.test(token[1])) {\n this.unknownWord([token]);\n }\n node2.raws.between += token[1];\n }\n }\n if (node2.prop[0] === \"_\" || node2.prop[0] === \"*\") {\n node2.raws.before += node2.prop[0];\n node2.prop = node2.prop.slice(1);\n }\n let firstSpaces = [];\n let next;\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== \"space\" && next !== \"comment\") break;\n firstSpaces.push(tokens.shift());\n }\n this.precheckMissedSemicolon(tokens);\n for (let i = tokens.length - 1; i >= 0; i--) {\n token = tokens[i];\n if (token[1].toLowerCase() === \"!important\") {\n node2.important = true;\n let string = this.stringFrom(tokens, i);\n string = this.spacesFromEnd(tokens) + string;\n if (string !== \" !important\") node2.raws.important = string;\n break;\n } else if (token[1].toLowerCase() === \"important\") {\n let cache = tokens.slice(0);\n let str = \"\";\n for (let j = i; j > 0; j--) {\n let type = cache[j][0];\n if (str.trim().indexOf(\"!\") === 0 && type !== \"space\") {\n break;\n }\n str = cache.pop()[1] + str;\n }\n if (str.trim().indexOf(\"!\") === 0) {\n node2.important = true;\n node2.raws.important = str;\n tokens = cache;\n }\n }\n if (token[0] !== \"space\" && token[0] !== \"comment\") {\n break;\n }\n }\n let hasWord = tokens.some((i) => i[0] !== \"space\" && i[0] !== \"comment\");\n if (hasWord) {\n node2.raws.between += firstSpaces.map((i) => i[1]).join(\"\");\n firstSpaces = [];\n }\n this.raw(node2, \"value\", firstSpaces.concat(tokens), customProperty);\n if (node2.value.includes(\":\") && !customProperty) {\n this.checkMissedSemicolon(tokens);\n }\n }\n doubleColon(token) {\n throw this.input.error(\n \"Double colon\",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n emptyRule(token) {\n let node2 = new Rule$2();\n this.init(node2, token[2]);\n node2.selector = \"\";\n node2.raws.between = \"\";\n this.current = node2;\n }\n end(token) {\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.semicolon = false;\n this.current.raws.after = (this.current.raws.after || \"\") + this.spaces;\n this.spaces = \"\";\n if (this.current.parent) {\n this.current.source.end = this.getPosition(token[2]);\n this.current.source.end.offset++;\n this.current = this.current.parent;\n } else {\n this.unexpectedClose(token);\n }\n }\n endFile() {\n if (this.current.parent) this.unclosedBlock();\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.current.raws.after = (this.current.raws.after || \"\") + this.spaces;\n this.root.source.end = this.getPosition(this.tokenizer.position());\n }\n freeSemicolon(token) {\n this.spaces += token[1];\n if (this.current.nodes) {\n let prev = this.current.nodes[this.current.nodes.length - 1];\n if (prev && prev.type === \"rule\" && !prev.raws.ownSemicolon) {\n prev.raws.ownSemicolon = this.spaces;\n this.spaces = \"\";\n }\n }\n }\n // Helpers\n getPosition(offset) {\n let pos = this.input.fromOffset(offset);\n return {\n column: pos.col,\n line: pos.line,\n offset\n };\n }\n init(node2, offset) {\n this.current.push(node2);\n node2.source = {\n input: this.input,\n start: this.getPosition(offset)\n };\n node2.raws.before = this.spaces;\n this.spaces = \"\";\n if (node2.type !== \"comment\") this.semicolon = false;\n }\n other(start) {\n let end = false;\n let type = null;\n let colon = false;\n let bracket = null;\n let brackets = [];\n let customProperty = start[1].startsWith(\"--\");\n let tokens = [];\n let token = start;\n while (token) {\n type = token[0];\n tokens.push(token);\n if (type === \"(\" || type === \"[\") {\n if (!bracket) bracket = token;\n brackets.push(type === \"(\" ? \")\" : \"]\");\n } else if (customProperty && colon && type === \"{\") {\n if (!bracket) bracket = token;\n brackets.push(\"}\");\n } else if (brackets.length === 0) {\n if (type === \";\") {\n if (colon) {\n this.decl(tokens, customProperty);\n return;\n } else {\n break;\n }\n } else if (type === \"{\") {\n this.rule(tokens);\n return;\n } else if (type === \"}\") {\n this.tokenizer.back(tokens.pop());\n end = true;\n break;\n } else if (type === \":\") {\n colon = true;\n }\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n if (brackets.length === 0) bracket = null;\n }\n token = this.tokenizer.nextToken();\n }\n if (this.tokenizer.endOfFile()) end = true;\n if (brackets.length > 0) this.unclosedBracket(bracket);\n if (end && colon) {\n if (!customProperty) {\n while (tokens.length) {\n token = tokens[tokens.length - 1][0];\n if (token !== \"space\" && token !== \"comment\") break;\n this.tokenizer.back(tokens.pop());\n }\n }\n this.decl(tokens, customProperty);\n } else {\n this.unknownWord(tokens);\n }\n }\n parse() {\n let token;\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n switch (token[0]) {\n case \"space\":\n this.spaces += token[1];\n break;\n case \";\":\n this.freeSemicolon(token);\n break;\n case \"}\":\n this.end(token);\n break;\n case \"comment\":\n this.comment(token);\n break;\n case \"at-word\":\n this.atrule(token);\n break;\n case \"{\":\n this.emptyRule(token);\n break;\n default:\n this.other(token);\n break;\n }\n }\n this.endFile();\n }\n precheckMissedSemicolon() {\n }\n raw(node2, prop, tokens, customProperty) {\n let token, type;\n let length = tokens.length;\n let value = \"\";\n let clean = true;\n let next, prev;\n for (let i = 0; i < length; i += 1) {\n token = tokens[i];\n type = token[0];\n if (type === \"space\" && i === length - 1 && !customProperty) {\n clean = false;\n } else if (type === \"comment\") {\n prev = tokens[i - 1] ? tokens[i - 1][0] : \"empty\";\n next = tokens[i + 1] ? tokens[i + 1][0] : \"empty\";\n if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {\n if (value.slice(-1) === \",\") {\n clean = false;\n } else {\n value += token[1];\n }\n } else {\n clean = false;\n }\n } else {\n value += token[1];\n }\n }\n if (!clean) {\n let raw = tokens.reduce((all, i) => all + i[1], \"\");\n node2.raws[prop] = { raw, value };\n }\n node2[prop] = value;\n }\n rule(tokens) {\n tokens.pop();\n let node2 = new Rule$2();\n this.init(node2, tokens[0][2]);\n node2.raws.between = this.spacesAndCommentsFromEnd(tokens);\n this.raw(node2, \"selector\", tokens);\n this.current = node2;\n }\n spacesAndCommentsFromEnd(tokens) {\n let lastTokenType;\n let spaces = \"\";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== \"space\" && lastTokenType !== \"comment\") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n // Errors\n spacesAndCommentsFromStart(tokens) {\n let next;\n let spaces = \"\";\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== \"space\" && next !== \"comment\") break;\n spaces += tokens.shift()[1];\n }\n return spaces;\n }\n spacesFromEnd(tokens) {\n let lastTokenType;\n let spaces = \"\";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== \"space\") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n stringFrom(tokens, from) {\n let result2 = \"\";\n for (let i = from; i < tokens.length; i++) {\n result2 += tokens[i][1];\n }\n tokens.splice(from, tokens.length - from);\n return result2;\n }\n unclosedBlock() {\n let pos = this.current.source.start;\n throw this.input.error(\"Unclosed block\", pos.line, pos.column);\n }\n unclosedBracket(bracket) {\n throw this.input.error(\n \"Unclosed bracket\",\n { offset: bracket[2] },\n { offset: bracket[2] + 1 }\n );\n }\n unexpectedClose(token) {\n throw this.input.error(\n \"Unexpected }\",\n { offset: token[2] },\n { offset: token[2] + 1 }\n );\n }\n unknownWord(tokens) {\n throw this.input.error(\n \"Unknown word\",\n { offset: tokens[0][2] },\n { offset: tokens[0][2] + tokens[0][1].length }\n );\n }\n unnamedAtrule(node2, token) {\n throw this.input.error(\n \"At-rule without name\",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n};\nvar parser = Parser$1;\nlet Container$2 = container;\nlet Parser2 = parser;\nlet Input$2 = input;\nfunction parse$3(css, opts) {\n let input2 = new Input$2(css, opts);\n let parser2 = new Parser2(input2);\n try {\n parser2.parse();\n } catch (e) {\n if (process.env.NODE_ENV !== \"production\") {\n if (e.name === \"CssSyntaxError\" && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e.message += \"\\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser\";\n } else if (/\\.sass/i.test(opts.from)) {\n e.message += \"\\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser\";\n } else if (/\\.less$/i.test(opts.from)) {\n e.message += \"\\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser\";\n }\n }\n }\n throw e;\n }\n return parser2.root;\n}\nvar parse_1 = parse$3;\nparse$3.default = parse$3;\nContainer$2.registerParse(parse$3);\nlet { isClean, my } = symbols;\nlet MapGenerator$1 = mapGenerator;\nlet stringify$2 = stringify_1;\nlet Container$1 = container;\nlet Document$2 = document$1;\nlet warnOnce$1 = warnOnce$2;\nlet Result$2 = result;\nlet parse$2 = parse_1;\nlet Root$3 = root;\nconst TYPE_TO_CLASS_NAME = {\n atrule: \"AtRule\",\n comment: \"Comment\",\n decl: \"Declaration\",\n document: \"Document\",\n root: \"Root\",\n rule: \"Rule\"\n};\nconst PLUGIN_PROPS = {\n AtRule: true,\n AtRuleExit: true,\n Comment: true,\n CommentExit: true,\n Declaration: true,\n DeclarationExit: true,\n Document: true,\n DocumentExit: true,\n Once: true,\n OnceExit: true,\n postcssPlugin: true,\n prepare: true,\n Root: true,\n RootExit: true,\n Rule: true,\n RuleExit: true\n};\nconst NOT_VISITORS = {\n Once: true,\n postcssPlugin: true,\n prepare: true\n};\nconst CHILDREN = 0;\nfunction isPromise(obj) {\n return typeof obj === \"object\" && typeof obj.then === \"function\";\n}\nfunction getEvents(node2) {\n let key = false;\n let type = TYPE_TO_CLASS_NAME[node2.type];\n if (node2.type === \"decl\") {\n key = node2.prop.toLowerCase();\n } else if (node2.type === \"atrule\") {\n key = node2.name.toLowerCase();\n }\n if (key && node2.append) {\n return [\n type,\n type + \"-\" + key,\n CHILDREN,\n type + \"Exit\",\n type + \"Exit-\" + key\n ];\n } else if (key) {\n return [type, type + \"-\" + key, type + \"Exit\", type + \"Exit-\" + key];\n } else if (node2.append) {\n return [type, CHILDREN, type + \"Exit\"];\n } else {\n return [type, type + \"Exit\"];\n }\n}\nfunction toStack(node2) {\n let events;\n if (node2.type === \"document\") {\n events = [\"Document\", CHILDREN, \"DocumentExit\"];\n } else if (node2.type === \"root\") {\n events = [\"Root\", CHILDREN, \"RootExit\"];\n } else {\n events = getEvents(node2);\n }\n return {\n eventIndex: 0,\n events,\n iterator: 0,\n node: node2,\n visitorIndex: 0,\n visitors: []\n };\n}\nfunction cleanMarks(node2) {\n node2[isClean] = false;\n if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));\n return node2;\n}\nlet postcss$2 = {};\nlet LazyResult$2 = class LazyResult {\n constructor(processor2, css, opts) {\n this.stringified = false;\n this.processed = false;\n let root2;\n if (typeof css === \"object\" && css !== null && (css.type === \"root\" || css.type === \"document\")) {\n root2 = cleanMarks(css);\n } else if (css instanceof LazyResult || css instanceof Result$2) {\n root2 = cleanMarks(css.root);\n if (css.map) {\n if (typeof opts.map === \"undefined\") opts.map = {};\n if (!opts.map.inline) opts.map.inline = false;\n opts.map.prev = css.map;\n }\n } else {\n let parser2 = parse$2;\n if (opts.syntax) parser2 = opts.syntax.parse;\n if (opts.parser) parser2 = opts.parser;\n if (parser2.parse) parser2 = parser2.parse;\n try {\n root2 = parser2(css, opts);\n } catch (error) {\n this.processed = true;\n this.error = error;\n }\n if (root2 && !root2[my]) {\n Container$1.rebuild(root2);\n }\n }\n this.result = new Result$2(processor2, root2, opts);\n this.helpers = { ...postcss$2, postcss: postcss$2, result: this.result };\n this.plugins = this.processor.plugins.map((plugin2) => {\n if (typeof plugin2 === \"object\" && plugin2.prepare) {\n return { ...plugin2, ...plugin2.prepare(this.result) };\n } else {\n return plugin2;\n }\n });\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n if (this.processed) return Promise.resolve(this.result);\n if (!this.processing) {\n this.processing = this.runAsync();\n }\n return this.processing;\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n getAsyncError() {\n throw new Error(\"Use process(css).then(cb) to work with async plugins\");\n }\n handleError(error, node2) {\n let plugin2 = this.result.lastPlugin;\n try {\n if (node2) node2.addToError(error);\n this.error = error;\n if (error.name === \"CssSyntaxError\" && !error.plugin) {\n error.plugin = plugin2.postcssPlugin;\n error.setMessage();\n } else if (plugin2.postcssVersion) {\n if (process.env.NODE_ENV !== \"production\") {\n let pluginName = plugin2.postcssPlugin;\n let pluginVer = plugin2.postcssVersion;\n let runtimeVer = this.result.processor.version;\n let a = pluginVer.split(\".\");\n let b = runtimeVer.split(\".\");\n if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {\n console.error(\n \"Unknown error from PostCSS plugin. Your current PostCSS version is \" + runtimeVer + \", but \" + pluginName + \" uses \" + pluginVer + \". Perhaps this is the source of the error below.\"\n );\n }\n }\n }\n } catch (err) {\n if (console && console.error) console.error(err);\n }\n return error;\n }\n prepareVisitors() {\n this.listeners = {};\n let add = (plugin2, type, cb) => {\n if (!this.listeners[type]) this.listeners[type] = [];\n this.listeners[type].push([plugin2, cb]);\n };\n for (let plugin2 of this.plugins) {\n if (typeof plugin2 === \"object\") {\n for (let event in plugin2) {\n if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {\n throw new Error(\n `Unknown event ${event} in ${plugin2.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`\n );\n }\n if (!NOT_VISITORS[event]) {\n if (typeof plugin2[event] === \"object\") {\n for (let filter in plugin2[event]) {\n if (filter === \"*\") {\n add(plugin2, event, plugin2[event][filter]);\n } else {\n add(\n plugin2,\n event + \"-\" + filter.toLowerCase(),\n plugin2[event][filter]\n );\n }\n }\n } else if (typeof plugin2[event] === \"function\") {\n add(plugin2, event, plugin2[event]);\n }\n }\n }\n }\n }\n this.hasListener = Object.keys(this.listeners).length > 0;\n }\n async runAsync() {\n this.plugin = 0;\n for (let i = 0; i < this.plugins.length; i++) {\n let plugin2 = this.plugins[i];\n let promise = this.runOnRoot(plugin2);\n if (isPromise(promise)) {\n try {\n await promise;\n } catch (error) {\n throw this.handleError(error);\n }\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean]) {\n root2[isClean] = true;\n let stack = [toStack(root2)];\n while (stack.length > 0) {\n let promise = this.visitTick(stack);\n if (isPromise(promise)) {\n try {\n await promise;\n } catch (e) {\n let node2 = stack[stack.length - 1].node;\n throw this.handleError(e, node2);\n }\n }\n }\n }\n if (this.listeners.OnceExit) {\n for (let [plugin2, visitor] of this.listeners.OnceExit) {\n this.result.lastPlugin = plugin2;\n try {\n if (root2.type === \"document\") {\n let roots = root2.nodes.map(\n (subRoot) => visitor(subRoot, this.helpers)\n );\n await Promise.all(roots);\n } else {\n await visitor(root2, this.helpers);\n }\n } catch (e) {\n throw this.handleError(e);\n }\n }\n }\n }\n this.processed = true;\n return this.stringify();\n }\n runOnRoot(plugin2) {\n this.result.lastPlugin = plugin2;\n try {\n if (typeof plugin2 === \"object\" && plugin2.Once) {\n if (this.result.root.type === \"document\") {\n let roots = this.result.root.nodes.map(\n (root2) => plugin2.Once(root2, this.helpers)\n );\n if (isPromise(roots[0])) {\n return Promise.all(roots);\n }\n return roots;\n }\n return plugin2.Once(this.result.root, this.helpers);\n } else if (typeof plugin2 === \"function\") {\n return plugin2(this.result.root, this.result);\n }\n } catch (error) {\n throw this.handleError(error);\n }\n }\n stringify() {\n if (this.error) throw this.error;\n if (this.stringified) return this.result;\n this.stringified = true;\n this.sync();\n let opts = this.result.opts;\n let str = stringify$2;\n if (opts.syntax) str = opts.syntax.stringify;\n if (opts.stringifier) str = opts.stringifier;\n if (str.stringify) str = str.stringify;\n let map = new MapGenerator$1(str, this.result.root, this.result.opts);\n let data = map.generate();\n this.result.css = data[0];\n this.result.map = data[1];\n return this.result;\n }\n sync() {\n if (this.error) throw this.error;\n if (this.processed) return this.result;\n this.processed = true;\n if (this.processing) {\n throw this.getAsyncError();\n }\n for (let plugin2 of this.plugins) {\n let promise = this.runOnRoot(plugin2);\n if (isPromise(promise)) {\n throw this.getAsyncError();\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean]) {\n root2[isClean] = true;\n this.walkSync(root2);\n }\n if (this.listeners.OnceExit) {\n if (root2.type === \"document\") {\n for (let subRoot of root2.nodes) {\n this.visitSync(this.listeners.OnceExit, subRoot);\n }\n } else {\n this.visitSync(this.listeners.OnceExit, root2);\n }\n }\n }\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this.opts)) {\n warnOnce$1(\n \"Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.\"\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this.css;\n }\n visitSync(visitors, node2) {\n for (let [plugin2, visitor] of visitors) {\n this.result.lastPlugin = plugin2;\n let promise;\n try {\n promise = visitor(node2, this.helpers);\n } catch (e) {\n throw this.handleError(e, node2.proxyOf);\n }\n if (node2.type !== \"root\" && node2.type !== \"document\" && !node2.parent) {\n return true;\n }\n if (isPromise(promise)) {\n throw this.getAsyncError();\n }\n }\n }\n visitTick(stack) {\n let visit2 = stack[stack.length - 1];\n let { node: node2, visitors } = visit2;\n if (node2.type !== \"root\" && node2.type !== \"document\" && !node2.parent) {\n stack.pop();\n return;\n }\n if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {\n let [plugin2, visitor] = visitors[visit2.visitorIndex];\n visit2.visitorIndex += 1;\n if (visit2.visitorIndex === visitors.length) {\n visit2.visitors = [];\n visit2.visitorIndex = 0;\n }\n this.result.lastPlugin = plugin2;\n try {\n return visitor(node2.toProxy(), this.helpers);\n } catch (e) {\n throw this.handleError(e, node2);\n }\n }\n if (visit2.iterator !== 0) {\n let iterator = visit2.iterator;\n let child;\n while (child = node2.nodes[node2.indexes[iterator]]) {\n node2.indexes[iterator] += 1;\n if (!child[isClean]) {\n child[isClean] = true;\n stack.push(toStack(child));\n return;\n }\n }\n visit2.iterator = 0;\n delete node2.indexes[iterator];\n }\n let events = visit2.events;\n while (visit2.eventIndex < events.length) {\n let event = events[visit2.eventIndex];\n visit2.eventIndex += 1;\n if (event === CHILDREN) {\n if (node2.nodes && node2.nodes.length) {\n node2[isClean] = true;\n visit2.iterator = node2.getIterator();\n }\n return;\n } else if (this.listeners[event]) {\n visit2.visitors = this.listeners[event];\n return;\n }\n }\n stack.pop();\n }\n walkSync(node2) {\n node2[isClean] = true;\n let events = getEvents(node2);\n for (let event of events) {\n if (event === CHILDREN) {\n if (node2.nodes) {\n node2.each((child) => {\n if (!child[isClean]) this.walkSync(child);\n });\n }\n } else {\n let visitors = this.listeners[event];\n if (visitors) {\n if (this.visitSync(visitors, node2.toProxy())) return;\n }\n }\n }\n }\n warnings() {\n return this.sync().warnings();\n }\n get content() {\n return this.stringify().content;\n }\n get css() {\n return this.stringify().css;\n }\n get map() {\n return this.stringify().map;\n }\n get messages() {\n return this.sync().messages;\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n return this.sync().root;\n }\n get [Symbol.toStringTag]() {\n return \"LazyResult\";\n }\n};\nLazyResult$2.registerPostcss = (dependant) => {\n postcss$2 = dependant;\n};\nvar lazyResult = LazyResult$2;\nLazyResult$2.default = LazyResult$2;\nRoot$3.registerLazyResult(LazyResult$2);\nDocument$2.registerLazyResult(LazyResult$2);\nlet MapGenerator2 = mapGenerator;\nlet stringify$1 = stringify_1;\nlet warnOnce2 = warnOnce$2;\nlet parse$1 = parse_1;\nconst Result$1 = result;\nlet NoWorkResult$1 = class NoWorkResult {\n constructor(processor2, css, opts) {\n css = css.toString();\n this.stringified = false;\n this._processor = processor2;\n this._css = css;\n this._opts = opts;\n this._map = void 0;\n let root2;\n let str = stringify$1;\n this.result = new Result$1(this._processor, root2, this._opts);\n this.result.css = css;\n let self = this;\n Object.defineProperty(this.result, \"root\", {\n get() {\n return self.root;\n }\n });\n let map = new MapGenerator2(str, root2, this._opts, css);\n if (map.isMap()) {\n let [generatedCSS, generatedMap] = map.generate();\n if (generatedCSS) {\n this.result.css = generatedCSS;\n }\n if (generatedMap) {\n this.result.map = generatedMap;\n }\n } else {\n map.clearAnnotation();\n this.result.css = map.css;\n }\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n return Promise.resolve(this.result);\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n sync() {\n if (this.error) throw this.error;\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this._opts)) {\n warnOnce2(\n \"Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.\"\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this._css;\n }\n warnings() {\n return [];\n }\n get content() {\n return this.result.css;\n }\n get css() {\n return this.result.css;\n }\n get map() {\n return this.result.map;\n }\n get messages() {\n return [];\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n if (this._root) {\n return this._root;\n }\n let root2;\n let parser2 = parse$1;\n try {\n root2 = parser2(this._css, this._opts);\n } catch (error) {\n this.error = error;\n }\n if (this.error) {\n throw this.error;\n } else {\n this._root = root2;\n return root2;\n }\n }\n get [Symbol.toStringTag]() {\n return \"NoWorkResult\";\n }\n};\nvar noWorkResult = NoWorkResult$1;\nNoWorkResult$1.default = NoWorkResult$1;\nlet NoWorkResult2 = noWorkResult;\nlet LazyResult$1 = lazyResult;\nlet Document$1 = document$1;\nlet Root$2 = root;\nlet Processor$1 = class Processor {\n constructor(plugins = []) {\n this.version = \"8.4.38\";\n this.plugins = this.normalize(plugins);\n }\n normalize(plugins) {\n let normalized = [];\n for (let i of plugins) {\n if (i.postcss === true) {\n i = i();\n } else if (i.postcss) {\n i = i.postcss;\n }\n if (typeof i === \"object\" && Array.isArray(i.plugins)) {\n normalized = normalized.concat(i.plugins);\n } else if (typeof i === \"object\" && i.postcssPlugin) {\n normalized.push(i);\n } else if (typeof i === \"function\") {\n normalized.push(i);\n } else if (typeof i === \"object\" && (i.parse || i.stringify)) {\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\n \"PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.\"\n );\n }\n } else {\n throw new Error(i + \" is not a PostCSS plugin\");\n }\n }\n return normalized;\n }\n process(css, opts = {}) {\n if (!this.plugins.length && !opts.parser && !opts.stringifier && !opts.syntax) {\n return new NoWorkResult2(this, css, opts);\n } else {\n return new LazyResult$1(this, css, opts);\n }\n }\n use(plugin2) {\n this.plugins = this.plugins.concat(this.normalize([plugin2]));\n return this;\n }\n};\nvar processor = Processor$1;\nProcessor$1.default = Processor$1;\nRoot$2.registerProcessor(Processor$1);\nDocument$1.registerProcessor(Processor$1);\nlet Declaration$1 = declaration;\nlet PreviousMap2 = previousMap;\nlet Comment$1 = comment;\nlet AtRule$1 = atRule;\nlet Input$1 = input;\nlet Root$1 = root;\nlet Rule$1 = rule;\nfunction fromJSON$1(json, inputs) {\n if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));\n let { inputs: ownInputs, ...defaults } = json;\n if (ownInputs) {\n inputs = [];\n for (let input2 of ownInputs) {\n let inputHydrated = { ...input2, __proto__: Input$1.prototype };\n if (inputHydrated.map) {\n inputHydrated.map = {\n ...inputHydrated.map,\n __proto__: PreviousMap2.prototype\n };\n }\n inputs.push(inputHydrated);\n }\n }\n if (defaults.nodes) {\n defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));\n }\n if (defaults.source) {\n let { inputId, ...source } = defaults.source;\n defaults.source = source;\n if (inputId != null) {\n defaults.source.input = inputs[inputId];\n }\n }\n if (defaults.type === \"root\") {\n return new Root$1(defaults);\n } else if (defaults.type === \"decl\") {\n return new Declaration$1(defaults);\n } else if (defaults.type === \"rule\") {\n return new Rule$1(defaults);\n } else if (defaults.type === \"comment\") {\n return new Comment$1(defaults);\n } else if (defaults.type === \"atrule\") {\n return new AtRule$1(defaults);\n } else {\n throw new Error(\"Unknown node type: \" + json.type);\n }\n}\nvar fromJSON_1 = fromJSON$1;\nfromJSON$1.default = fromJSON$1;\nlet CssSyntaxError2 = cssSyntaxError;\nlet Declaration2 = declaration;\nlet LazyResult2 = lazyResult;\nlet Container2 = container;\nlet Processor2 = processor;\nlet stringify = stringify_1;\nlet fromJSON = fromJSON_1;\nlet Document2 = document$1;\nlet Warning2 = warning;\nlet Comment2 = comment;\nlet AtRule2 = atRule;\nlet Result2 = result;\nlet Input2 = input;\nlet parse = parse_1;\nlet list = list_1;\nlet Rule2 = rule;\nlet Root2 = root;\nlet Node2 = node;\nfunction postcss(...plugins) {\n if (plugins.length === 1 && Array.isArray(plugins[0])) {\n plugins = plugins[0];\n }\n return new Processor2(plugins);\n}\npostcss.plugin = function plugin(name, initializer) {\n let warningPrinted = false;\n function creator(...args) {\n if (console && console.warn && !warningPrinted) {\n warningPrinted = true;\n console.warn(\n name + \": postcss.plugin was deprecated. Migration guide:\\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration\"\n );\n if (process.env.LANG && process.env.LANG.startsWith(\"cn\")) {\n console.warn(\n name + \": 里面 postcss.plugin 被弃用. 迁移指南:\\nhttps://www.w3ctech.com/topic/2226\"\n );\n }\n }\n let transformer = initializer(...args);\n transformer.postcssPlugin = name;\n transformer.postcssVersion = new Processor2().version;\n return transformer;\n }\n let cache;\n Object.defineProperty(creator, \"postcss\", {\n get() {\n if (!cache) cache = creator();\n return cache;\n }\n });\n creator.process = function(css, processOpts, pluginOpts) {\n return postcss([creator(pluginOpts)]).process(css, processOpts);\n };\n return creator;\n};\npostcss.stringify = stringify;\npostcss.parse = parse;\npostcss.fromJSON = fromJSON;\npostcss.list = list;\npostcss.comment = (defaults) => new Comment2(defaults);\npostcss.atRule = (defaults) => new AtRule2(defaults);\npostcss.decl = (defaults) => new Declaration2(defaults);\npostcss.rule = (defaults) => new Rule2(defaults);\npostcss.root = (defaults) => new Root2(defaults);\npostcss.document = (defaults) => new Document2(defaults);\npostcss.CssSyntaxError = CssSyntaxError2;\npostcss.Declaration = Declaration2;\npostcss.Container = Container2;\npostcss.Processor = Processor2;\npostcss.Document = Document2;\npostcss.Comment = Comment2;\npostcss.Warning = Warning2;\npostcss.AtRule = AtRule2;\npostcss.Result = Result2;\npostcss.Input = Input2;\npostcss.Rule = Rule2;\npostcss.Root = Root2;\npostcss.Node = Node2;\nLazyResult2.registerPostcss(postcss);\nvar postcss_1 = postcss;\npostcss.default = postcss;\nconst postcss$1 = /* @__PURE__ */ getDefaultExportFromCjs(postcss_1);\npostcss$1.stringify;\npostcss$1.fromJSON;\npostcss$1.plugin;\npostcss$1.parse;\npostcss$1.list;\npostcss$1.document;\npostcss$1.comment;\npostcss$1.atRule;\npostcss$1.rule;\npostcss$1.decl;\npostcss$1.root;\npostcss$1.CssSyntaxError;\npostcss$1.Declaration;\npostcss$1.Container;\npostcss$1.Processor;\npostcss$1.Document;\npostcss$1.Comment;\npostcss$1.Warning;\npostcss$1.AtRule;\npostcss$1.Result;\npostcss$1.Input;\npostcss$1.Rule;\npostcss$1.Root;\npostcss$1.Node;\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(n) {\n let tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName;\n if (tagName === \"link\" && n.attributes._cssText) {\n tagName = \"style\";\n }\n return tagName;\n}\nfunction adaptCssForReplay(cssText, cache) {\n const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);\n if (cachedStyle) return cachedStyle;\n const ast = postcss$1([\n mediaSelectorPlugin,\n pseudoClassPlugin\n ]).process(cssText);\n const result2 = ast.css;\n cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);\n return result2;\n}\nfunction createCache() {\n const stylesWithHoverClass = /* @__PURE__ */ new Map();\n return {\n stylesWithHoverClass\n };\n}\nfunction applyCssSplits(n, cssText, hackCss, cache) {\n const childTextNodes = [];\n for (const scn of n.childNodes) {\n if (scn.type === NodeType.Text) {\n childTextNodes.push(scn);\n }\n }\n const cssTextSplits = cssText.split(\"/* rr_split */\");\n while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {\n cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(\"\"));\n }\n for (let i = 0; i < childTextNodes.length; i++) {\n const childTextNode = childTextNodes[i];\n const cssTextSection = cssTextSplits[i];\n if (childTextNode && cssTextSection) {\n childTextNode.textContent = hackCss ? adaptCssForReplay(cssTextSection, cache) : cssTextSection;\n }\n }\n}\nfunction buildStyleNode(n, styleEl, cssText, options) {\n const { doc, hackCss, cache } = options;\n if (n.childNodes.length) {\n applyCssSplits(n, cssText, hackCss, cache);\n } else {\n if (hackCss) {\n cssText = adaptCssForReplay(cssText, cache);\n }\n styleEl.appendChild(doc.createTextNode(cssText));\n }\n}\nfunction buildNode(n, options) {\n var _a;\n const { doc, hackCss, cache } = options;\n switch (n.type) {\n case NodeType.Document:\n return doc.implementation.createDocument(null, \"\", null);\n case NodeType.DocumentType:\n return doc.implementation.createDocumentType(\n n.name || \"html\",\n n.publicId,\n n.systemId\n );\n case NodeType.Element: {\n const tagName = getTagName(n);\n let node2;\n if (n.isSVG) {\n node2 = doc.createElementNS(\"http://www.w3.org/2000/svg\", tagName);\n } else {\n if (\n // If the tag name is a custom element name\n n.isCustom && // If the browser supports custom elements\n ((_a = doc.defaultView) == null ? void 0 : _a.customElements) && // If the custom element hasn't been defined yet\n !doc.defaultView.customElements.get(n.tagName)\n )\n doc.defaultView.customElements.define(\n n.tagName,\n class extends doc.defaultView.HTMLElement {\n }\n );\n node2 = doc.createElement(tagName);\n }\n const specialAttributes = {};\n for (const name in n.attributes) {\n if (!Object.prototype.hasOwnProperty.call(n.attributes, name)) {\n continue;\n }\n let value = n.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 if (typeof value !== \"string\") ;\n else if (tagName === \"style\" && name === \"_cssText\") {\n buildStyleNode(n, node2, value, options);\n continue;\n } else if (tagName === \"textarea\" && name === \"value\") {\n node2.appendChild(doc.createTextNode(value));\n n.childNodes = [];\n continue;\n }\n try {\n if (n.isSVG && name === \"xlink:href\") {\n node2.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 node2.setAttribute(\"_\" + name, value.toString());\n } else if (tagName === \"meta\" && n.attributes[\"http-equiv\"] === \"Content-Security-Policy\" && name === \"content\") {\n node2.setAttribute(\"csp-content\", value.toString());\n continue;\n } else if (tagName === \"link\" && (n.attributes.rel === \"preload\" || n.attributes.rel === \"modulepreload\") && n.attributes.as === \"script\") {\n } else if (tagName === \"link\" && n.attributes.rel === \"prefetch\" && typeof n.attributes.href === \"string\" && n.attributes.href.endsWith(\".js\")) {\n } else if (tagName === \"img\" && n.attributes.srcset && n.attributes.rr_dataURL) {\n node2.setAttribute(\n \"rrweb-original-srcset\",\n n.attributes.srcset\n );\n } else {\n node2.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 = node2.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(image, 0, 0, image.width, image.height);\n }\n };\n image.src = value.toString();\n if (node2.RRNodeType)\n node2.rr_dataURL = value.toString();\n } else if (tagName === \"img\" && name === \"rr_dataURL\") {\n const image = node2;\n if (!image.currentSrc.startsWith(\"data:\")) {\n image.setAttribute(\n \"rrweb-original-src\",\n n.attributes.src\n );\n image.src = value.toString();\n }\n }\n if (name === \"rr_width\") {\n node2.style.setProperty(\"width\", value.toString());\n } else if (name === \"rr_height\") {\n node2.style.setProperty(\"height\", value.toString());\n } else if (name === \"rr_mediaCurrentTime\" && typeof value === \"number\") {\n node2.currentTime = value;\n } else if (name === \"rr_mediaState\") {\n switch (value) {\n case \"played\":\n node2.play().catch((e) => console.warn(\"media playback error\", e));\n break;\n case \"paused\":\n node2.pause();\n break;\n }\n } else if (name === \"rr_mediaPlaybackRate\" && typeof value === \"number\") {\n node2.playbackRate = value;\n } else if (name === \"rr_mediaMuted\" && typeof value === \"boolean\") {\n node2.muted = value;\n } else if (name === \"rr_mediaLoop\" && typeof value === \"boolean\") {\n node2.loop = value;\n } else if (name === \"rr_mediaVolume\" && typeof value === \"number\") {\n node2.volume = value;\n } else if (name === \"rr_open_mode\") {\n node2.setAttribute(\n \"rr_open_mode\",\n value\n );\n }\n }\n if (n.isShadowHost) {\n if (!node2.shadowRoot) {\n node2.attachShadow({ mode: \"open\" });\n } else {\n while (node2.shadowRoot.firstChild) {\n node2.shadowRoot.removeChild(node2.shadowRoot.firstChild);\n }\n }\n }\n return node2;\n }\n case NodeType.Text:\n if (n.isStyle && hackCss) {\n return doc.createTextNode(adaptCssForReplay(n.textContent, cache));\n }\n return doc.createTextNode(n.textContent);\n case NodeType.CDATA:\n return doc.createCDATASection(n.textContent);\n case NodeType.Comment:\n return doc.createComment(n.textContent);\n default:\n return null;\n }\n}\nfunction buildNodeWithSN(n, options) {\n const {\n doc,\n mirror,\n skipChild = false,\n hackCss = true,\n afterAppend,\n cache\n } = options;\n if (mirror.has(n.id)) {\n const nodeInMirror = mirror.getNode(n.id);\n const meta = mirror.getMeta(nodeInMirror);\n if (isNodeMetaEqual(meta, n)) return mirror.getNode(n.id);\n }\n let node2 = buildNode(n, { doc, hackCss, cache });\n if (!node2) {\n return null;\n }\n if (n.rootId && mirror.getNode(n.rootId) !== doc) {\n mirror.replace(n.rootId, doc);\n }\n if (n.type === NodeType.Document) {\n doc.close();\n doc.open();\n if (n.compatMode === \"BackCompat\" && n.childNodes && n.childNodes[0].type !== NodeType.DocumentType) {\n if (n.childNodes[0].type === NodeType.Element && \"xmlns\" in n.childNodes[0].attributes && n.childNodes[0].attributes.xmlns === \"http://www.w3.org/1999/xhtml\") {\n doc.write(\n ''\n );\n } else {\n doc.write(\n ''\n );\n }\n }\n node2 = doc;\n }\n mirror.add(node2, n);\n if ((n.type === NodeType.Document || n.type === NodeType.Element) && !skipChild) {\n for (const childN of n.childNodes) {\n const childNode = buildNodeWithSN(childN, {\n doc,\n mirror,\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(node2) && node2.shadowRoot) {\n node2.shadowRoot.appendChild(childNode);\n } else if (n.type === NodeType.Document && childN.type == NodeType.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 node2.appendChild(childNode);\n htmlElement.appendChild(body);\n } else {\n node2.appendChild(childNode);\n }\n } else {\n node2.appendChild(childNode);\n }\n if (afterAppend) {\n afterAppend(childNode, childN.id);\n }\n }\n }\n return node2;\n}\nfunction visit(mirror, onVisit) {\n function walk(node2) {\n onVisit(node2);\n }\n for (const id of mirror.getIds()) {\n if (mirror.has(id)) {\n walk(mirror.getNode(id));\n }\n }\n}\nfunction handleScroll(node2, mirror) {\n const n = mirror.getMeta(node2);\n if ((n == null ? void 0 : n.type) !== NodeType.Element) {\n return;\n }\n const el = node2;\n for (const name in n.attributes) {\n if (!(Object.prototype.hasOwnProperty.call(n.attributes, name) && name.startsWith(\"rr_\"))) {\n continue;\n }\n const value = n.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(n, options) {\n const {\n doc,\n onVisit,\n hackCss = true,\n afterAppend,\n cache,\n mirror = new Mirror()\n } = options;\n const node2 = buildNodeWithSN(n, {\n doc,\n mirror,\n skipChild: false,\n hackCss,\n afterAppend,\n cache\n });\n visit(mirror, (visitedNode) => {\n if (onVisit) {\n onVisit(visitedNode);\n }\n handleScroll(visitedNode, mirror);\n });\n return node2;\n}\nexport {\n IGNORED_NODE,\n Mirror,\n absolutifyURLs,\n adaptCssForReplay,\n buildNodeWithSN,\n classMatchesRegex,\n cleanupSnapshot,\n createCache,\n createMirror,\n escapeImportStatement,\n extractFileExtension,\n fixSafariColons,\n genId,\n getInputType,\n ignoreAttribute,\n is2DCanvasBlank,\n isCSSImportRule,\n isCSSStyleRule,\n isElement,\n isNativeShadowDom,\n isNodeMetaEqual,\n isShadowRoot,\n markCssSplits,\n maskInputValue,\n needMaskingText,\n normalizeCssString,\n rebuild,\n serializeNodeWithId,\n snapshot,\n splitCssText,\n stringifyRule,\n stringifyStylesheet,\n toLowerCase,\n transformAttribute,\n visitSnapshot\n};\n//# sourceMappingURL=rrweb-snapshot.js.map\n", "var __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);\nlet Mirror$1 = class Mirror {\n constructor() {\n __publicField2(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField2(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n) {\n var _a;\n if (!n) return -1;\n const id = (_a = this.getMeta(n)) == null ? void 0 : _a.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(n) {\n return this.nodeMetaMap.get(n) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n) {\n const id = this.getId(n);\n this.idNodeMap.delete(id);\n if (n.childNodes) {\n n.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n);\n this.nodeMetaMap.set(n, meta);\n }\n replace(id, n) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n, meta);\n }\n this.idNodeMap.set(id, n);\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 getDefaultExportFromCjs(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, \"default\") ? x2[\"default\"] : x2;\n}\nfunction getAugmentedNamespace(n) {\n if (n.__esModule) return n;\n var f = n.default;\n if (typeof f == \"function\") {\n var a = function a2() {\n if (this instanceof a2) {\n return Reflect.construct(f, arguments, this.constructor);\n }\n return f.apply(this, arguments);\n };\n a.prototype = f.prototype;\n } else a = {};\n Object.defineProperty(a, \"__esModule\", { value: true });\n Object.keys(n).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n, k);\n Object.defineProperty(a, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n[k];\n }\n });\n });\n return a;\n}\nvar picocolors_browser = { exports: {} };\nvar x = String;\nvar create = function() {\n return { isColorSupported: false, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x };\n};\npicocolors_browser.exports = create();\npicocolors_browser.exports.createColors = create;\nvar picocolors_browserExports = picocolors_browser.exports;\nconst __viteBrowserExternal = {};\nconst __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n default: __viteBrowserExternal\n}, Symbol.toStringTag, { value: \"Module\" }));\nconst require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);\nlet pico = picocolors_browserExports;\nlet terminalHighlight$1 = require$$2;\nlet CssSyntaxError$3 = class CssSyntaxError extends Error {\n constructor(message, line, column, source, file, plugin2) {\n super(message);\n this.name = \"CssSyntaxError\";\n this.reason = message;\n if (file) {\n this.file = file;\n }\n if (source) {\n this.source = source;\n }\n if (plugin2) {\n this.plugin = plugin2;\n }\n if (typeof line !== \"undefined\" && typeof column !== \"undefined\") {\n if (typeof line === \"number\") {\n this.line = line;\n this.column = column;\n } else {\n this.line = line.line;\n this.column = line.column;\n this.endLine = column.line;\n this.endColumn = column.column;\n }\n }\n this.setMessage();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CssSyntaxError);\n }\n }\n setMessage() {\n this.message = this.plugin ? this.plugin + \": \" : \"\";\n this.message += this.file ? this.file : \"\";\n if (typeof this.line !== \"undefined\") {\n this.message += \":\" + this.line + \":\" + this.column;\n }\n this.message += \": \" + this.reason;\n }\n showSourceCode(color) {\n if (!this.source) return \"\";\n let css = this.source;\n if (color == null) color = pico.isColorSupported;\n if (terminalHighlight$1) {\n if (color) css = terminalHighlight$1(css);\n }\n let lines = css.split(/\\r?\\n/);\n let start = Math.max(this.line - 3, 0);\n let end = Math.min(this.line + 2, lines.length);\n let maxWidth = String(end).length;\n let mark, aside;\n if (color) {\n let { bold, gray, red } = pico.createColors(true);\n mark = (text) => bold(red(text));\n aside = (text) => gray(text);\n } else {\n mark = aside = (str) => str;\n }\n return lines.slice(start, end).map((line, index2) => {\n let number = start + 1 + index2;\n let gutter = \" \" + (\" \" + number).slice(-maxWidth) + \" | \";\n if (number === this.line) {\n let spacing = aside(gutter.replace(/\\d/g, \" \")) + line.slice(0, this.column - 1).replace(/[^\\t]/g, \" \");\n return mark(\">\") + aside(gutter) + line + \"\\n \" + spacing + mark(\"^\");\n }\n return \" \" + aside(gutter) + line;\n }).join(\"\\n\");\n }\n toString() {\n let code = this.showSourceCode();\n if (code) {\n code = \"\\n\\n\" + code + \"\\n\";\n }\n return this.name + \": \" + this.message + code;\n }\n};\nvar cssSyntaxError = CssSyntaxError$3;\nCssSyntaxError$3.default = CssSyntaxError$3;\nvar symbols = {};\nsymbols.isClean = Symbol(\"isClean\");\nsymbols.my = Symbol(\"my\");\nconst DEFAULT_RAW = {\n after: \"\\n\",\n beforeClose: \"\\n\",\n beforeComment: \"\\n\",\n beforeDecl: \"\\n\",\n beforeOpen: \" \",\n beforeRule: \"\\n\",\n colon: \": \",\n commentLeft: \" \",\n commentRight: \" \",\n emptyBody: \"\",\n indent: \" \",\n semicolon: false\n};\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1);\n}\nlet Stringifier$2 = class Stringifier {\n constructor(builder) {\n this.builder = builder;\n }\n atrule(node2, semicolon) {\n let name = \"@\" + node2.name;\n let params = node2.params ? this.rawValue(node2, \"params\") : \"\";\n if (typeof node2.raws.afterName !== \"undefined\") {\n name += node2.raws.afterName;\n } else if (params) {\n name += \" \";\n }\n if (node2.nodes) {\n this.block(node2, name + params);\n } else {\n let end = (node2.raws.between || \"\") + (semicolon ? \";\" : \"\");\n this.builder(name + params + end, node2);\n }\n }\n beforeAfter(node2, detect) {\n let value;\n if (node2.type === \"decl\") {\n value = this.raw(node2, null, \"beforeDecl\");\n } else if (node2.type === \"comment\") {\n value = this.raw(node2, null, \"beforeComment\");\n } else if (detect === \"before\") {\n value = this.raw(node2, null, \"beforeRule\");\n } else {\n value = this.raw(node2, null, \"beforeClose\");\n }\n let buf = node2.parent;\n let depth = 0;\n while (buf && buf.type !== \"root\") {\n depth += 1;\n buf = buf.parent;\n }\n if (value.includes(\"\\n\")) {\n let indent = this.raw(node2, null, \"indent\");\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent;\n }\n }\n return value;\n }\n block(node2, start) {\n let between = this.raw(node2, \"between\", \"beforeOpen\");\n this.builder(start + between + \"{\", node2, \"start\");\n let after;\n if (node2.nodes && node2.nodes.length) {\n this.body(node2);\n after = this.raw(node2, \"after\");\n } else {\n after = this.raw(node2, \"after\", \"emptyBody\");\n }\n if (after) this.builder(after);\n this.builder(\"}\", node2, \"end\");\n }\n body(node2) {\n let last = node2.nodes.length - 1;\n while (last > 0) {\n if (node2.nodes[last].type !== \"comment\") break;\n last -= 1;\n }\n let semicolon = this.raw(node2, \"semicolon\");\n for (let i = 0; i < node2.nodes.length; i++) {\n let child = node2.nodes[i];\n let before = this.raw(child, \"before\");\n if (before) this.builder(before);\n this.stringify(child, last !== i || semicolon);\n }\n }\n comment(node2) {\n let left = this.raw(node2, \"left\", \"commentLeft\");\n let right = this.raw(node2, \"right\", \"commentRight\");\n this.builder(\"/*\" + left + node2.text + right + \"*/\", node2);\n }\n decl(node2, semicolon) {\n let between = this.raw(node2, \"between\", \"colon\");\n let string = node2.prop + between + this.rawValue(node2, \"value\");\n if (node2.important) {\n string += node2.raws.important || \" !important\";\n }\n if (semicolon) string += \";\";\n this.builder(string, node2);\n }\n document(node2) {\n this.body(node2);\n }\n raw(node2, own, detect) {\n let value;\n if (!detect) detect = own;\n if (own) {\n value = node2.raws[own];\n if (typeof value !== \"undefined\") return value;\n }\n let parent = node2.parent;\n if (detect === \"before\") {\n if (!parent || parent.type === \"root\" && parent.first === node2) {\n return \"\";\n }\n if (parent && parent.type === \"document\") {\n return \"\";\n }\n }\n if (!parent) return DEFAULT_RAW[detect];\n let root2 = node2.root();\n if (!root2.rawCache) root2.rawCache = {};\n if (typeof root2.rawCache[detect] !== \"undefined\") {\n return root2.rawCache[detect];\n }\n if (detect === \"before\" || detect === \"after\") {\n return this.beforeAfter(node2, detect);\n } else {\n let method = \"raw\" + capitalize(detect);\n if (this[method]) {\n value = this[method](root2, node2);\n } else {\n root2.walk((i) => {\n value = i.raws[own];\n if (typeof value !== \"undefined\") return false;\n });\n }\n }\n if (typeof value === \"undefined\") value = DEFAULT_RAW[detect];\n root2.rawCache[detect] = value;\n return value;\n }\n rawBeforeClose(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== \"undefined\") {\n value = i.raws.after;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, \"\");\n return value;\n }\n rawBeforeComment(root2, node2) {\n let value;\n root2.walkComments((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.raws.before;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n });\n if (typeof value === \"undefined\") {\n value = this.raw(node2, null, \"beforeDecl\");\n } else if (value) {\n value = value.replace(/\\S/g, \"\");\n }\n return value;\n }\n rawBeforeDecl(root2, node2) {\n let value;\n root2.walkDecls((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.raws.before;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n });\n if (typeof value === \"undefined\") {\n value = this.raw(node2, null, \"beforeRule\");\n } else if (value) {\n value = value.replace(/\\S/g, \"\");\n }\n return value;\n }\n rawBeforeOpen(root2) {\n let value;\n root2.walk((i) => {\n if (i.type !== \"decl\") {\n value = i.raws.between;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawBeforeRule(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && (i.parent !== root2 || root2.first !== i)) {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.raws.before;\n if (value.includes(\"\\n\")) {\n value = value.replace(/[^\\n]+$/, \"\");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, \"\");\n return value;\n }\n rawColon(root2) {\n let value;\n root2.walkDecls((i) => {\n if (typeof i.raws.between !== \"undefined\") {\n value = i.raws.between.replace(/[^\\s:]/g, \"\");\n return false;\n }\n });\n return value;\n }\n rawEmptyBody(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.raws.after;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawIndent(root2) {\n if (root2.raws.indent) return root2.raws.indent;\n let value;\n root2.walk((i) => {\n let p = i.parent;\n if (p && p !== root2 && p.parent && p.parent === root2) {\n if (typeof i.raws.before !== \"undefined\") {\n let parts = i.raws.before.split(\"\\n\");\n value = parts[parts.length - 1];\n value = value.replace(/\\S/g, \"\");\n return false;\n }\n }\n });\n return value;\n }\n rawSemicolon(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length && i.last.type === \"decl\") {\n value = i.raws.semicolon;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawValue(node2, prop) {\n let value = node2[prop];\n let raw = node2.raws[prop];\n if (raw && raw.value === value) {\n return raw.raw;\n }\n return value;\n }\n root(node2) {\n this.body(node2);\n if (node2.raws.after) this.builder(node2.raws.after);\n }\n rule(node2) {\n this.block(node2, this.rawValue(node2, \"selector\"));\n if (node2.raws.ownSemicolon) {\n this.builder(node2.raws.ownSemicolon, node2, \"end\");\n }\n }\n stringify(node2, semicolon) {\n if (!this[node2.type]) {\n throw new Error(\n \"Unknown AST node type \" + node2.type + \". Maybe you need to change PostCSS stringifier.\"\n );\n }\n this[node2.type](node2, semicolon);\n }\n};\nvar stringifier = Stringifier$2;\nStringifier$2.default = Stringifier$2;\nlet Stringifier$1 = stringifier;\nfunction stringify$4(node2, builder) {\n let str = new Stringifier$1(builder);\n str.stringify(node2);\n}\nvar stringify_1 = stringify$4;\nstringify$4.default = stringify$4;\nlet { isClean: isClean$2, my: my$2 } = symbols;\nlet CssSyntaxError$2 = cssSyntaxError;\nlet Stringifier2 = stringifier;\nlet stringify$3 = stringify_1;\nfunction cloneNode(obj, parent) {\n let cloned = new obj.constructor();\n for (let i in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i)) {\n continue;\n }\n if (i === \"proxyCache\") continue;\n let value = obj[i];\n let type = typeof value;\n if (i === \"parent\" && type === \"object\") {\n if (parent) cloned[i] = parent;\n } else if (i === \"source\") {\n cloned[i] = value;\n } else if (Array.isArray(value)) {\n cloned[i] = value.map((j) => cloneNode(j, cloned));\n } else {\n if (type === \"object\" && value !== null) value = cloneNode(value);\n cloned[i] = value;\n }\n }\n return cloned;\n}\nlet Node$4 = class Node {\n constructor(defaults = {}) {\n this.raws = {};\n this[isClean$2] = false;\n this[my$2] = true;\n for (let name in defaults) {\n if (name === \"nodes\") {\n this.nodes = [];\n for (let node2 of defaults[name]) {\n if (typeof node2.clone === \"function\") {\n this.append(node2.clone());\n } else {\n this.append(node2);\n }\n }\n } else {\n this[name] = defaults[name];\n }\n }\n }\n addToError(error) {\n error.postcssNode = this;\n if (error.stack && this.source && /\\n\\s{4}at /.test(error.stack)) {\n let s = this.source;\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s.input.from}:${s.start.line}:${s.start.column}$&`\n );\n }\n return error;\n }\n after(add) {\n this.parent.insertAfter(this, add);\n return this;\n }\n assign(overrides = {}) {\n for (let name in overrides) {\n this[name] = overrides[name];\n }\n return this;\n }\n before(add) {\n this.parent.insertBefore(this, add);\n return this;\n }\n cleanRaws(keepBetween) {\n delete this.raws.before;\n delete this.raws.after;\n if (!keepBetween) delete this.raws.between;\n }\n clone(overrides = {}) {\n let cloned = cloneNode(this);\n for (let name in overrides) {\n cloned[name] = overrides[name];\n }\n return cloned;\n }\n cloneAfter(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertAfter(this, cloned);\n return cloned;\n }\n cloneBefore(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertBefore(this, cloned);\n return cloned;\n }\n error(message, opts = {}) {\n if (this.source) {\n let { end, start } = this.rangeBy(opts);\n return this.source.input.error(\n message,\n { column: start.column, line: start.line },\n { column: end.column, line: end.line },\n opts\n );\n }\n return new CssSyntaxError$2(message);\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === \"proxyOf\") {\n return node2;\n } else if (prop === \"root\") {\n return () => node2.root().toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === \"prop\" || prop === \"value\" || prop === \"name\" || prop === \"params\" || prop === \"important\" || /* c8 ignore next */\n prop === \"text\") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n markDirty() {\n if (this[isClean$2]) {\n this[isClean$2] = false;\n let next = this;\n while (next = next.parent) {\n next[isClean$2] = false;\n }\n }\n }\n next() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 + 1];\n }\n positionBy(opts, stringRepresentation) {\n let pos = this.source.start;\n if (opts.index) {\n pos = this.positionInside(opts.index, stringRepresentation);\n } else if (opts.word) {\n stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) pos = this.positionInside(index2, stringRepresentation);\n }\n return pos;\n }\n positionInside(index2, stringRepresentation) {\n let string = stringRepresentation || this.toString();\n let column = this.source.start.column;\n let line = this.source.start.line;\n for (let i = 0; i < index2; i++) {\n if (string[i] === \"\\n\") {\n column = 1;\n line += 1;\n } else {\n column += 1;\n }\n }\n return { column, line };\n }\n prev() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 - 1];\n }\n rangeBy(opts) {\n let start = {\n column: this.source.start.column,\n line: this.source.start.line\n };\n let end = this.source.end ? {\n column: this.source.end.column + 1,\n line: this.source.end.line\n } : {\n column: start.column + 1,\n line: start.line\n };\n if (opts.word) {\n let stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) {\n start = this.positionInside(index2, stringRepresentation);\n end = this.positionInside(index2 + opts.word.length, stringRepresentation);\n }\n } else {\n if (opts.start) {\n start = {\n column: opts.start.column,\n line: opts.start.line\n };\n } else if (opts.index) {\n start = this.positionInside(opts.index);\n }\n if (opts.end) {\n end = {\n column: opts.end.column,\n line: opts.end.line\n };\n } else if (typeof opts.endIndex === \"number\") {\n end = this.positionInside(opts.endIndex);\n } else if (opts.index) {\n end = this.positionInside(opts.index + 1);\n }\n }\n if (end.line < start.line || end.line === start.line && end.column <= start.column) {\n end = { column: start.column + 1, line: start.line };\n }\n return { end, start };\n }\n raw(prop, defaultType) {\n let str = new Stringifier2();\n return str.raw(this, prop, defaultType);\n }\n remove() {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n this.parent = void 0;\n return this;\n }\n replaceWith(...nodes) {\n if (this.parent) {\n let bookmark = this;\n let foundSelf = false;\n for (let node2 of nodes) {\n if (node2 === this) {\n foundSelf = true;\n } else if (foundSelf) {\n this.parent.insertAfter(bookmark, node2);\n bookmark = node2;\n } else {\n this.parent.insertBefore(bookmark, node2);\n }\n }\n if (!foundSelf) {\n this.remove();\n }\n }\n return this;\n }\n root() {\n let result2 = this;\n while (result2.parent && result2.parent.type !== \"document\") {\n result2 = result2.parent;\n }\n return result2;\n }\n toJSON(_, inputs) {\n let fixed = {};\n let emitInputs = inputs == null;\n inputs = inputs || /* @__PURE__ */ new Map();\n let inputsNextIndex = 0;\n for (let name in this) {\n if (!Object.prototype.hasOwnProperty.call(this, name)) {\n continue;\n }\n if (name === \"parent\" || name === \"proxyCache\") continue;\n let value = this[name];\n if (Array.isArray(value)) {\n fixed[name] = value.map((i) => {\n if (typeof i === \"object\" && i.toJSON) {\n return i.toJSON(null, inputs);\n } else {\n return i;\n }\n });\n } else if (typeof value === \"object\" && value.toJSON) {\n fixed[name] = value.toJSON(null, inputs);\n } else if (name === \"source\") {\n let inputId = inputs.get(value.input);\n if (inputId == null) {\n inputId = inputsNextIndex;\n inputs.set(value.input, inputsNextIndex);\n inputsNextIndex++;\n }\n fixed[name] = {\n end: value.end,\n inputId,\n start: value.start\n };\n } else {\n fixed[name] = value;\n }\n }\n if (emitInputs) {\n fixed.inputs = [...inputs.keys()].map((input2) => input2.toJSON());\n }\n return fixed;\n }\n toProxy() {\n if (!this.proxyCache) {\n this.proxyCache = new Proxy(this, this.getProxyProcessor());\n }\n return this.proxyCache;\n }\n toString(stringifier2 = stringify$3) {\n if (stringifier2.stringify) stringifier2 = stringifier2.stringify;\n let result2 = \"\";\n stringifier2(this, (i) => {\n result2 += i;\n });\n return result2;\n }\n warn(result2, text, opts) {\n let data = { node: this };\n for (let i in opts) data[i] = opts[i];\n return result2.warn(text, data);\n }\n get proxyOf() {\n return this;\n }\n};\nvar node = Node$4;\nNode$4.default = Node$4;\nlet Node$3 = node;\nlet Declaration$4 = class Declaration extends Node$3 {\n constructor(defaults) {\n if (defaults && typeof defaults.value !== \"undefined\" && typeof defaults.value !== \"string\") {\n defaults = { ...defaults, value: String(defaults.value) };\n }\n super(defaults);\n this.type = \"decl\";\n }\n get variable() {\n return this.prop.startsWith(\"--\") || this.prop[0] === \"$\";\n }\n};\nvar declaration = Declaration$4;\nDeclaration$4.default = Declaration$4;\nlet urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nlet customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += alphabet[Math.random() * alphabet.length | 0];\n }\n return id;\n };\n};\nlet nanoid$1 = (size = 21) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += urlAlphabet[Math.random() * 64 | 0];\n }\n return id;\n};\nvar nonSecure = { nanoid: nanoid$1, customAlphabet };\nlet { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;\nlet { existsSync, readFileSync } = require$$2;\nlet { dirname: dirname$1, join } = require$$2;\nfunction fromBase64(str) {\n if (Buffer) {\n return Buffer.from(str, \"base64\").toString();\n } else {\n return window.atob(str);\n }\n}\nlet PreviousMap$2 = class PreviousMap {\n constructor(css, opts) {\n if (opts.map === false) return;\n this.loadAnnotation(css);\n this.inline = this.startWith(this.annotation, \"data:\");\n let prev = opts.map ? opts.map.prev : void 0;\n let text = this.loadMap(opts.from, prev);\n if (!this.mapFile && opts.from) {\n this.mapFile = opts.from;\n }\n if (this.mapFile) this.root = dirname$1(this.mapFile);\n if (text) this.text = text;\n }\n consumer() {\n if (!this.consumerCache) {\n this.consumerCache = new SourceMapConsumer$2(this.text);\n }\n return this.consumerCache;\n }\n decodeInline(text) {\n let baseCharsetUri = /^data:application\\/json;charset=utf-?8;base64,/;\n let baseUri = /^data:application\\/json;base64,/;\n let charsetUri = /^data:application\\/json;charset=utf-?8,/;\n let uri = /^data:application\\/json,/;\n if (charsetUri.test(text) || uri.test(text)) {\n return decodeURIComponent(text.substr(RegExp.lastMatch.length));\n }\n if (baseCharsetUri.test(text) || baseUri.test(text)) {\n return fromBase64(text.substr(RegExp.lastMatch.length));\n }\n let encoding = text.match(/data:application\\/json;([^,]+),/)[1];\n throw new Error(\"Unsupported source map encoding \" + encoding);\n }\n getAnnotationURL(sourceMapString) {\n return sourceMapString.replace(/^\\/\\*\\s*# sourceMappingURL=/, \"\").trim();\n }\n isMap(map) {\n if (typeof map !== \"object\") return false;\n return typeof map.mappings === \"string\" || typeof map._mappings === \"string\" || Array.isArray(map.sections);\n }\n loadAnnotation(css) {\n let comments = css.match(/\\/\\*\\s*# sourceMappingURL=/gm);\n if (!comments) return;\n let start = css.lastIndexOf(comments.pop());\n let end = css.indexOf(\"*/\", start);\n if (start > -1 && end > -1) {\n this.annotation = this.getAnnotationURL(css.substring(start, end));\n }\n }\n loadFile(path) {\n this.root = dirname$1(path);\n if (existsSync(path)) {\n this.mapFile = path;\n return readFileSync(path, \"utf-8\").toString().trim();\n }\n }\n loadMap(file, prev) {\n if (prev === false) return false;\n if (prev) {\n if (typeof prev === \"string\") {\n return prev;\n } else if (typeof prev === \"function\") {\n let prevPath = prev(file);\n if (prevPath) {\n let map = this.loadFile(prevPath);\n if (!map) {\n throw new Error(\n \"Unable to load previous source map: \" + prevPath.toString()\n );\n }\n return map;\n }\n } else if (prev instanceof SourceMapConsumer$2) {\n return SourceMapGenerator$2.fromSourceMap(prev).toString();\n } else if (prev instanceof SourceMapGenerator$2) {\n return prev.toString();\n } else if (this.isMap(prev)) {\n return JSON.stringify(prev);\n } else {\n throw new Error(\n \"Unsupported previous source map format: \" + prev.toString()\n );\n }\n } else if (this.inline) {\n return this.decodeInline(this.annotation);\n } else if (this.annotation) {\n let map = this.annotation;\n if (file) map = join(dirname$1(file), map);\n return this.loadFile(map);\n }\n }\n startWith(string, start) {\n if (!string) return false;\n return string.substr(0, start.length) === start;\n }\n withContent() {\n return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);\n }\n};\nvar previousMap = PreviousMap$2;\nPreviousMap$2.default = PreviousMap$2;\nlet { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;\nlet { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;\nlet { isAbsolute, resolve: resolve$1 } = require$$2;\nlet { nanoid } = nonSecure;\nlet terminalHighlight = require$$2;\nlet CssSyntaxError$1 = cssSyntaxError;\nlet PreviousMap$1 = previousMap;\nlet fromOffsetCache = Symbol(\"fromOffsetCache\");\nlet sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);\nlet pathAvailable$1 = Boolean(resolve$1 && isAbsolute);\nlet Input$4 = class Input {\n constructor(css, opts = {}) {\n if (css === null || typeof css === \"undefined\" || typeof css === \"object\" && !css.toString) {\n throw new Error(`PostCSS received ${css} instead of CSS string`);\n }\n this.css = css.toString();\n if (this.css[0] === \"\\uFEFF\" || this.css[0] === \"￾\") {\n this.hasBOM = true;\n this.css = this.css.slice(1);\n } else {\n this.hasBOM = false;\n }\n if (opts.from) {\n if (!pathAvailable$1 || /^\\w+:\\/\\//.test(opts.from) || isAbsolute(opts.from)) {\n this.file = opts.from;\n } else {\n this.file = resolve$1(opts.from);\n }\n }\n if (pathAvailable$1 && sourceMapAvailable$1) {\n let map = new PreviousMap$1(this.css, opts);\n if (map.text) {\n this.map = map;\n let file = map.consumer().file;\n if (!this.file && file) this.file = this.mapResolve(file);\n }\n }\n if (!this.file) {\n this.id = \"\";\n }\n if (this.map) this.map.file = this.from;\n }\n error(message, line, column, opts = {}) {\n let result2, endLine, endColumn;\n if (line && typeof line === \"object\") {\n let start = line;\n let end = column;\n if (typeof start.offset === \"number\") {\n let pos = this.fromOffset(start.offset);\n line = pos.line;\n column = pos.col;\n } else {\n line = start.line;\n column = start.column;\n }\n if (typeof end.offset === \"number\") {\n let pos = this.fromOffset(end.offset);\n endLine = pos.line;\n endColumn = pos.col;\n } else {\n endLine = end.line;\n endColumn = end.column;\n }\n } else if (!column) {\n let pos = this.fromOffset(line);\n line = pos.line;\n column = pos.col;\n }\n let origin = this.origin(line, column, endLine, endColumn);\n if (origin) {\n result2 = new CssSyntaxError$1(\n message,\n origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },\n origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },\n origin.source,\n origin.file,\n opts.plugin\n );\n } else {\n result2 = new CssSyntaxError$1(\n message,\n endLine === void 0 ? line : { column, line },\n endLine === void 0 ? column : { column: endColumn, line: endLine },\n this.css,\n this.file,\n opts.plugin\n );\n }\n result2.input = { column, endColumn, endLine, line, source: this.css };\n if (this.file) {\n if (pathToFileURL$1) {\n result2.input.url = pathToFileURL$1(this.file).toString();\n }\n result2.input.file = this.file;\n }\n return result2;\n }\n fromOffset(offset) {\n let lastLine, lineToIndex;\n if (!this[fromOffsetCache]) {\n let lines = this.css.split(\"\\n\");\n lineToIndex = new Array(lines.length);\n let prevIndex = 0;\n for (let i = 0, l = lines.length; i < l; i++) {\n lineToIndex[i] = prevIndex;\n prevIndex += lines[i].length + 1;\n }\n this[fromOffsetCache] = lineToIndex;\n } else {\n lineToIndex = this[fromOffsetCache];\n }\n lastLine = lineToIndex[lineToIndex.length - 1];\n let min = 0;\n if (offset >= lastLine) {\n min = lineToIndex.length - 1;\n } else {\n let max = lineToIndex.length - 2;\n let mid;\n while (min < max) {\n mid = min + (max - min >> 1);\n if (offset < lineToIndex[mid]) {\n max = mid - 1;\n } else if (offset >= lineToIndex[mid + 1]) {\n min = mid + 1;\n } else {\n min = mid;\n break;\n }\n }\n }\n return {\n col: offset - lineToIndex[min] + 1,\n line: min + 1\n };\n }\n mapResolve(file) {\n if (/^\\w+:\\/\\//.test(file)) {\n return file;\n }\n return resolve$1(this.map.consumer().sourceRoot || this.map.root || \".\", file);\n }\n origin(line, column, endLine, endColumn) {\n if (!this.map) return false;\n let consumer = this.map.consumer();\n let from = consumer.originalPositionFor({ column, line });\n if (!from.source) return false;\n let to;\n if (typeof endLine === \"number\") {\n to = consumer.originalPositionFor({ column: endColumn, line: endLine });\n }\n let fromUrl;\n if (isAbsolute(from.source)) {\n fromUrl = pathToFileURL$1(from.source);\n } else {\n fromUrl = new URL(\n from.source,\n this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)\n );\n }\n let result2 = {\n column: from.column,\n endColumn: to && to.column,\n endLine: to && to.line,\n line: from.line,\n url: fromUrl.toString()\n };\n if (fromUrl.protocol === \"file:\") {\n if (fileURLToPath) {\n result2.file = fileURLToPath(fromUrl);\n } else {\n throw new Error(`file: protocol is not available in this PostCSS build`);\n }\n }\n let source = consumer.sourceContentFor(from.source);\n if (source) result2.source = source;\n return result2;\n }\n toJSON() {\n let json = {};\n for (let name of [\"hasBOM\", \"css\", \"file\", \"id\"]) {\n if (this[name] != null) {\n json[name] = this[name];\n }\n }\n if (this.map) {\n json.map = { ...this.map };\n if (json.map.consumerCache) {\n json.map.consumerCache = void 0;\n }\n }\n return json;\n }\n get from() {\n return this.file || this.id;\n }\n};\nvar input = Input$4;\nInput$4.default = Input$4;\nif (terminalHighlight && terminalHighlight.registerInput) {\n terminalHighlight.registerInput(Input$4);\n}\nlet { SourceMapConsumer, SourceMapGenerator } = require$$2;\nlet { dirname, relative, resolve, sep } = require$$2;\nlet { pathToFileURL } = require$$2;\nlet Input$3 = input;\nlet sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);\nlet pathAvailable = Boolean(dirname && resolve && relative && sep);\nlet MapGenerator$2 = class MapGenerator {\n constructor(stringify2, root2, opts, cssString) {\n this.stringify = stringify2;\n this.mapOpts = opts.map || {};\n this.root = root2;\n this.opts = opts;\n this.css = cssString;\n this.originalCSS = cssString;\n this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;\n this.memoizedFileURLs = /* @__PURE__ */ new Map();\n this.memoizedPaths = /* @__PURE__ */ new Map();\n this.memoizedURLs = /* @__PURE__ */ new Map();\n }\n addAnnotation() {\n let content;\n if (this.isInline()) {\n content = \"data:application/json;base64,\" + this.toBase64(this.map.toString());\n } else if (typeof this.mapOpts.annotation === \"string\") {\n content = this.mapOpts.annotation;\n } else if (typeof this.mapOpts.annotation === \"function\") {\n content = this.mapOpts.annotation(this.opts.to, this.root);\n } else {\n content = this.outputFile() + \".map\";\n }\n let eol = \"\\n\";\n if (this.css.includes(\"\\r\\n\")) eol = \"\\r\\n\";\n this.css += eol + \"/*# sourceMappingURL=\" + content + \" */\";\n }\n applyPrevMaps() {\n for (let prev of this.previous()) {\n let from = this.toUrl(this.path(prev.file));\n let root2 = prev.root || dirname(prev.file);\n let map;\n if (this.mapOpts.sourcesContent === false) {\n map = new SourceMapConsumer(prev.text);\n if (map.sourcesContent) {\n map.sourcesContent = null;\n }\n } else {\n map = prev.consumer();\n }\n this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));\n }\n }\n clearAnnotation() {\n if (this.mapOpts.annotation === false) return;\n if (this.root) {\n let node2;\n for (let i = this.root.nodes.length - 1; i >= 0; i--) {\n node2 = this.root.nodes[i];\n if (node2.type !== \"comment\") continue;\n if (node2.text.indexOf(\"# sourceMappingURL=\") === 0) {\n this.root.removeChild(i);\n }\n }\n } else if (this.css) {\n this.css = this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm, \"\");\n }\n }\n generate() {\n this.clearAnnotation();\n if (pathAvailable && sourceMapAvailable && this.isMap()) {\n return this.generateMap();\n } else {\n let result2 = \"\";\n this.stringify(this.root, (i) => {\n result2 += i;\n });\n return [result2];\n }\n }\n generateMap() {\n if (this.root) {\n this.generateString();\n } else if (this.previous().length === 1) {\n let prev = this.previous()[0].consumer();\n prev.file = this.outputFile();\n this.map = SourceMapGenerator.fromSourceMap(prev, {\n ignoreInvalidMapping: true\n });\n } else {\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n this.map.addMapping({\n generated: { column: 0, line: 1 },\n original: { column: 0, line: 1 },\n source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : \"\"\n });\n }\n if (this.isSourcesContent()) this.setSourcesContent();\n if (this.root && this.previous().length > 0) this.applyPrevMaps();\n if (this.isAnnotation()) this.addAnnotation();\n if (this.isInline()) {\n return [this.css];\n } else {\n return [this.css, this.map];\n }\n }\n generateString() {\n this.css = \"\";\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n let line = 1;\n let column = 1;\n let noSource = \"\";\n let mapping = {\n generated: { column: 0, line: 0 },\n original: { column: 0, line: 0 },\n source: \"\"\n };\n let lines, last;\n this.stringify(this.root, (str, node2, type) => {\n this.css += str;\n if (node2 && type !== \"end\") {\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n if (node2.source && node2.source.start) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.start.line;\n mapping.original.column = node2.source.start.column - 1;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n this.map.addMapping(mapping);\n }\n }\n lines = str.match(/\\n/g);\n if (lines) {\n line += lines.length;\n last = str.lastIndexOf(\"\\n\");\n column = str.length - last;\n } else {\n column += str.length;\n }\n if (node2 && type !== \"start\") {\n let p = node2.parent || { raws: {} };\n let childless = node2.type === \"decl\" || node2.type === \"atrule\" && !node2.nodes;\n if (!childless || node2 !== p.last || p.raws.semicolon) {\n if (node2.source && node2.source.end) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.end.line;\n mapping.original.column = node2.source.end.column - 1;\n mapping.generated.line = line;\n mapping.generated.column = column - 2;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n this.map.addMapping(mapping);\n }\n }\n }\n });\n }\n isAnnotation() {\n if (this.isInline()) {\n return true;\n }\n if (typeof this.mapOpts.annotation !== \"undefined\") {\n return this.mapOpts.annotation;\n }\n if (this.previous().length) {\n return this.previous().some((i) => i.annotation);\n }\n return true;\n }\n isInline() {\n if (typeof this.mapOpts.inline !== \"undefined\") {\n return this.mapOpts.inline;\n }\n let annotation = this.mapOpts.annotation;\n if (typeof annotation !== \"undefined\" && annotation !== true) {\n return false;\n }\n if (this.previous().length) {\n return this.previous().some((i) => i.inline);\n }\n return true;\n }\n isMap() {\n if (typeof this.opts.map !== \"undefined\") {\n return !!this.opts.map;\n }\n return this.previous().length > 0;\n }\n isSourcesContent() {\n if (typeof this.mapOpts.sourcesContent !== \"undefined\") {\n return this.mapOpts.sourcesContent;\n }\n if (this.previous().length) {\n return this.previous().some((i) => i.withContent());\n }\n return true;\n }\n outputFile() {\n if (this.opts.to) {\n return this.path(this.opts.to);\n } else if (this.opts.from) {\n return this.path(this.opts.from);\n } else {\n return \"to.css\";\n }\n }\n path(file) {\n if (this.mapOpts.absolute) return file;\n if (file.charCodeAt(0) === 60) return file;\n if (/^\\w+:\\/\\//.test(file)) return file;\n let cached = this.memoizedPaths.get(file);\n if (cached) return cached;\n let from = this.opts.to ? dirname(this.opts.to) : \".\";\n if (typeof this.mapOpts.annotation === \"string\") {\n from = dirname(resolve(from, this.mapOpts.annotation));\n }\n let path = relative(from, file);\n this.memoizedPaths.set(file, path);\n return path;\n }\n previous() {\n if (!this.previousMaps) {\n this.previousMaps = [];\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source && node2.source.input.map) {\n let map = node2.source.input.map;\n if (!this.previousMaps.includes(map)) {\n this.previousMaps.push(map);\n }\n }\n });\n } else {\n let input2 = new Input$3(this.originalCSS, this.opts);\n if (input2.map) this.previousMaps.push(input2.map);\n }\n }\n return this.previousMaps;\n }\n setSourcesContent() {\n let already = {};\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source) {\n let from = node2.source.input.from;\n if (from && !already[from]) {\n already[from] = true;\n let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));\n this.map.setSourceContent(fromUrl, node2.source.input.css);\n }\n }\n });\n } else if (this.css) {\n let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : \"\";\n this.map.setSourceContent(from, this.css);\n }\n }\n sourcePath(node2) {\n if (this.mapOpts.from) {\n return this.toUrl(this.mapOpts.from);\n } else if (this.usesFileUrls) {\n return this.toFileUrl(node2.source.input.from);\n } else {\n return this.toUrl(this.path(node2.source.input.from));\n }\n }\n toBase64(str) {\n if (Buffer) {\n return Buffer.from(str).toString(\"base64\");\n } else {\n return window.btoa(unescape(encodeURIComponent(str)));\n }\n }\n toFileUrl(path) {\n let cached = this.memoizedFileURLs.get(path);\n if (cached) return cached;\n if (pathToFileURL) {\n let fileURL = pathToFileURL(path).toString();\n this.memoizedFileURLs.set(path, fileURL);\n return fileURL;\n } else {\n throw new Error(\n \"`map.absolute` option is not available in this PostCSS build\"\n );\n }\n }\n toUrl(path) {\n let cached = this.memoizedURLs.get(path);\n if (cached) return cached;\n if (sep === \"\\\\\") {\n path = path.replace(/\\\\/g, \"/\");\n }\n let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);\n this.memoizedURLs.set(path, url);\n return url;\n }\n};\nvar mapGenerator = MapGenerator$2;\nlet Node$2 = node;\nlet Comment$4 = class Comment extends Node$2 {\n constructor(defaults) {\n super(defaults);\n this.type = \"comment\";\n }\n};\nvar comment = Comment$4;\nComment$4.default = Comment$4;\nlet { isClean: isClean$1, my: my$1 } = symbols;\nlet Declaration$3 = declaration;\nlet Comment$3 = comment;\nlet Node$1 = node;\nlet parse$4, Rule$4, AtRule$4, Root$6;\nfunction cleanSource(nodes) {\n return nodes.map((i) => {\n if (i.nodes) i.nodes = cleanSource(i.nodes);\n delete i.source;\n return i;\n });\n}\nfunction markDirtyUp(node2) {\n node2[isClean$1] = false;\n if (node2.proxyOf.nodes) {\n for (let i of node2.proxyOf.nodes) {\n markDirtyUp(i);\n }\n }\n}\nlet Container$7 = class Container extends Node$1 {\n append(...children) {\n for (let child of children) {\n let nodes = this.normalize(child, this.last);\n for (let node2 of nodes) this.proxyOf.nodes.push(node2);\n }\n this.markDirty();\n return this;\n }\n cleanRaws(keepBetween) {\n super.cleanRaws(keepBetween);\n if (this.nodes) {\n for (let node2 of this.nodes) node2.cleanRaws(keepBetween);\n }\n }\n each(callback) {\n if (!this.proxyOf.nodes) return void 0;\n let iterator = this.getIterator();\n let index2, result2;\n while (this.indexes[iterator] < this.proxyOf.nodes.length) {\n index2 = this.indexes[iterator];\n result2 = callback(this.proxyOf.nodes[index2], index2);\n if (result2 === false) break;\n this.indexes[iterator] += 1;\n }\n delete this.indexes[iterator];\n return result2;\n }\n every(condition) {\n return this.nodes.every(condition);\n }\n getIterator() {\n if (!this.lastEach) this.lastEach = 0;\n if (!this.indexes) this.indexes = {};\n this.lastEach += 1;\n let iterator = this.lastEach;\n this.indexes[iterator] = 0;\n return iterator;\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === \"proxyOf\") {\n return node2;\n } else if (!node2[prop]) {\n return node2[prop];\n } else if (prop === \"each\" || typeof prop === \"string\" && prop.startsWith(\"walk\")) {\n return (...args) => {\n return node2[prop](\n ...args.map((i) => {\n if (typeof i === \"function\") {\n return (child, index2) => i(child.toProxy(), index2);\n } else {\n return i;\n }\n })\n );\n };\n } else if (prop === \"every\" || prop === \"some\") {\n return (cb) => {\n return node2[prop](\n (child, ...other) => cb(child.toProxy(), ...other)\n );\n };\n } else if (prop === \"root\") {\n return () => node2.root().toProxy();\n } else if (prop === \"nodes\") {\n return node2.nodes.map((i) => i.toProxy());\n } else if (prop === \"first\" || prop === \"last\") {\n return node2[prop].toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === \"name\" || prop === \"params\" || prop === \"selector\") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n index(child) {\n if (typeof child === \"number\") return child;\n if (child.proxyOf) child = child.proxyOf;\n return this.proxyOf.nodes.indexOf(child);\n }\n insertAfter(exist, add) {\n let existIndex = this.index(exist);\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex < index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n insertBefore(exist, add) {\n let existIndex = this.index(exist);\n let type = existIndex === 0 ? \"prepend\" : false;\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex <= index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n normalize(nodes, sample) {\n if (typeof nodes === \"string\") {\n nodes = cleanSource(parse$4(nodes).nodes);\n } else if (typeof nodes === \"undefined\") {\n nodes = [];\n } else if (Array.isArray(nodes)) {\n nodes = nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"ignore\");\n }\n } else if (nodes.type === \"root\" && this.type !== \"document\") {\n nodes = nodes.nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"ignore\");\n }\n } else if (nodes.type) {\n nodes = [nodes];\n } else if (nodes.prop) {\n if (typeof nodes.value === \"undefined\") {\n throw new Error(\"Value field is missed in node creation\");\n } else if (typeof nodes.value !== \"string\") {\n nodes.value = String(nodes.value);\n }\n nodes = [new Declaration$3(nodes)];\n } else if (nodes.selector) {\n nodes = [new Rule$4(nodes)];\n } else if (nodes.name) {\n nodes = [new AtRule$4(nodes)];\n } else if (nodes.text) {\n nodes = [new Comment$3(nodes)];\n } else {\n throw new Error(\"Unknown node type in node creation\");\n }\n let processed = nodes.map((i) => {\n if (!i[my$1]) Container.rebuild(i);\n i = i.proxyOf;\n if (i.parent) i.parent.removeChild(i);\n if (i[isClean$1]) markDirtyUp(i);\n if (typeof i.raws.before === \"undefined\") {\n if (sample && typeof sample.raws.before !== \"undefined\") {\n i.raws.before = sample.raws.before.replace(/\\S/g, \"\");\n }\n }\n i.parent = this.proxyOf;\n return i;\n });\n return processed;\n }\n prepend(...children) {\n children = children.reverse();\n for (let child of children) {\n let nodes = this.normalize(child, this.first, \"prepend\").reverse();\n for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);\n for (let id in this.indexes) {\n this.indexes[id] = this.indexes[id] + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n push(child) {\n child.parent = this;\n this.proxyOf.nodes.push(child);\n return this;\n }\n removeAll() {\n for (let node2 of this.proxyOf.nodes) node2.parent = void 0;\n this.proxyOf.nodes = [];\n this.markDirty();\n return this;\n }\n removeChild(child) {\n child = this.index(child);\n this.proxyOf.nodes[child].parent = void 0;\n this.proxyOf.nodes.splice(child, 1);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (index2 >= child) {\n this.indexes[id] = index2 - 1;\n }\n }\n this.markDirty();\n return this;\n }\n replaceValues(pattern, opts, callback) {\n if (!callback) {\n callback = opts;\n opts = {};\n }\n this.walkDecls((decl) => {\n if (opts.props && !opts.props.includes(decl.prop)) return;\n if (opts.fast && !decl.value.includes(opts.fast)) return;\n decl.value = decl.value.replace(pattern, callback);\n });\n this.markDirty();\n return this;\n }\n some(condition) {\n return this.nodes.some(condition);\n }\n walk(callback) {\n return this.each((child, i) => {\n let result2;\n try {\n result2 = callback(child, i);\n } catch (e) {\n throw child.addToError(e);\n }\n if (result2 !== false && child.walk) {\n result2 = child.walk(callback);\n }\n return result2;\n });\n }\n walkAtRules(name, callback) {\n if (!callback) {\n callback = name;\n return this.walk((child, i) => {\n if (child.type === \"atrule\") {\n return callback(child, i);\n }\n });\n }\n if (name instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && name.test(child.name)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && child.name === name) {\n return callback(child, i);\n }\n });\n }\n walkComments(callback) {\n return this.walk((child, i) => {\n if (child.type === \"comment\") {\n return callback(child, i);\n }\n });\n }\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop;\n return this.walk((child, i) => {\n if (child.type === \"decl\") {\n return callback(child, i);\n }\n });\n }\n if (prop instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"decl\" && prop.test(child.prop)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"decl\" && child.prop === prop) {\n return callback(child, i);\n }\n });\n }\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector;\n return this.walk((child, i) => {\n if (child.type === \"rule\") {\n return callback(child, i);\n }\n });\n }\n if (selector instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"rule\" && selector.test(child.selector)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"rule\" && child.selector === selector) {\n return callback(child, i);\n }\n });\n }\n get first() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[0];\n }\n get last() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];\n }\n};\nContainer$7.registerParse = (dependant) => {\n parse$4 = dependant;\n};\nContainer$7.registerRule = (dependant) => {\n Rule$4 = dependant;\n};\nContainer$7.registerAtRule = (dependant) => {\n AtRule$4 = dependant;\n};\nContainer$7.registerRoot = (dependant) => {\n Root$6 = dependant;\n};\nvar container = Container$7;\nContainer$7.default = Container$7;\nContainer$7.rebuild = (node2) => {\n if (node2.type === \"atrule\") {\n Object.setPrototypeOf(node2, AtRule$4.prototype);\n } else if (node2.type === \"rule\") {\n Object.setPrototypeOf(node2, Rule$4.prototype);\n } else if (node2.type === \"decl\") {\n Object.setPrototypeOf(node2, Declaration$3.prototype);\n } else if (node2.type === \"comment\") {\n Object.setPrototypeOf(node2, Comment$3.prototype);\n } else if (node2.type === \"root\") {\n Object.setPrototypeOf(node2, Root$6.prototype);\n }\n node2[my$1] = true;\n if (node2.nodes) {\n node2.nodes.forEach((child) => {\n Container$7.rebuild(child);\n });\n }\n};\nlet Container$6 = container;\nlet LazyResult$4, Processor$3;\nlet Document$3 = class Document2 extends Container$6 {\n constructor(defaults) {\n super({ type: \"document\", ...defaults });\n if (!this.nodes) {\n this.nodes = [];\n }\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$4(new Processor$3(), this, opts);\n return lazy.stringify();\n }\n};\nDocument$3.registerLazyResult = (dependant) => {\n LazyResult$4 = dependant;\n};\nDocument$3.registerProcessor = (dependant) => {\n Processor$3 = dependant;\n};\nvar document$1 = Document$3;\nDocument$3.default = Document$3;\nlet printed = {};\nvar warnOnce$2 = function warnOnce(message) {\n if (printed[message]) return;\n printed[message] = true;\n if (typeof console !== \"undefined\" && console.warn) {\n console.warn(message);\n }\n};\nlet Warning$2 = class Warning {\n constructor(text, opts = {}) {\n this.type = \"warning\";\n this.text = text;\n if (opts.node && opts.node.source) {\n let range = opts.node.rangeBy(opts);\n this.line = range.start.line;\n this.column = range.start.column;\n this.endLine = range.end.line;\n this.endColumn = range.end.column;\n }\n for (let opt in opts) this[opt] = opts[opt];\n }\n toString() {\n if (this.node) {\n return this.node.error(this.text, {\n index: this.index,\n plugin: this.plugin,\n word: this.word\n }).message;\n }\n if (this.plugin) {\n return this.plugin + \": \" + this.text;\n }\n return this.text;\n }\n};\nvar warning = Warning$2;\nWarning$2.default = Warning$2;\nlet Warning$1 = warning;\nlet Result$3 = class Result {\n constructor(processor2, root2, opts) {\n this.processor = processor2;\n this.messages = [];\n this.root = root2;\n this.opts = opts;\n this.css = void 0;\n this.map = void 0;\n }\n toString() {\n return this.css;\n }\n warn(text, opts = {}) {\n if (!opts.plugin) {\n if (this.lastPlugin && this.lastPlugin.postcssPlugin) {\n opts.plugin = this.lastPlugin.postcssPlugin;\n }\n }\n let warning2 = new Warning$1(text, opts);\n this.messages.push(warning2);\n return warning2;\n }\n warnings() {\n return this.messages.filter((i) => i.type === \"warning\");\n }\n get content() {\n return this.css;\n }\n};\nvar result = Result$3;\nResult$3.default = Result$3;\nconst SINGLE_QUOTE = \"'\".charCodeAt(0);\nconst DOUBLE_QUOTE = '\"'.charCodeAt(0);\nconst BACKSLASH = \"\\\\\".charCodeAt(0);\nconst SLASH = \"/\".charCodeAt(0);\nconst NEWLINE = \"\\n\".charCodeAt(0);\nconst SPACE = \" \".charCodeAt(0);\nconst FEED = \"\\f\".charCodeAt(0);\nconst TAB = \"\t\".charCodeAt(0);\nconst CR = \"\\r\".charCodeAt(0);\nconst OPEN_SQUARE = \"[\".charCodeAt(0);\nconst CLOSE_SQUARE = \"]\".charCodeAt(0);\nconst OPEN_PARENTHESES = \"(\".charCodeAt(0);\nconst CLOSE_PARENTHESES = \")\".charCodeAt(0);\nconst OPEN_CURLY = \"{\".charCodeAt(0);\nconst CLOSE_CURLY = \"}\".charCodeAt(0);\nconst SEMICOLON = \";\".charCodeAt(0);\nconst ASTERISK = \"*\".charCodeAt(0);\nconst COLON = \":\".charCodeAt(0);\nconst AT = \"@\".charCodeAt(0);\nconst RE_AT_END = /[\\t\\n\\f\\r \"#'()/;[\\\\\\]{}]/g;\nconst RE_WORD_END = /[\\t\\n\\f\\r !\"#'():;@[\\\\\\]{}]|\\/(?=\\*)/g;\nconst RE_BAD_BRACKET = /.[\\r\\n\"'(/\\\\]/;\nconst RE_HEX_ESCAPE = /[\\da-f]/i;\nvar tokenize = function tokenizer(input2, options = {}) {\n let css = input2.css.valueOf();\n let ignore = options.ignoreErrors;\n let code, next, quote, content, escape;\n let escaped, escapePos, prev, n, currentToken;\n let length = css.length;\n let pos = 0;\n let buffer = [];\n let returned = [];\n function position() {\n return pos;\n }\n function unclosed(what) {\n throw input2.error(\"Unclosed \" + what, pos);\n }\n function endOfFile() {\n return returned.length === 0 && pos >= length;\n }\n function nextToken(opts) {\n if (returned.length) return returned.pop();\n if (pos >= length) return;\n let ignoreUnclosed = opts ? opts.ignoreUnclosed : false;\n code = css.charCodeAt(pos);\n switch (code) {\n case NEWLINE:\n case SPACE:\n case TAB:\n case CR:\n case FEED: {\n next = pos;\n do {\n next += 1;\n code = css.charCodeAt(next);\n } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);\n currentToken = [\"space\", css.slice(pos, next)];\n pos = next - 1;\n break;\n }\n case OPEN_SQUARE:\n case CLOSE_SQUARE:\n case OPEN_CURLY:\n case CLOSE_CURLY:\n case COLON:\n case SEMICOLON:\n case CLOSE_PARENTHESES: {\n let controlChar = String.fromCharCode(code);\n currentToken = [controlChar, controlChar, pos];\n break;\n }\n case OPEN_PARENTHESES: {\n prev = buffer.length ? buffer.pop()[1] : \"\";\n n = css.charCodeAt(pos + 1);\n if (prev === \"url\" && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(\")\", next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos;\n break;\n } else {\n unclosed(\"bracket\");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = [\"brackets\", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n next = css.indexOf(\")\", pos + 1);\n content = css.slice(pos, next + 1);\n if (next === -1 || RE_BAD_BRACKET.test(content)) {\n currentToken = [\"(\", \"(\", pos];\n } else {\n currentToken = [\"brackets\", content, pos, next];\n pos = next;\n }\n }\n break;\n }\n case SINGLE_QUOTE:\n case DOUBLE_QUOTE: {\n quote = code === SINGLE_QUOTE ? \"'\" : '\"';\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(quote, next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos + 1;\n break;\n } else {\n unclosed(\"string\");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = [\"string\", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case AT: {\n RE_AT_END.lastIndex = pos + 1;\n RE_AT_END.test(css);\n if (RE_AT_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_AT_END.lastIndex - 2;\n }\n currentToken = [\"at-word\", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case BACKSLASH: {\n next = pos;\n escape = true;\n while (css.charCodeAt(next + 1) === BACKSLASH) {\n next += 1;\n escape = !escape;\n }\n code = css.charCodeAt(next + 1);\n if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {\n next += 1;\n if (RE_HEX_ESCAPE.test(css.charAt(next))) {\n while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {\n next += 1;\n }\n if (css.charCodeAt(next + 1) === SPACE) {\n next += 1;\n }\n }\n }\n currentToken = [\"word\", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n default: {\n if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {\n next = css.indexOf(\"*/\", pos + 2) + 1;\n if (next === 0) {\n if (ignore || ignoreUnclosed) {\n next = css.length;\n } else {\n unclosed(\"comment\");\n }\n }\n currentToken = [\"comment\", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n RE_WORD_END.lastIndex = pos + 1;\n RE_WORD_END.test(css);\n if (RE_WORD_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_WORD_END.lastIndex - 2;\n }\n currentToken = [\"word\", css.slice(pos, next + 1), pos, next];\n buffer.push(currentToken);\n pos = next;\n }\n break;\n }\n }\n pos++;\n return currentToken;\n }\n function back(token) {\n returned.push(token);\n }\n return {\n back,\n endOfFile,\n nextToken,\n position\n };\n};\nlet Container$5 = container;\nlet AtRule$3 = class AtRule extends Container$5 {\n constructor(defaults) {\n super(defaults);\n this.type = \"atrule\";\n }\n append(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.append(...children);\n }\n prepend(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.prepend(...children);\n }\n};\nvar atRule = AtRule$3;\nAtRule$3.default = AtRule$3;\nContainer$5.registerAtRule(AtRule$3);\nlet Container$4 = container;\nlet LazyResult$3, Processor$2;\nlet Root$5 = class Root extends Container$4 {\n constructor(defaults) {\n super(defaults);\n this.type = \"root\";\n if (!this.nodes) this.nodes = [];\n }\n normalize(child, sample, type) {\n let nodes = super.normalize(child);\n if (sample) {\n if (type === \"prepend\") {\n if (this.nodes.length > 1) {\n sample.raws.before = this.nodes[1].raws.before;\n } else {\n delete sample.raws.before;\n }\n } else if (this.first !== sample) {\n for (let node2 of nodes) {\n node2.raws.before = sample.raws.before;\n }\n }\n }\n return nodes;\n }\n removeChild(child, ignore) {\n let index2 = this.index(child);\n if (!ignore && index2 === 0 && this.nodes.length > 1) {\n this.nodes[1].raws.before = this.nodes[index2].raws.before;\n }\n return super.removeChild(child);\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$3(new Processor$2(), this, opts);\n return lazy.stringify();\n }\n};\nRoot$5.registerLazyResult = (dependant) => {\n LazyResult$3 = dependant;\n};\nRoot$5.registerProcessor = (dependant) => {\n Processor$2 = dependant;\n};\nvar root = Root$5;\nRoot$5.default = Root$5;\nContainer$4.registerRoot(Root$5);\nlet list$2 = {\n comma(string) {\n return list$2.split(string, [\",\"], true);\n },\n space(string) {\n let spaces = [\" \", \"\\n\", \"\t\"];\n return list$2.split(string, spaces);\n },\n split(string, separators, last) {\n let array = [];\n let current = \"\";\n let split = false;\n let func = 0;\n let inQuote = false;\n let prevQuote = \"\";\n let escape = false;\n for (let letter of string) {\n if (escape) {\n escape = false;\n } else if (letter === \"\\\\\") {\n escape = true;\n } else if (inQuote) {\n if (letter === prevQuote) {\n inQuote = false;\n }\n } else if (letter === '\"' || letter === \"'\") {\n inQuote = true;\n prevQuote = letter;\n } else if (letter === \"(\") {\n func += 1;\n } else if (letter === \")\") {\n if (func > 0) func -= 1;\n } else if (func === 0) {\n if (separators.includes(letter)) split = true;\n }\n if (split) {\n if (current !== \"\") array.push(current.trim());\n current = \"\";\n split = false;\n } else {\n current += letter;\n }\n }\n if (last || current !== \"\") array.push(current.trim());\n return array;\n }\n};\nvar list_1 = list$2;\nlist$2.default = list$2;\nlet Container$3 = container;\nlet list$1 = list_1;\nlet Rule$3 = class Rule extends Container$3 {\n constructor(defaults) {\n super(defaults);\n this.type = \"rule\";\n if (!this.nodes) this.nodes = [];\n }\n get selectors() {\n return list$1.comma(this.selector);\n }\n set selectors(values) {\n let match = this.selector ? this.selector.match(/,\\s*/) : null;\n let sep2 = match ? match[0] : \",\" + this.raw(\"between\", \"beforeOpen\");\n this.selector = values.join(sep2);\n }\n};\nvar rule = Rule$3;\nRule$3.default = Rule$3;\nContainer$3.registerRule(Rule$3);\nlet Declaration$2 = declaration;\nlet tokenizer2 = tokenize;\nlet Comment$2 = comment;\nlet AtRule$2 = atRule;\nlet Root$4 = root;\nlet Rule$2 = rule;\nconst SAFE_COMMENT_NEIGHBOR = {\n empty: true,\n space: true\n};\nfunction findLastWithPosition(tokens) {\n for (let i = tokens.length - 1; i >= 0; i--) {\n let token = tokens[i];\n let pos = token[3] || token[2];\n if (pos) return pos;\n }\n}\nlet Parser$1 = class Parser {\n constructor(input2) {\n this.input = input2;\n this.root = new Root$4();\n this.current = this.root;\n this.spaces = \"\";\n this.semicolon = false;\n this.createTokenizer();\n this.root.source = { input: input2, start: { column: 1, line: 1, offset: 0 } };\n }\n atrule(token) {\n let node2 = new AtRule$2();\n node2.name = token[1].slice(1);\n if (node2.name === \"\") {\n this.unnamedAtrule(node2, token);\n }\n this.init(node2, token[2]);\n let type;\n let prev;\n let shift;\n let last = false;\n let open = false;\n let params = [];\n let brackets = [];\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n type = token[0];\n if (type === \"(\" || type === \"[\") {\n brackets.push(type === \"(\" ? \")\" : \"]\");\n } else if (type === \"{\" && brackets.length > 0) {\n brackets.push(\"}\");\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n }\n if (brackets.length === 0) {\n if (type === \";\") {\n node2.source.end = this.getPosition(token[2]);\n node2.source.end.offset++;\n this.semicolon = true;\n break;\n } else if (type === \"{\") {\n open = true;\n break;\n } else if (type === \"}\") {\n if (params.length > 0) {\n shift = params.length - 1;\n prev = params[shift];\n while (prev && prev[0] === \"space\") {\n prev = params[--shift];\n }\n if (prev) {\n node2.source.end = this.getPosition(prev[3] || prev[2]);\n node2.source.end.offset++;\n }\n }\n this.end(token);\n break;\n } else {\n params.push(token);\n }\n } else {\n params.push(token);\n }\n if (this.tokenizer.endOfFile()) {\n last = true;\n break;\n }\n }\n node2.raws.between = this.spacesAndCommentsFromEnd(params);\n if (params.length) {\n node2.raws.afterName = this.spacesAndCommentsFromStart(params);\n this.raw(node2, \"params\", params);\n if (last) {\n token = params[params.length - 1];\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n this.spaces = node2.raws.between;\n node2.raws.between = \"\";\n }\n } else {\n node2.raws.afterName = \"\";\n node2.params = \"\";\n }\n if (open) {\n node2.nodes = [];\n this.current = node2;\n }\n }\n checkMissedSemicolon(tokens) {\n let colon = this.colon(tokens);\n if (colon === false) return;\n let founded = 0;\n let token;\n for (let j = colon - 1; j >= 0; j--) {\n token = tokens[j];\n if (token[0] !== \"space\") {\n founded += 1;\n if (founded === 2) break;\n }\n }\n throw this.input.error(\n \"Missed semicolon\",\n token[0] === \"word\" ? token[3] + 1 : token[2]\n );\n }\n colon(tokens) {\n let brackets = 0;\n let token, type, prev;\n for (let [i, element] of tokens.entries()) {\n token = element;\n type = token[0];\n if (type === \"(\") {\n brackets += 1;\n }\n if (type === \")\") {\n brackets -= 1;\n }\n if (brackets === 0 && type === \":\") {\n if (!prev) {\n this.doubleColon(token);\n } else if (prev[0] === \"word\" && prev[1] === \"progid\") {\n continue;\n } else {\n return i;\n }\n }\n prev = token;\n }\n return false;\n }\n comment(token) {\n let node2 = new Comment$2();\n this.init(node2, token[2]);\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n let text = token[1].slice(2, -2);\n if (/^\\s*$/.test(text)) {\n node2.text = \"\";\n node2.raws.left = text;\n node2.raws.right = \"\";\n } else {\n let match = text.match(/^(\\s*)([^]*\\S)(\\s*)$/);\n node2.text = match[2];\n node2.raws.left = match[1];\n node2.raws.right = match[3];\n }\n }\n createTokenizer() {\n this.tokenizer = tokenizer2(this.input);\n }\n decl(tokens, customProperty) {\n let node2 = new Declaration$2();\n this.init(node2, tokens[0][2]);\n let last = tokens[tokens.length - 1];\n if (last[0] === \";\") {\n this.semicolon = true;\n tokens.pop();\n }\n node2.source.end = this.getPosition(\n last[3] || last[2] || findLastWithPosition(tokens)\n );\n node2.source.end.offset++;\n while (tokens[0][0] !== \"word\") {\n if (tokens.length === 1) this.unknownWord(tokens);\n node2.raws.before += tokens.shift()[1];\n }\n node2.source.start = this.getPosition(tokens[0][2]);\n node2.prop = \"\";\n while (tokens.length) {\n let type = tokens[0][0];\n if (type === \":\" || type === \"space\" || type === \"comment\") {\n break;\n }\n node2.prop += tokens.shift()[1];\n }\n node2.raws.between = \"\";\n let token;\n while (tokens.length) {\n token = tokens.shift();\n if (token[0] === \":\") {\n node2.raws.between += token[1];\n break;\n } else {\n if (token[0] === \"word\" && /\\w/.test(token[1])) {\n this.unknownWord([token]);\n }\n node2.raws.between += token[1];\n }\n }\n if (node2.prop[0] === \"_\" || node2.prop[0] === \"*\") {\n node2.raws.before += node2.prop[0];\n node2.prop = node2.prop.slice(1);\n }\n let firstSpaces = [];\n let next;\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== \"space\" && next !== \"comment\") break;\n firstSpaces.push(tokens.shift());\n }\n this.precheckMissedSemicolon(tokens);\n for (let i = tokens.length - 1; i >= 0; i--) {\n token = tokens[i];\n if (token[1].toLowerCase() === \"!important\") {\n node2.important = true;\n let string = this.stringFrom(tokens, i);\n string = this.spacesFromEnd(tokens) + string;\n if (string !== \" !important\") node2.raws.important = string;\n break;\n } else if (token[1].toLowerCase() === \"important\") {\n let cache = tokens.slice(0);\n let str = \"\";\n for (let j = i; j > 0; j--) {\n let type = cache[j][0];\n if (str.trim().indexOf(\"!\") === 0 && type !== \"space\") {\n break;\n }\n str = cache.pop()[1] + str;\n }\n if (str.trim().indexOf(\"!\") === 0) {\n node2.important = true;\n node2.raws.important = str;\n tokens = cache;\n }\n }\n if (token[0] !== \"space\" && token[0] !== \"comment\") {\n break;\n }\n }\n let hasWord = tokens.some((i) => i[0] !== \"space\" && i[0] !== \"comment\");\n if (hasWord) {\n node2.raws.between += firstSpaces.map((i) => i[1]).join(\"\");\n firstSpaces = [];\n }\n this.raw(node2, \"value\", firstSpaces.concat(tokens), customProperty);\n if (node2.value.includes(\":\") && !customProperty) {\n this.checkMissedSemicolon(tokens);\n }\n }\n doubleColon(token) {\n throw this.input.error(\n \"Double colon\",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n emptyRule(token) {\n let node2 = new Rule$2();\n this.init(node2, token[2]);\n node2.selector = \"\";\n node2.raws.between = \"\";\n this.current = node2;\n }\n end(token) {\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.semicolon = false;\n this.current.raws.after = (this.current.raws.after || \"\") + this.spaces;\n this.spaces = \"\";\n if (this.current.parent) {\n this.current.source.end = this.getPosition(token[2]);\n this.current.source.end.offset++;\n this.current = this.current.parent;\n } else {\n this.unexpectedClose(token);\n }\n }\n endFile() {\n if (this.current.parent) this.unclosedBlock();\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.current.raws.after = (this.current.raws.after || \"\") + this.spaces;\n this.root.source.end = this.getPosition(this.tokenizer.position());\n }\n freeSemicolon(token) {\n this.spaces += token[1];\n if (this.current.nodes) {\n let prev = this.current.nodes[this.current.nodes.length - 1];\n if (prev && prev.type === \"rule\" && !prev.raws.ownSemicolon) {\n prev.raws.ownSemicolon = this.spaces;\n this.spaces = \"\";\n }\n }\n }\n // Helpers\n getPosition(offset) {\n let pos = this.input.fromOffset(offset);\n return {\n column: pos.col,\n line: pos.line,\n offset\n };\n }\n init(node2, offset) {\n this.current.push(node2);\n node2.source = {\n input: this.input,\n start: this.getPosition(offset)\n };\n node2.raws.before = this.spaces;\n this.spaces = \"\";\n if (node2.type !== \"comment\") this.semicolon = false;\n }\n other(start) {\n let end = false;\n let type = null;\n let colon = false;\n let bracket = null;\n let brackets = [];\n let customProperty = start[1].startsWith(\"--\");\n let tokens = [];\n let token = start;\n while (token) {\n type = token[0];\n tokens.push(token);\n if (type === \"(\" || type === \"[\") {\n if (!bracket) bracket = token;\n brackets.push(type === \"(\" ? \")\" : \"]\");\n } else if (customProperty && colon && type === \"{\") {\n if (!bracket) bracket = token;\n brackets.push(\"}\");\n } else if (brackets.length === 0) {\n if (type === \";\") {\n if (colon) {\n this.decl(tokens, customProperty);\n return;\n } else {\n break;\n }\n } else if (type === \"{\") {\n this.rule(tokens);\n return;\n } else if (type === \"}\") {\n this.tokenizer.back(tokens.pop());\n end = true;\n break;\n } else if (type === \":\") {\n colon = true;\n }\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n if (brackets.length === 0) bracket = null;\n }\n token = this.tokenizer.nextToken();\n }\n if (this.tokenizer.endOfFile()) end = true;\n if (brackets.length > 0) this.unclosedBracket(bracket);\n if (end && colon) {\n if (!customProperty) {\n while (tokens.length) {\n token = tokens[tokens.length - 1][0];\n if (token !== \"space\" && token !== \"comment\") break;\n this.tokenizer.back(tokens.pop());\n }\n }\n this.decl(tokens, customProperty);\n } else {\n this.unknownWord(tokens);\n }\n }\n parse() {\n let token;\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n switch (token[0]) {\n case \"space\":\n this.spaces += token[1];\n break;\n case \";\":\n this.freeSemicolon(token);\n break;\n case \"}\":\n this.end(token);\n break;\n case \"comment\":\n this.comment(token);\n break;\n case \"at-word\":\n this.atrule(token);\n break;\n case \"{\":\n this.emptyRule(token);\n break;\n default:\n this.other(token);\n break;\n }\n }\n this.endFile();\n }\n precheckMissedSemicolon() {\n }\n raw(node2, prop, tokens, customProperty) {\n let token, type;\n let length = tokens.length;\n let value = \"\";\n let clean = true;\n let next, prev;\n for (let i = 0; i < length; i += 1) {\n token = tokens[i];\n type = token[0];\n if (type === \"space\" && i === length - 1 && !customProperty) {\n clean = false;\n } else if (type === \"comment\") {\n prev = tokens[i - 1] ? tokens[i - 1][0] : \"empty\";\n next = tokens[i + 1] ? tokens[i + 1][0] : \"empty\";\n if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {\n if (value.slice(-1) === \",\") {\n clean = false;\n } else {\n value += token[1];\n }\n } else {\n clean = false;\n }\n } else {\n value += token[1];\n }\n }\n if (!clean) {\n let raw = tokens.reduce((all, i) => all + i[1], \"\");\n node2.raws[prop] = { raw, value };\n }\n node2[prop] = value;\n }\n rule(tokens) {\n tokens.pop();\n let node2 = new Rule$2();\n this.init(node2, tokens[0][2]);\n node2.raws.between = this.spacesAndCommentsFromEnd(tokens);\n this.raw(node2, \"selector\", tokens);\n this.current = node2;\n }\n spacesAndCommentsFromEnd(tokens) {\n let lastTokenType;\n let spaces = \"\";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== \"space\" && lastTokenType !== \"comment\") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n // Errors\n spacesAndCommentsFromStart(tokens) {\n let next;\n let spaces = \"\";\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== \"space\" && next !== \"comment\") break;\n spaces += tokens.shift()[1];\n }\n return spaces;\n }\n spacesFromEnd(tokens) {\n let lastTokenType;\n let spaces = \"\";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== \"space\") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n stringFrom(tokens, from) {\n let result2 = \"\";\n for (let i = from; i < tokens.length; i++) {\n result2 += tokens[i][1];\n }\n tokens.splice(from, tokens.length - from);\n return result2;\n }\n unclosedBlock() {\n let pos = this.current.source.start;\n throw this.input.error(\"Unclosed block\", pos.line, pos.column);\n }\n unclosedBracket(bracket) {\n throw this.input.error(\n \"Unclosed bracket\",\n { offset: bracket[2] },\n { offset: bracket[2] + 1 }\n );\n }\n unexpectedClose(token) {\n throw this.input.error(\n \"Unexpected }\",\n { offset: token[2] },\n { offset: token[2] + 1 }\n );\n }\n unknownWord(tokens) {\n throw this.input.error(\n \"Unknown word\",\n { offset: tokens[0][2] },\n { offset: tokens[0][2] + tokens[0][1].length }\n );\n }\n unnamedAtrule(node2, token) {\n throw this.input.error(\n \"At-rule without name\",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n};\nvar parser = Parser$1;\nlet Container$2 = container;\nlet Parser2 = parser;\nlet Input$2 = input;\nfunction parse$3(css, opts) {\n let input2 = new Input$2(css, opts);\n let parser2 = new Parser2(input2);\n try {\n parser2.parse();\n } catch (e) {\n if (process.env.NODE_ENV !== \"production\") {\n if (e.name === \"CssSyntaxError\" && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e.message += \"\\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser\";\n } else if (/\\.sass/i.test(opts.from)) {\n e.message += \"\\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser\";\n } else if (/\\.less$/i.test(opts.from)) {\n e.message += \"\\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser\";\n }\n }\n }\n throw e;\n }\n return parser2.root;\n}\nvar parse_1 = parse$3;\nparse$3.default = parse$3;\nContainer$2.registerParse(parse$3);\nlet { isClean, my } = symbols;\nlet MapGenerator$1 = mapGenerator;\nlet stringify$2 = stringify_1;\nlet Container$1 = container;\nlet Document$2 = document$1;\nlet warnOnce$1 = warnOnce$2;\nlet Result$2 = result;\nlet parse$2 = parse_1;\nlet Root$3 = root;\nconst TYPE_TO_CLASS_NAME = {\n atrule: \"AtRule\",\n comment: \"Comment\",\n decl: \"Declaration\",\n document: \"Document\",\n root: \"Root\",\n rule: \"Rule\"\n};\nconst PLUGIN_PROPS = {\n AtRule: true,\n AtRuleExit: true,\n Comment: true,\n CommentExit: true,\n Declaration: true,\n DeclarationExit: true,\n Document: true,\n DocumentExit: true,\n Once: true,\n OnceExit: true,\n postcssPlugin: true,\n prepare: true,\n Root: true,\n RootExit: true,\n Rule: true,\n RuleExit: true\n};\nconst NOT_VISITORS = {\n Once: true,\n postcssPlugin: true,\n prepare: true\n};\nconst CHILDREN = 0;\nfunction isPromise(obj) {\n return typeof obj === \"object\" && typeof obj.then === \"function\";\n}\nfunction getEvents(node2) {\n let key = false;\n let type = TYPE_TO_CLASS_NAME[node2.type];\n if (node2.type === \"decl\") {\n key = node2.prop.toLowerCase();\n } else if (node2.type === \"atrule\") {\n key = node2.name.toLowerCase();\n }\n if (key && node2.append) {\n return [\n type,\n type + \"-\" + key,\n CHILDREN,\n type + \"Exit\",\n type + \"Exit-\" + key\n ];\n } else if (key) {\n return [type, type + \"-\" + key, type + \"Exit\", type + \"Exit-\" + key];\n } else if (node2.append) {\n return [type, CHILDREN, type + \"Exit\"];\n } else {\n return [type, type + \"Exit\"];\n }\n}\nfunction toStack(node2) {\n let events;\n if (node2.type === \"document\") {\n events = [\"Document\", CHILDREN, \"DocumentExit\"];\n } else if (node2.type === \"root\") {\n events = [\"Root\", CHILDREN, \"RootExit\"];\n } else {\n events = getEvents(node2);\n }\n return {\n eventIndex: 0,\n events,\n iterator: 0,\n node: node2,\n visitorIndex: 0,\n visitors: []\n };\n}\nfunction cleanMarks(node2) {\n node2[isClean] = false;\n if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));\n return node2;\n}\nlet postcss$2 = {};\nlet LazyResult$2 = class LazyResult {\n constructor(processor2, css, opts) {\n this.stringified = false;\n this.processed = false;\n let root2;\n if (typeof css === \"object\" && css !== null && (css.type === \"root\" || css.type === \"document\")) {\n root2 = cleanMarks(css);\n } else if (css instanceof LazyResult || css instanceof Result$2) {\n root2 = cleanMarks(css.root);\n if (css.map) {\n if (typeof opts.map === \"undefined\") opts.map = {};\n if (!opts.map.inline) opts.map.inline = false;\n opts.map.prev = css.map;\n }\n } else {\n let parser2 = parse$2;\n if (opts.syntax) parser2 = opts.syntax.parse;\n if (opts.parser) parser2 = opts.parser;\n if (parser2.parse) parser2 = parser2.parse;\n try {\n root2 = parser2(css, opts);\n } catch (error) {\n this.processed = true;\n this.error = error;\n }\n if (root2 && !root2[my]) {\n Container$1.rebuild(root2);\n }\n }\n this.result = new Result$2(processor2, root2, opts);\n this.helpers = { ...postcss$2, postcss: postcss$2, result: this.result };\n this.plugins = this.processor.plugins.map((plugin2) => {\n if (typeof plugin2 === \"object\" && plugin2.prepare) {\n return { ...plugin2, ...plugin2.prepare(this.result) };\n } else {\n return plugin2;\n }\n });\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n if (this.processed) return Promise.resolve(this.result);\n if (!this.processing) {\n this.processing = this.runAsync();\n }\n return this.processing;\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n getAsyncError() {\n throw new Error(\"Use process(css).then(cb) to work with async plugins\");\n }\n handleError(error, node2) {\n let plugin2 = this.result.lastPlugin;\n try {\n if (node2) node2.addToError(error);\n this.error = error;\n if (error.name === \"CssSyntaxError\" && !error.plugin) {\n error.plugin = plugin2.postcssPlugin;\n error.setMessage();\n } else if (plugin2.postcssVersion) {\n if (process.env.NODE_ENV !== \"production\") {\n let pluginName = plugin2.postcssPlugin;\n let pluginVer = plugin2.postcssVersion;\n let runtimeVer = this.result.processor.version;\n let a = pluginVer.split(\".\");\n let b = runtimeVer.split(\".\");\n if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {\n console.error(\n \"Unknown error from PostCSS plugin. Your current PostCSS version is \" + runtimeVer + \", but \" + pluginName + \" uses \" + pluginVer + \". Perhaps this is the source of the error below.\"\n );\n }\n }\n }\n } catch (err) {\n if (console && console.error) console.error(err);\n }\n return error;\n }\n prepareVisitors() {\n this.listeners = {};\n let add = (plugin2, type, cb) => {\n if (!this.listeners[type]) this.listeners[type] = [];\n this.listeners[type].push([plugin2, cb]);\n };\n for (let plugin2 of this.plugins) {\n if (typeof plugin2 === \"object\") {\n for (let event in plugin2) {\n if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {\n throw new Error(\n `Unknown event ${event} in ${plugin2.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`\n );\n }\n if (!NOT_VISITORS[event]) {\n if (typeof plugin2[event] === \"object\") {\n for (let filter in plugin2[event]) {\n if (filter === \"*\") {\n add(plugin2, event, plugin2[event][filter]);\n } else {\n add(\n plugin2,\n event + \"-\" + filter.toLowerCase(),\n plugin2[event][filter]\n );\n }\n }\n } else if (typeof plugin2[event] === \"function\") {\n add(plugin2, event, plugin2[event]);\n }\n }\n }\n }\n }\n this.hasListener = Object.keys(this.listeners).length > 0;\n }\n async runAsync() {\n this.plugin = 0;\n for (let i = 0; i < this.plugins.length; i++) {\n let plugin2 = this.plugins[i];\n let promise = this.runOnRoot(plugin2);\n if (isPromise(promise)) {\n try {\n await promise;\n } catch (error) {\n throw this.handleError(error);\n }\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean]) {\n root2[isClean] = true;\n let stack = [toStack(root2)];\n while (stack.length > 0) {\n let promise = this.visitTick(stack);\n if (isPromise(promise)) {\n try {\n await promise;\n } catch (e) {\n let node2 = stack[stack.length - 1].node;\n throw this.handleError(e, node2);\n }\n }\n }\n }\n if (this.listeners.OnceExit) {\n for (let [plugin2, visitor] of this.listeners.OnceExit) {\n this.result.lastPlugin = plugin2;\n try {\n if (root2.type === \"document\") {\n let roots = root2.nodes.map(\n (subRoot) => visitor(subRoot, this.helpers)\n );\n await Promise.all(roots);\n } else {\n await visitor(root2, this.helpers);\n }\n } catch (e) {\n throw this.handleError(e);\n }\n }\n }\n }\n this.processed = true;\n return this.stringify();\n }\n runOnRoot(plugin2) {\n this.result.lastPlugin = plugin2;\n try {\n if (typeof plugin2 === \"object\" && plugin2.Once) {\n if (this.result.root.type === \"document\") {\n let roots = this.result.root.nodes.map(\n (root2) => plugin2.Once(root2, this.helpers)\n );\n if (isPromise(roots[0])) {\n return Promise.all(roots);\n }\n return roots;\n }\n return plugin2.Once(this.result.root, this.helpers);\n } else if (typeof plugin2 === \"function\") {\n return plugin2(this.result.root, this.result);\n }\n } catch (error) {\n throw this.handleError(error);\n }\n }\n stringify() {\n if (this.error) throw this.error;\n if (this.stringified) return this.result;\n this.stringified = true;\n this.sync();\n let opts = this.result.opts;\n let str = stringify$2;\n if (opts.syntax) str = opts.syntax.stringify;\n if (opts.stringifier) str = opts.stringifier;\n if (str.stringify) str = str.stringify;\n let map = new MapGenerator$1(str, this.result.root, this.result.opts);\n let data = map.generate();\n this.result.css = data[0];\n this.result.map = data[1];\n return this.result;\n }\n sync() {\n if (this.error) throw this.error;\n if (this.processed) return this.result;\n this.processed = true;\n if (this.processing) {\n throw this.getAsyncError();\n }\n for (let plugin2 of this.plugins) {\n let promise = this.runOnRoot(plugin2);\n if (isPromise(promise)) {\n throw this.getAsyncError();\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean]) {\n root2[isClean] = true;\n this.walkSync(root2);\n }\n if (this.listeners.OnceExit) {\n if (root2.type === \"document\") {\n for (let subRoot of root2.nodes) {\n this.visitSync(this.listeners.OnceExit, subRoot);\n }\n } else {\n this.visitSync(this.listeners.OnceExit, root2);\n }\n }\n }\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this.opts)) {\n warnOnce$1(\n \"Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.\"\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this.css;\n }\n visitSync(visitors, node2) {\n for (let [plugin2, visitor] of visitors) {\n this.result.lastPlugin = plugin2;\n let promise;\n try {\n promise = visitor(node2, this.helpers);\n } catch (e) {\n throw this.handleError(e, node2.proxyOf);\n }\n if (node2.type !== \"root\" && node2.type !== \"document\" && !node2.parent) {\n return true;\n }\n if (isPromise(promise)) {\n throw this.getAsyncError();\n }\n }\n }\n visitTick(stack) {\n let visit2 = stack[stack.length - 1];\n let { node: node2, visitors } = visit2;\n if (node2.type !== \"root\" && node2.type !== \"document\" && !node2.parent) {\n stack.pop();\n return;\n }\n if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {\n let [plugin2, visitor] = visitors[visit2.visitorIndex];\n visit2.visitorIndex += 1;\n if (visit2.visitorIndex === visitors.length) {\n visit2.visitors = [];\n visit2.visitorIndex = 0;\n }\n this.result.lastPlugin = plugin2;\n try {\n return visitor(node2.toProxy(), this.helpers);\n } catch (e) {\n throw this.handleError(e, node2);\n }\n }\n if (visit2.iterator !== 0) {\n let iterator = visit2.iterator;\n let child;\n while (child = node2.nodes[node2.indexes[iterator]]) {\n node2.indexes[iterator] += 1;\n if (!child[isClean]) {\n child[isClean] = true;\n stack.push(toStack(child));\n return;\n }\n }\n visit2.iterator = 0;\n delete node2.indexes[iterator];\n }\n let events = visit2.events;\n while (visit2.eventIndex < events.length) {\n let event = events[visit2.eventIndex];\n visit2.eventIndex += 1;\n if (event === CHILDREN) {\n if (node2.nodes && node2.nodes.length) {\n node2[isClean] = true;\n visit2.iterator = node2.getIterator();\n }\n return;\n } else if (this.listeners[event]) {\n visit2.visitors = this.listeners[event];\n return;\n }\n }\n stack.pop();\n }\n walkSync(node2) {\n node2[isClean] = true;\n let events = getEvents(node2);\n for (let event of events) {\n if (event === CHILDREN) {\n if (node2.nodes) {\n node2.each((child) => {\n if (!child[isClean]) this.walkSync(child);\n });\n }\n } else {\n let visitors = this.listeners[event];\n if (visitors) {\n if (this.visitSync(visitors, node2.toProxy())) return;\n }\n }\n }\n }\n warnings() {\n return this.sync().warnings();\n }\n get content() {\n return this.stringify().content;\n }\n get css() {\n return this.stringify().css;\n }\n get map() {\n return this.stringify().map;\n }\n get messages() {\n return this.sync().messages;\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n return this.sync().root;\n }\n get [Symbol.toStringTag]() {\n return \"LazyResult\";\n }\n};\nLazyResult$2.registerPostcss = (dependant) => {\n postcss$2 = dependant;\n};\nvar lazyResult = LazyResult$2;\nLazyResult$2.default = LazyResult$2;\nRoot$3.registerLazyResult(LazyResult$2);\nDocument$2.registerLazyResult(LazyResult$2);\nlet MapGenerator2 = mapGenerator;\nlet stringify$1 = stringify_1;\nlet warnOnce2 = warnOnce$2;\nlet parse$1 = parse_1;\nconst Result$1 = result;\nlet NoWorkResult$1 = class NoWorkResult {\n constructor(processor2, css, opts) {\n css = css.toString();\n this.stringified = false;\n this._processor = processor2;\n this._css = css;\n this._opts = opts;\n this._map = void 0;\n let root2;\n let str = stringify$1;\n this.result = new Result$1(this._processor, root2, this._opts);\n this.result.css = css;\n let self = this;\n Object.defineProperty(this.result, \"root\", {\n get() {\n return self.root;\n }\n });\n let map = new MapGenerator2(str, root2, this._opts, css);\n if (map.isMap()) {\n let [generatedCSS, generatedMap] = map.generate();\n if (generatedCSS) {\n this.result.css = generatedCSS;\n }\n if (generatedMap) {\n this.result.map = generatedMap;\n }\n } else {\n map.clearAnnotation();\n this.result.css = map.css;\n }\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n return Promise.resolve(this.result);\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n sync() {\n if (this.error) throw this.error;\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this._opts)) {\n warnOnce2(\n \"Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.\"\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this._css;\n }\n warnings() {\n return [];\n }\n get content() {\n return this.result.css;\n }\n get css() {\n return this.result.css;\n }\n get map() {\n return this.result.map;\n }\n get messages() {\n return [];\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n if (this._root) {\n return this._root;\n }\n let root2;\n let parser2 = parse$1;\n try {\n root2 = parser2(this._css, this._opts);\n } catch (error) {\n this.error = error;\n }\n if (this.error) {\n throw this.error;\n } else {\n this._root = root2;\n return root2;\n }\n }\n get [Symbol.toStringTag]() {\n return \"NoWorkResult\";\n }\n};\nvar noWorkResult = NoWorkResult$1;\nNoWorkResult$1.default = NoWorkResult$1;\nlet NoWorkResult2 = noWorkResult;\nlet LazyResult$1 = lazyResult;\nlet Document$1 = document$1;\nlet Root$2 = root;\nlet Processor$1 = class Processor {\n constructor(plugins = []) {\n this.version = \"8.4.38\";\n this.plugins = this.normalize(plugins);\n }\n normalize(plugins) {\n let normalized = [];\n for (let i of plugins) {\n if (i.postcss === true) {\n i = i();\n } else if (i.postcss) {\n i = i.postcss;\n }\n if (typeof i === \"object\" && Array.isArray(i.plugins)) {\n normalized = normalized.concat(i.plugins);\n } else if (typeof i === \"object\" && i.postcssPlugin) {\n normalized.push(i);\n } else if (typeof i === \"function\") {\n normalized.push(i);\n } else if (typeof i === \"object\" && (i.parse || i.stringify)) {\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\n \"PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.\"\n );\n }\n } else {\n throw new Error(i + \" is not a PostCSS plugin\");\n }\n }\n return normalized;\n }\n process(css, opts = {}) {\n if (!this.plugins.length && !opts.parser && !opts.stringifier && !opts.syntax) {\n return new NoWorkResult2(this, css, opts);\n } else {\n return new LazyResult$1(this, css, opts);\n }\n }\n use(plugin2) {\n this.plugins = this.plugins.concat(this.normalize([plugin2]));\n return this;\n }\n};\nvar processor = Processor$1;\nProcessor$1.default = Processor$1;\nRoot$2.registerProcessor(Processor$1);\nDocument$1.registerProcessor(Processor$1);\nlet Declaration$1 = declaration;\nlet PreviousMap2 = previousMap;\nlet Comment$1 = comment;\nlet AtRule$1 = atRule;\nlet Input$1 = input;\nlet Root$1 = root;\nlet Rule$1 = rule;\nfunction fromJSON$1(json, inputs) {\n if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));\n let { inputs: ownInputs, ...defaults } = json;\n if (ownInputs) {\n inputs = [];\n for (let input2 of ownInputs) {\n let inputHydrated = { ...input2, __proto__: Input$1.prototype };\n if (inputHydrated.map) {\n inputHydrated.map = {\n ...inputHydrated.map,\n __proto__: PreviousMap2.prototype\n };\n }\n inputs.push(inputHydrated);\n }\n }\n if (defaults.nodes) {\n defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));\n }\n if (defaults.source) {\n let { inputId, ...source } = defaults.source;\n defaults.source = source;\n if (inputId != null) {\n defaults.source.input = inputs[inputId];\n }\n }\n if (defaults.type === \"root\") {\n return new Root$1(defaults);\n } else if (defaults.type === \"decl\") {\n return new Declaration$1(defaults);\n } else if (defaults.type === \"rule\") {\n return new Rule$1(defaults);\n } else if (defaults.type === \"comment\") {\n return new Comment$1(defaults);\n } else if (defaults.type === \"atrule\") {\n return new AtRule$1(defaults);\n } else {\n throw new Error(\"Unknown node type: \" + json.type);\n }\n}\nvar fromJSON_1 = fromJSON$1;\nfromJSON$1.default = fromJSON$1;\nlet CssSyntaxError2 = cssSyntaxError;\nlet Declaration2 = declaration;\nlet LazyResult2 = lazyResult;\nlet Container2 = container;\nlet Processor2 = processor;\nlet stringify = stringify_1;\nlet fromJSON = fromJSON_1;\nlet Document22 = document$1;\nlet Warning2 = warning;\nlet Comment2 = comment;\nlet AtRule2 = atRule;\nlet Result2 = result;\nlet Input2 = input;\nlet parse = parse_1;\nlet list = list_1;\nlet Rule2 = rule;\nlet Root2 = root;\nlet Node2 = node;\nfunction postcss(...plugins) {\n if (plugins.length === 1 && Array.isArray(plugins[0])) {\n plugins = plugins[0];\n }\n return new Processor2(plugins);\n}\npostcss.plugin = function plugin(name, initializer) {\n let warningPrinted = false;\n function creator(...args) {\n if (console && console.warn && !warningPrinted) {\n warningPrinted = true;\n console.warn(\n name + \": postcss.plugin was deprecated. Migration guide:\\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration\"\n );\n if (process.env.LANG && process.env.LANG.startsWith(\"cn\")) {\n console.warn(\n name + \": 里面 postcss.plugin 被弃用. 迁移指南:\\nhttps://www.w3ctech.com/topic/2226\"\n );\n }\n }\n let transformer = initializer(...args);\n transformer.postcssPlugin = name;\n transformer.postcssVersion = new Processor2().version;\n return transformer;\n }\n let cache;\n Object.defineProperty(creator, \"postcss\", {\n get() {\n if (!cache) cache = creator();\n return cache;\n }\n });\n creator.process = function(css, processOpts, pluginOpts) {\n return postcss([creator(pluginOpts)]).process(css, processOpts);\n };\n return creator;\n};\npostcss.stringify = stringify;\npostcss.parse = parse;\npostcss.fromJSON = fromJSON;\npostcss.list = list;\npostcss.comment = (defaults) => new Comment2(defaults);\npostcss.atRule = (defaults) => new AtRule2(defaults);\npostcss.decl = (defaults) => new Declaration2(defaults);\npostcss.rule = (defaults) => new Rule2(defaults);\npostcss.root = (defaults) => new Root2(defaults);\npostcss.document = (defaults) => new Document22(defaults);\npostcss.CssSyntaxError = CssSyntaxError2;\npostcss.Declaration = Declaration2;\npostcss.Container = Container2;\npostcss.Processor = Processor2;\npostcss.Document = Document22;\npostcss.Comment = Comment2;\npostcss.Warning = Warning2;\npostcss.AtRule = AtRule2;\npostcss.Result = Result2;\npostcss.Input = Input2;\npostcss.Rule = Rule2;\npostcss.Root = Root2;\npostcss.Node = Node2;\nLazyResult2.registerPostcss(postcss);\nvar postcss_1 = postcss;\npostcss.default = postcss;\nconst postcss$1 = /* @__PURE__ */ getDefaultExportFromCjs(postcss_1);\npostcss$1.stringify;\npostcss$1.fromJSON;\npostcss$1.plugin;\npostcss$1.parse;\npostcss$1.list;\npostcss$1.document;\npostcss$1.comment;\npostcss$1.atRule;\npostcss$1.rule;\npostcss$1.decl;\npostcss$1.root;\npostcss$1.CssSyntaxError;\npostcss$1.Declaration;\npostcss$1.Container;\npostcss$1.Processor;\npostcss$1.Document;\npostcss$1.Comment;\npostcss$1.Warning;\npostcss$1.AtRule;\npostcss$1.Result;\npostcss$1.Input;\npostcss$1.Rule;\npostcss$1.Root;\npostcss$1.Node;\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 || {});\nfunction parseCSSText(cssText) {\n const res = {};\n const listDelimiter = /;(?![^(]*\\))/g;\n const propertyDelimiter = /:(.+)/;\n const comment2 = /\\/\\*.*?\\*\\//g;\n cssText.replace(comment2, \"\").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, (_, c) => c ? c.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 // corresponding nodeType value of standard HTML Node\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(node2) {\n if (!(node2 instanceof BaseRRNode)) return false;\n else if (node2.ownerDocument !== this.ownerDocument) return false;\n else if (node2 === this) return true;\n while (node2.parentNode) {\n if (node2.parentNode === this) return true;\n node2 = node2.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 (node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === \"HTML\"\n ) || null;\n }\n get body() {\n var _a;\n return ((_a = this.documentElement) == null ? void 0 : _a.childNodes.find(\n (node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === \"BODY\"\n )) || null;\n }\n get head() {\n var _a;\n return ((_a = this.documentElement) == null ? void 0 : _a.childNodes.find(\n (node2) => node2.RRNodeType === NodeType$1.Element && node2.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((s) => s.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((s) => s.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(node2) {\n return removeChild(this, node2);\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('\\')\n * 2. doc.write('\\')\n */\n write(content) {\n let publicId;\n if (content === '')\n publicId = \"-//W3C//DTD XHTML 1.0 Transitional//EN\";\n else if (content === '')\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 comment2 = new BaseRRComment(data);\n comment2.ownerDocument = this;\n return comment2;\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 result2 = \"\";\n this.childNodes.forEach((node2) => result2 += node2.textContent);\n return result2;\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 if (this.attributes[name] === void 0) return null;\n return this.attributes[name];\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(node2) {\n return removeChild(this, node2);\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 BaseRRDialogElement extends BaseRRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"tagName\", \"DIALOG\");\n __publicField(this, \"nodeName\", \"DIALOG\");\n }\n get isModal() {\n return this.getAttribute(\"rr_open_mode\") === \"modal\";\n }\n get open() {\n return this.getAttribute(\"open\") !== null;\n }\n close() {\n this.removeAttribute(\"open\");\n this.removeAttribute(\"rr_open_mode\");\n }\n show() {\n this.setAttribute(\"open\", \"\");\n this.setAttribute(\"rr_open_mode\", \"non-modal\");\n }\n showModal() {\n this.setAttribute(\"open\", \"\");\n this.setAttribute(\"rr_open_mode\", \"modal\");\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 || {});\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 var _a;\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 (_a = oldTree.parentNode) == null ? void 0 : _a.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 == null ? void 0 : 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 = oldTree.contentDocument;\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 var _a;\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 newMediaRRElement.paused ? void oldMediaElement.pause() : void oldMediaElement.play();\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 if (newMediaRRElement.loop !== void 0)\n oldMediaElement.loop = newMediaRRElement.loop;\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 (canvasMutation) => replayer.applyCanvas(\n canvasMutation.event,\n canvasMutation.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 case \"DIALOG\": {\n const dialog = oldElement;\n const rrDialog = newRRElement;\n const wasOpen = dialog.open;\n const wasModal = dialog.matches(\"dialog:modal\");\n const shouldBeOpen = rrDialog.open;\n const shouldBeModal = rrDialog.isModal;\n const modalChanged = wasModal !== shouldBeModal;\n const openChanged = wasOpen !== shouldBeOpen;\n if (modalChanged || wasOpen && openChanged) dialog.close();\n if (shouldBeOpen && (openChanged || modalChanged)) {\n try {\n if (shouldBeModal) dialog.showModal();\n else dialog.show();\n } catch (e) {\n console.warn(e);\n }\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 == null ? void 0 : createdNodeSet.has(oldTree)) {\n createdNodeSet.delete(oldTree);\n (_a = replayer.afterAppend) == null ? void 0 : _a.call(replayer, 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 == null ? void 0 : 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 oldTree.insertBefore(oldStartNode, oldEndNode.nextSibling);\n } catch (e) {\n console.warn(e);\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 oldTree.insertBefore(oldEndNode, oldStartNode);\n } catch (e) {\n console.warn(e);\n }\n oldEndNode = oldChildren[--oldEndIndex];\n newStartNode = newChildren[++newStartIndex];\n } else {\n if (!oldIdToIndex) {\n oldIdToIndex = {};\n for (let i = oldStartIndex; i <= oldEndIndex; i++) {\n const oldChild2 = oldChildren[i];\n if (oldChild2 && replayer.mirror.hasNode(oldChild2))\n oldIdToIndex[replayer.mirror.getId(oldChild2)] = i;\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 oldTree.insertBefore(nodeToMove, oldStartNode);\n } catch (e) {\n console.warn(e);\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 oldTree.insertBefore(newNode, oldStartNode || null);\n } catch (e) {\n console.warn(e);\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 oldTree.insertBefore(newNode, referenceNode);\n } catch (e) {\n console.warn(e);\n }\n }\n } else if (newStartIndex > newEndIndex) {\n for (; oldStartIndex <= oldEndIndex; oldStartIndex++) {\n const node2 = oldChildren[oldStartIndex];\n if (!node2 || node2.parentNode !== oldTree) continue;\n try {\n oldTree.removeChild(node2);\n replayer.mirror.removeNodeFromMap(node2);\n } catch (e) {\n console.warn(e);\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 node2 = null;\n if (nodeId > -1) node2 = domMirror.getNode(nodeId);\n if (node2 !== null && sameNodeType(node2, rrNode)) return node2;\n switch (rrNode.RRNodeType) {\n case NodeType$1.Document:\n node2 = new Document();\n break;\n case NodeType$1.DocumentType:\n node2 = 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 == null ? void 0 : sn.isSVG)) {\n node2 = document.createElementNS(NAMESPACES[\"svg\"], tagName);\n } else node2 = document.createElement(rrNode.tagName);\n break;\n }\n case NodeType$1.Text:\n node2 = document.createTextNode(rrNode.data);\n break;\n case NodeType$1.Comment:\n node2 = document.createComment(rrNode.data);\n break;\n case NodeType$1.CDATA:\n node2 = document.createCDATASection(rrNode.data);\n break;\n }\n if (sn) domMirror.add(node2, { ...sn });\n try {\n createdNodeSet == null ? void 0 : createdNodeSet.add(node2);\n } catch (e) {\n }\n return node2;\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}\nclass RRDocument extends BaseRRDocument {\n constructor(mirror) {\n super();\n __publicField(this, \"UNSERIALIZED_STARTING_ID\", -2);\n // In the rrweb replayer, there are some unserialized nodes like the element that stores the injected style rules.\n // These unserialized nodes may interfere the execution of the diff algorithm.\n // The id of serialized node is larger than 0. So this value less than 0 is used as id for these unserialized nodes.\n __publicField(this, \"_unserializedId\", this.UNSERIALIZED_STARTING_ID);\n __publicField(this, \"mirror\", createMirror());\n __publicField(this, \"scrollData\", null);\n if (mirror) {\n this.mirror = mirror;\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 case \"DIALOG\":\n element = new RRDialogElement(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 RRDialogElement extends BaseRRDialogElement {\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, mirror) {\n super(upperTagName);\n __publicField(this, \"contentDocument\", new RRDocument());\n this.contentDocument.mirror = mirror;\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(node2, rrdom, domMirror, parentRRNode) {\n let rrNode;\n switch (node2.nodeType) {\n case NodeType.DOCUMENT_NODE:\n if (parentRRNode && parentRRNode.nodeName === \"IFRAME\")\n rrNode = parentRRNode.contentDocument;\n else {\n rrNode = rrdom;\n rrNode.compatMode = node2.compatMode;\n }\n break;\n case NodeType.DOCUMENT_TYPE_NODE: {\n const documentType = node2;\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 = node2;\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(node2.textContent || \"\");\n break;\n case NodeType.CDATA_SECTION_NODE:\n rrNode = rrdom.createCDATASection(node2.data);\n break;\n case NodeType.COMMENT_NODE:\n rrNode = rrdom.createComment(node2.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(node2);\n if (rrdom instanceof RRDocument) {\n if (!sn) {\n sn = getDefaultSN(rrNode, rrdom.unserializedId);\n domMirror.add(node2, 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(node2, parentRRNode) {\n const rrNode = buildFromNode(node2, rrdom, domMirror, parentRRNode);\n if (rrNode === null) return;\n if (\n // if the parentRRNode isn't a RRIFrameElement\n (parentRRNode == null ? void 0 : parentRRNode.nodeName) !== \"IFRAME\" && // if node isn't a shadow root\n node2.nodeType !== NodeType.DOCUMENT_FRAGMENT_NODE\n ) {\n parentRRNode == null ? void 0 : parentRRNode.appendChild(rrNode);\n rrNode.parentNode = parentRRNode;\n rrNode.parentElement = parentRRNode;\n }\n if (node2.nodeName === \"IFRAME\") {\n const iframeDoc = node2.contentDocument;\n iframeDoc && walk2(iframeDoc, rrNode);\n } else if (node2.nodeType === NodeType.DOCUMENT_NODE || node2.nodeType === NodeType.ELEMENT_NODE || node2.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {\n if (node2.nodeType === NodeType.ELEMENT_NODE && node2.shadowRoot)\n walk2(node2.shadowRoot, rrNode);\n node2.childNodes.forEach((childNode) => walk2(childNode, rrNode));\n }\n }\n walk2(dom, null);\n return rrdom;\n}\nfunction createMirror() {\n return new Mirror2();\n}\nclass Mirror2 {\n constructor() {\n __publicField(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n) {\n var _a;\n if (!n) return -1;\n const id = (_a = this.getMeta(n)) == null ? void 0 : _a.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(n) {\n return this.nodeMetaMap.get(n) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n) {\n const id = this.getId(n);\n this.idNodeMap.delete(id);\n if (n.childNodes) {\n n.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode));\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n);\n this.nodeMetaMap.set(n, meta);\n }\n replace(id, n) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n, meta);\n }\n this.idNodeMap.set(id, n);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction getDefaultSN(node2, id) {\n switch (node2.RRNodeType) {\n case NodeType$1.Document:\n return {\n id,\n type: node2.RRNodeType,\n childNodes: []\n };\n case NodeType$1.DocumentType: {\n const doctype = node2;\n return {\n id,\n type: node2.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: node2.RRNodeType,\n tagName: node2.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: node2.RRNodeType,\n textContent: node2.textContent || \"\"\n };\n case NodeType$1.Comment:\n return {\n id,\n type: node2.RRNodeType,\n textContent: node2.textContent || \"\"\n };\n case NodeType$1.CDATA:\n return {\n id,\n type: node2.RRNodeType,\n textContent: \"\"\n };\n }\n}\nfunction printRRDom(rootNode, mirror) {\n return walk(rootNode, mirror, \"\");\n}\nfunction walk(node2, mirror, blankSpace) {\n let printText = `${blankSpace}${mirror.getId(node2)} ${node2.toString()}\n`;\n if (node2.RRNodeType === NodeType$1.Element) {\n const element = node2;\n if (element.shadowRoot)\n printText += walk(element.shadowRoot, mirror, blankSpace + \" \");\n }\n for (const child of node2.childNodes)\n printText += walk(child, mirror, blankSpace + \" \");\n if (node2.nodeName === \"IFRAME\")\n printText += walk(\n node2.contentDocument,\n mirror,\n blankSpace + \" \"\n );\n return printText;\n}\nexport {\n BaseRRCDATASection,\n BaseRRComment,\n BaseRRDialogElement,\n BaseRRDocument,\n BaseRRDocumentType,\n BaseRRElement,\n BaseRRMediaElement,\n BaseRRNode,\n BaseRRText,\n ClassList,\n Mirror2 as Mirror,\n NodeType,\n RRCDATASection,\n RRCanvasElement,\n RRComment,\n RRDialogElement,\n RRDocument,\n RRDocumentType,\n RRElement,\n RRIFrameElement,\n RRMediaElement,\n BaseRRNode as RRNode,\n RRStyleElement,\n RRText,\n buildFromDom,\n buildFromNode,\n createMirror,\n createOrGetNode,\n diff,\n getDefaultSN,\n printRRDom\n};\n//# sourceMappingURL=rrdom.js.map\n", "const testableAccessors = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\nconst untaintedBasePrototype = {};\nconst isAngularZonePresent = () => {\n return !!globalThis.Zone;\n};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a, _b;\n return Boolean(\n (_b = (_a = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a;\n return typeof defaultPrototype[method] === \"function\" && ((_a = defaultPrototype[method]) == null ? void 0 : _a.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n) {\n return getUntaintedAccessor(\"Node\", n, \"childNodes\");\n}\nfunction parentNode(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentNode\");\n}\nfunction parentElement(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentElement\");\n}\nfunction textContent(n) {\n return getUntaintedAccessor(\"Node\", n, \"textContent\");\n}\nfunction contains(n, other) {\n return getUntaintedMethod(\"Node\", n, \"contains\")(other);\n}\nfunction getRootNode(n) {\n return getUntaintedMethod(\"Node\", n, \"getRootNode\")();\n}\nfunction host(n) {\n if (!n || !(\"host\" in n)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n, \"host\");\n}\nfunction styleSheets(n) {\n return n.styleSheets;\n}\nfunction shadowRoot(n) {\n if (!n || !(\"shadowRoot\" in n)) return null;\n return getUntaintedAccessor(\"Element\", n, \"shadowRoot\");\n}\nfunction querySelector(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype(\"MutationObserver\").constructor;\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor\n};\nexport {\n childNodes,\n contains,\n index as default,\n getRootNode,\n getUntaintedAccessor,\n getUntaintedMethod,\n getUntaintedPrototype,\n host,\n isAngularZonePresent,\n mutationObserverCtor,\n parentElement,\n parentNode,\n querySelector,\n querySelectorAll,\n shadowRoot,\n styleSheets,\n textContent\n};\n//# sourceMappingURL=utils.js.map\n", "import type {\n throttleOptions,\n listenerHandler,\n hookResetter,\n blockClass,\n addedNodeMutation,\n DocumentDimension,\n IWindow,\n DeprecatedMirror,\n textMutation,\n IMirror,\n} from '@rrweb/types';\nimport type { Mirror, SlimDOMOptions } from 'rrweb-snapshot';\nimport { isShadowRoot, IGNORED_NODE, classMatchesRegex } from 'rrweb-snapshot';\nimport { RRNode, RRIFrameElement, BaseRRNode } from 'rrdom';\nimport dom from '@rrweb/utils';\n\nexport function on(\n type: string,\n fn: EventListenerOrEventListenerObject,\n target: Document | IWindow = document,\n): listenerHandler {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\n\n// https://github.com/rrweb-io/rrweb/pull/407\nconst DEPARTED_MIRROR_ACCESS_WARNING =\n 'Please stop import mirror directly. Instead of that,' +\n '\\r\\n' +\n 'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +\n '\\r\\n' +\n 'or you can use record.mirror to access the mirror instance during recording.';\n/** @deprecated */\nexport let _mirror: DeprecatedMirror = {\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n// copy from underscore and modified\nexport function throttle(\n func: (arg: T) => void,\n wait: number,\n options: throttleOptions = {},\n) {\n let timeout: ReturnType | null = null;\n let previous = 0;\n return function (...args: T[]) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-this-alias\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(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\n\nexport function hookSetter(\n target: T,\n key: string | number | symbol,\n d: PropertyDescriptor,\n isRevoked?: boolean,\n win = window,\n): hookResetter {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked\n ? d\n : {\n set(value) {\n // put hooked setter into event loop to avoid of set latency\n setTimeout(() => {\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}\n\n// copy from https://github.com/getsentry/sentry-javascript/blob/b2109071975af8bf0316d3b5b38f519bdaf5dc15/packages/utils/src/object.ts\nexport function patch(\n source: { [key: string]: any },\n name: string,\n replacement: (...args: unknown[]) => unknown,\n): () => void {\n try {\n if (!(name in source)) {\n return () => {\n //\n };\n }\n\n const original = source[name] as () => unknown;\n const wrapped = replacement(original);\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original,\n },\n });\n }\n\n source[name] = wrapped;\n\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {\n //\n };\n // This can throw if multiple fill happens on a global object like XMLHttpRequest\n // Fixes https://github.com/getsentry/sentry-javascript/issues/2043\n }\n}\n\n// guard against old third party libraries which redefine Date.now\nlet nowTimestamp = Date.now;\n\nif (!(/*@__PURE__*/ /[1-9][0-9]{12}/.test(Date.now().toString()))) {\n // they have already redefined it! use a fallback\n nowTimestamp = () => new Date().getTime();\n}\nexport { nowTimestamp };\n\nexport function getWindowScroll(win: Window) {\n const doc = win.document;\n return {\n left: doc.scrollingElement\n ? doc.scrollingElement.scrollLeft\n : win.pageXOffset !== undefined\n ? win.pageXOffset\n : doc.documentElement.scrollLeft ||\n (doc?.body && dom.parentElement(doc.body)?.scrollLeft) ||\n doc?.body?.scrollLeft ||\n 0,\n top: doc.scrollingElement\n ? doc.scrollingElement.scrollTop\n : win.pageYOffset !== undefined\n ? win.pageYOffset\n : doc?.documentElement.scrollTop ||\n (doc?.body && dom.parentElement(doc.body)?.scrollTop) ||\n doc?.body?.scrollTop ||\n 0,\n };\n}\n\nexport function getWindowHeight(): number {\n return (\n window.innerHeight ||\n (document.documentElement && document.documentElement.clientHeight) ||\n (document.body && document.body.clientHeight)\n );\n}\n\nexport function getWindowWidth(): number {\n return (\n window.innerWidth ||\n (document.documentElement && document.documentElement.clientWidth) ||\n (document.body && document.body.clientWidth)\n );\n}\n\n/**\n * Returns the given node as an HTMLElement if it is one, otherwise the parent node as an HTMLElement\n * @param node - node to check\n * @returns HTMLElement or null\n */\n\nexport function closestElementOfNode(node: Node | null): HTMLElement | null {\n if (!node) {\n return null;\n }\n const el: HTMLElement | null =\n node.nodeType === node.ELEMENT_NODE\n ? (node as HTMLElement)\n : dom.parentElement(node);\n return el;\n}\n\n/**\n * Checks if the given element set to be blocked by rrweb\n * @param node - node to check\n * @param blockClass - class name to check\n * @param blockSelector - css selectors to check\n * @param checkAncestors - whether to search through parent nodes for the block class\n * @returns true/false if the node was blocked or not\n */\nexport function isBlocked(\n node: Node | null,\n blockClass: blockClass,\n blockSelector: string | null,\n checkAncestors: boolean,\n): boolean {\n if (!node) {\n return false;\n }\n const el = closestElementOfNode(node);\n\n if (!el) {\n return false;\n }\n\n try {\n if (typeof blockClass === 'string') {\n if (el.classList.contains(blockClass)) return true;\n if (checkAncestors && el.closest('.' + blockClass) !== null) return true;\n } else {\n if (classMatchesRegex(el, blockClass, checkAncestors)) return true;\n }\n } catch (e) {\n // e\n }\n if (blockSelector) {\n if (el.matches(blockSelector)) return true;\n if (checkAncestors && el.closest(blockSelector) !== null) return true;\n }\n return false;\n}\n\nexport function isSerialized(n: Node, mirror: Mirror): boolean {\n return mirror.getId(n) !== -1;\n}\n\nexport function isIgnored(\n n: Node,\n mirror: Mirror,\n slimDOMOptions: SlimDOMOptions,\n): boolean {\n if ((n as Element).tagName === 'TITLE' && slimDOMOptions.headTitleMutations) {\n // we do this check here but not in rrweb-snapshot\n // to block mutations/animations on the title.\n // the headTitleMutations option isn't intended to block recording of the initial value\n return true;\n }\n // The main part of the slimDOM check happens in\n // rrweb-snapshot::serializeNodeWithId\n return mirror.getId(n) === IGNORED_NODE;\n}\n\nexport function isAncestorRemoved(target: Node, mirror: Mirror): boolean {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror.getId(target);\n if (!mirror.has(id)) {\n return true;\n }\n const parent = dom.parentNode(target);\n if (parent && parent.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n // if the root is not document, it means the node is not in the DOM tree anymore\n if (!parent) {\n return true;\n }\n return isAncestorRemoved(parent, mirror);\n}\n\nexport function legacy_isTouchEvent(\n event: MouseEvent | TouchEvent | PointerEvent,\n): event is TouchEvent {\n return Boolean((event as TouchEvent).changedTouches);\n}\n\nexport function polyfill(win = window) {\n if ('NodeList' in win && !win.NodeList.prototype.forEach) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n win.NodeList.prototype.forEach = Array.prototype\n .forEach as unknown as NodeList['forEach'];\n }\n\n if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n win.DOMTokenList.prototype.forEach = Array.prototype\n .forEach as unknown as DOMTokenList['forEach'];\n }\n}\n\ntype ResolveTree = {\n value: addedNodeMutation;\n children: ResolveTree[];\n parent: ResolveTree | null;\n};\n\nexport function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[] {\n const queueNodeMap: Record = {};\n const putIntoMap = (\n m: addedNodeMutation,\n parent: ResolveTree | null,\n ): ResolveTree => {\n const nodeInTree: ResolveTree = {\n value: m,\n parent,\n children: [],\n };\n queueNodeMap[m.node.id] = nodeInTree;\n return nodeInTree;\n };\n\n const queueNodeTrees: ResolveTree[] = [];\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\n return queueNodeTrees;\n}\n\nexport function iterateResolveTree(\n tree: ResolveTree,\n cb: (mutation: addedNodeMutation) => unknown,\n) {\n cb(tree.value);\n /**\n * The resolve tree was designed to reflect the DOM layout,\n * but we need append next sibling first, so we do a reverse\n * loop here.\n */\n for (let i = tree.children.length - 1; i >= 0; i--) {\n iterateResolveTree(tree.children[i], cb);\n }\n}\n\nexport type AppendedIframe = {\n mutationInQueue: addedNodeMutation;\n builtNode: HTMLIFrameElement | RRIFrameElement;\n};\n\nexport function isSerializedIframe(\n n: TNode,\n mirror: IMirror,\n): boolean {\n return Boolean(n.nodeName === 'IFRAME' && mirror.getMeta(n));\n}\n\nexport function isSerializedStylesheet(\n n: TNode,\n mirror: IMirror,\n): boolean {\n return Boolean(\n n.nodeName === 'LINK' &&\n n.nodeType === n.ELEMENT_NODE &&\n (n as HTMLElement).getAttribute &&\n (n as HTMLElement).getAttribute('rel') === 'stylesheet' &&\n mirror.getMeta(n),\n );\n}\n\nexport function getBaseDimension(\n node: Node,\n rootIframe: Node,\n): DocumentDimension {\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\n const frameDimension = frameElement.getBoundingClientRect();\n const frameBaseDimension = getBaseDimension(frameElement, rootIframe);\n // the iframe element may have a scale transform\n const relativeScale = frameDimension.height / frameElement.clientHeight;\n return {\n x:\n frameDimension.x * frameBaseDimension.relativeScale +\n frameBaseDimension.x,\n y:\n frameDimension.y * frameBaseDimension.relativeScale +\n frameBaseDimension.y,\n relativeScale,\n absoluteScale: frameBaseDimension.absoluteScale * relativeScale,\n };\n}\n\nexport function hasShadowRoot(\n n: T,\n): n is T & { shadowRoot: ShadowRoot } {\n if (!n) return false;\n if (n instanceof BaseRRNode && 'shadowRoot' in n) {\n return Boolean(n.shadowRoot);\n }\n return Boolean(dom.shadowRoot(n as unknown as Element));\n}\n\nexport function getNestedRule(\n rules: CSSRuleList,\n position: number[],\n): CSSGroupingRule {\n const rule = rules[position[0]] as CSSGroupingRule;\n if (position.length === 1) {\n return rule;\n } else {\n return getNestedRule(\n (rule.cssRules[position[1]] as CSSGroupingRule).cssRules,\n position.slice(2),\n );\n }\n}\n\nexport function getPositionsAndIndex(nestedIndex: number[]) {\n const positions = [...nestedIndex];\n const index = positions.pop();\n return { positions, index };\n}\n\n/**\n * Returns the latest mutation in the queue for each node.\n * @param mutations - mutations The text mutations to filter.\n * @returns The filtered text mutations.\n */\nexport function uniqueTextMutations(mutations: textMutation[]): textMutation[] {\n const idSet = new Set();\n const uniqueMutations: textMutation[] = [];\n\n for (let i = mutations.length; i--; ) {\n const mutation = mutations[i];\n if (!idSet.has(mutation.id)) {\n uniqueMutations.push(mutation);\n idSet.add(mutation.id);\n }\n }\n\n return uniqueMutations;\n}\n\nexport class StyleSheetMirror {\n private id = 1;\n private styleIDMap = new WeakMap();\n private idStyleMap = new Map();\n\n getId(stylesheet: CSSStyleSheet): number {\n return this.styleIDMap.get(stylesheet) ?? -1;\n }\n\n has(stylesheet: CSSStyleSheet): boolean {\n return this.styleIDMap.has(stylesheet);\n }\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: CSSStyleSheet, id?: number): number {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId: number;\n if (id === undefined) {\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\n getStyle(id: number): CSSStyleSheet | null {\n return this.idStyleMap.get(id) || null;\n }\n\n reset(): void {\n this.styleIDMap = new WeakMap();\n this.idStyleMap = new Map();\n this.id = 1;\n }\n\n generateId(): number {\n return this.id++;\n }\n}\n\n/**\n * Get the direct shadow host of a node in shadow dom. Returns null if it is not in a shadow dom.\n */\nexport function getShadowHost(n: Node): Element | null {\n let shadowHost: Element | null = null;\n if (\n 'getRootNode' in n &&\n dom.getRootNode(n)?.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&\n dom.host(dom.getRootNode(n) as ShadowRoot)\n )\n shadowHost = dom.host(dom.getRootNode(n) as ShadowRoot);\n return shadowHost;\n}\n\n/**\n * Get the root shadow host of a node in nested shadow doms. Returns the node itself if it is not in a shadow dom.\n */\nexport function getRootShadowHost(n: Node): Node {\n let rootShadowHost: Node = n;\n\n let shadowHost: Element | null;\n // If n is in a nested shadow dom.\n while ((shadowHost = getShadowHost(rootShadowHost)))\n rootShadowHost = shadowHost;\n\n return rootShadowHost;\n}\n\nexport function shadowHostInDom(n: Node): boolean {\n const doc = n.ownerDocument;\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n);\n return dom.contains(doc, shadowHost);\n}\n\nexport function inDom(n: Node): boolean {\n const doc = n.ownerDocument;\n if (!doc) return false;\n return dom.contains(doc, n) || shadowHostInDom(n);\n}\n", "var 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 NodeType = /* @__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 || {});\nexport {\n CanvasContext,\n EventType,\n IncrementalSource,\n MediaInteractions,\n MouseInteractions,\n NodeType,\n PointerTypes,\n ReplayerEvents\n};\n//# sourceMappingURL=types.js.map\n", "import {\n serializeNodeWithId,\n transformAttribute,\n IGNORED_NODE,\n ignoreAttribute,\n isShadowRoot,\n needMaskingText,\n maskInputValue,\n Mirror,\n isNativeShadowDom,\n getInputType,\n toLowerCase,\n} from 'rrweb-snapshot';\nimport type { observerParam, MutationBufferParam } from '../types';\nimport type {\n mutationRecord,\n textCursor,\n attributeCursor,\n removedNodeMutation,\n addedNodeMutation,\n Optional,\n} from '@rrweb/types';\nimport {\n isBlocked,\n isAncestorRemoved,\n isIgnored,\n isSerialized,\n hasShadowRoot,\n isSerializedIframe,\n isSerializedStylesheet,\n inDom,\n getShadowHost,\n closestElementOfNode,\n} from '../utils';\nimport dom from '@rrweb/utils';\n\ntype DoubleLinkedListNode = {\n previous: DoubleLinkedListNode | null;\n next: DoubleLinkedListNode | null;\n value: NodeInLinkedList;\n};\ntype NodeInLinkedList = Node & {\n __ln: DoubleLinkedListNode;\n};\n\nfunction isNodeInLinkedList(n: Node | NodeInLinkedList): n is NodeInLinkedList {\n return '__ln' in n;\n}\n\nclass DoubleLinkedList {\n public length = 0;\n public head: DoubleLinkedListNode | null = null;\n public tail: DoubleLinkedListNode | null = null;\n\n public get(position: number) {\n if (position >= this.length) {\n throw new Error('Position outside of list range');\n }\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\n public addNode(n: Node) {\n const node: DoubleLinkedListNode = {\n value: n as NodeInLinkedList,\n previous: null,\n next: null,\n };\n (n as NodeInLinkedList).__ln = node;\n if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) {\n const current = n.previousSibling.__ln.next;\n node.next = current;\n node.previous = n.previousSibling.__ln;\n n.previousSibling.__ln.next = node;\n if (current) {\n current.previous = node;\n }\n } else if (\n n.nextSibling &&\n isNodeInLinkedList(n.nextSibling) &&\n n.nextSibling.__ln.previous\n ) {\n const current = n.nextSibling.__ln.previous;\n node.previous = current;\n node.next = n.nextSibling.__ln;\n n.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\n public removeNode(n: NodeInLinkedList) {\n const current = n.__ln;\n if (!this.head) {\n return;\n }\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 (n.__ln) {\n delete (n as Optional).__ln;\n }\n this.length--;\n }\n}\n\nconst moveKey = (id: number, parentId: number) => `${id}@${parentId}`;\n\n/**\n * controls behaviour of a MutationObserver\n */\nexport default class MutationBuffer {\n private frozen = false;\n private locked = false;\n\n private texts: textCursor[] = [];\n private attributes: attributeCursor[] = [];\n private attributeMap = new WeakMap();\n private removes: removedNodeMutation[] = [];\n private mapRemoves: Node[] = [];\n\n private movedMap: Record = {};\n\n /**\n * the browser MutationObserver emits multiple mutations after\n * a delay for performance reasons, making tracing added nodes hard\n * in our `processMutations` callback function.\n * For example, if we append an element el_1 into body, and then append\n * another element el_2 into el_1, these two mutations may be passed to the\n * callback function together when the two operations were done.\n * Generally we need to trace child nodes of newly added nodes, but in this\n * case if we count el_2 as el_1's child node in the first mutation record,\n * then we will count el_2 again in the second mutation record which was\n * duplicated.\n * To avoid of duplicate counting added nodes, we use a Set to store\n * added nodes and its child nodes during iterate mutation records. Then\n * collect added nodes from the Set which have no duplicate copy. But\n * this also causes newly added nodes will not be serialized with id ASAP,\n * which means all the id related calculation should be lazy too.\n */\n private addedSet = new Set();\n private movedSet = new Set();\n private droppedSet = new Set();\n private removesSubTreeCache = new Set();\n\n private mutationCb: observerParam['mutationCb'];\n private blockClass: observerParam['blockClass'];\n private blockSelector: observerParam['blockSelector'];\n private maskTextClass: observerParam['maskTextClass'];\n private maskTextSelector: observerParam['maskTextSelector'];\n private inlineStylesheet: observerParam['inlineStylesheet'];\n private maskInputOptions: observerParam['maskInputOptions'];\n private maskTextFn: observerParam['maskTextFn'];\n private maskInputFn: observerParam['maskInputFn'];\n private keepIframeSrcFn: observerParam['keepIframeSrcFn'];\n private recordCanvas: observerParam['recordCanvas'];\n private inlineImages: observerParam['inlineImages'];\n private slimDOMOptions: observerParam['slimDOMOptions'];\n private dataURLOptions: observerParam['dataURLOptions'];\n private doc: observerParam['doc'];\n private mirror: observerParam['mirror'];\n private iframeManager: observerParam['iframeManager'];\n private stylesheetManager: observerParam['stylesheetManager'];\n private shadowDomManager: observerParam['shadowDomManager'];\n private canvasManager: observerParam['canvasManager'];\n private processedNodeManager: observerParam['processedNodeManager'];\n private unattachedDoc: HTMLDocument;\n\n public init(options: MutationBufferParam) {\n (\n [\n 'mutationCb',\n 'blockClass',\n 'blockSelector',\n 'maskTextClass',\n 'maskTextSelector',\n 'inlineStylesheet',\n 'maskInputOptions',\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 ] as const\n ).forEach((key) => {\n // just a type trick, the runtime result is correct\n this[key] = options[key] as never;\n });\n }\n\n public freeze() {\n this.frozen = true;\n this.canvasManager.freeze();\n }\n\n public unfreeze() {\n this.frozen = false;\n this.canvasManager.unfreeze();\n this.emit();\n }\n\n public isFrozen() {\n return this.frozen;\n }\n\n public lock() {\n this.locked = true;\n this.canvasManager.lock();\n }\n\n public unlock() {\n this.locked = false;\n this.canvasManager.unlock();\n this.emit();\n }\n\n public reset() {\n this.shadowDomManager.reset();\n this.canvasManager.reset();\n }\n\n public processMutations = (mutations: mutationRecord[]) => {\n mutations.forEach(this.processMutation); // adds mutations to the buffer\n this.emit(); // clears buffer if not locked/frozen\n };\n\n public emit = () => {\n if (this.frozen || this.locked) {\n return;\n }\n\n // delay any modification of the mirror until this function\n // so that the mirror for takeFullSnapshot doesn't get mutated while it's event is being processed\n\n const adds: addedNodeMutation[] = [];\n const addedIds = new Set();\n\n /**\n * Sometimes child node may be pushed before its newly added\n * parent, so we init a queue to store these nodes.\n */\n const addList = new DoubleLinkedList();\n const getNextId = (n: Node): number | null => {\n let ns: Node | null = n;\n let nextId: number | null = IGNORED_NODE; // slimDOM: ignored\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 = (n: Node) => {\n const parent = dom.parentNode(n);\n if (!parent || !inDom(n)) {\n return;\n }\n let cssCaptured = false;\n if (n.nodeType === Node.TEXT_NODE) {\n const parentTag = (parent as Element).tagName;\n if (parentTag === 'TEXTAREA') {\n // genTextAreaValueMutation already called via parent\n return;\n } else if (parentTag === 'STYLE' && this.addedSet.has(parent)) {\n // css content will be recorded via parent's _cssText attribute when\n // mutation adds entire