/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./dev/dark-mode/index.js":
/*!********************************!*\
!*** ./dev/dark-mode/index.js ***!
\********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _src_main__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/main */ \"./dev/dark-mode/src/main.js\");\n\nwindow.AdminifyDarkMode = {\n enable: function enable(config) {\n return (0,_src_main__WEBPACK_IMPORTED_MODULE_0__.run)(config);\n },\n disable: function disable() {\n return (0,_src_main__WEBPACK_IMPORTED_MODULE_0__.remove)();\n }\n};\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/index.js?");
/***/ }),
/***/ "./dev/dark-mode/src/default.js":
/*!**************************************!*\
!*** ./dev/dark-mode/src/default.js ***!
\**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_COLORS: () => (/* binding */ DEFAULT_COLORS),\n/* harmony export */ DEFAULT_COLORSCHEME: () => (/* binding */ DEFAULT_COLORSCHEME),\n/* harmony export */ DEFAULT_SETTINGS: () => (/* binding */ DEFAULT_SETTINGS),\n/* harmony export */ DEFAULT_THEME: () => (/* binding */ DEFAULT_THEME)\n/* harmony export */ });\n// import { ThemeEngine } from \"./generators/theme-engines\";\n// import { isMacOS, isWindows, isCSSColorSchemePropSupported } from \"./utils/platform\";\n// import { AutomationMode } from \"./utils/automation\";\n\nvar DEFAULT_COLORS = {\n darkScheme: {\n // background: \"#181a1b\",\n // text: \"#e8e6e3\",\n\n background: \"#131516\",\n text: \"#d8d4cf\"\n\n // background: \"black\",\n // text: \"white\",\n },\n lightScheme: {\n // background: \"#dcdad7\",\n // text: \"#181a1b\",\n\n background: \"#004daa\",\n text: \"#e8e6e3\"\n }\n};\nvar DEFAULT_THEME = {\n mode: 1,\n brightness: 100,\n contrast: 100,\n grayscale: 0,\n sepia: 0,\n imgGrayscale: false,\n // boolean true | flase\n imgGrayscalePercent: \"100%\",\n // (min:0% | max:100% )\n videoGrayscale: false,\n videoGrayscalePercent: \"100%\",\n useFont: false,\n // fontFamily: isMacOS ? \"Helvetica Neue\" : isWindows ? \"Segoe UI\" : \"Open Sans\",\n fontFamily: \"Open Sans\",\n textStroke: 0,\n engine: \"\",\n //ThemeEngine.dynamicTheme,\n stylesheet: \"\",\n darkSchemeBackgroundColor: DEFAULT_COLORS.darkScheme.background,\n darkSchemeTextColor: DEFAULT_COLORS.darkScheme.text,\n lightSchemeBackgroundColor: DEFAULT_COLORS.lightScheme.background,\n lightSchemeTextColor: DEFAULT_COLORS.lightScheme.text,\n // scrollbarColor: isMacOS ? \"\" : \"auto\",\n scrollbarColor: \"auto\",\n selectionColor: \"auto\",\n styleSystemControls: false,\n lightColorScheme: \"Default\",\n darkColorScheme: \"Default\",\n immediateModify: false\n};\nvar DEFAULT_COLORSCHEME = {\n light: {\n Default: {\n backgroundColor: DEFAULT_COLORS.lightScheme.background,\n textColor: DEFAULT_COLORS.lightScheme.text\n }\n },\n dark: {\n Default: {\n backgroundColor: DEFAULT_COLORS.darkScheme.background,\n textColor: DEFAULT_COLORS.darkScheme.text\n }\n }\n};\nvar DEFAULT_SETTINGS = {\n enabled: true,\n fetchNews: true,\n theme: DEFAULT_THEME,\n presets: [],\n customThemes: [],\n siteList: [],\n siteListEnabled: [],\n applyToListedOnly: false,\n changeBrowserTheme: false,\n syncSettings: true,\n syncSitesFixes: false,\n automation: {\n enabled: false,\n mode: \"\",\n //AutomationMode.NONE,\n behavior: \"OnOff\"\n },\n time: {\n activation: \"18:00\",\n deactivation: \"9:00\"\n },\n location: {\n latitude: null,\n longitude: null\n },\n previewNewDesign: false,\n enableForPDF: true,\n enableForProtectedPages: false,\n enableContextMenus: false,\n detectDarkTheme: false\n};\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/default.js?");
/***/ }),
/***/ "./dev/dark-mode/src/generators/css-filter.js":
/*!****************************************************!*\
!*** ./dev/dark-mode/src/generators/css-filter.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterMode: () => (/* binding */ FilterMode),\n/* harmony export */ cssFilterStyleSheetTemplate: () => (/* binding */ cssFilterStyleSheetTemplate),\n/* harmony export */ getCSSFilterValue: () => (/* binding */ getCSSFilterValue),\n/* harmony export */ getInversionFixesFor: () => (/* binding */ getInversionFixesFor),\n/* harmony export */ hasFirefoxNewRootBehavior: () => (/* binding */ hasFirefoxNewRootBehavior),\n/* harmony export */ hasPatchForChromiumIssue501582: () => (/* binding */ hasPatchForChromiumIssue501582)\n/* harmony export */ });\n/* harmony import */ var _utils_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/matrix */ \"./dev/dark-mode/src/generators/utils/matrix.js\");\n/* harmony import */ var _utils_parse__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/parse */ \"./dev/dark-mode/src/generators/utils/parse.js\");\n/* harmony import */ var _utils_text__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/text */ \"./dev/dark-mode/src/utils/text.js\");\n/* harmony import */ var _utils_url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/url */ \"./dev/dark-mode/src/utils/url.js\");\n/* harmony import */ var _text_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./text-style */ \"./dev/dark-mode/src/generators/text-style.js\");\n/* harmony import */ var _utils_platform__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/platform */ \"./dev/dark-mode/src/utils/platform.js\");\n\n\n\n\n\n\nvar FilterMode;\n(function (FilterMode) {\n FilterMode[FilterMode[\"light\"] = 0] = \"light\";\n FilterMode[FilterMode[\"dark\"] = 1] = \"dark\";\n})(FilterMode || (FilterMode = {}));\n\n/**\n * This checks if the current chromium version has the patch in it.\n * As of Chromium v81.0.4035.0 this has been the situation\n *\n * Bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=501582\n * Patch: https://chromium-review.googlesource.com/c/chromium/src/+/1979258\n */\nfunction hasPatchForChromiumIssue501582() {\n return __CHROMIUM_MV3__ || Boolean(__CHROMIUM_MV2__ && (0,_utils_platform__WEBPACK_IMPORTED_MODULE_5__.compareChromeVersions)(_utils_platform__WEBPACK_IMPORTED_MODULE_5__.chromiumVersion, \"81.0.4035.0\") >= 0);\n}\n\n/**\n * Since Firefox v102.0, they have changed to the new root behavior.\n * This was already the case for Chromium v81.0.4035.0 and Firefox now\n * switched over as well.\n */\nfunction hasFirefoxNewRootBehavior() {\n return Boolean(_utils_platform__WEBPACK_IMPORTED_MODULE_5__.isFirefox && (0,_utils_platform__WEBPACK_IMPORTED_MODULE_5__.compareChromeVersions)(_utils_platform__WEBPACK_IMPORTED_MODULE_5__.firefoxVersion, \"102.0\") >= 0);\n}\n\n// export default function createCSSFilterStyleSheet(config, url, isTopFrame, fixes, index) {\n// const filterValue = getCSSFilterValue(config);\n// const reverseFilterValue = \"invert(100%) hue-rotate(180deg)\";\n// return cssFilterStyleSheetTemplate(\n// filterValue,\n// reverseFilterValue,\n// config,\n// url,\n// isTopFrame,\n// fixes,\n// index\n// );\n// }\n\nfunction cssFilterStyleSheetTemplate(filterValue, reverseFilterValue, config, url, isTopFrame, fixes, index) {\n var fix = getInversionFixesFor(url, fixes, index);\n var lines = [];\n lines.push(\"@media screen {\");\n\n // Add leading rule\n if (filterValue && isTopFrame) {\n lines.push(\"\");\n lines.push(\"/* Leading rule */\");\n lines.push(createLeadingRule(filterValue));\n }\n if (config.mode === FilterMode.dark) {\n // Add reverse rule\n lines.push(\"\");\n lines.push(\"/* Reverse rule */\");\n lines.push(createReverseRule(reverseFilterValue, fix));\n }\n if (config.useFont || config.textStroke > 0) {\n // Add text rule\n lines.push(\"\");\n lines.push(\"/* Font */\");\n lines.push((0,_text_style__WEBPACK_IMPORTED_MODULE_4__.createTextStyle)(config));\n }\n\n // Fix bad font hinting after inversion\n lines.push(\"\");\n lines.push(\"/* Text contrast */\");\n lines.push(\"html {\");\n lines.push(\" text-shadow: 0 0 0 !important;\");\n lines.push(\"}\");\n\n // Full screen fix\n lines.push(\"\");\n lines.push(\"/* Full screen */\");\n [\":-webkit-full-screen\", \":-moz-full-screen\", \":fullscreen\"].forEach(function (fullScreen) {\n lines.push(\"\".concat(fullScreen, \", \").concat(fullScreen, \" * {\"));\n lines.push(\" -webkit-filter: none !important;\");\n lines.push(\" filter: none !important;\");\n lines.push(\"}\");\n });\n if (isTopFrame) {\n var light = [255, 255, 255];\n // If browser affected by Chromium Issue 501582, set dark background on html\n // Or if browser is Firefox v102+\n var bgColor = !hasPatchForChromiumIssue501582() && !hasFirefoxNewRootBehavior() && config.mode === FilterMode.dark ? (0,_utils_matrix__WEBPACK_IMPORTED_MODULE_0__.applyColorMatrix)(light, (0,_utils_matrix__WEBPACK_IMPORTED_MODULE_0__.createFilterMatrix)(config)).map(Math.round) : light;\n lines.push(\"\");\n lines.push(\"/* Page background */\");\n lines.push(\"html {\");\n lines.push(\" background: rgb(\".concat(bgColor.join(\",\"), \") !important;\"));\n lines.push(\"}\");\n }\n if (fix.css && fix.css.length > 0 && config.mode === FilterMode.dark) {\n lines.push(\"\");\n lines.push(\"/* Custom rules */\");\n lines.push(fix.css);\n }\n lines.push(\"\");\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\nfunction getCSSFilterValue(config) {\n var filters = [];\n if (config.mode === FilterMode.dark) {\n filters.push(\"invert(100%) hue-rotate(180deg)\");\n }\n if (config.brightness !== 100) {\n filters.push(\"brightness(\".concat(config.brightness, \"%)\"));\n }\n if (config.contrast !== 100) {\n filters.push(\"contrast(\".concat(config.contrast, \"%)\"));\n }\n if (config.grayscale !== 0) {\n filters.push(\"grayscale(\".concat(config.grayscale, \"%)\"));\n }\n if (config.sepia !== 0) {\n filters.push(\"sepia(\".concat(config.sepia, \"%)\"));\n }\n if (filters.length === 0) {\n return null;\n }\n return filters.join(\" \");\n}\nfunction createLeadingRule(filterValue) {\n return [\"html {\", \" -webkit-filter: \".concat(filterValue, \" !important;\"), \" filter: \".concat(filterValue, \" !important;\"), \"}\"].join(\"\\n\");\n}\nfunction joinSelectors(selectors) {\n return selectors.map(function (s) {\n return s.replace(/\\,$/, \"\");\n }).join(\",\\n\");\n}\nfunction createReverseRule(reverseFilterValue, fix) {\n var lines = [];\n if (fix.invert.length > 0) {\n lines.push(\"\".concat(joinSelectors(fix.invert), \" {\"));\n lines.push(\" -webkit-filter: \".concat(reverseFilterValue, \" !important;\"));\n lines.push(\" filter: \".concat(reverseFilterValue, \" !important;\"));\n lines.push(\"}\");\n }\n if (fix.noinvert.length > 0) {\n lines.push(\"\".concat(joinSelectors(fix.noinvert), \" {\"));\n lines.push(\" -webkit-filter: none !important;\");\n lines.push(\" filter: none !important;\");\n lines.push(\"}\");\n }\n if (fix.removebg.length > 0) {\n lines.push(\"\".concat(joinSelectors(fix.removebg), \" {\"));\n lines.push(\" background: white !important;\");\n lines.push(\"}\");\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Returns fixes for a given URL.\n * If no matches found, common fixes will be returned.\n * @param url Site URL.\n * @param inversionFixes List of inversion fixes.\n */\nfunction getInversionFixesFor(url, fixes, index) {\n var inversionFixes = (0,_utils_parse__WEBPACK_IMPORTED_MODULE_1__.getSitesFixesFor)(url, fixes, index, {\n commands: Object.keys(inversionFixesCommands),\n getCommandPropName: function getCommandPropName(command) {\n return inversionFixesCommands[command];\n },\n parseCommandValue: function parseCommandValue(command, value) {\n if (command === \"CSS\") {\n return value.trim();\n }\n return (0,_utils_text__WEBPACK_IMPORTED_MODULE_2__.parseArray)(value);\n }\n });\n var common = {\n url: inversionFixes[0].url,\n invert: inversionFixes[0].invert || [],\n noinvert: inversionFixes[0].noinvert || [],\n removebg: inversionFixes[0].removebg || [],\n css: inversionFixes[0].css || \"\"\n };\n if (url) {\n // Search for match with given URL\n var matches = inversionFixes.slice(1).filter(function (s) {\n return (0,_utils_url__WEBPACK_IMPORTED_MODULE_3__.isURLInList)(url, s.url);\n }).sort(function (a, b) {\n return b.url[0].length - a.url[0].length;\n });\n if (matches.length > 0) {\n var found = matches[0];\n return {\n url: found.url,\n invert: common.invert.concat(found.invert || []),\n noinvert: common.noinvert.concat(found.noinvert || []),\n removebg: common.removebg.concat(found.removebg || []),\n css: [common.css, found.css].filter(function (s) {\n return s;\n }).join(\"\\n\")\n };\n }\n }\n return common;\n}\nvar inversionFixesCommands = {\n INVERT: \"invert\",\n \"NO INVERT\": \"noinvert\",\n \"REMOVE BG\": \"removebg\",\n CSS: \"css\"\n};\n\n// export function parseInversionFixes(text) {\n// return parseSitesFixesConfig(text, {\n// commands: Object.keys(inversionFixesCommands),\n// getCommandPropName: (command) => inversionFixesCommands[command],\n// parseCommandValue: (command, value) => {\n// if (command === \"CSS\") {\n// return value.trim();\n// }\n// return parseArray(value);\n// },\n// });\n// }\n\n// export function formatInversionFixes(inversionFixes) {\n// const fixes = inversionFixes.slice().sort((a, b) => compareURLPatterns(a.url[0], b.url[0]));\n\n// return formatSitesFixesConfig(fixes, {\n// props: Object.values(inversionFixesCommands),\n// getPropCommandName: (prop) =>\n// Object.entries(inversionFixesCommands).find(([, p]) => p === prop)[0],\n// formatPropValue: (prop, value) => {\n// if (prop === \"css\") {\n// return value.trim().replace(/\\n+/g, \"\\n\");\n// }\n// return formatArray(value).trim();\n// },\n// shouldIgnoreProp: (prop, value) => {\n// if (prop === \"css\") {\n// return !value;\n// }\n// return !(Array.isArray(value) && value.length > 0);\n// },\n// });\n// }\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/generators/css-filter.js?");
/***/ }),
/***/ "./dev/dark-mode/src/generators/modify-colors.js":
/*!*******************************************************!*\
!*** ./dev/dark-mode/src/generators/modify-colors.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clearColorModificationCache: () => (/* binding */ clearColorModificationCache),\n/* harmony export */ modifyBackgroundColor: () => (/* binding */ modifyBackgroundColor),\n/* harmony export */ modifyBorderColor: () => (/* binding */ modifyBorderColor),\n/* harmony export */ modifyColor: () => (/* binding */ modifyColor),\n/* harmony export */ modifyForegroundColor: () => (/* binding */ modifyForegroundColor),\n/* harmony export */ modifyGradientColor: () => (/* binding */ modifyGradientColor),\n/* harmony export */ modifyShadowColor: () => (/* binding */ modifyShadowColor)\n/* harmony export */ });\n/* harmony import */ var _utils_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/color */ \"./dev/dark-mode/src/utils/color.js\");\n/* harmony import */ var _utils_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/math */ \"./dev/dark-mode/src/utils/math.js\");\n/* harmony import */ var _utils_matrix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/matrix */ \"./dev/dark-mode/src/generators/utils/matrix.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\n\n\n\nfunction getBgPole(theme) {\n var isDarkScheme = theme.mode === 1;\n var prop = isDarkScheme ? \"darkSchemeBackgroundColor\" : \"lightSchemeBackgroundColor\";\n return theme[prop];\n}\nfunction getFgPole(theme) {\n var isDarkScheme = theme.mode === 1;\n var prop = isDarkScheme ? \"darkSchemeTextColor\" : \"lightSchemeTextColor\";\n return theme[prop];\n}\nvar colorModificationCache = new Map();\nfunction clearColorModificationCache() {\n colorModificationCache.clear();\n}\nvar rgbCacheKeys = [\"r\", \"g\", \"b\", \"a\"];\nvar themeCacheKeys = [\"mode\", \"brightness\", \"contrast\", \"grayscale\", \"sepia\", \"darkSchemeBackgroundColor\", \"darkSchemeTextColor\", \"lightSchemeBackgroundColor\", \"lightSchemeTextColor\"];\nfunction getCacheId(rgb, theme) {\n var resultId = \"\";\n rgbCacheKeys.forEach(function (key) {\n resultId += \"\".concat(rgb[key], \";\");\n });\n themeCacheKeys.forEach(function (key) {\n resultId += \"\".concat(theme[key], \";\");\n });\n return resultId;\n}\nfunction modifyColorWithCache(rgb, theme, modifyHSL, poleColor, anotherPoleColor) {\n var fnCache;\n if (colorModificationCache.has(modifyHSL)) {\n fnCache = colorModificationCache.get(modifyHSL);\n } else {\n fnCache = new Map();\n colorModificationCache.set(modifyHSL, fnCache);\n }\n var id = getCacheId(rgb, theme);\n if (fnCache.has(id)) {\n return fnCache.get(id);\n }\n var hsl = (0,_utils_color__WEBPACK_IMPORTED_MODULE_0__.rgbToHSL)(rgb);\n var pole = poleColor == null ? null : (0,_utils_color__WEBPACK_IMPORTED_MODULE_0__.parseToHSLWithCache)(poleColor);\n var anotherPole = anotherPoleColor == null ? null : (0,_utils_color__WEBPACK_IMPORTED_MODULE_0__.parseToHSLWithCache)(anotherPoleColor);\n var modified = modifyHSL(hsl, pole, anotherPole);\n var _hslToRGB = (0,_utils_color__WEBPACK_IMPORTED_MODULE_0__.hslToRGB)(modified),\n r = _hslToRGB.r,\n g = _hslToRGB.g,\n b = _hslToRGB.b,\n a = _hslToRGB.a;\n var matrix = (0,_utils_matrix__WEBPACK_IMPORTED_MODULE_2__.createFilterMatrix)(theme);\n var _applyColorMatrix = (0,_utils_matrix__WEBPACK_IMPORTED_MODULE_2__.applyColorMatrix)([r, g, b], matrix),\n _applyColorMatrix2 = _slicedToArray(_applyColorMatrix, 3),\n rf = _applyColorMatrix2[0],\n gf = _applyColorMatrix2[1],\n bf = _applyColorMatrix2[2];\n var color = a === 1 ? (0,_utils_color__WEBPACK_IMPORTED_MODULE_0__.rgbToHexString)({\n r: rf,\n g: gf,\n b: bf\n }) : (0,_utils_color__WEBPACK_IMPORTED_MODULE_0__.rgbToString)({\n r: rf,\n g: gf,\n b: bf,\n a: a\n });\n fnCache.set(id, color);\n return color;\n}\nfunction noopHSL(hsl) {\n return hsl;\n}\nfunction modifyColor(rgb, theme) {\n return modifyColorWithCache(rgb, theme, noopHSL);\n}\nfunction modifyLightSchemeColor(rgb, theme) {\n var poleBg = getBgPole(theme);\n var poleFg = getFgPole(theme);\n return modifyColorWithCache(rgb, theme, modifyLightModeHSL, poleFg, poleBg);\n}\nfunction modifyLightModeHSL(_ref, poleFg, poleBg) {\n var h = _ref.h,\n s = _ref.s,\n l = _ref.l,\n a = _ref.a;\n var isDark = l < 0.5;\n var isNeutral;\n if (isDark) {\n isNeutral = l < 0.2 || s < 0.12;\n } else {\n var isBlue = h > 200 && h < 280;\n isNeutral = s < 0.24 || l > 0.8 && isBlue;\n }\n var hx = h;\n var sx = l;\n if (isNeutral) {\n if (isDark) {\n hx = poleFg.h;\n sx = poleFg.s;\n } else {\n hx = poleBg.h;\n sx = poleBg.s;\n }\n }\n var lx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0, 1, poleFg.l, poleBg.l);\n return {\n h: hx,\n s: sx,\n l: lx,\n a: a\n };\n}\nvar MAX_BG_LIGHTNESS = 0.4;\nfunction modifyBgHSL(_ref2, pole) {\n var h = _ref2.h,\n s = _ref2.s,\n l = _ref2.l,\n a = _ref2.a;\n var isDark = l < 0.5;\n var isBlue = h > 200 && h < 280;\n var isNeutral = s < 0.12 || l > 0.8 && isBlue;\n if (isDark) {\n var _lx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0, 0.5, 0, MAX_BG_LIGHTNESS);\n if (isNeutral) {\n var _hx = pole.h;\n var sx = pole.s;\n return {\n h: _hx,\n s: sx,\n l: _lx,\n a: a\n };\n }\n return {\n h: h,\n s: s,\n l: _lx,\n a: a\n };\n }\n var lx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0.5, 1, MAX_BG_LIGHTNESS, pole.l);\n if (isNeutral) {\n var _hx2 = pole.h;\n var _sx = pole.s;\n return {\n h: _hx2,\n s: _sx,\n l: lx,\n a: a\n };\n }\n var hx = h;\n var isYellow = h > 60 && h < 180;\n if (isYellow) {\n var isCloserToGreen = h > 120;\n if (isCloserToGreen) {\n hx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(h, 120, 180, 135, 180);\n } else {\n hx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(h, 60, 120, 60, 105);\n }\n }\n\n // Lower the lightness, if the resulting\n // hue is in lower yellow spectrum.\n if (hx > 40 && hx < 80) {\n lx *= 0.75;\n }\n return {\n h: hx,\n s: s,\n l: lx,\n a: a\n };\n}\nfunction modifyBackgroundColor(rgb, theme) {\n if (theme.mode === 0) {\n return modifyLightSchemeColor(rgb, theme);\n }\n var pole = getBgPole(theme);\n return modifyColorWithCache(rgb, _objectSpread(_objectSpread({}, theme), {}, {\n mode: 0\n }), modifyBgHSL, pole);\n}\nvar MIN_FG_LIGHTNESS = 0.55;\nfunction modifyBlueFgHue(hue) {\n return (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(hue, 205, 245, 205, 220);\n}\nfunction modifyFgHSL(_ref3, pole) {\n var h = _ref3.h,\n s = _ref3.s,\n l = _ref3.l,\n a = _ref3.a;\n var isLight = l > 0.5;\n var isNeutral = l < 0.2 || s < 0.24;\n var isBlue = !isNeutral && h > 205 && h < 245;\n if (isLight) {\n var _lx2 = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0.5, 1, MIN_FG_LIGHTNESS, pole.l);\n if (isNeutral) {\n var _hx3 = pole.h;\n var sx = pole.s;\n return {\n h: _hx3,\n s: sx,\n l: _lx2,\n a: a\n };\n }\n var _hx4 = h;\n if (isBlue) {\n _hx4 = modifyBlueFgHue(h);\n }\n return {\n h: _hx4,\n s: s,\n l: _lx2,\n a: a\n };\n }\n if (isNeutral) {\n var _hx5 = pole.h;\n var _sx2 = pole.s;\n var _lx3 = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0, 0.5, pole.l, MIN_FG_LIGHTNESS);\n return {\n h: _hx5,\n s: _sx2,\n l: _lx3,\n a: a\n };\n }\n var hx = h;\n var lx;\n if (isBlue) {\n hx = modifyBlueFgHue(h);\n lx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0, 0.5, pole.l, Math.min(1, MIN_FG_LIGHTNESS + 0.05));\n } else {\n lx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0, 0.5, pole.l, MIN_FG_LIGHTNESS);\n }\n return {\n h: hx,\n s: s,\n l: lx,\n a: a\n };\n}\nfunction modifyForegroundColor(rgb, theme) {\n if (theme.mode === 0) {\n return modifyLightSchemeColor(rgb, theme);\n }\n var pole = getFgPole(theme);\n return modifyColorWithCache(rgb, _objectSpread(_objectSpread({}, theme), {}, {\n mode: 0\n }), modifyFgHSL, pole);\n}\nfunction modifyBorderHSL(_ref4, poleFg, poleBg) {\n var h = _ref4.h,\n s = _ref4.s,\n l = _ref4.l,\n a = _ref4.a;\n var isDark = l < 0.5;\n var isNeutral = l < 0.2 || s < 0.24;\n var hx = h;\n var sx = s;\n if (isNeutral) {\n if (isDark) {\n hx = poleFg.h;\n sx = poleFg.s;\n } else {\n hx = poleBg.h;\n sx = poleBg.s;\n }\n }\n var lx = (0,_utils_math__WEBPACK_IMPORTED_MODULE_1__.scale)(l, 0, 1, 0.5, 0.2);\n return {\n h: hx,\n s: sx,\n l: lx,\n a: a\n };\n}\nfunction modifyBorderColor(rgb, theme) {\n if (theme.mode === 0) {\n return modifyLightSchemeColor(rgb, theme);\n }\n var poleFg = getFgPole(theme);\n var poleBg = getBgPole(theme);\n return modifyColorWithCache(rgb, _objectSpread(_objectSpread({}, theme), {}, {\n mode: 0\n }), modifyBorderHSL, poleFg, poleBg);\n}\nfunction modifyShadowColor(rgb, filter) {\n return modifyBackgroundColor(rgb, filter);\n}\nfunction modifyGradientColor(rgb, filter) {\n return modifyBackgroundColor(rgb, filter);\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/generators/modify-colors.js?");
/***/ }),
/***/ "./dev/dark-mode/src/generators/svg-filter.js":
/*!****************************************************!*\
!*** ./dev/dark-mode/src/generators/svg-filter.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createSVGFilterStylesheet: () => (/* binding */ createSVGFilterStylesheet),\n/* harmony export */ getSVGFilterMatrixValue: () => (/* binding */ getSVGFilterMatrixValue),\n/* harmony export */ getSVGReverseFilterMatrixValue: () => (/* binding */ getSVGReverseFilterMatrixValue)\n/* harmony export */ });\n/* harmony import */ var _utils_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/matrix */ \"./dev/dark-mode/src/generators/utils/matrix.js\");\n/* harmony import */ var _css_filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./css-filter */ \"./dev/dark-mode/src/generators/css-filter.js\");\n/* harmony import */ var _utils_platform__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/platform */ \"./dev/dark-mode/src/utils/platform.js\");\n\n\n\nfunction createSVGFilterStylesheet(config, url, isTopFrame, fixes, index) {\n var filterValue;\n var reverseFilterValue;\n if (_utils_platform__WEBPACK_IMPORTED_MODULE_2__.isFirefox) {\n filterValue = getEmbeddedSVGFilterValue(getSVGFilterMatrixValue(config));\n reverseFilterValue = getEmbeddedSVGFilterValue(getSVGReverseFilterMatrixValue());\n } else {\n // Chrome fails with \"Unsafe attempt to load URL ... Domains, protocols and ports must match.\n filterValue = \"url(#dark-reader-filter)\";\n reverseFilterValue = \"url(#dark-reader-reverse-filter)\";\n }\n return (0,_css_filter__WEBPACK_IMPORTED_MODULE_1__.cssFilterStyleSheetTemplate)(filterValue, reverseFilterValue, config, url, isTopFrame, fixes, index);\n}\nfunction getEmbeddedSVGFilterValue(matrixValue) {\n var id = \"adminify-filter\";\n var svg = ['\"].join(\"\");\n return \"url(data:image/svg+xml;base64,\".concat(btoa(svg), \"#\").concat(id, \")\");\n}\nfunction toSVGMatrix(matrix) {\n return matrix.slice(0, 4).map(function (m) {\n return m.map(function (m) {\n return m.toFixed(3);\n }).join(\" \");\n }).join(\" \");\n}\nfunction getSVGFilterMatrixValue(config) {\n return toSVGMatrix((0,_utils_matrix__WEBPACK_IMPORTED_MODULE_0__.createFilterMatrix)(config));\n}\nfunction getSVGReverseFilterMatrixValue() {\n return toSVGMatrix(_utils_matrix__WEBPACK_IMPORTED_MODULE_0__.Matrix.invertNHue());\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/generators/svg-filter.js?");
/***/ }),
/***/ "./dev/dark-mode/src/generators/text-style.js":
/*!****************************************************!*\
!*** ./dev/dark-mode/src/generators/text-style.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createTextStyle: () => (/* binding */ createTextStyle)\n/* harmony export */ });\nfunction createTextStyle(config) {\n var lines = [];\n // Don't target pre elements as they are preformatted element's e.g. code blocks\n // Exclude font libraries to preserve icons\n lines.push('*:not(pre, pre *, code, .far, .fa, .glyphicon, [class*=\"vjs-\"], .fab, .fa-github, .fas, .material-icons, .icofont, .typcn, mu, [class*=\"mu-\"], .glyphicon, .icon) {');\n if (config.useFont && config.fontFamily) {\n // TODO: Validate...\n lines.push(\" font-family: \".concat(config.fontFamily, \" !important;\"));\n }\n if (config.textStroke > 0) {\n lines.push(\" -webkit-text-stroke: \".concat(config.textStroke, \"px !important;\"));\n lines.push(\" text-stroke: \".concat(config.textStroke, \"px !important;\"));\n }\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/generators/text-style.js?");
/***/ }),
/***/ "./dev/dark-mode/src/generators/utils/matrix.js":
/*!******************************************************!*\
!*** ./dev/dark-mode/src/generators/utils/matrix.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Matrix: () => (/* binding */ Matrix),\n/* harmony export */ applyColorMatrix: () => (/* binding */ applyColorMatrix),\n/* harmony export */ createFilterMatrix: () => (/* binding */ createFilterMatrix)\n/* harmony export */ });\n/* harmony import */ var _utils_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/math */ \"./dev/dark-mode/src/utils/math.js\");\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\n\nfunction createFilterMatrix(config) {\n var m = Matrix.identity();\n if (config.sepia !== 0) {\n m = (0,_utils_math__WEBPACK_IMPORTED_MODULE_0__.multiplyMatrices)(m, Matrix.sepia(config.sepia / 100));\n }\n if (config.grayscale !== 0) {\n m = (0,_utils_math__WEBPACK_IMPORTED_MODULE_0__.multiplyMatrices)(m, Matrix.grayscale(config.grayscale / 100));\n }\n if (config.contrast !== 100) {\n m = (0,_utils_math__WEBPACK_IMPORTED_MODULE_0__.multiplyMatrices)(m, Matrix.contrast(config.contrast / 100));\n }\n if (config.brightness !== 100) {\n m = (0,_utils_math__WEBPACK_IMPORTED_MODULE_0__.multiplyMatrices)(m, Matrix.brightness(config.brightness / 100));\n }\n if (config.mode === 1) {\n m = (0,_utils_math__WEBPACK_IMPORTED_MODULE_0__.multiplyMatrices)(m, Matrix.invertNHue());\n }\n return m;\n}\nfunction applyColorMatrix(_ref, matrix) {\n var _ref2 = _slicedToArray(_ref, 3),\n r = _ref2[0],\n g = _ref2[1],\n b = _ref2[2];\n var rgb = [[r / 255], [g / 255], [b / 255], [1], [1]];\n var result = (0,_utils_math__WEBPACK_IMPORTED_MODULE_0__.multiplyMatrices)(matrix, rgb);\n return [0, 1, 2].map(function (i) {\n return (0,_utils_math__WEBPACK_IMPORTED_MODULE_0__.clamp)(Math.round(result[i][0] * 255), 0, 255);\n });\n}\nvar Matrix = {\n identity: function identity() {\n return [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];\n },\n invertNHue: function invertNHue() {\n return [[0.333, -0.667, -0.667, 0, 1], [-0.667, 0.333, -0.667, 0, 1], [-0.667, -0.667, 0.333, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];\n },\n brightness: function brightness(v) {\n return [[v, 0, 0, 0, 0], [0, v, 0, 0, 0], [0, 0, v, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];\n },\n contrast: function contrast(v) {\n var t = (1 - v) / 2;\n return [[v, 0, 0, 0, t], [0, v, 0, 0, t], [0, 0, v, 0, t], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];\n },\n sepia: function sepia(v) {\n return [[0.393 + 0.607 * (1 - v), 0.769 - 0.769 * (1 - v), 0.189 - 0.189 * (1 - v), 0, 0], [0.349 - 0.349 * (1 - v), 0.686 + 0.314 * (1 - v), 0.168 - 0.168 * (1 - v), 0, 0], [0.272 - 0.272 * (1 - v), 0.534 - 0.534 * (1 - v), 0.131 + 0.869 * (1 - v), 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];\n },\n grayscale: function grayscale(v) {\n return [[0.2126 + 0.7874 * (1 - v), 0.7152 - 0.7152 * (1 - v), 0.0722 - 0.0722 * (1 - v), 0, 0], [0.2126 - 0.2126 * (1 - v), 0.7152 + 0.2848 * (1 - v), 0.0722 - 0.0722 * (1 - v), 0, 0], [0.2126 - 0.2126 * (1 - v), 0.7152 - 0.7152 * (1 - v), 0.0722 + 0.9278 * (1 - v), 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];\n }\n};\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/generators/utils/matrix.js?");
/***/ }),
/***/ "./dev/dark-mode/src/generators/utils/parse.js":
/*!*****************************************************!*\
!*** ./dev/dark-mode/src/generators/utils/parse.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getDomain: () => (/* binding */ getDomain),\n/* harmony export */ getSitesFixesFor: () => (/* binding */ getSitesFixesFor),\n/* harmony export */ parseSitesFixesConfig: () => (/* binding */ parseSitesFixesConfig)\n/* harmony export */ });\n/* harmony import */ var _utils_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/url */ \"./dev/dark-mode/src/utils/url.js\");\n/* harmony import */ var _utils_text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/text */ \"./dev/dark-mode/src/utils/text.js\");\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nfunction _createForOfIteratorHelper(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t[\"return\"] || t[\"return\"](); } finally { if (u) throw o; } } }; }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\n\n\nvar INDEX_CACHE_CLEANUP_INTERVAL_IN_MS = 60000;\nfunction parseSitesFixesConfig(text, options) {\n var sites = [];\n var blocks = text.replace(/\\r/g, \"\").split(/^\\s*={2,}\\s*$/gm);\n blocks.forEach(function (block) {\n var lines = block.split(\"\\n\");\n var commandIndices = [];\n lines.forEach(function (ln, i) {\n if (ln.match(/^[A-Z]+(\\s[A-Z]+){0,2}$/)) {\n commandIndices.push(i);\n }\n });\n if (commandIndices.length === 0) {\n return;\n }\n var siteFix = {\n url: (0,_utils_text__WEBPACK_IMPORTED_MODULE_1__.parseArray)(lines.slice(0, commandIndices[0]).join(\"\\n\"))\n };\n commandIndices.forEach(function (commandIndex, i) {\n var command = lines[commandIndex].trim();\n var valueText = lines.slice(commandIndex + 1, i === commandIndices.length - 1 ? lines.length : commandIndices[i + 1]).join(\"\\n\");\n var prop = options.getCommandPropName(command);\n if (!prop) {\n return;\n }\n var value = options.parseCommandValue(command, valueText);\n siteFix[prop] = value;\n });\n sites.push(siteFix);\n });\n return sites;\n}\n// URL patterns are guaranteed to not have protocol and leading '/'\nfunction getDomain(url) {\n try {\n return new URL(url).hostname.toLowerCase();\n } catch (error) {\n return url.split(\"/\")[0].toLowerCase();\n }\n}\n/*\n * Encode all offsets into a string, where each record is 7 bytes long:\n * - 4 bytes for start offset\n * - 3 bytes for record length (end offset - start offset)\n * Both values are stored in base 36 (radix 36) notation.\n * Maximum supported numbers:\n * - start offset must be no more than parseInt('zzzz', 36) = 1679615\n * - length must be no more than parseInt('zzz', 36) = 46655\n *\n * We have to encode offsets into a string to be able to save them in\n * chrome.storage.local for use in non-persistent background contexts.\n */\n// function encodeOffsets(offsets) {\n// return offsets\n// .map(([offset, length]) => {\n// const stringOffset = offset.toString(36);\n// const stringLength = length.toString(36);\n// return (\n// \"0\".repeat(4 - stringOffset.length) +\n// stringOffset +\n// \"0\".repeat(3 - stringLength.length) +\n// stringLength\n// );\n// })\n// .join(\"\");\n// }\n\nfunction decodeOffset(offsets, index) {\n var base = (4 + 3) * index;\n var offset = parseInt(offsets.substring(base + 0, base + 4), 36);\n var length = parseInt(offsets.substring(base + 4, base + 4 + 3), 36);\n return [offset, offset + length];\n}\n\n// function addLabel(set, label, index) {\n// if (!set[label]) {\n// set[label] = [index];\n// } else if (!set[label].includes(index)) {\n// set[label].push(index);\n// }\n// }\n\n// function extractDomainLabelsFromFullyQualifiedDomainWildcard(fullyQualifiedDomainWildcard) {\n// const postfixStart = fullyQualifiedDomainWildcard.lastIndexOf(\"*\");\n// const postfix = fullyQualifiedDomainWildcard.substring(postfixStart + 2);\n// if (postfixStart < 0 || postfix.length === 0) {\n// return fullyQualifiedDomainWildcard.split(\".\");\n// }\n// const labels = [postfix];\n// const prefix = fullyQualifiedDomainWildcard.substring(0, postfixStart);\n// prefix\n// .split(\".\")\n// .filter(Boolean)\n// .forEach((l) => labels.concat(l));\n// return labels;\n// }\n\n// function indexConfigURLs(urls) {\n// const domains = {};\n// const domainLabels = {};\n// const nonstandard = [];\n// const domainLabelFrequencies = {};\n// const domainLabelMembers = [];\n// for (let index = 0; index < urls.length; index++) {\n// const block = urls[index];\n// const blockDomainLabels = new Set();\n// for (const url of block) {\n// const domain = getDomain(url);\n// if (isFullyQualifiedDomain(domain)) {\n// addLabel(domains, domain, index);\n// } else if (isFullyQualifiedDomainWildcard(domain)) {\n// const labels = extractDomainLabelsFromFullyQualifiedDomainWildcard(domain);\n// domainLabelMembers.push({ labels, index });\n// labels.forEach((l) => blockDomainLabels.add(l));\n// } else {\n// // Sitefix parser encountered non-standard URL\n// nonstandard.push(index);\n// break;\n// }\n// }\n// // Compute domain label frequencies, counting each label within each fix only once\n// for (const label of blockDomainLabels) {\n// if (domainLabelFrequencies[label]) {\n// domainLabelFrequencies[label]++;\n// } else {\n// domainLabelFrequencies[label] = 1;\n// }\n// }\n// }\n// // For each domain name, find the most specific label\n// for (const { labels, index } of domainLabelMembers) {\n// let label = labels[0];\n// for (const currLabel of labels) {\n// if (domainLabelFrequencies[currLabel] < domainLabelFrequencies[label]) {\n// label = currLabel;\n// }\n// }\n// addLabel(domainLabels, label, index);\n// }\n// return { domains, domainLabels, nonstandard };\n// }\n\n// function processSiteFixesConfigBlock(text, offsets, recordStart, recordEnd, urls) {\n// // TODO: more formal definition of URLs and delimiters\n// const block = text.substring(recordStart, recordEnd);\n// const lines = block.split(\"\\n\");\n// const commandIndices = [];\n// lines.forEach((ln, i) => {\n// if (ln.match(/^[A-Z]+(\\s[A-Z]+){0,2}$/)) {\n// commandIndices.push(i);\n// }\n// });\n// if (commandIndices.length === 0) {\n// return;\n// }\n// offsets.push([recordStart, recordEnd - recordStart]);\n// const urls_ = parseArray(lines.slice(0, commandIndices[0]).join(\"\\n\"));\n// urls.push(urls_);\n// }\n\n// function extractURLsFromSiteFixesConfig(text) {\n// const urls = [];\n// // Array of tuples, where first number is an offset of record start and second number is record length.\n// const offsets = [];\n// let recordStart = 0;\n// // Delimiter between two blocks\n// const delimiterRegex = /^\\s*={2,}\\s*$/gm;\n// let delimiter;\n// while ((delimiter = delimiterRegex.exec(text))) {\n// const nextDelimiterStart = delimiter.index;\n// const nextDelimiterEnd = delimiter.index + delimiter[0].length;\n// processSiteFixesConfigBlock(text, offsets, recordStart, nextDelimiterStart, urls);\n// recordStart = nextDelimiterEnd;\n// }\n// processSiteFixesConfigBlock(text, offsets, recordStart, text.length, urls);\n// return { urls, offsets };\n// }\n\n// export function indexSitesFixesConfig(text) {\n// const { urls, offsets } = extractURLsFromSiteFixesConfig(text);\n// const { domains, domainLabels, nonstandard } = indexConfigURLs(urls);\n// return {\n// offsets: encodeOffsets(offsets),\n// domains,\n// domainLabels,\n// nonstandard,\n// cacheDomainIndex: {},\n// cacheSiteFix: {},\n// cacheCleanupTimer: null,\n// };\n// }\n\nfunction lookupConfigURLsInDomainLabels(domain, recordIds, currRecordIds, getAllRecordURLs) {\n var _iterator = _createForOfIteratorHelper(currRecordIds),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var recordId = _step.value;\n var recordURLs = getAllRecordURLs(recordId);\n var _iterator2 = _createForOfIteratorHelper(recordURLs),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var ruleUrl = _step2.value;\n var wildcard = getDomain(ruleUrl);\n if ((0,_utils_url__WEBPACK_IMPORTED_MODULE_0__.isFullyQualifiedDomainWildcard)(wildcard) && (0,_utils_url__WEBPACK_IMPORTED_MODULE_0__.fullyQualifiedDomainMatchesWildcard)(wildcard, domain)) {\n recordIds.push(recordId);\n } else {\n // Skip this rule, since the label match must have come from a different URL\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n}\nfunction lookupConfigURLs(domain, index, getAllRecordURLs) {\n var labels = domain.split(\".\");\n var recordIds = [];\n // Common fix\n if (\"*\" in index.domainLabels) {\n recordIds = recordIds.concat(index.domainLabels[\"*\"]);\n }\n // Wildcard fixes\n var _iterator3 = _createForOfIteratorHelper(labels),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var label = _step3.value;\n // We need to use in operator because ids are 0-based and 0 is falsy\n if (label in index.domainLabels) {\n var _currRecordIds = index.domainLabels[label];\n lookupConfigURLsInDomainLabels(domain, recordIds, _currRecordIds, getAllRecordURLs);\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n for (var i = 0; i < labels.length; i++) {\n var substring = labels.slice(i).join(\".\");\n if (substring in index.domains) {\n recordIds = recordIds.concat(index.domains[substring]);\n }\n if (substring in index.domainLabels) {\n var currRecordIds = index.domainLabels[substring];\n lookupConfigURLsInDomainLabels(domain, recordIds, currRecordIds, getAllRecordURLs);\n }\n }\n // Backwards compatibility: check for nonssend over nonstandard patterns, which will be filtered out\n // via regex in content script\n if (index.nonstandard) {\n var _iterator4 = _createForOfIteratorHelper(index.nonstandard),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var currRecordId = _step4.value;\n var urls = getAllRecordURLs(currRecordId);\n if (urls.some(function (url) {\n return (0,_utils_url__WEBPACK_IMPORTED_MODULE_0__.isURLMatched)(domain, getDomain(url));\n })) {\n recordIds.push(currRecordId);\n continue;\n }\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }\n // Deduplicate array elements\n recordIds = Array.from(new Set(recordIds));\n return recordIds;\n}\n/**\n * Extracts a single site fix and parses it (cached)\n * @param text the fix file\n * @param index site fix index\n * @param options fix parsing options\n * @param id numeric index of the fix\n * @returns a single fix\n */\nfunction getSiteFix(text, index, options, id) {\n if (id in index.cacheSiteFix) {\n return index.cacheSiteFix[id];\n }\n var _decodeOffset = decodeOffset(index.offsets, id),\n _decodeOffset2 = _slicedToArray(_decodeOffset, 2),\n blockStart = _decodeOffset2[0],\n blockEnd = _decodeOffset2[1];\n var block = text.substring(blockStart, blockEnd);\n var fix = parseSitesFixesConfig(block, options)[0];\n index.cacheSiteFix[id] = fix;\n return fix;\n}\n/**\n * This function uses setTimeout instead of Alarms API so that background context can\n * go incative (resulting in cleanup of all context variables) and then not be awoken\n * by the alarm.\n * @param index\n */\nfunction scheduleCacheCleanup(index) {\n // if (__TEST__) {\n // return;\n // }\n clearTimeout(index.cacheCleanupTimer);\n index.cacheCleanupTimer = setTimeout(function () {\n index.cacheCleanupTimer = null;\n index.cacheDomainIndex = {};\n index.cacheSiteFix = {};\n }, INDEX_CACHE_CLEANUP_INTERVAL_IN_MS);\n}\n/**\n * Given a URL, raw fixes, and an index, finds the applicable fixes.\n * Note that dependents assume that the first returned fix is a generic fix (has URL pattern '*').\n *\n * This method uses two levels of caching:\n * - caching the site fixes keyed by a numeric id (to avoid re-parsing the site fixes)\n * - caching the numeric ids keyed by domain (to avoid re-computing lists of site fixes for the same site,\n * which is useful if user has multiple tabs of the same site and toggles Dark Reader on)\n */\nfunction getSitesFixesFor(url, text, index, options) {\n var records = [];\n var domain = getDomain(url);\n if (!index.cacheDomainIndex[domain]) {\n index.cacheDomainIndex[domain] = lookupConfigURLs(domain, index, function (recordId) {\n return getSiteFix(text, index, options, recordId).url;\n });\n }\n var recordIds = index.cacheDomainIndex[domain];\n var _iterator5 = _createForOfIteratorHelper(recordIds),\n _step5;\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var recordId = _step5.value;\n var fix = getSiteFix(text, index, options, recordId);\n records.push(fix);\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n scheduleCacheCleanup(index);\n return records;\n}\n\n// export function indexSiteListConfig(text) {\n// const urls = parseArray(text);\n// const urls2D = urls.map((u) => [u]);\n// const { domains, domainLabels, nonstandard } = indexConfigURLs(urls2D);\n// return { domains, domainLabels, nonstandard, urls };\n// }\n\n// function getSiteListFor(url, index) {\n// const domain = getDomain(url);\n// const recordIds = lookupConfigURLs(domain, index, (recordId) => [index.urls[recordId]]);\n// const result = [];\n// for (const recordId of recordIds) {\n// result.push(index.urls[recordId]);\n// }\n// return result;\n// }\n\n// export function isURLInSiteList(url, index) {\n// if (index === null) {\n// return false;\n// }\n// const urls = getSiteListFor(url, index);\n// return isURLInList(url, urls);\n// }\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/generators/utils/parse.js?");
/***/ }),
/***/ "./dev/dark-mode/src/inject/dynamic-theme/css-rules.js":
/*!*************************************************************!*\
!*** ./dev/dark-mode/src/inject/dynamic-theme/css-rules.js ***!
\*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cssImportRegex: () => (/* binding */ cssImportRegex),\n/* harmony export */ cssURLRegex: () => (/* binding */ cssURLRegex),\n/* harmony export */ getCSSBaseBath: () => (/* binding */ getCSSBaseBath),\n/* harmony export */ getCSSURLValue: () => (/* binding */ getCSSURLValue),\n/* harmony export */ iterateCSSDeclarations: () => (/* binding */ iterateCSSDeclarations),\n/* harmony export */ iterateCSSRules: () => (/* binding */ iterateCSSRules),\n/* harmony export */ removeCSSComments: () => (/* binding */ removeCSSComments),\n/* harmony export */ replaceCSSFontFace: () => (/* binding */ replaceCSSFontFace),\n/* harmony export */ replaceCSSRelativeURLsWithAbsolute: () => (/* binding */ replaceCSSRelativeURLsWithAbsolute)\n/* harmony export */ });\n/* harmony import */ var _utils_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/array */ \"./dev/dark-mode/src/utils/array.js\");\n/* harmony import */ var _utils_platform__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/platform */ \"./dev/dark-mode/src/utils/platform.js\");\n/* harmony import */ var _utils_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/url */ \"./dev/dark-mode/src/utils/url.js\");\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\n\n\n\n// import { logInfo, logWarn } from \"../utils/log\";\n\nfunction iterateCSSRules(rules, iterate, onMediaRuleError) {\n (0,_utils_array__WEBPACK_IMPORTED_MODULE_0__.forEach)(rules, function (rule) {\n // Don't rely on prototype or instanceof, they are slow implementations within the browsers.\n // However we can rely on certain properties to indentify which CSSRule we are dealing with.\n // And it's 2x so fast, https://jsben.ch/B0eLa\n if (rule.selectorText) {\n iterate(rule);\n } else if (rule.href) {\n try {\n iterateCSSRules(rule.styleSheet.cssRules, iterate, onMediaRuleError);\n } catch (err) {\n // logInfo(`Found a non-loaded link.`);\n onMediaRuleError && onMediaRuleError();\n }\n } else if (rule.media) {\n var media = Array.from(rule.media);\n var isScreenOrAllOrQuery = media.some(function (m) {\n return m.startsWith(\"screen\") || m.startsWith(\"all\") || m.startsWith(\"(\");\n });\n var isPrintOrSpeech = media.some(function (m) {\n return m.startsWith(\"print\") || m.startsWith(\"speech\");\n });\n if (isScreenOrAllOrQuery || !isPrintOrSpeech) {\n iterateCSSRules(rule.cssRules, iterate, onMediaRuleError);\n }\n } else if (rule.conditionText) {\n if (CSS.supports(rule.conditionText)) {\n iterateCSSRules(rule.cssRules, iterate, onMediaRuleError);\n }\n } else {\n // logWarn(`CSSRule type not supported`, rule);\n }\n });\n}\n\n// These properties are not iterable\n// when they depend on variables\nvar shorthandVarDependantProperties = [\"background\", \"border\", \"border-color\", \"border-bottom\", \"border-left\", \"border-right\", \"border-top\", \"outline\", \"outline-color\"];\nvar shorthandVarDepPropRegexps = _utils_platform__WEBPACK_IMPORTED_MODULE_1__.isSafari ? shorthandVarDependantProperties.map(function (prop) {\n var regexp = new RegExp(\"\".concat(prop, \":\\\\s*(.*?)\\\\s*;\"));\n return [prop, regexp];\n}) : null;\nfunction iterateCSSDeclarations(style, iterate) {\n (0,_utils_array__WEBPACK_IMPORTED_MODULE_0__.forEach)(style, function (property) {\n var value = style.getPropertyValue(property).trim();\n if (!value) {\n return;\n }\n iterate(property, value);\n });\n\n // Bigger sites like gmail.com and google.com will love this optimization.\n // As a side-effect, styles with a lot of `var(` will notice a maximum slowdown of ~50ms.\n // Against the bigger sites that saves around ~150ms+ it's a good win.\n var cssText = style.cssText;\n if (cssText.includes(\"var(\")) {\n if (_utils_platform__WEBPACK_IMPORTED_MODULE_1__.isSafari) {\n // Safari doesn't show shorthand properties' values\n shorthandVarDepPropRegexps.forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n prop = _ref2[0],\n regexp = _ref2[1];\n var match = cssText.match(regexp);\n if (match && match[1]) {\n var val = match[1].trim();\n iterate(prop, val);\n }\n });\n } else {\n shorthandVarDependantProperties.forEach(function (prop) {\n var val = style.getPropertyValue(prop);\n if (val && val.includes(\"var(\")) {\n iterate(prop, val);\n }\n });\n }\n }\n}\nvar cssURLRegex = /url\\((('.*?')|(\".*?\")|([^\\)]*?))\\)/g;\nvar cssImportRegex = /@import\\s*(url\\()?(('.+?')|(\".+?\")|([^\\)]*?))\\)? ?(screen)?;?/gi;\n\n// First try to extract the CSS URL value. Then do some post fixes, like unescaping\n// backslashes in the URL. (Chromium don't handle this natively). Remove all newlines\n// beforehand, otherwise `.` will fail matching the content within the url, as it\n// doesn't match any linebreaks.\nfunction getCSSURLValue(cssURL) {\n return cssURL.trim().replace(/[\\n\\r\\\\]+/g, \"\").replace(/^url\\((.*)\\)$/, \"$1\").trim().replace(/^\"(.*)\"$/, \"$1\").replace(/^'(.*)'$/, \"$1\").replace(/(?:\\\\(.))/g, \"$1\");\n}\nfunction getCSSBaseBath(url) {\n var cssURL = (0,_utils_url__WEBPACK_IMPORTED_MODULE_2__.parseURL)(url);\n return \"\".concat(cssURL.origin).concat(cssURL.pathname.replace(/\\?.*$/, \"\").replace(/(\\/)([^\\/]+)$/i, \"$1\"));\n}\nfunction replaceCSSRelativeURLsWithAbsolute($css, cssBasePath) {\n return $css.replace(cssURLRegex, function (match) {\n var pathValue = getCSSURLValue(match);\n // Sites can have any kind of specified URL, thus also invalid ones.\n // To prevent the whole operation from failing, let's just skip those\n // invalid URL's and let them be invalid.\n try {\n return \"url('\".concat((0,_utils_url__WEBPACK_IMPORTED_MODULE_2__.getAbsoluteURL)(cssBasePath, pathValue), \"')\");\n } catch (err) {\n // logWarn(\"Not able to replace relative URL with Absolute URL, skipping\");\n return match;\n }\n });\n}\nvar cssCommentsRegex = /\\/\\*[\\s\\S]*?\\*\\//g;\nfunction removeCSSComments($css) {\n return $css.replace(cssCommentsRegex, \"\");\n}\nvar fontFaceRegex = /@font-face\\s*{[^}]*}/g;\nfunction replaceCSSFontFace($css) {\n return $css.replace(fontFaceRegex, \"\");\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/css-rules.js?");
/***/ }),
/***/ "./dev/dark-mode/src/inject/dynamic-theme/image.js":
/*!*********************************************************!*\
!*** ./dev/dark-mode/src/inject/dynamic-theme/image.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cleanImageProcessingCache: () => (/* binding */ cleanImageProcessingCache),\n/* harmony export */ getFilteredImageDataURL: () => (/* binding */ getFilteredImageDataURL),\n/* harmony export */ getImageDetails: () => (/* binding */ getImageDetails)\n/* harmony export */ });\n/* harmony import */ var _generators_svg_filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../generators/svg-filter */ \"./dev/dark-mode/src/generators/svg-filter.js\");\n/* harmony import */ var _utils_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/color */ \"./dev/dark-mode/src/utils/color.js\");\n/* harmony import */ var _utils_network__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/network */ \"./dev/dark-mode/src/utils/network.js\");\n/* harmony import */ var _utils_async_queue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/async-queue */ \"./dev/dark-mode/src/utils/async-queue.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\n\n// import { bgFetch } from \"./network\";\n\n\n// import { logInfo, logWarn } from \"../utils/log\";\n\nvar imageManager = new _utils_async_queue__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\nfunction getImageDetails(_x) {\n return _getImageDetails.apply(this, arguments);\n}\nfunction _getImageDetails() {\n _getImageDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url) {\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", new Promise( /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {\n var dataURL, image;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!url.startsWith(\"data:\")) {\n _context.next = 4;\n break;\n }\n dataURL = url;\n _context.next = 14;\n break;\n case 4:\n _context.prev = 4;\n _context.next = 7;\n return getImageDataURL(url);\n case 7:\n dataURL = _context.sent;\n _context.next = 14;\n break;\n case 10:\n _context.prev = 10;\n _context.t0 = _context[\"catch\"](4);\n reject(_context.t0);\n return _context.abrupt(\"return\");\n case 14:\n _context.prev = 14;\n _context.next = 17;\n return urlToImage(dataURL);\n case 17:\n image = _context.sent;\n imageManager.addToQueue(function () {\n resolve(_objectSpread({\n src: url,\n dataURL: dataURL,\n width: image.naturalWidth,\n height: image.naturalHeight\n }, analyzeImage(image)));\n });\n _context.next = 24;\n break;\n case 21:\n _context.prev = 21;\n _context.t1 = _context[\"catch\"](14);\n reject(_context.t1);\n case 24:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[4, 10], [14, 21]]);\n }));\n return function (_x4, _x5) {\n return _ref2.apply(this, arguments);\n };\n }()));\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _getImageDetails.apply(this, arguments);\n}\nfunction getImageDataURL(_x2) {\n return _getImageDataURL.apply(this, arguments);\n}\nfunction _getImageDataURL() {\n _getImageDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url) {\n var parsedURL;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n parsedURL = new URL(url);\n if (!(parsedURL.origin === location.origin)) {\n _context3.next = 5;\n break;\n }\n _context3.next = 4;\n return (0,_utils_network__WEBPACK_IMPORTED_MODULE_2__.loadAsDataURL)(url);\n case 4:\n return _context3.abrupt(\"return\", _context3.sent);\n case 5:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n }));\n return _getImageDataURL.apply(this, arguments);\n}\nfunction urlToImage(_x3) {\n return _urlToImage.apply(this, arguments);\n}\nfunction _urlToImage() {\n _urlToImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url) {\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n return _context4.abrupt(\"return\", new Promise(function (resolve, reject) {\n var image = new Image();\n image.onload = function () {\n return resolve(image);\n };\n image.onerror = function () {\n return reject(\"Unable to load image \".concat(url));\n };\n image.src = url;\n }));\n case 1:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4);\n }));\n return _urlToImage.apply(this, arguments);\n}\nvar MAX_ANALIZE_PIXELS_COUNT = 32 * 32;\nvar canvas;\nvar context;\nfunction createCanvas() {\n var maxWidth = MAX_ANALIZE_PIXELS_COUNT;\n var maxHeight = MAX_ANALIZE_PIXELS_COUNT;\n canvas = document.createElement(\"canvas\");\n canvas.width = maxWidth;\n canvas.height = maxHeight;\n context = canvas.getContext(\"2d\", {\n willReadFrequently: true\n });\n context.imageSmoothingEnabled = false;\n}\nfunction removeCanvas() {\n canvas = null;\n context = null;\n}\n\n// 5MB\nvar MAX_IMAGE_SIZE = 5 * 1024 * 1024;\nfunction analyzeImage(image) {\n if (!canvas) {\n createCanvas();\n }\n var naturalWidth = image.naturalWidth,\n naturalHeight = image.naturalHeight;\n if (naturalHeight === 0 || naturalWidth === 0) {\n // logWarn(`logWarn(Image is empty ${image.currentSrc})`);\n return {\n isDark: false,\n isLight: false,\n isTransparent: false,\n isLarge: false,\n isTooLarge: false\n };\n }\n\n // Get good appromized image size in memory terms.\n // Width * Height * 4(R, G, B, A) and 500B(metadata) because rgba can contain up to 3 digits.\n var size = naturalWidth * naturalHeight * 4;\n // Is it over ~5MB? Let's not decode the image, it's something that's useless to analyze.\n // And very performance senstive for the browser to decode this image(~50ms) and take into account\n // It's being async `drawImage` calls.\n if (size > MAX_IMAGE_SIZE) {\n // logInfo(\"Skipped large image analyzing(Larger than 5mb in memory)\");\n return {\n isDark: false,\n isLight: false,\n isTransparent: false,\n isLarge: false,\n isTooLarge: true\n };\n }\n var naturalPixelsCount = naturalWidth * naturalHeight;\n var k = Math.min(1, Math.sqrt(MAX_ANALIZE_PIXELS_COUNT / naturalPixelsCount));\n var width = Math.ceil(naturalWidth * k);\n var height = Math.ceil(naturalHeight * k);\n context.clearRect(0, 0, width, height);\n context.drawImage(image, 0, 0, naturalWidth, naturalHeight, 0, 0, width, height);\n var imageData = context.getImageData(0, 0, width, height);\n var d = imageData.data;\n var TRANSPARENT_ALPHA_THRESHOLD = 0.05;\n var DARK_LIGHTNESS_THRESHOLD = 0.4;\n var LIGHT_LIGHTNESS_THRESHOLD = 0.7;\n var transparentPixelsCount = 0;\n var darkPixelsCount = 0;\n var lightPixelsCount = 0;\n var i, x, y;\n var r, g, b, a;\n var l;\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n i = 4 * (y * width + x);\n r = d[i + 0];\n g = d[i + 1];\n b = d[i + 2];\n a = d[i + 3];\n if (a / 255 < TRANSPARENT_ALPHA_THRESHOLD) {\n transparentPixelsCount++;\n } else {\n l = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.getSRGBLightness)(r, g, b);\n if (l < DARK_LIGHTNESS_THRESHOLD) {\n darkPixelsCount++;\n }\n if (l > LIGHT_LIGHTNESS_THRESHOLD) {\n lightPixelsCount++;\n }\n }\n }\n }\n var totalPixelsCount = width * height;\n var opaquePixelsCount = totalPixelsCount - transparentPixelsCount;\n var DARK_IMAGE_THRESHOLD = 0.7;\n var LIGHT_IMAGE_THRESHOLD = 0.7;\n var TRANSPARENT_IMAGE_THRESHOLD = 0.1;\n var LARGE_IMAGE_PIXELS_COUNT = 800 * 600;\n return {\n isDark: darkPixelsCount / opaquePixelsCount >= DARK_IMAGE_THRESHOLD,\n isLight: lightPixelsCount / opaquePixelsCount >= LIGHT_IMAGE_THRESHOLD,\n isTransparent: transparentPixelsCount / totalPixelsCount >= TRANSPARENT_IMAGE_THRESHOLD,\n isLarge: naturalPixelsCount >= LARGE_IMAGE_PIXELS_COUNT,\n isTooLarge: false\n };\n}\nfunction getFilteredImageDataURL(_ref, theme) {\n var dataURL = _ref.dataURL,\n width = _ref.width,\n height = _ref.height;\n var matrix = (0,_generators_svg_filter__WEBPACK_IMPORTED_MODULE_0__.getSVGFilterMatrixValue)(theme);\n var svg = [\"\"].join(\"\");\n return \"data:image/svg+xml;base64,\".concat(btoa(svg));\n}\nfunction cleanImageProcessingCache() {\n imageManager && imageManager.stopQueue();\n removeCanvas();\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/image.js?");
/***/ }),
/***/ "./dev/dark-mode/src/inject/dynamic-theme/index.js":
/*!*********************************************************!*\
!*** ./dev/dark-mode/src/inject/dynamic-theme/index.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cleanDynamicThemeCache: () => (/* binding */ cleanDynamicThemeCache),\n/* harmony export */ removeDynamicTheme: () => (/* binding */ removeDynamicTheme),\n/* harmony export */ run_createThemeAndWatchForUpdates: () => (/* binding */ run_createThemeAndWatchForUpdates)\n/* harmony export */ });\n/* harmony import */ var _default__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../default */ \"./dev/dark-mode/src/default.js\");\n/* harmony import */ var _generators_css_filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../generators/css-filter */ \"./dev/dark-mode/src/generators/css-filter.js\");\n/* harmony import */ var _generators_modify_colors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../generators/modify-colors */ \"./dev/dark-mode/src/generators/modify-colors.js\");\n/* harmony import */ var _utils_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/array */ \"./dev/dark-mode/src/utils/array.js\");\n/* harmony import */ var _utils_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/color */ \"./dev/dark-mode/src/utils/color.js\");\n/* harmony import */ var _utils_throttle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/throttle */ \"./dev/dark-mode/src/utils/throttle.js\");\n/* harmony import */ var _utils_url__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils/url */ \"./dev/dark-mode/src/utils/url.js\");\n/* harmony import */ var _utils_visibility__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils/visibility */ \"./dev/dark-mode/src/utils/visibility.js\");\n/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/dom */ \"./dev/dark-mode/src/inject/utils/dom.js\");\n/* harmony import */ var _inline_style__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./inline-style */ \"./dev/dark-mode/src/inject/dynamic-theme/inline-style.js\");\n/* harmony import */ var _modify_css__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modify-css */ \"./dev/dark-mode/src/inject/dynamic-theme/modify-css.js\");\n/* harmony import */ var _style_manager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./style-manager */ \"./dev/dark-mode/src/inject/dynamic-theme/style-manager.js\");\n/* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./variables */ \"./dev/dark-mode/src/inject/dynamic-theme/variables.js\");\n/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./watch */ \"./dev/dark-mode/src/inject/dynamic-theme/watch.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelper(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t[\"return\"] || t[\"return\"](); } finally { if (u) throw o; } } }; }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\n\n\n\n// import { logInfo } from \"../utils/log\";\n\n\n\n\n\nvar filter = _default__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_THEME;\nvar fixes = null;\nvar isIFrame = null;\nvar styleManagers = new Map();\nvar ignoredImageAnalysisSelectors = [];\nvar ignoredInlineSelectors = [];\nvar adoptedStyleManagers = [];\nfunction createOrUpdateStyle(className) {\n var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.head || document;\n var element = root.querySelector(\".\".concat(className));\n if (!element) {\n element = document.createElement(\"style\");\n element.classList.add(\"adminify\");\n element.classList.add(className);\n element.media = \"screen\";\n element.textContent = \"\";\n }\n return element;\n}\nvar nodePositionWatchers = new Map();\n\n// **important**\nfunction setupNodePositionWatcher(node, alias) {\n nodePositionWatchers.has(alias) && nodePositionWatchers.get(alias).stop();\n nodePositionWatchers.set(alias, (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.watchForNodePosition)(node, \"head\"));\n}\nfunction createStaticStyleOverrides() {\n var fallbackStyle = createOrUpdateStyle(\"adminify--fallback\", document);\n fallbackStyle.textContent = (0,_modify_css__WEBPACK_IMPORTED_MODULE_10__.getModifiedFallbackStyle)(filter, {\n strict: true\n });\n document.head.insertBefore(fallbackStyle, document.head.firstChild);\n setupNodePositionWatcher(fallbackStyle, \"fallback\");\n var userAgentStyle = createOrUpdateStyle(\"adminify--user-agent\");\n userAgentStyle.textContent = (0,_modify_css__WEBPACK_IMPORTED_MODULE_10__.getModifiedUserAgentStyle)(filter, isIFrame, filter.styleSystemControls);\n document.head.insertBefore(userAgentStyle, fallbackStyle.nextSibling);\n setupNodePositionWatcher(userAgentStyle, \"user-agent\");\n var textStyle = createOrUpdateStyle(\"adminify--text\");\n if (filter.useFont || filter.textStroke > 0) {\n textStyle.textContent = createTextStyle(filter);\n } else {\n textStyle.textContent = \"\";\n }\n document.head.insertBefore(textStyle, fallbackStyle.nextSibling);\n setupNodePositionWatcher(textStyle, \"text\");\n var invertStyle = createOrUpdateStyle(\"adminify--invert\");\n if (fixes && Array.isArray(fixes.invert) && fixes.invert.length > 0) {\n invertStyle.textContent = [\"\".concat(fixes.invert.join(\", \"), \" {\"), \" filter: \".concat((0,_generators_css_filter__WEBPACK_IMPORTED_MODULE_1__.getCSSFilterValue)(_objectSpread(_objectSpread({}, filter), {}, {\n contrast: filter.mode === 0 ? filter.contrast : clamp(filter.contrast - 10, 0, 100)\n })), \" !important;\"), \"}\"].join(\"\\n\");\n } else {\n invertStyle.textContent = \"\";\n }\n document.head.insertBefore(invertStyle, textStyle.nextSibling);\n setupNodePositionWatcher(invertStyle, \"invert\");\n var inlineStyle = createOrUpdateStyle(\"adminify--inline\");\n inlineStyle.textContent = (0,_inline_style__WEBPACK_IMPORTED_MODULE_9__.getInlineOverrideStyle)();\n document.head.insertBefore(inlineStyle, invertStyle.nextSibling);\n setupNodePositionWatcher(inlineStyle, \"inline\");\n var overrideStyle = createOrUpdateStyle(\"adminify--override\");\n overrideStyle.textContent = fixes && fixes.css ? replaceCSSTemplates(fixes.css) : \"\";\n document.head.appendChild(overrideStyle);\n setupNodePositionWatcher(overrideStyle, \"override\");\n var variableStyle = createOrUpdateStyle(\"adminify--variables\");\n var selectionColors = (0,_modify_css__WEBPACK_IMPORTED_MODULE_10__.getSelectionColor)(filter);\n var _filter = filter,\n darkSchemeBackgroundColor = _filter.darkSchemeBackgroundColor,\n darkSchemeTextColor = _filter.darkSchemeTextColor,\n lightSchemeBackgroundColor = _filter.lightSchemeBackgroundColor,\n lightSchemeTextColor = _filter.lightSchemeTextColor,\n mode = _filter.mode;\n var schemeBackgroundColor = mode === 0 ? lightSchemeBackgroundColor : darkSchemeBackgroundColor;\n var schemeTextColor = mode === 0 ? lightSchemeTextColor : darkSchemeTextColor;\n schemeBackgroundColor = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_2__.modifyBackgroundColor)((0,_utils_color__WEBPACK_IMPORTED_MODULE_4__.parseColorWithCache)(schemeBackgroundColor), filter);\n schemeTextColor = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_2__.modifyForegroundColor)((0,_utils_color__WEBPACK_IMPORTED_MODULE_4__.parseColorWithCache)(schemeTextColor), filter);\n variableStyle.textContent = [\":root {\", \" --adminify-neutral-background: \".concat(schemeBackgroundColor, \";\"), \" --adminify-neutral-text: \".concat(schemeTextColor, \";\"), \" --adminify-selection-background: \".concat(selectionColors.backgroundColorSelection, \";\"), \" --adminify-selection-text: \".concat(selectionColors.foregroundColorSelection, \";\"), \"}\"].join(\"\\n\");\n document.head.insertBefore(variableStyle, inlineStyle.nextSibling);\n setupNodePositionWatcher(variableStyle, \"variables\");\n var rootVarsStyle = createOrUpdateStyle(\"adminify--root-vars\");\n document.head.insertBefore(rootVarsStyle, variableStyle.nextSibling);\n\n //Media Grayscale\n if (filter.imgGrayscale || filter.videoGrayscale) {\n var adminifyMediaCSS = createOrUpdateStyle(\"adminify--media\", document);\n adminifyMediaCSS.textContent = \"\".concat(filter.imgGrayscale ? \"img{filter: grayscale(\".concat(filter.imgGrayscalePercent, \")}\") : \"\").concat(filter.videoGrayscale ? \"video, .wp-block-embed-youtube, .wp-block-embed[data-title=\\\"YouTube\\\"]{filter: grayscale(\".concat(filter.videoGrayscalePercent, \")}\") : \"\");\n document.head.insertBefore(adminifyMediaCSS, rootVarsStyle.nextSibling);\n setupNodePositionWatcher(adminifyMediaCSS, \"media\");\n }\n}\nfunction runDynamicStyle() {\n createDynamicStyleOverrides();\n // watchForUpdates();\n}\nfunction createThemeAndWatchForUpdates() {\n createStaticStyleOverrides();\n if (!(0,_utils_visibility__WEBPACK_IMPORTED_MODULE_7__.documentIsVisible)() && !filter.immediateModify) {\n (0,_utils_visibility__WEBPACK_IMPORTED_MODULE_7__.setDocumentVisibilityListener)(runDynamicStyle);\n } else {\n runDynamicStyle();\n }\n // changeMetaThemeColorWhenAvailable(filter);\n}\n\n//Main Func\nfunction run_createThemeAndWatchForUpdates(config) {\n filter = _objectSpread(_objectSpread({}, filter), config);\n createThemeAndWatchForUpdates();\n}\nvar loadingStylesCounter = 0;\nvar loadingStyles = new Set();\nfunction createManager(element) {\n var loadingStyleId = ++loadingStylesCounter;\n // logInfo(`New manager for element, with loadingStyleID ${loadingStyleId}`, element);\n\n function loadingStart() {\n if (!(0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.isDOMReady)() || !(0,_utils_visibility__WEBPACK_IMPORTED_MODULE_7__.documentIsVisible)()) {\n loadingStyles.add(loadingStyleId);\n // logInfo(`Current amount of styles loading: ${loadingStyles.size}`);\n\n var fallbackStyle = document.querySelector(\".adminify--fallback\");\n if (!fallbackStyle.textContent) {\n fallbackStyle.textContent = (0,_modify_css__WEBPACK_IMPORTED_MODULE_10__.getModifiedFallbackStyle)(filter, {\n strict: false\n });\n }\n }\n }\n function loadingEnd() {\n loadingStyles[\"delete\"](loadingStyleId);\n // logInfo(`Removed loadingStyle ${loadingStyleId}, now awaiting: ${loadingStyles.size}`);\n // logInfo(`To-do to be loaded`, loadingStyles);\n\n // if (loadingStyles.size === 0 && isDOMReady()) {\n if (loadingStyles.size === 0) {\n cleanFallbackStyle();\n }\n }\n function update() {\n var details = manager.details({\n secondRound: true\n });\n if (!details) {\n return;\n }\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.addRulesForMatching(details.rules);\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.matchVariablesAndDependants();\n manager.render(filter, ignoredImageAnalysisSelectors);\n }\n var manager = (0,_style_manager__WEBPACK_IMPORTED_MODULE_11__.manageStyle)(element, {\n update: update,\n loadingStart: loadingStart,\n loadingEnd: loadingEnd\n });\n styleManagers.set(element, manager);\n return manager;\n}\nfunction createDynamicStyleOverrides() {\n var allStyles = (0,_style_manager__WEBPACK_IMPORTED_MODULE_11__.getManageableStyles)(document);\n var newManagers = allStyles.filter(function (style) {\n return !styleManagers.has(style);\n }).map(function (style) {\n return createManager(style);\n });\n newManagers.map(function (manager) {\n return manager.details({\n secondRound: false\n });\n }).filter(function (detail) {\n return detail && detail.rules.length > 0;\n }).forEach(function (detail) {\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.addRulesForMatching(detail.rules);\n });\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.matchVariablesAndDependants();\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.setOnRootVariableChange(function () {\n var rootVarsStyle = createOrUpdateStyle(\"adminify--root-vars\");\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.putRootVars(rootVarsStyle, filter);\n });\n var rootVarsStyle = createOrUpdateStyle(\"adminify--root-vars\");\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.putRootVars(rootVarsStyle, filter);\n styleManagers.forEach(function (manager) {\n return manager.render(filter, ignoredImageAnalysisSelectors);\n });\n if (loadingStyles.size === 0) {\n cleanFallbackStyle();\n }\n newManagers.forEach(function (manager) {\n return manager.watch();\n });\n var inlineStyleElements = (0,_utils_array__WEBPACK_IMPORTED_MODULE_3__.toArray)(document.querySelectorAll(_inline_style__WEBPACK_IMPORTED_MODULE_9__.INLINE_STYLE_SELECTOR));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.iterateShadowHosts)(document.documentElement, function (host) {\n createShadowStaticStyleOverrides(host.shadowRoot);\n var elements = host.shadowRoot.querySelectorAll(_inline_style__WEBPACK_IMPORTED_MODULE_9__.INLINE_STYLE_SELECTOR);\n if (elements.length > 0) {\n push(inlineStyleElements, elements);\n }\n });\n inlineStyleElements.forEach(function (el) {\n return (0,_inline_style__WEBPACK_IMPORTED_MODULE_9__.overrideInlineStyle)(el, filter, ignoredInlineSelectors, ignoredImageAnalysisSelectors);\n });\n // handleAdoptedStyleSheets(document);\n}\nfunction cleanFallbackStyle() {\n var fallback = document.querySelector(\".adminify--fallback\");\n if (fallback) {\n fallback.textContent = \"\";\n }\n}\nfunction replaceCSSTemplates($cssText) {\n return $cssText.replace(/\\${(.+?)}/g, function (_, $color) {\n var color = (0,_utils_color__WEBPACK_IMPORTED_MODULE_4__.parseColorWithCache)($color);\n if (color) {\n return (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_2__.modifyColor)(color, filter);\n }\n // logWarn(\"Couldn't parse CSSTemplate's color.\");\n return $color;\n });\n}\nfunction createShadowStaticStyleOverrides(root) {\n // The shadow DOM may not be populated yet and the custom element implementation\n // may assume that unpopulated shadow root is empty and inadvertently remove\n // Dark Reader's overrides\n var uninit = root.firstChild === null;\n createShadowStaticStyleOverridesInner(root);\n if (uninit) {\n delayedCreateShadowStaticStyleOverrides(root);\n }\n}\nvar shadowRootsWithOverrides = new Set();\nfunction createShadowStaticStyleOverridesInner(root) {\n var inlineStyle = createOrUpdateStyle(\"adminify--inline\", root);\n inlineStyle.textContent = (0,_inline_style__WEBPACK_IMPORTED_MODULE_9__.getInlineOverrideStyle)();\n root.insertBefore(inlineStyle, root.firstChild);\n var overrideStyle = createOrUpdateStyle(\"adminify--override\", root);\n overrideStyle.textContent = fixes && fixes.css ? replaceCSSTemplates(fixes.css) : \"\";\n root.insertBefore(overrideStyle, inlineStyle.nextSibling);\n var invertStyle = createOrUpdateStyle(\"adminify--invert\", root);\n if (fixes && Array.isArray(fixes.invert) && fixes.invert.length > 0) {\n invertStyle.textContent = [\"\".concat(fixes.invert.join(\", \"), \" {\"), \" filter: \".concat((0,_generators_css_filter__WEBPACK_IMPORTED_MODULE_1__.getCSSFilterValue)(_objectSpread(_objectSpread({}, filter), {}, {\n contrast: filter.mode === 0 ? filter.contrast : clamp(filter.contrast - 10, 0, 100)\n })), \" !important;\"), \"}\"].join(\"\\n\");\n } else {\n invertStyle.textContent = \"\";\n }\n root.insertBefore(invertStyle, overrideStyle.nextSibling);\n shadowRootsWithOverrides.add(root);\n}\nfunction delayedCreateShadowStaticStyleOverrides(root) {\n var observer = new MutationObserver(function (mutations, observer) {\n // Disconnect observer immediatelly before making any other changes\n observer.disconnect();\n\n // Do not make any changes unless Dark Reader's fixes have been removed\n var _iterator = _createForOfIteratorHelper(mutations),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _step$value = _step.value,\n type = _step$value.type,\n removedNodes = _step$value.removedNodes;\n if (type === \"childList\") {\n var _iterator2 = _createForOfIteratorHelper(removedNodes),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var _step2$value = _step2.value,\n nodeName = _step2$value.nodeName,\n className = _step2$value.className;\n if (nodeName === \"STYLE\" && [\"adminify adminify--inline\", \"adminify adminify--override\", \"adminify adminify--invert\"].includes(className)) {\n createShadowStaticStyleOverridesInner(root);\n return;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n });\n observer.observe(root, {\n childList: true\n });\n}\n\n//remove styles\n\nfunction removeManager(element) {\n var manager = styleManagers.get(element);\n if (manager) {\n manager.destroy();\n styleManagers[\"delete\"](element);\n }\n}\nvar throttledRenderAllStyles = (0,_utils_throttle__WEBPACK_IMPORTED_MODULE_5__.throttle)(function (callback) {\n styleManagers.forEach(function (manager) {\n return manager.render(filter, ignoredImageAnalysisSelectors);\n });\n adoptedStyleManagers.forEach(function (manager) {\n return manager.render(filter, ignoredImageAnalysisSelectors);\n });\n callback && callback();\n});\nvar cancelRendering = function cancelRendering() {\n throttledRenderAllStyles.cancel();\n};\nvar metaObserver;\nfunction removeDynamicTheme() {\n document.documentElement.removeAttribute(\"data-adminify-mode\");\n document.documentElement.removeAttribute(\"data-adminify-scheme\");\n cleanDynamicThemeCache();\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.querySelector(\".adminify--fallback\"));\n if (document.head) {\n // restoreMetaThemeColor();\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector(\".adminify--user-agent\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector(\".adminify--text\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector(\".adminify--invert\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector(\".adminify--inline\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector(\".adminify--override\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector(\".adminify--variables\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector(\".adminify--root-vars\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(document.head.querySelector('meta[name=\"adminify\"]'));\n // removeProxy();\n }\n shadowRootsWithOverrides.forEach(function (root) {\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(root.querySelector(\".adminify--inline\"));\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeNode)(root.querySelector(\".adminify--override\"));\n });\n shadowRootsWithOverrides.clear();\n (0,_utils_array__WEBPACK_IMPORTED_MODULE_3__.forEach)(styleManagers.keys(), function (el) {\n return removeManager(el);\n });\n loadingStyles.clear();\n\n // cleanLoadingLinks();\n // forEach(document.querySelectorAll(\".adminify\"), removeNode);\n // adoptedStyleManagers.forEach((manager) => {\n // manager.destroy();\n // });\n // adoptedStyleManagers.splice(0);\n // metaObserver && metaObserver.disconnect();\n}\nfunction cleanDynamicThemeCache() {\n _variables__WEBPACK_IMPORTED_MODULE_12__.variablesStore.clear();\n _utils_url__WEBPACK_IMPORTED_MODULE_6__.parsedURLCache.clear();\n (0,_utils_visibility__WEBPACK_IMPORTED_MODULE_7__.removeDocumentVisibilityListener)();\n cancelRendering();\n stopWatchingForUpdates();\n (0,_modify_css__WEBPACK_IMPORTED_MODULE_10__.cleanModificationCache)();\n (0,_utils_color__WEBPACK_IMPORTED_MODULE_4__.clearColorCache)();\n}\nfunction stopWatchingForUpdates() {\n styleManagers.forEach(function (manager) {\n return manager.pause();\n });\n stopStylePositionWatchers();\n (0,_watch__WEBPACK_IMPORTED_MODULE_13__.stopWatchingForStyleChanges)();\n (0,_inline_style__WEBPACK_IMPORTED_MODULE_9__.stopWatchingForInlineStyles)();\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.removeDOMReadyListener)(onDOMReady);\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_8__.cleanReadyStateCompleteListeners)();\n}\nfunction stopStylePositionWatchers() {\n (0,_utils_array__WEBPACK_IMPORTED_MODULE_3__.forEach)(nodePositionWatchers.values(), function (watcher) {\n return watcher.stop();\n });\n nodePositionWatchers.clear();\n}\nfunction onDOMReady() {\n if (loadingStyles.size === 0) {\n cleanFallbackStyle();\n return;\n }\n // logWarn(`DOM is ready, but still have styles being loaded.`, loadingStyles);\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/index.js?");
/***/ }),
/***/ "./dev/dark-mode/src/inject/dynamic-theme/inline-style.js":
/*!****************************************************************!*\
!*** ./dev/dark-mode/src/inject/dynamic-theme/inline-style.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ INLINE_STYLE_SELECTOR: () => (/* binding */ INLINE_STYLE_SELECTOR),\n/* harmony export */ getInlineOverrideStyle: () => (/* binding */ getInlineOverrideStyle),\n/* harmony export */ overrideInlineStyle: () => (/* binding */ overrideInlineStyle),\n/* harmony export */ stopWatchingForInlineStyles: () => (/* binding */ stopWatchingForInlineStyles)\n/* harmony export */ });\n/* harmony import */ var _utils_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/array */ \"./dev/dark-mode/src/utils/array.js\");\n/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/dom */ \"./dev/dark-mode/src/inject/utils/dom.js\");\n/* harmony import */ var _css_rules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./css-rules */ \"./dev/dark-mode/src/inject/dynamic-theme/css-rules.js\");\n/* harmony import */ var _modify_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modify-css */ \"./dev/dark-mode/src/inject/dynamic-theme/modify-css.js\");\n/* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variables */ \"./dev/dark-mode/src/inject/dynamic-theme/variables.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n\n\n\n\n\nvar overrides = {\n \"background-color\": {\n customProp: \"--adminify-inline-bgcolor\",\n cssProp: \"background-color\",\n dataAttr: \"data-adminify-inline-bgcolor\"\n },\n \"background-image\": {\n customProp: \"--adminify-inline-bgimage\",\n cssProp: \"background-image\",\n dataAttr: \"data-adminify-inline-bgimage\"\n },\n \"border-color\": {\n customProp: \"--adminify-inline-border\",\n cssProp: \"border-color\",\n dataAttr: \"data-adminify-inline-border\"\n },\n \"border-bottom-color\": {\n customProp: \"--adminify-inline-border-bottom\",\n cssProp: \"border-bottom-color\",\n dataAttr: \"data-adminify-inline-border-bottom\"\n },\n \"border-left-color\": {\n customProp: \"--adminify-inline-border-left\",\n cssProp: \"border-left-color\",\n dataAttr: \"data-adminify-inline-border-left\"\n },\n \"border-right-color\": {\n customProp: \"--adminify-inline-border-right\",\n cssProp: \"border-right-color\",\n dataAttr: \"data-adminify-inline-border-right\"\n },\n \"border-top-color\": {\n customProp: \"--adminify-inline-border-top\",\n cssProp: \"border-top-color\",\n dataAttr: \"data-adminify-inline-border-top\"\n },\n \"box-shadow\": {\n customProp: \"--adminify-inline-boxshadow\",\n cssProp: \"box-shadow\",\n dataAttr: \"data-adminify-inline-boxshadow\"\n },\n color: {\n customProp: \"--adminify-inline-color\",\n cssProp: \"color\",\n dataAttr: \"data-adminify-inline-color\"\n },\n fill: {\n customProp: \"--adminify-inline-fill\",\n cssProp: \"fill\",\n dataAttr: \"data-adminify-inline-fill\"\n },\n stroke: {\n customProp: \"--adminify-inline-stroke\",\n cssProp: \"stroke\",\n dataAttr: \"data-adminify-inline-stroke\"\n },\n \"outline-color\": {\n customProp: \"--adminify-inline-outline\",\n cssProp: \"outline-color\",\n dataAttr: \"data-adminify-inline-outline\"\n },\n \"stop-color\": {\n customProp: \"--adminify-inline-stopcolor\",\n cssProp: \"stop-color\",\n dataAttr: \"data-adminify-inline-stopcolor\"\n }\n};\nvar overridesList = Object.values(overrides);\nvar normalizedPropList = {};\noverridesList.forEach(function (_ref) {\n var cssProp = _ref.cssProp,\n customProp = _ref.customProp;\n return normalizedPropList[customProp] = cssProp;\n});\nvar INLINE_STYLE_ATTRS = [\"style\", \"fill\", \"stop-color\", \"stroke\", \"bgcolor\", \"color\"];\nvar INLINE_STYLE_SELECTOR = INLINE_STYLE_ATTRS.map(function (attr) {\n return \"[\".concat(attr, \"]\");\n}).join(\", \");\nfunction getInlineOverrideStyle() {\n return overridesList.map(function (_ref2) {\n var dataAttr = _ref2.dataAttr,\n customProp = _ref2.customProp,\n cssProp = _ref2.cssProp;\n return [\"[\".concat(dataAttr, \"] {\"), \" \".concat(cssProp, \": var(\").concat(customProp, \") !important;\"), \"}\"].join(\"\\n\");\n }).join(\"\\n\");\n}\nvar inlineStyleCache = new WeakMap();\nvar filterProps = [\"brightness\", \"contrast\", \"grayscale\", \"sepia\", \"mode\"];\nfunction getInlineStyleCacheKey(el, theme) {\n return INLINE_STYLE_ATTRS.map(function (attr) {\n return \"\".concat(attr, \"=\\\"\").concat(el.getAttribute(attr), \"\\\"\");\n }).concat(filterProps.map(function (prop) {\n return \"\".concat(prop, \"=\\\"\").concat(theme[prop], \"\\\"\");\n })).join(\" \");\n}\nfunction overrideInlineStyle(element, theme, ignoreInlineSelectors, ignoreImageSelectors) {\n var cacheKey = getInlineStyleCacheKey(element, theme);\n if (cacheKey === inlineStyleCache.get(element)) {\n return;\n }\n var unsetProps = new Set(Object.keys(overrides));\n function setCustomProp(targetCSSProp, modifierCSSProp, cssVal) {\n var isPropertyVariable = targetCSSProp.startsWith(\"--\");\n var _ref3 = isPropertyVariable ? {} : overrides[targetCSSProp],\n customProp = _ref3.customProp,\n dataAttr = _ref3.dataAttr;\n var mod = (0,_modify_css__WEBPACK_IMPORTED_MODULE_3__.getModifiableCSSDeclaration)(modifierCSSProp, cssVal, {\n style: element.style\n }, _variables__WEBPACK_IMPORTED_MODULE_4__.variablesStore, ignoreImageSelectors, null);\n if (!mod) {\n return;\n }\n var value = mod.value;\n if (typeof value === \"function\") {\n value = value(theme);\n }\n\n // typeof value === 'object' always evaluate to true when\n // `isPropertyVariable` is true, but it serves as a type hint for typescript.\n // Such that `as ReturnType` won't error about the possible\n // string type.\n if (isPropertyVariable && _typeof(value) === \"object\") {\n var typedValue = value;\n typedValue.declarations.forEach(function (_ref4) {\n var property = _ref4.property,\n value = _ref4.value;\n !(value instanceof Promise) && element.style.setProperty(property, value);\n });\n\n // TODO: add listener for `onTypeChange`.\n } else {\n element.style.setProperty(customProp, value);\n if (!element.hasAttribute(dataAttr)) {\n element.setAttribute(dataAttr, \"\");\n }\n unsetProps[\"delete\"](targetCSSProp);\n }\n }\n if (ignoreInlineSelectors.length > 0) {\n if (shouldIgnoreInlineStyle(element, ignoreInlineSelectors)) {\n unsetProps.forEach(function (cssProp) {\n element.removeAttribute(overrides[cssProp].dataAttr);\n });\n return;\n }\n }\n if (element.hasAttribute(\"bgcolor\")) {\n var value = element.getAttribute(\"bgcolor\");\n if (value.match(/^[0-9a-f]{3}$/i) || value.match(/^[0-9a-f]{6}$/i)) {\n value = \"#\".concat(value);\n }\n setCustomProp(\"background-color\", \"background-color\", value);\n }\n\n // We can catch some link elements here, that are from ``.\n // It's valid HTML code according to the specs, https://html.spec.whatwg.org/#attr-link-color\n // We don't want to touch such links, as it cause weird browser behavior (silent DOMException).\n if (element.hasAttribute(\"color\") && element.rel !== \"mask-icon\") {\n var _value = element.getAttribute(\"color\");\n if (_value.match(/^[0-9a-f]{3}$/i) || _value.match(/^[0-9a-f]{6}$/i)) {\n _value = \"#\".concat(_value);\n }\n setCustomProp(\"color\", \"color\", _value);\n }\n if (element instanceof SVGElement) {\n if (element.hasAttribute(\"fill\")) {\n var SMALL_SVG_LIMIT = 32;\n var _value2 = element.getAttribute(\"fill\");\n if (_value2 !== \"none\") {\n if (!(element instanceof SVGTextElement)) {\n // getBoundingClientRect forces a layout change. And when it happens and\n // the DOM is not in the `complete` readystate, it will cause the layout to be drawn\n // and it will cause a layout of unstyled content which results in white flashes.\n // Therefore, check if the DOM is at the `complete` readystate.\n var handleSVGElement = function handleSVGElement() {\n var _element$getBoundingC = element.getBoundingClientRect(),\n width = _element$getBoundingC.width,\n height = _element$getBoundingC.height;\n var isBg = width > SMALL_SVG_LIMIT || height > SMALL_SVG_LIMIT;\n setCustomProp(\"fill\", isBg ? \"background-color\" : \"color\", _value2);\n };\n if ((0,_utils_dom__WEBPACK_IMPORTED_MODULE_1__.isReadyStateComplete)()) {\n handleSVGElement();\n } else {\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_1__.addReadyStateCompleteListener)(handleSVGElement);\n }\n } else {\n setCustomProp(\"fill\", \"color\", _value2);\n }\n }\n }\n if (element.hasAttribute(\"stop-color\")) {\n setCustomProp(\"stop-color\", \"background-color\", element.getAttribute(\"stop-color\"));\n }\n }\n if (element.hasAttribute(\"stroke\")) {\n var _value3 = element.getAttribute(\"stroke\");\n setCustomProp(\"stroke\", element instanceof SVGLineElement || element instanceof SVGTextElement ? \"border-color\" : \"color\", _value3);\n }\n element.style && (0,_css_rules__WEBPACK_IMPORTED_MODULE_2__.iterateCSSDeclarations)(element.style, function (property, value) {\n // Temporarily ignore background images due to the possible performance\n // issues and complexity of handling async requests.\n if (property === \"background-image\" && value.includes(\"url\")) {\n return;\n }\n if (overrides.hasOwnProperty(property) || property.startsWith(\"--\") && !normalizedPropList[property]) {\n setCustomProp(property, property, value);\n } else {\n var overridenProp = normalizedPropList[property];\n if (overridenProp && !element.style.getPropertyValue(overridenProp) && !element.hasAttribute(overridenProp)) {\n if (overridenProp === \"background-color\" && element.hasAttribute(\"bgcolor\")) {\n return;\n }\n element.style.setProperty(property, \"\");\n }\n }\n });\n if (element.style && element instanceof SVGTextElement && element.style.fill) {\n setCustomProp(\"fill\", \"color\", element.style.getPropertyValue(\"fill\"));\n }\n (0,_utils_array__WEBPACK_IMPORTED_MODULE_0__.forEach)(unsetProps, function (cssProp) {\n element.removeAttribute(overrides[cssProp].dataAttr);\n });\n inlineStyleCache.set(element, getInlineStyleCacheKey(element, theme));\n}\nvar treeObservers = new Map();\nvar attrObservers = new Map();\nfunction stopWatchingForInlineStyles() {\n treeObservers.forEach(function (o) {\n return o.disconnect();\n });\n attrObservers.forEach(function (o) {\n return o.disconnect();\n });\n treeObservers.clear();\n attrObservers.clear();\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/inline-style.js?");
/***/ }),
/***/ "./dev/dark-mode/src/inject/dynamic-theme/modify-css.js":
/*!**************************************************************!*\
!*** ./dev/dark-mode/src/inject/dynamic-theme/modify-css.js ***!
\**************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cleanModificationCache: () => (/* binding */ cleanModificationCache),\n/* harmony export */ getBgImageModifier: () => (/* binding */ getBgImageModifier),\n/* harmony export */ getModifiableCSSDeclaration: () => (/* binding */ getModifiableCSSDeclaration),\n/* harmony export */ getModifiedFallbackStyle: () => (/* binding */ getModifiedFallbackStyle),\n/* harmony export */ getModifiedUserAgentStyle: () => (/* binding */ getModifiedUserAgentStyle),\n/* harmony export */ getSelectionColor: () => (/* binding */ getSelectionColor),\n/* harmony export */ getShadowModifier: () => (/* binding */ getShadowModifier),\n/* harmony export */ getShadowModifierWithInfo: () => (/* binding */ getShadowModifierWithInfo)\n/* harmony export */ });\n/* harmony import */ var _generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../generators/modify-colors */ \"./dev/dark-mode/src/generators/modify-colors.js\");\n/* harmony import */ var _utils_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/color */ \"./dev/dark-mode/src/utils/color.js\");\n/* harmony import */ var _utils_math__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/math */ \"./dev/dark-mode/src/utils/math.js\");\n/* harmony import */ var _utils_parsing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/parsing */ \"./dev/dark-mode/src/utils/parsing.js\");\n/* harmony import */ var _utils_platform__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/platform */ \"./dev/dark-mode/src/utils/platform.js\");\n/* harmony import */ var _utils_text__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/text */ \"./dev/dark-mode/src/utils/text.js\");\n/* harmony import */ var _utils_url__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils/url */ \"./dev/dark-mode/src/utils/url.js\");\n/* harmony import */ var _css_rules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./css-rules */ \"./dev/dark-mode/src/inject/dynamic-theme/css-rules.js\");\n/* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./image */ \"./dev/dark-mode/src/inject/dynamic-theme/image.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\n\n// import { logInfo, logWarn } from \"../utils/log\";\n\n\nvar fallbackFactory = null;\nfunction getPriority(ruleStyle, property) {\n return Boolean(ruleStyle && ruleStyle.getPropertyPriority(property));\n}\nvar unparsableColors = new Set([\"inherit\", \"transparent\", \"initial\", \"currentcolor\", \"none\", \"unset\"]);\nfunction getColorModifier(prop, value, rule) {\n if (unparsableColors.has(value.toLowerCase())) {\n return value;\n }\n var rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.parseColorWithCache)(value);\n if (!rgb) {\n // logWarn(\"Couldn't parse color\", value);\n return null;\n }\n if (prop.includes(\"background\")) {\n if (rule.style.webkitMaskImage && rule.style.webkitMaskImage !== \"none\" || rule.style.webkitMask && !rule.style.webkitMask.startsWith(\"none\") || rule.style.mask && rule.style.mask !== \"none\" || rule.style.getPropertyValue(\"mask-image\") && rule.style.getPropertyValue(\"mask-image\") !== \"none\") {\n return function (filter) {\n return (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)(rgb, filter);\n };\n }\n return function (filter) {\n return (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)(rgb, filter);\n };\n }\n if (prop.includes(\"border\") || prop.includes(\"outline\")) {\n return function (filter) {\n return (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBorderColor)(rgb, filter);\n };\n }\n return function (filter) {\n return (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)(rgb, filter);\n };\n}\nfunction getVariableModifier(variablesStore, prop, value, rule, ignoredImgSelectors, isCancelled) {\n return variablesStore.getModifierForVariable({\n varName: prop,\n sourceValue: value,\n rule: rule,\n ignoredImgSelectors: ignoredImgSelectors,\n isCancelled: isCancelled\n });\n}\nfunction getVariableDependantModifier(variablesStore, prop, value) {\n return variablesStore.getModifierForVarDependant(prop, value);\n}\nfunction getShadowModifier(value) {\n var shadowModifier = getShadowModifierWithInfo(value);\n if (!shadowModifier) {\n return null;\n }\n return function (theme) {\n return shadowModifier(theme).result;\n };\n}\nfunction getModifiableCSSDeclaration(property, value, rule, variablesStore, ignoreImageSelectors, isCancelled) {\n if (property.startsWith(\"--\")) {\n var modifier = getVariableModifier(variablesStore, property, value, rule, ignoreImageSelectors, isCancelled);\n if (modifier) {\n return {\n property: property,\n value: modifier,\n important: getPriority(rule.style, property),\n sourceValue: value\n };\n }\n } else if (value.includes(\"var(\")) {\n var _modifier = getVariableDependantModifier(variablesStore, property, value);\n if (_modifier) {\n return {\n property: property,\n value: _modifier,\n important: getPriority(rule.style, property),\n sourceValue: value\n };\n }\n } else if (property === \"color-scheme\") {\n // Note: this if statement needs to be above the next one\n // logWarn(\"CSS property color-scheme is not supported\");\n return null;\n } else if (property.includes(\"color\") && property !== \"-webkit-print-color-adjust\" || property === \"fill\" || property === \"stroke\" || property === \"stop-color\") {\n var _modifier2 = getColorModifier(property, value, rule);\n if (_modifier2) {\n return {\n property: property,\n value: _modifier2,\n important: getPriority(rule.style, property),\n sourceValue: value\n };\n }\n } else if (property === \"background-image\" || property === \"list-style-image\") {\n var _modifier3 = getBgImageModifier(value, rule, ignoreImageSelectors, isCancelled);\n if (_modifier3) {\n return {\n property: property,\n value: _modifier3,\n important: getPriority(rule.style, property),\n sourceValue: value\n };\n }\n } else if (property.includes(\"shadow\")) {\n var _modifier4 = getShadowModifier(value);\n if (_modifier4) {\n return {\n property: property,\n value: _modifier4,\n important: getPriority(rule.style, property),\n sourceValue: value\n };\n }\n }\n return null;\n}\n\n// **important**\nfunction getModifiedFallbackStyle(filter, _ref) {\n var strict = _ref.strict;\n var factory = fallbackFactory || defaultFallbackFactory;\n return factory(filter, {\n strict: strict\n });\n}\nfunction joinSelectors() {\n for (var _len = arguments.length, selectors = new Array(_len), _key = 0; _key < _len; _key++) {\n selectors[_key] = arguments[_key];\n }\n return selectors.filter(Boolean).join(\", \");\n}\n\n// **important**\nfunction defaultFallbackFactory(filter, _ref2) {\n var strict = _ref2.strict;\n var lines = [];\n // https://github.com/darkreader/darkreader/issues/3618#issuecomment-895477598\n var isMicrosoft = [\"microsoft.com\", \"docs.microsoft.com\"].includes(location.hostname);\n lines.push(\"html, body, \".concat(strict ? \"body :not(iframe)\".concat(isMicrosoft ? ':not(div[style^=\"position:absolute;top:0;left:-\"]' : \"\") : \"body > :not(iframe)\", \" {\"));\n lines.push(\" background-color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 255,\n g: 255,\n b: 255\n }, filter), \" !important;\"));\n lines.push(\" border-color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBorderColor)({\n r: 64,\n g: 64,\n b: 64\n }, filter), \" !important;\"));\n lines.push(\" color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)({\n r: 0,\n g: 0,\n b: 0\n }, filter), \" !important;\"));\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\nfunction getSelectionColor(theme) {\n var backgroundColorSelection;\n var foregroundColorSelection;\n if (theme.selectionColor === \"auto\") {\n backgroundColorSelection = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 0,\n g: 96,\n b: 212\n }, _objectSpread(_objectSpread({}, theme), {}, {\n grayscale: 0\n }));\n foregroundColorSelection = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)({\n r: 255,\n g: 255,\n b: 255\n }, _objectSpread(_objectSpread({}, theme), {}, {\n grayscale: 0\n }));\n } else {\n var rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.parseColorWithCache)(theme.selectionColor);\n var hsl = rgbToHSL(rgb);\n backgroundColorSelection = theme.selectionColor;\n if (hsl.l < 0.5) {\n foregroundColorSelection = \"#FFF\";\n } else {\n foregroundColorSelection = \"#000\";\n }\n }\n return {\n backgroundColorSelection: backgroundColorSelection,\n foregroundColorSelection: foregroundColorSelection\n };\n}\nfunction getModifiedSelectionStyle(theme) {\n var lines = [];\n var modifiedSelectionColor = getSelectionColor(theme);\n var backgroundColorSelection = modifiedSelectionColor.backgroundColorSelection;\n var foregroundColorSelection = modifiedSelectionColor.foregroundColorSelection;\n [\"::selection\", \"::-moz-selection\"].forEach(function (selection) {\n lines.push(\"\".concat(selection, \" {\"));\n lines.push(\" background-color: \".concat(backgroundColorSelection, \" !important;\"));\n lines.push(\" color: \".concat(foregroundColorSelection, \" !important;\"));\n lines.push(\"}\");\n });\n return lines.join(\"\\n\");\n}\nfunction getModifiedUserAgentStyle(theme, isIFrame, styleSystemControls) {\n var lines = [];\n if (!isIFrame) {\n lines.push(\"html {\");\n lines.push(\" background-color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 255,\n g: 255,\n b: 255\n }, theme), \" !important;\"));\n lines.push(\"}\");\n }\n if (_utils_platform__WEBPACK_IMPORTED_MODULE_4__.isCSSColorSchemePropSupported) {\n lines.push(\"html {\");\n lines.push(\" color-scheme: \".concat(theme.mode === 1 ? \"dark\" : \"dark light\", \" !important;\"));\n lines.push(\"}\");\n }\n var bgSelectors = joinSelectors(isIFrame ? \"\" : \"html, body\", styleSystemControls ? \"input, textarea, select, button, dialog\" : \"\");\n if (bgSelectors) {\n lines.push(\"\".concat(bgSelectors, \" {\"));\n lines.push(\" background-color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 255,\n g: 255,\n b: 255\n }, theme), \";\"));\n lines.push(\"}\");\n }\n lines.push(\"\".concat(joinSelectors(\"html, body\", styleSystemControls ? \"input, textarea, select, button\" : \"\"), \" {\"));\n lines.push(\" border-color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBorderColor)({\n r: 76,\n g: 76,\n b: 76\n }, theme), \";\"));\n lines.push(\" color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)({\n r: 0,\n g: 0,\n b: 0\n }, theme), \";\"));\n lines.push(\"}\");\n lines.push(\"a {\");\n lines.push(\" color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)({\n r: 0,\n g: 64,\n b: 255\n }, theme), \";\"));\n lines.push(\"}\");\n lines.push(\"table {\");\n lines.push(\" border-color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBorderColor)({\n r: 128,\n g: 128,\n b: 128\n }, theme), \";\"));\n lines.push(\"}\");\n lines.push(\"::placeholder {\");\n lines.push(\" color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)({\n r: 169,\n g: 169,\n b: 169\n }, theme), \";\"));\n lines.push(\"}\");\n lines.push(\"input:-webkit-autofill,\");\n lines.push(\"textarea:-webkit-autofill,\");\n lines.push(\"select:-webkit-autofill {\");\n lines.push(\" background-color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 250,\n g: 255,\n b: 189\n }, theme), \" !important;\"));\n lines.push(\" color: \".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)({\n r: 0,\n g: 0,\n b: 0\n }, theme), \" !important;\"));\n lines.push(\"}\");\n if (theme.scrollbarColor) {\n lines.push(getModifiedScrollbarStyle(theme));\n }\n if (theme.selectionColor) {\n lines.push(getModifiedSelectionStyle(theme));\n }\n return lines.join(\"\\n\");\n}\nfunction getModifiedScrollbarStyle(theme) {\n var lines = [];\n var colorTrack;\n var colorIcons;\n var colorThumb;\n var colorThumbHover;\n var colorThumbActive;\n var colorCorner;\n if (theme.scrollbarColor === \"auto\") {\n colorTrack = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 241,\n g: 241,\n b: 241\n }, theme);\n colorIcons = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor)({\n r: 96,\n g: 96,\n b: 96\n }, theme);\n colorThumb = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 176,\n g: 176,\n b: 176\n }, theme);\n colorThumbHover = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 144,\n g: 144,\n b: 144\n }, theme);\n colorThumbActive = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 96,\n g: 96,\n b: 96\n }, theme);\n colorCorner = (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor)({\n r: 255,\n g: 255,\n b: 255\n }, theme);\n } else {\n var rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.parseColorWithCache)(theme.scrollbarColor);\n var hsl = rgbToHSL(rgb);\n var isLight = hsl.l > 0.5;\n var lighten = function lighten(lighter) {\n return _objectSpread(_objectSpread({}, hsl), {}, {\n l: (0,_utils_math__WEBPACK_IMPORTED_MODULE_2__.clamp)(hsl.l + lighter, 0, 1)\n });\n };\n var darken = function darken(darker) {\n return _objectSpread(_objectSpread({}, hsl), {}, {\n l: (0,_utils_math__WEBPACK_IMPORTED_MODULE_2__.clamp)(hsl.l - darker, 0, 1)\n });\n };\n colorTrack = hslToString(darken(0.4));\n colorIcons = hslToString(isLight ? darken(0.4) : lighten(0.4));\n colorThumb = hslToString(hsl);\n colorThumbHover = hslToString(lighten(0.1));\n colorThumbActive = hslToString(lighten(0.2));\n colorCorner = hslToString(darken(0.5));\n }\n lines.push(\"::-webkit-scrollbar {\");\n lines.push(\" background-color: \".concat(colorTrack, \";\"));\n lines.push(\" color: \".concat(colorIcons, \";\"));\n lines.push(\"}\");\n lines.push(\"::-webkit-scrollbar-thumb {\");\n lines.push(\" background-color: \".concat(colorThumb, \";\"));\n lines.push(\"}\");\n lines.push(\"::-webkit-scrollbar-thumb:hover {\");\n lines.push(\" background-color: \".concat(colorThumbHover, \";\"));\n lines.push(\"}\");\n lines.push(\"::-webkit-scrollbar-thumb:active {\");\n lines.push(\" background-color: \".concat(colorThumbActive, \";\"));\n lines.push(\"}\");\n lines.push(\"::-webkit-scrollbar-corner {\");\n lines.push(\" background-color: \".concat(colorCorner, \";\"));\n lines.push(\"}\");\n if (_utils_platform__WEBPACK_IMPORTED_MODULE_4__.isFirefox) {\n lines.push(\"* {\");\n lines.push(\" scrollbar-color: \".concat(colorThumb, \" \").concat(colorTrack, \";\"));\n lines.push(\"}\");\n }\n return lines.join(\"\\n\");\n}\nfunction shouldIgnoreImage(selectorText, selectors) {\n if (!selectorText || selectors.length === 0) {\n return false;\n }\n if (selectors.some(function (s) {\n return s === \"*\";\n })) {\n return true;\n }\n var ruleSelectors = selectorText.split(/,\\s*/g);\n var _loop = function _loop() {\n var ignoredSelector = selectors[i];\n if (ruleSelectors.some(function (s) {\n return s === ignoredSelector;\n })) {\n return {\n v: true\n };\n }\n },\n _ret;\n for (var i = 0; i < selectors.length; i++) {\n _ret = _loop();\n if (_ret) return _ret.v;\n }\n return false;\n}\nvar imageDetailsCache = new Map();\nvar awaitingForImageLoading = new Map();\nfunction getBgImageModifier(value, rule, ignoreImageSelectors, isCancelled) {\n try {\n var gradients = (0,_utils_parsing__WEBPACK_IMPORTED_MODULE_3__.parseGradient)(value);\n var urls = (0,_utils_text__WEBPACK_IMPORTED_MODULE_5__.getMatches)(_css_rules__WEBPACK_IMPORTED_MODULE_7__.cssURLRegex, value);\n if (urls.length === 0 && gradients.length === 0) {\n return value;\n }\n var getIndices = function getIndices(matches) {\n var index = 0;\n return matches.map(function (match) {\n var valueIndex = value.indexOf(match, index);\n index = valueIndex + match.length;\n return {\n match: match,\n index: valueIndex\n };\n });\n };\n var matches = gradients.map(function (i) {\n return _objectSpread({\n type: \"gradient\"\n }, i);\n }).concat(getIndices(urls).map(function (i) {\n return _objectSpread({\n type: \"url\",\n offset: 0\n }, i);\n })).sort(function (a, b) {\n return a.index > b.index ? 1 : -1;\n });\n var getGradientModifier = function getGradientModifier(gradient) {\n var typeGradient = gradient.typeGradient,\n match = gradient.match,\n hasComma = gradient.hasComma;\n var partsRegex = /([^\\(\\),]+(\\([^\\(\\)]*(\\([^\\(\\)]*\\)*[^\\(\\)]*)?\\))?([^\\(\\), ]|( (?!calc)))*),?/g;\n var colorStopRegex = /^(from|color-stop|to)\\(([^\\(\\)]*?,\\s*)?(.*?)\\)$/;\n var parts = (0,_utils_text__WEBPACK_IMPORTED_MODULE_5__.getMatches)(partsRegex, match, 1).map(function (part) {\n part = part.trim();\n var rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.parseColorWithCache)(part);\n if (rgb) {\n return function (filter) {\n return (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyGradientColor)(rgb, filter);\n };\n }\n var space = part.lastIndexOf(\" \");\n rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.parseColorWithCache)(part.substring(0, space));\n if (rgb) {\n return function (filter) {\n return \"\".concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyGradientColor)(rgb, filter), \" \").concat(part.substring(space + 1));\n };\n }\n var colorStopMatch = part.match(colorStopRegex);\n if (colorStopMatch) {\n rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.parseColorWithCache)(colorStopMatch[3]);\n if (rgb) {\n return function (filter) {\n return \"\".concat(colorStopMatch[1], \"(\").concat(colorStopMatch[2] ? \"\".concat(colorStopMatch[2], \", \") : \"\").concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyGradientColor)(rgb, filter), \")\");\n };\n }\n }\n return function () {\n return part;\n };\n });\n return function (filter) {\n return \"\".concat(typeGradient, \"(\").concat(parts.map(function (modify) {\n return modify(filter);\n }).join(\", \"), \")\").concat(hasComma ? \", \" : \"\");\n };\n };\n var getURLModifier = function getURLModifier(urlValue) {\n var _parentStyleSheet$own;\n if (shouldIgnoreImage(rule.selectorText, ignoreImageSelectors)) {\n return null;\n }\n var url = (0,_css_rules__WEBPACK_IMPORTED_MODULE_7__.getCSSURLValue)(urlValue);\n var isURLEmpty = url.length === 0;\n var parentStyleSheet = rule.parentStyleSheet;\n var baseURL = parentStyleSheet && parentStyleSheet.href ? (0,_css_rules__WEBPACK_IMPORTED_MODULE_7__.getCSSBaseBath)(parentStyleSheet.href) : ((_parentStyleSheet$own = parentStyleSheet.ownerNode) === null || _parentStyleSheet$own === void 0 ? void 0 : _parentStyleSheet$own.baseURI) || location.origin;\n url = (0,_utils_url__WEBPACK_IMPORTED_MODULE_6__.getAbsoluteURL)(baseURL, url);\n var absoluteValue = \"url(\\\"\".concat(url, \"\\\")\");\n return /*#__PURE__*/function () {\n var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filter) {\n var imageDetails, awaiters, bgImageValue;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!isURLEmpty) {\n _context.next = 2;\n break;\n }\n return _context.abrupt(\"return\", \"url('')\");\n case 2:\n if (!imageDetailsCache.has(url)) {\n _context.next = 6;\n break;\n }\n imageDetails = imageDetailsCache.get(url);\n _context.next = 31;\n break;\n case 6:\n _context.prev = 6;\n if (!awaitingForImageLoading.has(url)) {\n _context.next = 16;\n break;\n }\n awaiters = awaitingForImageLoading.get(url);\n _context.next = 11;\n return new Promise(function (resolve) {\n return awaiters.push(resolve);\n });\n case 11:\n imageDetails = _context.sent;\n if (imageDetails) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"return\", null);\n case 14:\n _context.next = 23;\n break;\n case 16:\n awaitingForImageLoading.set(url, []);\n _context.next = 19;\n return (0,_image__WEBPACK_IMPORTED_MODULE_8__.getImageDetails)(url);\n case 19:\n imageDetails = _context.sent;\n imageDetailsCache.set(url, imageDetails);\n awaitingForImageLoading.get(url).forEach(function (resolve) {\n return resolve(imageDetails);\n });\n awaitingForImageLoading[\"delete\"](url);\n case 23:\n if (!isCancelled()) {\n _context.next = 25;\n break;\n }\n return _context.abrupt(\"return\", null);\n case 25:\n _context.next = 31;\n break;\n case 27:\n _context.prev = 27;\n _context.t0 = _context[\"catch\"](6);\n // logWarn(err);\n if (awaitingForImageLoading.has(url)) {\n awaitingForImageLoading.get(url).forEach(function (resolve) {\n return resolve(null);\n });\n awaitingForImageLoading[\"delete\"](url);\n }\n return _context.abrupt(\"return\", absoluteValue);\n case 31:\n bgImageValue = getBgImageValue(imageDetails, filter) || absoluteValue;\n return _context.abrupt(\"return\", bgImageValue);\n case 33:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[6, 27]]);\n }));\n return function (_x) {\n return _ref3.apply(this, arguments);\n };\n }();\n };\n var getBgImageValue = function getBgImageValue(imageDetails, filter) {\n var isDark = imageDetails.isDark,\n isLight = imageDetails.isLight,\n isTransparent = imageDetails.isTransparent,\n isLarge = imageDetails.isLarge,\n isTooLarge = imageDetails.isTooLarge,\n width = imageDetails.width;\n var result;\n if (isTooLarge) {\n // logInfo(`Not modifying too large image ${imageDetails.src}`);\n result = \"url(\\\"\".concat(imageDetails.src, \"\\\")\");\n } else if (isDark && isTransparent && filter.mode === 1 && !isLarge && width > 2) {\n // logInfo(`Inverting dark image ${imageDetails.src}`);\n var inverted = (0,_image__WEBPACK_IMPORTED_MODULE_8__.getFilteredImageDataURL)(imageDetails, _objectSpread(_objectSpread({}, filter), {}, {\n sepia: (0,_utils_math__WEBPACK_IMPORTED_MODULE_2__.clamp)(filter.sepia + 10, 0, 100)\n }));\n result = \"url(\\\"\".concat(inverted, \"\\\")\");\n } else if (isLight && !isTransparent && filter.mode === 1) {\n if (isLarge) {\n // logInfo(`Not modifying light non-transparent large image ${imageDetails.src}`);\n result = \"none\";\n } else {\n // logInfo(`Dimming light image ${imageDetails.src}`);\n var dimmed = (0,_image__WEBPACK_IMPORTED_MODULE_8__.getFilteredImageDataURL)(imageDetails, filter);\n result = \"url(\\\"\".concat(dimmed, \"\\\")\");\n }\n } else if (filter.mode === 0 && isLight && !isLarge) {\n // logInfo(`Applying filter to image ${imageDetails.src}`);\n var filtered = (0,_image__WEBPACK_IMPORTED_MODULE_8__.getFilteredImageDataURL)(imageDetails, _objectSpread(_objectSpread({}, filter), {}, {\n brightness: (0,_utils_math__WEBPACK_IMPORTED_MODULE_2__.clamp)(filter.brightness - 10, 5, 200),\n sepia: (0,_utils_math__WEBPACK_IMPORTED_MODULE_2__.clamp)(filter.sepia + 10, 0, 100)\n }));\n result = \"url(\\\"\".concat(filtered, \"\\\")\");\n } else {\n // logInfo(`Not modifying too large image ${imageDetails.src}`);\n result = null;\n }\n return result;\n };\n var modifiers = [];\n var matchIndex = 0;\n var prevHasComma = false;\n matches.forEach(function (_ref4, i) {\n var type = _ref4.type,\n match = _ref4.match,\n index = _ref4.index,\n typeGradient = _ref4.typeGradient,\n hasComma = _ref4.hasComma,\n offset = _ref4.offset;\n var matchStart = index;\n var prefixStart = matchIndex;\n var matchEnd = matchStart + match.length + offset;\n matchIndex = matchEnd;\n\n // Make sure we still push all the unrelated content between gradients and URLs.\n if (prefixStart !== matchStart) {\n if (prevHasComma) {\n modifiers.push(function () {\n var betweenValue = value.substring(prefixStart, matchStart);\n if (betweenValue[0] === \",\") {\n betweenValue = betweenValue.substring(1);\n }\n return betweenValue;\n });\n } else {\n modifiers.push(function () {\n return value.substring(prefixStart, matchStart);\n });\n }\n }\n prevHasComma = hasComma || false;\n if (type === \"url\") {\n modifiers.push(getURLModifier(match));\n } else if (type === \"gradient\") {\n modifiers.push(getGradientModifier({\n match: match,\n index: index,\n typeGradient: typeGradient,\n hasComma: hasComma || false,\n offset: offset\n }));\n }\n if (i === matches.length - 1) {\n modifiers.push(function () {\n return value.substring(matchEnd);\n });\n }\n });\n return function (filter) {\n var results = modifiers.filter(Boolean).map(function (modify) {\n return modify(filter);\n });\n if (results.some(function (r) {\n return r instanceof Promise;\n })) {\n return Promise.all(results).then(function (asyncResults) {\n return asyncResults.filter(Boolean).join(\"\");\n });\n }\n // Strip `, initial` suffix. This is some weird computed value by the browser\n var combinedResult = results.join(\"\");\n if (combinedResult.endsWith(\", initial\")) {\n return combinedResult.slice(0, -9);\n }\n return combinedResult;\n };\n } catch (err) {\n // logWarn(`Unable to parse gradient ${value}`, err);\n return null;\n }\n}\nfunction getShadowModifierWithInfo(value) {\n try {\n var index = 0;\n var colorMatches = (0,_utils_text__WEBPACK_IMPORTED_MODULE_5__.getMatches)(/(^|\\s)(?!calc)([a-z]+\\(.+?\\)|#[0-9a-f]+|[a-z]+)(.*?(inset|outset)?($|,))/gi, value, 2);\n var notParsed = 0;\n var modifiers = colorMatches.map(function (match, i) {\n var prefixIndex = index;\n var matchIndex = value.indexOf(match, index);\n var matchEnd = matchIndex + match.length;\n index = matchEnd;\n var rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_1__.parseColorWithCache)(match);\n if (!rgb) {\n notParsed++;\n return function () {\n return value.substring(prefixIndex, matchEnd);\n };\n }\n return function (filter) {\n return \"\".concat(value.substring(prefixIndex, matchIndex)).concat((0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyShadowColor)(rgb, filter)).concat(i === colorMatches.length - 1 ? value.substring(matchEnd) : \"\");\n };\n });\n return function (filter) {\n var modified = modifiers.map(function (modify) {\n return modify(filter);\n }).join(\"\");\n return {\n matchesLength: colorMatches.length,\n unparseableMatchesLength: notParsed,\n result: modified\n };\n };\n } catch (err) {\n // logWarn(`Unable to parse shadow ${value}`, err);\n return null;\n }\n}\nfunction cleanModificationCache() {\n (0,_generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.clearColorModificationCache)();\n imageDetailsCache.clear();\n (0,_image__WEBPACK_IMPORTED_MODULE_8__.cleanImageProcessingCache)();\n awaitingForImageLoading.clear();\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/modify-css.js?");
/***/ }),
/***/ "./dev/dark-mode/src/inject/dynamic-theme/style-manager.js":
/*!*****************************************************************!*\
!*** ./dev/dark-mode/src/inject/dynamic-theme/style-manager.js ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ STYLE_SELECTOR: () => (/* binding */ STYLE_SELECTOR),\n/* harmony export */ cleanLoadingLinks: () => (/* binding */ cleanLoadingLinks),\n/* harmony export */ getManageableStyles: () => (/* binding */ getManageableStyles),\n/* harmony export */ manageStyle: () => (/* binding */ manageStyle),\n/* harmony export */ shouldManageStyle: () => (/* binding */ shouldManageStyle)\n/* harmony export */ });\n/* harmony import */ var _utils_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/array */ \"./dev/dark-mode/src/utils/array.js\");\n/* harmony import */ var _utils_platform__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/platform */ \"./dev/dark-mode/src/utils/platform.js\");\n/* harmony import */ var _utils_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/url */ \"./dev/dark-mode/src/utils/url.js\");\n/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/dom */ \"./dev/dark-mode/src/inject/utils/dom.js\");\n/* harmony import */ var _css_rules__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./css-rules */ \"./dev/dark-mode/src/inject/dynamic-theme/css-rules.js\");\n/* harmony import */ var _stylesheet_modifier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stylesheet-modifier */ \"./dev/dark-mode/src/inject/dynamic-theme/stylesheet-modifier.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\n\n\n\n\n// import { logInfo, logWarn } from \"../utils/log\";\n\n\nvar rejectorsForLoadingLinks = new Map();\nvar STYLE_SELECTOR = 'style, link[rel*=\"stylesheet\" i]:not([disabled])';\nvar loadingLinkCounter = 0;\n\n// isFontsGoogleApiStyle returns is the given link element is a style from\n// google fonts.\nfunction isFontsGoogleApiStyle(element) {\n if (!element.href) {\n return false;\n }\n try {\n var elementURL = new URL(element.href);\n return elementURL.hostname === \"fonts.googleapis.com\";\n } catch (err) {\n // logInfo(`Couldn't construct ${element.href} as URL`);\n return false;\n }\n}\nfunction shouldManageStyle(element) {\n return (element instanceof HTMLStyleElement || element instanceof SVGStyleElement || element instanceof HTMLLinkElement && Boolean(element.rel) && element.rel.toLowerCase().includes(\"stylesheet\") && Boolean(element.href) && !element.disabled && (_utils_platform__WEBPACK_IMPORTED_MODULE_1__.isFirefox ? !element.href.startsWith(\"moz-extension://\") : true) && !isFontsGoogleApiStyle(element)) && !element.classList.contains(\"adminify\") && element.media.toLowerCase() !== \"print\" && !element.classList.contains(\"stylus\");\n}\nfunction getManageableStyles(node) {\n var results = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n if (shouldManageStyle(node)) {\n results.push(node);\n } else if (node instanceof Element || _utils_platform__WEBPACK_IMPORTED_MODULE_1__.isShadowDomSupported && node instanceof ShadowRoot || node === document) {\n (0,_utils_array__WEBPACK_IMPORTED_MODULE_0__.forEach)(node.querySelectorAll(STYLE_SELECTOR), function (style) {\n return getManageableStyles(style, results, false);\n });\n if (deep) {\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_3__.iterateShadowHosts)(node, function (host) {\n return getManageableStyles(host.shadowRoot, results, false);\n });\n }\n }\n return results;\n}\nvar syncStyleSet = new WeakSet();\nvar corsStyleSet = new WeakSet();\nfunction manageStyle(element, _ref) {\n var update = _ref.update,\n loadingStart = _ref.loadingStart,\n loadingEnd = _ref.loadingEnd;\n var prevStyles = [];\n var next = element;\n while ((next = next.nextElementSibling) && next.matches(\".adminify\")) {\n prevStyles.push(next);\n }\n var corsCopy = prevStyles.find(function (el) {\n return el.matches(\".adminify--cors\") && !corsStyleSet.has(el);\n }) || null;\n var syncStyle = prevStyles.find(function (el) {\n return el.matches(\".adminify--sync\") && !syncStyleSet.has(el);\n }) || null;\n var corsCopyPositionWatcher = null;\n var syncStylePositionWatcher = null;\n var cancelAsyncOperations = false;\n var isOverrideEmpty = true;\n var sheetModifier = (0,_stylesheet_modifier__WEBPACK_IMPORTED_MODULE_5__.createStyleSheetModifier)();\n var observer = new MutationObserver(function () {\n update();\n });\n var observerOptions = {\n attributes: true,\n childList: true,\n subtree: true,\n characterData: true\n };\n function containsCSSImport() {\n return element instanceof HTMLStyleElement && element.textContent.trim().match(_css_rules__WEBPACK_IMPORTED_MODULE_4__.cssImportRegex);\n }\n\n // It loops trough the cssRules and check for CSSImportRule and their `href`.\n // If the `href` isn't local and doesn't start with the same-origin.\n // We can be ensure that's a cross-origin import\n // And should add a cors-sheet to this element.\n function hasImports(cssRules, checkCrossOrigin) {\n var result = false;\n if (cssRules) {\n var rule;\n cssRulesLoop: for (var i = 0, len = cssRules.length; i < len; i++) {\n rule = cssRules[i];\n if (rule.href) {\n if (checkCrossOrigin) {\n if (!rule.href.startsWith(\"https://fonts.googleapis.com/\") && rule.href.startsWith(\"http\") && !rule.href.startsWith(location.origin)) {\n result = true;\n break cssRulesLoop;\n }\n } else {\n result = true;\n break cssRulesLoop;\n }\n }\n }\n }\n return result;\n }\n function getRulesSync() {\n if (corsCopy) {\n // logInfo(\"[getRulesSync] Using cors-copy.\");\n return corsCopy.sheet.cssRules;\n }\n if (containsCSSImport()) {\n // logInfo(\"[getRulesSync] CSSImport detected.\");\n return null;\n }\n var cssRules = safeGetSheetRules();\n if (element instanceof HTMLLinkElement && !(0,_utils_url__WEBPACK_IMPORTED_MODULE_2__.isRelativeHrefOnAbsolutePath)(element.href) && hasImports(cssRules, false)) {\n // logInfo(\"[getRulesSync] CSSImportRule detected on non-local href.\");\n return null;\n }\n if (hasImports(cssRules, true)) {\n // logInfo(\"[getRulesSync] Cross-Origin CSSImportRule detected.\");\n return null;\n }\n\n // logInfo(\"[getRulesSync] Using cssRules.\");\n // !cssRules && logWarn(\"[getRulesSync] cssRules is null, trying again.\");\n return cssRules;\n }\n function insertStyle() {\n if (corsCopy) {\n if (element.nextSibling !== corsCopy) {\n element.parentNode.insertBefore(corsCopy, element.nextSibling);\n }\n if (corsCopy.nextSibling !== syncStyle) {\n element.parentNode.insertBefore(syncStyle, corsCopy.nextSibling);\n }\n } else if (element.nextSibling !== syncStyle) {\n element.parentNode.insertBefore(syncStyle, element.nextSibling);\n }\n }\n function createSyncStyle() {\n syncStyle = element instanceof SVGStyleElement ? document.createElementNS(\"http://www.w3.org/2000/svg\", \"style\") : document.createElement(\"style\");\n syncStyle.classList.add(\"adminify\");\n syncStyle.classList.add(\"adminify--sync\");\n syncStyle.media = \"screen\";\n if (element.title) {\n syncStyle.title = element.title;\n }\n syncStyleSet.add(syncStyle);\n }\n var isLoadingRules = false;\n var wasLoadingError = false;\n var loadingLinkId = ++loadingLinkCounter;\n function getRulesAsync() {\n return _getRulesAsync.apply(this, arguments);\n }\n function _getRulesAsync() {\n _getRulesAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var cssText, cssBasePath, _getRulesOrError3, _getRulesOrError4, cssRules, accessError, _getRulesOrError5, _getRulesOrError6, fullCSSText;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!(element instanceof HTMLLinkElement)) {\n _context.next = 24;\n break;\n }\n _getRulesOrError3 = getRulesOrError(), _getRulesOrError4 = _slicedToArray(_getRulesOrError3, 2), cssRules = _getRulesOrError4[0], accessError = _getRulesOrError4[1];\n if (accessError) {\n // logWarn(accessError);\n }\n if (!(_utils_platform__WEBPACK_IMPORTED_MODULE_1__.isSafari && !element.sheet || !_utils_platform__WEBPACK_IMPORTED_MODULE_1__.isSafari && !cssRules && !accessError || isStillLoadingError(accessError))) {\n _context.next = 19;\n break;\n }\n _context.prev = 4;\n _context.next = 7;\n return linkLoading(element, loadingLinkId);\n case 7:\n _context.next = 12;\n break;\n case 9:\n _context.prev = 9;\n _context.t0 = _context[\"catch\"](4);\n // NOTE: Some @import resources can fail,\n // but the style sheet can still be valid.\n // There's no way to get the actual error.\n // logWarn(err);\n wasLoadingError = true;\n case 12:\n if (!cancelAsyncOperations) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"return\", null);\n case 14:\n _getRulesOrError5 = getRulesOrError();\n _getRulesOrError6 = _slicedToArray(_getRulesOrError5, 2);\n cssRules = _getRulesOrError6[0];\n accessError = _getRulesOrError6[1];\n if (accessError) {\n // CORS error, cssRules are not accessible\n // for cross-origin resources\n // logWarn(accessError);\n }\n case 19:\n if (!cssRules) {\n _context.next = 22;\n break;\n }\n if (hasImports(cssRules, false)) {\n _context.next = 22;\n break;\n }\n return _context.abrupt(\"return\", cssRules);\n case 22:\n _context.next = 30;\n break;\n case 24:\n if (!containsCSSImport()) {\n _context.next = 29;\n break;\n }\n cssText = element.textContent.trim();\n cssBasePath = getCSSBaseBath(location.href);\n _context.next = 30;\n break;\n case 29:\n return _context.abrupt(\"return\", null);\n case 30:\n if (!cssText) {\n _context.next = 43;\n break;\n }\n _context.prev = 31;\n _context.next = 34;\n return replaceCSSImports(cssText, cssBasePath);\n case 34:\n fullCSSText = _context.sent;\n corsCopy = createCORSCopy(element, fullCSSText);\n _context.next = 40;\n break;\n case 38:\n _context.prev = 38;\n _context.t1 = _context[\"catch\"](31);\n case 40:\n if (!corsCopy) {\n _context.next = 43;\n break;\n }\n corsCopyPositionWatcher = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_3__.watchForNodePosition)(corsCopy, \"prev-sibling\");\n return _context.abrupt(\"return\", corsCopy.sheet.cssRules);\n case 43:\n return _context.abrupt(\"return\", null);\n case 44:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[4, 9], [31, 38]]);\n }));\n return _getRulesAsync.apply(this, arguments);\n }\n function details(options) {\n var rules = getRulesSync();\n if (!rules) {\n // secondRound is only true after it's\n // has gone trough `details()` & `getRulesAsync` already\n // So that means that `getRulesSync` shouldn't fail.\n // However as a fail-safe to prevent loops, we should\n // return null here and not continue to `getRulesAsync`\n if (options.secondRound) {\n // logWarn(\"Detected dead-lock at details(), returning early to prevent it.\");\n return null;\n }\n if (isLoadingRules || wasLoadingError) {\n return null;\n }\n isLoadingRules = true;\n loadingStart();\n getRulesAsync().then(function (results) {\n isLoadingRules = false;\n loadingEnd();\n if (results) {\n update();\n }\n })[\"catch\"](function (err) {\n // logWarn(err);\n isLoadingRules = false;\n loadingEnd();\n });\n return null;\n }\n return {\n rules: rules\n };\n }\n var forceRenderStyle = false;\n function render(theme, ignoreImageAnalysis) {\n var rules = getRulesSync();\n if (!rules) {\n return;\n }\n cancelAsyncOperations = false;\n function removeCSSRulesFromSheet(sheet) {\n if (!sheet) {\n return;\n }\n for (var i = sheet.cssRules.length - 1; i >= 0; i--) {\n sheet.deleteRule(i);\n }\n }\n function prepareOverridesSheet() {\n if (!syncStyle) {\n createSyncStyle();\n }\n syncStylePositionWatcher && syncStylePositionWatcher.stop();\n insertStyle();\n\n // Firefox issue: Some websites get CSP warning,\n // when `textContent` is not set (e.g. pypi.org).\n // But for other websites (e.g. facebook.com)\n // some images disappear when `textContent`\n // is initially set to an empty string.\n if (syncStyle.sheet == null) {\n syncStyle.textContent = \"\";\n }\n var sheet = syncStyle.sheet;\n removeCSSRulesFromSheet(sheet);\n if (syncStylePositionWatcher) {\n syncStylePositionWatcher.run();\n } else {\n syncStylePositionWatcher = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_3__.watchForNodePosition)(syncStyle, \"prev-sibling\", function () {\n forceRenderStyle = true;\n buildOverrides();\n });\n }\n return syncStyle.sheet;\n }\n function buildOverrides() {\n var force = forceRenderStyle;\n forceRenderStyle = false;\n sheetModifier.modifySheet({\n prepareSheet: prepareOverridesSheet,\n sourceCSSRules: rules,\n theme: theme,\n ignoreImageAnalysis: ignoreImageAnalysis,\n force: force,\n isAsyncCancelled: function isAsyncCancelled() {\n return cancelAsyncOperations;\n }\n });\n isOverrideEmpty = syncStyle.sheet.cssRules.length === 0;\n if (sheetModifier.shouldRebuildStyle()) {\n // \"update\" function schedules rebuilding the style\n // ideally to wait for link loading, because some sites put links any time,\n // but it can be complicated, so waiting for document completion can do the trick\n addReadyStateCompleteListener(function () {\n return update();\n });\n }\n }\n buildOverrides();\n }\n function getRulesOrError() {\n try {\n if (element.sheet == null) {\n return [null, null];\n }\n return [element.sheet.cssRules, null];\n } catch (err) {\n return [null, err];\n }\n }\n\n // NOTE: In Firefox, when link is loading,\n // `sheet` property is not null,\n // but `cssRules` access error is thrown\n function isStillLoadingError(error) {\n return error && error.message && error.message.includes(\"loading\");\n }\n\n // Seems like Firefox bug: silent exception is produced\n // without any notice, when accessing