| 1 |
/* |
| 2 |
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). |
| 3 |
* This devtool is neither made for production nor for readable output files. |
| 4 |
* It uses "eval()" calls to create a separate source file in the browser devtools. |
| 5 |
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) |
| 6 |
* or disable the default devtool with "devtool: false". |
| 7 |
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). |
| 8 |
*/ |
| 9 |
/******/ (() => { // webpackBootstrap |
| 10 |
/******/ "use strict"; |
| 11 |
/******/ var __webpack_modules__ = ({ |
| 12 |
|
| 13 |
/***/ "./dev/dark-mode/index.js": |
| 14 |
/*!********************************!*\ |
| 15 |
!*** ./dev/dark-mode/index.js ***! |
| 16 |
\********************************/ |
| 17 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 18 |
|
| 19 |
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?"); |
| 20 |
|
| 21 |
/***/ }), |
| 22 |
|
| 23 |
/***/ "./dev/dark-mode/src/default.js": |
| 24 |
/*!**************************************!*\ |
| 25 |
!*** ./dev/dark-mode/src/default.js ***! |
| 26 |
\**************************************/ |
| 27 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 28 |
|
| 29 |
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?"); |
| 30 |
|
| 31 |
/***/ }), |
| 32 |
|
| 33 |
/***/ "./dev/dark-mode/src/generators/css-filter.js": |
| 34 |
/*!****************************************************!*\ |
| 35 |
!*** ./dev/dark-mode/src/generators/css-filter.js ***! |
| 36 |
\****************************************************/ |
| 37 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 38 |
|
| 39 |
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?"); |
| 40 |
|
| 41 |
/***/ }), |
| 42 |
|
| 43 |
/***/ "./dev/dark-mode/src/generators/modify-colors.js": |
| 44 |
/*!*******************************************************!*\ |
| 45 |
!*** ./dev/dark-mode/src/generators/modify-colors.js ***! |
| 46 |
\*******************************************************/ |
| 47 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 48 |
|
| 49 |
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?"); |
| 50 |
|
| 51 |
/***/ }), |
| 52 |
|
| 53 |
/***/ "./dev/dark-mode/src/generators/svg-filter.js": |
| 54 |
/*!****************************************************!*\ |
| 55 |
!*** ./dev/dark-mode/src/generators/svg-filter.js ***! |
| 56 |
\****************************************************/ |
| 57 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 58 |
|
| 59 |
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 = ['<svg xmlns=\"http://www.w3.org/2000/svg\">', \"<filter id=\\\"\".concat(id, \"\\\" style=\\\"color-interpolation-filters: sRGB;\\\">\"), \"<feColorMatrix type=\\\"matrix\\\" values=\\\"\".concat(matrixValue, \"\\\" />\"), \"</filter>\", \"</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?"); |
| 60 |
|
| 61 |
/***/ }), |
| 62 |
|
| 63 |
/***/ "./dev/dark-mode/src/generators/text-style.js": |
| 64 |
/*!****************************************************!*\ |
| 65 |
!*** ./dev/dark-mode/src/generators/text-style.js ***! |
| 66 |
\****************************************************/ |
| 67 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 68 |
|
| 69 |
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?"); |
| 70 |
|
| 71 |
/***/ }), |
| 72 |
|
| 73 |
/***/ "./dev/dark-mode/src/generators/utils/matrix.js": |
| 74 |
/*!******************************************************!*\ |
| 75 |
!*** ./dev/dark-mode/src/generators/utils/matrix.js ***! |
| 76 |
\******************************************************/ |
| 77 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 78 |
|
| 79 |
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?"); |
| 80 |
|
| 81 |
/***/ }), |
| 82 |
|
| 83 |
/***/ "./dev/dark-mode/src/generators/utils/parse.js": |
| 84 |
/*!*****************************************************!*\ |
| 85 |
!*** ./dev/dark-mode/src/generators/utils/parse.js ***! |
| 86 |
\*****************************************************/ |
| 87 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 88 |
|
| 89 |
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?"); |
| 90 |
|
| 91 |
/***/ }), |
| 92 |
|
| 93 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/css-rules.js": |
| 94 |
/*!*************************************************************!*\ |
| 95 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/css-rules.js ***! |
| 96 |
\*************************************************************/ |
| 97 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 98 |
|
| 99 |
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?"); |
| 100 |
|
| 101 |
/***/ }), |
| 102 |
|
| 103 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/image.js": |
| 104 |
/*!*********************************************************!*\ |
| 105 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/image.js ***! |
| 106 |
\*********************************************************/ |
| 107 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 108 |
|
| 109 |
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 = [\"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" width=\\\"\".concat(width, \"\\\" height=\\\"\").concat(height, \"\\\">\"), \"<defs>\", '<filter id=\"adminify-image-filter\">', \"<feColorMatrix type=\\\"matrix\\\" values=\\\"\".concat(matrix, \"\\\" />\"), \"</filter>\", \"</defs>\", \"<image width=\\\"\".concat(width, \"\\\" height=\\\"\").concat(height, \"\\\" filter=\\\"url(#adminify-image-filter)\\\" xlink:href=\\\"\").concat(dataURL, \"\\\" />\"), \"</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?"); |
| 110 |
|
| 111 |
/***/ }), |
| 112 |
|
| 113 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/index.js": |
| 114 |
/*!*********************************************************!*\ |
| 115 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/index.js ***! |
| 116 |
\*********************************************************/ |
| 117 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 118 |
|
| 119 |
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?"); |
| 120 |
|
| 121 |
/***/ }), |
| 122 |
|
| 123 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/inline-style.js": |
| 124 |
/*!****************************************************************!*\ |
| 125 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/inline-style.js ***! |
| 126 |
\****************************************************************/ |
| 127 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 128 |
|
| 129 |
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<CSSVariableModifier>` 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 `<link rel=\"mask-icon\" color=\"#000000\">`.\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?"); |
| 130 |
|
| 131 |
/***/ }), |
| 132 |
|
| 133 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/modify-css.js": |
| 134 |
/*!**************************************************************!*\ |
| 135 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/modify-css.js ***! |
| 136 |
\**************************************************************/ |
| 137 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 138 |
|
| 139 |
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?"); |
| 140 |
|
| 141 |
/***/ }), |
| 142 |
|
| 143 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/style-manager.js": |
| 144 |
/*!*****************************************************************!*\ |
| 145 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/style-manager.js ***! |
| 146 |
\*****************************************************************/ |
| 147 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 148 |
|
| 149 |
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 <style> CSS rules\n function safeGetSheetRules() {\n var _getRulesOrError = getRulesOrError(),\n _getRulesOrError2 = _slicedToArray(_getRulesOrError, 2),\n cssRules = _getRulesOrError2[0],\n err = _getRulesOrError2[1];\n if (err) {\n // logWarn(err);\n return null;\n }\n return cssRules;\n }\n function watchForSheetChanges() {\n watchForSheetChangesUsingProxy();\n // Sometimes sheet can be null in Firefox and Safari\n // So need to watch for it using rAF\n\n // if (!__THUNDERBIRD__ && !(canOptimizeUsingProxy && element.sheet)) {\n // watchForSheetChangesUsingRAF();\n // }\n }\n\n // let rulesChangeKey = null;\n var rulesCheckFrameId = null;\n\n // function getRulesChangeKey() {\n // const rules = safeGetSheetRules();\n // return rules ? rules.length : null;\n // }\n\n // function didRulesKeyChange() {\n // return getRulesChangeKey() !== rulesChangeKey;\n // }\n\n // function watchForSheetChangesUsingRAF() {\n // rulesChangeKey = getRulesChangeKey();\n // stopWatchingForSheetChangesUsingRAF();\n // const checkForUpdate = () => {\n // if (didRulesKeyChange()) {\n // rulesChangeKey = getRulesChangeKey();\n // update();\n // }\n // if (canOptimizeUsingProxy && element.sheet) {\n // stopWatchingForSheetChangesUsingRAF();\n // return;\n // }\n // rulesCheckFrameId = requestAnimationFrame(checkForUpdate);\n // };\n\n // checkForUpdate();\n // }\n\n function stopWatchingForSheetChangesUsingRAF() {\n // TODO: reove cast once types are updated\n cancelAnimationFrame(rulesCheckFrameId);\n }\n var areSheetChangesPending = false;\n function onSheetChange() {\n canOptimizeUsingProxy = true;\n stopWatchingForSheetChangesUsingRAF();\n if (areSheetChangesPending) {\n return;\n }\n function handleSheetChanges() {\n areSheetChangesPending = false;\n if (cancelAsyncOperations) {\n return;\n }\n update();\n }\n areSheetChangesPending = true;\n if (typeof queueMicrotask === \"function\") {\n queueMicrotask(handleSheetChanges);\n } else {\n requestAnimationFrame(handleSheetChanges);\n }\n }\n function watchForSheetChangesUsingProxy() {\n element.addEventListener(\"__adminify__updateSheet\", onSheetChange, {\n passive: true\n });\n }\n function stopWatchingForSheetChangesUsingProxy() {\n element.removeEventListener(\"__adminify__updateSheet\", onSheetChange);\n }\n function stopWatchingForSheetChanges() {\n stopWatchingForSheetChangesUsingProxy();\n stopWatchingForSheetChangesUsingRAF();\n }\n function pause() {\n observer.disconnect();\n cancelAsyncOperations = true;\n corsCopyPositionWatcher && corsCopyPositionWatcher.stop();\n syncStylePositionWatcher && syncStylePositionWatcher.stop();\n stopWatchingForSheetChanges();\n }\n function destroy() {\n pause();\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_3__.removeNode)(corsCopy);\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_3__.removeNode)(syncStyle);\n loadingEnd();\n if (rejectorsForLoadingLinks.has(loadingLinkId)) {\n var reject = rejectorsForLoadingLinks.get(loadingLinkId);\n rejectorsForLoadingLinks[\"delete\"](loadingLinkId);\n reject && reject();\n }\n }\n function watch() {\n observer.observe(element, observerOptions);\n if (element instanceof HTMLStyleElement) {\n watchForSheetChanges();\n }\n }\n var maxMoveCount = 10;\n var moveCount = 0;\n function restore() {\n if (!syncStyle) {\n return;\n }\n moveCount++;\n if (moveCount > maxMoveCount) {\n // logWarn(\"Style sheet was moved multiple times\", element);\n return;\n }\n\n // logWarn(\"Restore style\", syncStyle, element);\n insertStyle();\n corsCopyPositionWatcher && corsCopyPositionWatcher.skip();\n syncStylePositionWatcher && syncStylePositionWatcher.skip();\n if (!isOverrideEmpty) {\n forceRenderStyle = true;\n update();\n }\n }\n return {\n details: details,\n render: render,\n pause: pause,\n destroy: destroy,\n watch: watch,\n restore: restore\n };\n}\nfunction cleanLoadingLinks() {\n rejectorsForLoadingLinks.clear();\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/style-manager.js?"); |
| 150 |
|
| 151 |
/***/ }), |
| 152 |
|
| 153 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/stylesheet-modifier.js": |
| 154 |
/*!***********************************************************************!*\ |
| 155 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/stylesheet-modifier.js ***! |
| 156 |
\***********************************************************************/ |
| 157 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 158 |
|
| 159 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createStyleSheetModifier: () => (/* binding */ createStyleSheetModifier)\n/* harmony export */ });\n/* harmony import */ var _utils_throttle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/throttle */ \"./dev/dark-mode/src/utils/throttle.js\");\n/* harmony import */ var _css_rules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./css-rules */ \"./dev/dark-mode/src/inject/dynamic-theme/css-rules.js\");\n/* harmony import */ var _modify_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modify-css */ \"./dev/dark-mode/src/inject/dynamic-theme/modify-css.js\");\n/* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./variables */ \"./dev/dark-mode/src/inject/dynamic-theme/variables.js\");\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread 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 _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\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\n\n\nvar themeCacheKeys = [\"mode\", \"brightness\", \"contrast\", \"grayscale\", \"sepia\", \"darkSchemeBackgroundColor\", \"darkSchemeTextColor\", \"lightSchemeBackgroundColor\", \"lightSchemeTextColor\"];\nfunction getThemeKey(theme) {\n var resultKey = \"\";\n themeCacheKeys.forEach(function (key) {\n resultKey += \"\".concat(key, \":\").concat(theme[key], \";\");\n });\n return resultKey;\n}\nvar asyncQueue = (0,_utils_throttle__WEBPACK_IMPORTED_MODULE_0__.createAsyncTasksQueue)();\nfunction createStyleSheetModifier() {\n var renderId = 0;\n var rulesTextCache = new Set();\n var rulesModCache = new Map();\n var varTypeChangeCleaners = new Set();\n var prevFilterKey = null;\n var hasNonLoadedLink = false;\n var wasRebuilt = false;\n function shouldRebuildStyle() {\n return hasNonLoadedLink && !wasRebuilt;\n }\n function modifySheet(options) {\n var rules = options.sourceCSSRules;\n var theme = options.theme,\n ignoreImageAnalysis = options.ignoreImageAnalysis,\n force = options.force,\n prepareSheet = options.prepareSheet,\n isAsyncCancelled = options.isAsyncCancelled;\n var rulesChanged = rulesModCache.size === 0;\n var notFoundCacheKeys = new Set(rulesModCache.keys());\n var themeKey = getThemeKey(theme);\n var themeChanged = themeKey !== prevFilterKey;\n if (hasNonLoadedLink) {\n wasRebuilt = true;\n }\n var modRules = [];\n (0,_css_rules__WEBPACK_IMPORTED_MODULE_1__.iterateCSSRules)(rules, function (rule) {\n var cssText = rule.cssText;\n var textDiffersFromPrev = false;\n notFoundCacheKeys[\"delete\"](cssText);\n if (rule.parentRule instanceof CSSMediaRule) {\n cssText += \";\".concat(rule.parentRule.media.mediaText);\n }\n if (!rulesTextCache.has(cssText)) {\n rulesTextCache.add(cssText);\n textDiffersFromPrev = true;\n }\n if (textDiffersFromPrev) {\n rulesChanged = true;\n } else {\n modRules.push(rulesModCache.get(cssText));\n return;\n }\n\n // A very specific case to skip. This causes a lot of calls to `getModifiableCSSDeclaration`\n // and currently contributes nothing in real-world case.\n // TODO: Allow `setRule` to throw a exception when we're modifying SVGs namespace styles.\n if (rule.style.all === \"revert\") {\n return;\n }\n var modDecs = [];\n rule.style && (0,_css_rules__WEBPACK_IMPORTED_MODULE_1__.iterateCSSDeclarations)(rule.style, function (property, value) {\n var mod = (0,_modify_css__WEBPACK_IMPORTED_MODULE_2__.getModifiableCSSDeclaration)(property, value, rule, _variables__WEBPACK_IMPORTED_MODULE_3__.variablesStore, ignoreImageAnalysis, isAsyncCancelled);\n if (mod) {\n modDecs.push(mod);\n }\n });\n var modRule = null;\n if (modDecs.length > 0) {\n var parentRule = rule.parentRule;\n modRule = {\n selector: rule.selectorText,\n declarations: modDecs,\n parentRule: parentRule\n };\n modRules.push(modRule);\n }\n rulesModCache.set(cssText, modRule);\n }, function () {\n hasNonLoadedLink = true;\n });\n notFoundCacheKeys.forEach(function (key) {\n rulesTextCache[\"delete\"](key);\n rulesModCache[\"delete\"](key);\n });\n prevFilterKey = themeKey;\n if (!force && !rulesChanged && !themeChanged) {\n return;\n }\n renderId++;\n function setRule(target, index, rule) {\n var selector = rule.selector,\n declarations = rule.declarations;\n var getDeclarationText = function getDeclarationText(dec) {\n var property = dec.property,\n value = dec.value,\n important = dec.important,\n sourceValue = dec.sourceValue;\n return \"\".concat(property, \": \").concat(value == null ? sourceValue : value).concat(important ? \" !important\" : \"\", \";\");\n };\n var cssRulesText = \"\";\n declarations.forEach(function (declarations) {\n cssRulesText += \"\".concat(getDeclarationText(declarations), \" \");\n });\n var ruleText = \"\".concat(selector, \" { \").concat(cssRulesText, \" }\");\n target.insertRule(ruleText, index);\n }\n var asyncDeclarations = new Map();\n var varDeclarations = new Map();\n var asyncDeclarationCounter = 0;\n var varDeclarationCounter = 0;\n var rootReadyGroup = {\n rule: null,\n rules: [],\n isGroup: true\n };\n var groupRefs = new WeakMap();\n function getGroup(rule) {\n if (rule == null) {\n return rootReadyGroup;\n }\n if (groupRefs.has(rule)) {\n return groupRefs.get(rule);\n }\n var group = {\n rule: rule,\n rules: [],\n isGroup: true\n };\n groupRefs.set(rule, group);\n var parentGroup = getGroup(rule.parentRule);\n parentGroup.rules.push(group);\n return group;\n }\n varTypeChangeCleaners.forEach(function (clear) {\n return clear();\n });\n varTypeChangeCleaners.clear();\n modRules.filter(function (r) {\n return r;\n }).forEach(function (_ref) {\n var selector = _ref.selector,\n declarations = _ref.declarations,\n parentRule = _ref.parentRule;\n var group = getGroup(parentRule);\n var readyStyleRule = {\n selector: selector,\n declarations: [],\n isGroup: false\n };\n var readyDeclarations = readyStyleRule.declarations;\n group.rules.push(readyStyleRule);\n function handleAsyncDeclaration(property, modified, important, sourceValue) {\n var asyncKey = ++asyncDeclarationCounter;\n var asyncDeclaration = {\n property: property,\n value: null,\n important: important,\n asyncKey: asyncKey,\n sourceValue: sourceValue\n };\n readyDeclarations.push(asyncDeclaration);\n var currentRenderId = renderId;\n modified.then(function (asyncValue) {\n if (!asyncValue || isAsyncCancelled() || currentRenderId !== renderId) {\n return;\n }\n asyncDeclaration.value = asyncValue;\n asyncQueue.add(function () {\n if (isAsyncCancelled() || currentRenderId !== renderId) {\n return;\n }\n rebuildAsyncRule(asyncKey);\n });\n });\n }\n function handleVarDeclarations(property, modified, important, sourceValue) {\n var varDecs = modified.declarations,\n onTypeChange = modified.onTypeChange;\n var varKey = ++varDeclarationCounter;\n var currentRenderId = renderId;\n var initialIndex = readyDeclarations.length;\n var oldDecs = [];\n if (varDecs.length === 0) {\n var tempDec = {\n property: property,\n value: sourceValue,\n important: important,\n sourceValue: sourceValue,\n varKey: varKey\n };\n readyDeclarations.push(tempDec);\n oldDecs = [tempDec];\n }\n varDecs.forEach(function (mod) {\n if (mod.value instanceof Promise) {\n handleAsyncDeclaration(mod.property, mod.value, important, sourceValue);\n } else {\n var readyDec = {\n property: mod.property,\n value: mod.value,\n important: important,\n sourceValue: sourceValue,\n varKey: varKey\n };\n readyDeclarations.push(readyDec);\n oldDecs.push(readyDec);\n }\n });\n onTypeChange.addListener(function (newDecs) {\n if (isAsyncCancelled() || currentRenderId !== renderId) {\n return;\n }\n var readyVarDecs = newDecs.map(function (mod) {\n return {\n property: mod.property,\n value: mod.value,\n important: important,\n sourceValue: sourceValue,\n varKey: varKey\n };\n });\n // TODO: Don't search for index, store some way or use Linked List.\n var index = readyDeclarations.indexOf(oldDecs[0], initialIndex);\n readyDeclarations.splice.apply(readyDeclarations, [index, oldDecs.length].concat(_toConsumableArray(readyVarDecs)));\n oldDecs = readyVarDecs;\n rebuildVarRule(varKey);\n });\n varTypeChangeCleaners.add(function () {\n return onTypeChange.removeListeners();\n });\n }\n declarations.forEach(function (_ref2) {\n var property = _ref2.property,\n value = _ref2.value,\n important = _ref2.important,\n sourceValue = _ref2.sourceValue;\n if (typeof value === \"function\") {\n var modified = value(theme);\n if (modified instanceof Promise) {\n handleAsyncDeclaration(property, modified, important, sourceValue);\n } else if (property.startsWith(\"--\")) {\n handleVarDeclarations(property, modified, important, sourceValue);\n } else {\n readyDeclarations.push({\n property: property,\n value: modified,\n important: important,\n sourceValue: sourceValue\n });\n }\n } else {\n readyDeclarations.push({\n property: property,\n value: value,\n important: important,\n sourceValue: sourceValue\n });\n }\n });\n });\n var sheet = prepareSheet();\n function buildStyleSheet() {\n function createTarget(group, parent) {\n var rule = group.rule;\n if (rule instanceof CSSMediaRule) {\n var media = rule.media;\n var index = parent.cssRules.length;\n parent.insertRule(\"@media \".concat(media.mediaText, \" {}\"), index);\n return parent.cssRules[index];\n }\n return parent;\n }\n function iterateReadyRules(group, target, styleIterator) {\n group.rules.forEach(function (r) {\n if (r.isGroup) {\n var t = createTarget(r, target);\n iterateReadyRules(r, t, styleIterator);\n } else {\n styleIterator(r, target);\n }\n });\n }\n iterateReadyRules(rootReadyGroup, sheet, function (rule, target) {\n var index = target.cssRules.length;\n rule.declarations.forEach(function (_ref3) {\n var asyncKey = _ref3.asyncKey,\n varKey = _ref3.varKey;\n if (asyncKey != null) {\n asyncDeclarations.set(asyncKey, {\n rule: rule,\n target: target,\n index: index\n });\n }\n if (varKey != null) {\n varDeclarations.set(varKey, {\n rule: rule,\n target: target,\n index: index\n });\n }\n });\n setRule(target, index, rule);\n });\n }\n function rebuildAsyncRule(key) {\n var _asyncDeclarations$ge = asyncDeclarations.get(key),\n rule = _asyncDeclarations$ge.rule,\n target = _asyncDeclarations$ge.target,\n index = _asyncDeclarations$ge.index;\n target.deleteRule(index);\n setRule(target, index, rule);\n asyncDeclarations[\"delete\"](key);\n }\n function rebuildVarRule(key) {\n var _varDeclarations$get = varDeclarations.get(key),\n rule = _varDeclarations$get.rule,\n target = _varDeclarations$get.target,\n index = _varDeclarations$get.index;\n target.deleteRule(index);\n setRule(target, index, rule);\n }\n buildStyleSheet();\n }\n return {\n modifySheet: modifySheet,\n shouldRebuildStyle: shouldRebuildStyle\n };\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/stylesheet-modifier.js?"); |
| 160 |
|
| 161 |
/***/ }), |
| 162 |
|
| 163 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/variables.js": |
| 164 |
/*!*************************************************************!*\ |
| 165 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/variables.js ***! |
| 166 |
\*************************************************************/ |
| 167 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 168 |
|
| 169 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VariablesStore: () => (/* binding */ VariablesStore),\n/* harmony export */ replaceCSSVariablesNames: () => (/* binding */ replaceCSSVariablesNames),\n/* harmony export */ variablesStore: () => (/* binding */ variablesStore)\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_text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/text */ \"./dev/dark-mode/src/utils/text.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 _utils_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/color */ \"./dev/dark-mode/src/utils/color.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 _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; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), 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\nvar VAR_TYPE_BGCOLOR = 1 << 0;\nvar VAR_TYPE_TEXTCOLOR = 1 << 1;\nvar VAR_TYPE_BORDERCOLOR = 1 << 2;\nvar VAR_TYPE_BGIMG = 1 << 3;\nvar VariablesStore = /*#__PURE__*/function () {\n function VariablesStore() {\n _classCallCheck(this, VariablesStore);\n this.varTypes = new Map();\n this.rulesQueue = [];\n this.definedVars = new Set();\n this.varRefs = new Map();\n this.unknownColorVars = new Set();\n this.unknownBgVars = new Set();\n this.undefinedVars = new Set();\n this.initialVarTypes = new Map();\n this.changedTypeVars = new Set();\n this.typeChangeSubscriptions = new Map();\n this.unstableVarValues = new Map();\n }\n return _createClass(VariablesStore, [{\n key: \"clear\",\n value: function clear() {\n this.varTypes.clear();\n this.rulesQueue.splice(0);\n this.definedVars.clear();\n this.varRefs.clear();\n this.unknownColorVars.clear();\n this.unknownBgVars.clear();\n this.undefinedVars.clear();\n this.initialVarTypes.clear();\n this.changedTypeVars.clear();\n this.typeChangeSubscriptions.clear();\n this.unstableVarValues.clear();\n }\n }, {\n key: \"isVarType\",\n value: function isVarType(varName, typeNum) {\n return this.varTypes.has(varName) && (this.varTypes.get(varName) & typeNum) > 0;\n }\n }, {\n key: \"addRulesForMatching\",\n value: function addRulesForMatching(rules) {\n this.rulesQueue.push(rules);\n }\n }, {\n key: \"matchVariablesAndDependants\",\n value: function matchVariablesAndDependants() {\n var _this = this;\n this.changedTypeVars.clear();\n this.initialVarTypes = new Map(this.varTypes);\n this.collectRootVariables();\n this.collectVariablesAndVarDep(this.rulesQueue);\n this.rulesQueue.splice(0);\n this.collectRootVarDependants();\n this.varRefs.forEach(function (refs, v) {\n refs.forEach(function (r) {\n if (_this.varTypes.has(v)) {\n _this.resolveVariableType(r, _this.varTypes.get(v));\n }\n });\n });\n this.unknownColorVars.forEach(function (v) {\n if (_this.unknownBgVars.has(v)) {\n _this.unknownColorVars[\"delete\"](v);\n _this.unknownBgVars[\"delete\"](v);\n _this.resolveVariableType(v, VAR_TYPE_BGCOLOR);\n } else if (_this.isVarType(v, VAR_TYPE_BGCOLOR | VAR_TYPE_TEXTCOLOR | VAR_TYPE_BORDERCOLOR)) {\n _this.unknownColorVars[\"delete\"](v);\n } else {\n _this.undefinedVars.add(v);\n }\n });\n this.unknownBgVars.forEach(function (v) {\n var hasColor = _this.findVarRef(v, function (ref) {\n return _this.unknownColorVars.has(ref) || _this.isVarType(ref, VAR_TYPE_TEXTCOLOR | VAR_TYPE_BORDERCOLOR);\n }) != null;\n if (hasColor) {\n _this.itarateVarRefs(v, function (ref) {\n _this.resolveVariableType(ref, VAR_TYPE_BGCOLOR);\n });\n } else if (_this.isVarType(v, VAR_TYPE_BGCOLOR | VAR_TYPE_BGIMG)) {\n _this.unknownBgVars[\"delete\"](v);\n } else {\n _this.undefinedVars.add(v);\n }\n });\n this.changedTypeVars.forEach(function (varName) {\n if (_this.typeChangeSubscriptions.has(varName)) {\n _this.typeChangeSubscriptions.get(varName).forEach(function (callback) {\n callback();\n });\n }\n });\n this.changedTypeVars.clear();\n }\n }, {\n key: \"getModifierForVariable\",\n value: function getModifierForVariable(options) {\n var _this2 = this;\n return function (theme) {\n var varName = options.varName,\n sourceValue = options.sourceValue,\n rule = options.rule,\n ignoredImgSelectors = options.ignoredImgSelectors,\n isCancelled = options.isCancelled;\n var getDeclarations = function getDeclarations() {\n var declarations = [];\n var addModifiedValue = function addModifiedValue(typeNum, varNameWrapper, colorModifier) {\n if (!_this2.isVarType(varName, typeNum)) {\n return;\n }\n var property = varNameWrapper(varName);\n var modifiedValue;\n if (isVarDependant(sourceValue)) {\n if (isConstructedColorVar(sourceValue)) {\n var value = insertVarValues(sourceValue, _this2.unstableVarValues);\n if (!value) {\n value = typeNum === VAR_TYPE_BGCOLOR ? \"#ffffff\" : \"#000000\";\n }\n modifiedValue = colorModifier(value, theme);\n } else {\n modifiedValue = replaceCSSVariablesNames(sourceValue, function (v) {\n return varNameWrapper(v);\n }, function (fallback) {\n return colorModifier(fallback, theme);\n });\n }\n } else {\n modifiedValue = colorModifier(sourceValue, theme);\n }\n declarations.push({\n property: property,\n value: modifiedValue\n });\n };\n addModifiedValue(VAR_TYPE_BGCOLOR, wrapBgColorVariableName, tryModifyBgColor);\n addModifiedValue(VAR_TYPE_TEXTCOLOR, wrapTextColorVariableName, tryModifyTextColor);\n addModifiedValue(VAR_TYPE_BORDERCOLOR, wrapBorderColorVariableName, tryModifyBorderColor);\n if (_this2.isVarType(varName, VAR_TYPE_BGIMG)) {\n var property = wrapBgImgVariableName(varName);\n var modifiedValue = sourceValue;\n if (isVarDependant(sourceValue)) {\n modifiedValue = replaceCSSVariablesNames(sourceValue, function (v) {\n return wrapBgColorVariableName(v);\n }, function (fallback) {\n return tryModifyBgColor(fallback, theme);\n });\n }\n var bgModifier = (0,_modify_css__WEBPACK_IMPORTED_MODULE_3__.getBgImageModifier)(modifiedValue, rule, ignoredImgSelectors, isCancelled);\n modifiedValue = typeof bgModifier === \"function\" ? bgModifier(theme) : bgModifier;\n declarations.push({\n property: property,\n value: modifiedValue\n });\n }\n return declarations;\n };\n var callbacks = new Set();\n var addListener = function addListener(onTypeChange) {\n var callback = function callback() {\n var decs = getDeclarations();\n onTypeChange(decs);\n };\n callbacks.add(callback);\n _this2.subscribeForVarTypeChange(varName, callback);\n };\n var removeListeners = function removeListeners() {\n callbacks.forEach(function (callback) {\n _this2.unsubscribeFromVariableTypeChanges(varName, callback);\n });\n };\n return {\n declarations: getDeclarations(),\n onTypeChange: {\n addListener: addListener,\n removeListeners: removeListeners\n }\n };\n };\n }\n }, {\n key: \"getModifierForVarDependant\",\n value: function getModifierForVarDependant(property, sourceValue) {\n var _this3 = this;\n // TODO(gusted): This condition is incorrect, as the sourceValue still contains a variable.\n // Simply replacing it with some definition is incorrect as variables are element-independent.\n // Fully handling this requires having a function that gives the variable's value given an\n // element's position in the DOM, but that's quite computationally hard to facilitate. We'll\n // probably just handle edge-cases like `rgb(22 163 74/var(--tb-bg-opacity)` and hope that\n // lowering the opacity is enough.\n if (sourceValue.match(/^\\s*(rgb|hsl)a?\\(/)) {\n var isBg = property.startsWith(\"background\");\n var isText = isTextColorProperty(property);\n return function (theme) {\n var value = insertVarValues(sourceValue, _this3.unstableVarValues);\n if (!value) {\n value = isBg ? \"#ffffff\" : \"#000000\";\n }\n var modifier = isBg ? tryModifyBgColor : isText ? tryModifyTextColor : tryModifyBorderColor;\n return modifier(value, theme);\n };\n }\n if (property === \"background-color\") {\n return function (theme) {\n return replaceCSSVariablesNames(sourceValue, function (v) {\n return wrapBgColorVariableName(v);\n }, function (fallback) {\n return tryModifyBgColor(fallback, theme);\n });\n };\n }\n if (isTextColorProperty(property)) {\n return function (theme) {\n return replaceCSSVariablesNames(sourceValue, function (v) {\n return wrapTextColorVariableName(v);\n }, function (fallback) {\n return tryModifyTextColor(fallback, theme);\n });\n };\n }\n if (property === \"background\" || property === \"background-image\" || property === \"box-shadow\") {\n return function (theme) {\n var unknownVars = new Set();\n var modify = function modify() {\n var variableReplaced = replaceCSSVariablesNames(sourceValue, function (v) {\n if (_this3.isVarType(v, VAR_TYPE_BGCOLOR)) {\n return wrapBgColorVariableName(v);\n }\n if (_this3.isVarType(v, VAR_TYPE_BGIMG)) {\n return wrapBgImgVariableName(v);\n }\n unknownVars.add(v);\n return v;\n }, function (fallback) {\n return tryModifyBgColor(fallback, theme);\n });\n // Check if the property is box-shadow and if so, do a pass-through to modify the shadow.\n if (property === \"box-shadow\") {\n var shadowModifier = (0,_modify_css__WEBPACK_IMPORTED_MODULE_3__.getShadowModifierWithInfo)(variableReplaced);\n var modifiedShadow = shadowModifier(theme);\n if (modifiedShadow.unparseableMatchesLength !== modifiedShadow.matchesLength) {\n return modifiedShadow.result;\n }\n }\n return variableReplaced;\n };\n var modified = modify();\n if (unknownVars.size > 0) {\n return new Promise(function (resolve) {\n var firstUnknownVar = unknownVars.values().next().value;\n var callback = function callback() {\n _this3.unsubscribeFromVariableTypeChanges(firstUnknownVar, callback);\n var newValue = modify();\n resolve(newValue);\n };\n _this3.subscribeForVarTypeChange(firstUnknownVar, callback);\n });\n }\n return modified;\n };\n }\n if (property.startsWith(\"border\") || property.startsWith(\"outline\")) {\n return function (theme) {\n return replaceCSSVariablesNames(sourceValue, function (v) {\n return wrapBorderColorVariableName(v);\n }, function (fallback) {\n return tryModifyBorderColor(fallback, theme);\n });\n };\n }\n return null;\n }\n }, {\n key: \"subscribeForVarTypeChange\",\n value: function subscribeForVarTypeChange(varName, callback) {\n if (!this.typeChangeSubscriptions.has(varName)) {\n this.typeChangeSubscriptions.set(varName, new Set());\n }\n var rootStore = this.typeChangeSubscriptions.get(varName);\n if (!rootStore.has(callback)) {\n rootStore.add(callback);\n }\n }\n }, {\n key: \"unsubscribeFromVariableTypeChanges\",\n value: function unsubscribeFromVariableTypeChanges(varName, callback) {\n if (this.typeChangeSubscriptions.has(varName)) {\n this.typeChangeSubscriptions.get(varName)[\"delete\"](callback);\n }\n }\n\n // Because of the similar expensive task between the old `collectVariables`\n // and `collectVarDepandant`, we only want to do it once.\n // This function should only do the same expensive task once\n // and ensure that the result comes to the correct task.\n // The task is either `inspectVariable` or `inspectVarDependant`.\n }, {\n key: \"collectVariablesAndVarDep\",\n value: function collectVariablesAndVarDep(ruleList) {\n var _this4 = this;\n ruleList.forEach(function (rules) {\n (0,_css_rules__WEBPACK_IMPORTED_MODULE_2__.iterateCSSRules)(rules, function (rule) {\n rule.style && (0,_css_rules__WEBPACK_IMPORTED_MODULE_2__.iterateCSSDeclarations)(rule.style, function (property, value) {\n if (isVariable(property)) {\n _this4.inspectVariable(property, value);\n }\n if (isVarDependant(value)) {\n _this4.inspectVarDependant(property, value);\n }\n });\n });\n });\n }\n }, {\n key: \"collectRootVariables\",\n value: function collectRootVariables() {\n var _this5 = this;\n (0,_css_rules__WEBPACK_IMPORTED_MODULE_2__.iterateCSSDeclarations)(document.documentElement.style, function (property, value) {\n if (isVariable(property)) {\n _this5.inspectVariable(property, value);\n }\n });\n }\n }, {\n key: \"inspectVariable\",\n value: function inspectVariable(varName, value) {\n this.unstableVarValues.set(varName, value);\n if (isVarDependant(value) && isConstructedColorVar(value)) {\n this.unknownColorVars.add(varName);\n this.definedVars.add(varName);\n }\n if (this.definedVars.has(varName)) {\n return;\n }\n this.definedVars.add(varName);\n\n // Check if the value is either a raw value or a value that can be parsed\n // e.g. rgb, hsl.\n var isColor = rawValueRegex.test(value) || (0,_utils_color__WEBPACK_IMPORTED_MODULE_4__.parseColorWithCache)(value);\n if (isColor) {\n this.unknownColorVars.add(varName);\n } else if (value.includes(\"url(\") || value.includes(\"linear-gradient(\") || value.includes(\"radial-gradient(\")) {\n this.resolveVariableType(varName, VAR_TYPE_BGIMG);\n }\n }\n }, {\n key: \"resolveVariableType\",\n value: function resolveVariableType(varName, typeNum) {\n var initialType = this.initialVarTypes.get(varName) || 0;\n var currentType = this.varTypes.get(varName) || 0;\n var newType = currentType | typeNum;\n this.varTypes.set(varName, newType);\n if (newType !== initialType || this.undefinedVars.has(varName)) {\n this.changedTypeVars.add(varName);\n this.undefinedVars[\"delete\"](varName);\n }\n this.unknownColorVars[\"delete\"](varName);\n this.unknownBgVars[\"delete\"](varName);\n }\n }, {\n key: \"collectRootVarDependants\",\n value: function collectRootVarDependants() {\n var _this6 = this;\n (0,_css_rules__WEBPACK_IMPORTED_MODULE_2__.iterateCSSDeclarations)(document.documentElement.style, function (property, value) {\n if (isVarDependant(value)) {\n _this6.inspectVarDependant(property, value);\n }\n });\n }\n }, {\n key: \"inspectVarDependant\",\n value: function inspectVarDependant(property, value) {\n var _this7 = this;\n if (isVariable(property)) {\n this.iterateVarDeps(value, function (ref) {\n if (!_this7.varRefs.has(property)) {\n _this7.varRefs.set(property, new Set());\n }\n _this7.varRefs.get(property).add(ref);\n });\n } else if (property === \"background-color\" || property === \"box-shadow\") {\n this.iterateVarDeps(value, function (v) {\n return _this7.resolveVariableType(v, VAR_TYPE_BGCOLOR);\n });\n } else if (isTextColorProperty(property)) {\n this.iterateVarDeps(value, function (v) {\n return _this7.resolveVariableType(v, VAR_TYPE_TEXTCOLOR);\n });\n } else if (property.startsWith(\"border\") || property.startsWith(\"outline\")) {\n this.iterateVarDeps(value, function (v) {\n return _this7.resolveVariableType(v, VAR_TYPE_BORDERCOLOR);\n });\n } else if (property === \"background\" || property === \"background-image\") {\n this.iterateVarDeps(value, function (v) {\n if (_this7.isVarType(v, VAR_TYPE_BGCOLOR | VAR_TYPE_BGIMG)) {\n return;\n }\n var isBgColor = _this7.findVarRef(v, function (ref) {\n return _this7.unknownColorVars.has(ref) || _this7.isVarType(ref, VAR_TYPE_TEXTCOLOR | VAR_TYPE_BORDERCOLOR);\n }) != null;\n _this7.itarateVarRefs(v, function (ref) {\n if (isBgColor) {\n _this7.resolveVariableType(ref, VAR_TYPE_BGCOLOR);\n } else {\n _this7.unknownBgVars.add(ref);\n }\n });\n });\n }\n }\n }, {\n key: \"iterateVarDeps\",\n value: function iterateVarDeps(value, iterator) {\n var varDeps = new Set();\n iterateVarDependencies(value, function (v) {\n return varDeps.add(v);\n });\n varDeps.forEach(function (v) {\n return iterator(v);\n });\n }\n }, {\n key: \"findVarRef\",\n value: function findVarRef(varName, iterator) {\n var stack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();\n if (stack.has(varName)) {\n return null;\n }\n stack.add(varName);\n var result = iterator(varName);\n if (result) {\n return varName;\n }\n var refs = this.varRefs.get(varName);\n if (!refs || refs.size === 0) {\n return null;\n }\n var _iterator = _createForOfIteratorHelper(refs),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var ref = _step.value;\n var found = this.findVarRef(ref, iterator, stack);\n if (found) {\n return found;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return null;\n }\n }, {\n key: \"itarateVarRefs\",\n value: function itarateVarRefs(varName, iterator) {\n this.findVarRef(varName, function (ref) {\n iterator(ref);\n return false;\n });\n }\n }, {\n key: \"setOnRootVariableChange\",\n value: function setOnRootVariableChange(callback) {\n this.onRootVariableDefined = callback;\n }\n }, {\n key: \"putRootVars\",\n value: function putRootVars(styleElement, theme) {\n var _this8 = this;\n var sheet = styleElement.sheet;\n if (sheet.cssRules.length > 0) {\n sheet.deleteRule(0);\n }\n var declarations = new Map();\n (0,_css_rules__WEBPACK_IMPORTED_MODULE_2__.iterateCSSDeclarations)(document.documentElement.style, function (property, value) {\n if (isVariable(property)) {\n if (_this8.isVarType(property, VAR_TYPE_BGCOLOR)) {\n declarations.set(wrapBgColorVariableName(property), tryModifyBgColor(value, theme));\n }\n if (_this8.isVarType(property, VAR_TYPE_TEXTCOLOR)) {\n declarations.set(wrapTextColorVariableName(property), tryModifyTextColor(value, theme));\n }\n if (_this8.isVarType(property, VAR_TYPE_BORDERCOLOR)) {\n declarations.set(wrapBorderColorVariableName(property), tryModifyBorderColor(value, theme));\n }\n _this8.subscribeForVarTypeChange(property, _this8.onRootVariableDefined);\n }\n });\n var cssLines = [];\n cssLines.push(\":root {\");\n var _iterator2 = _createForOfIteratorHelper(declarations),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var _step2$value = _slicedToArray(_step2.value, 2),\n property = _step2$value[0],\n value = _step2$value[1];\n cssLines.push(\" \".concat(property, \": \").concat(value, \";\"));\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n cssLines.push(\"}\");\n var cssText = cssLines.join(\"\\n\");\n sheet.insertRule(cssText);\n }\n }]);\n}();\nvar variablesStore = new VariablesStore();\nfunction getVariableRange(input) {\n var searchStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var start = input.indexOf(\"var(\", searchStart);\n if (start >= 0) {\n var range = (0,_utils_text__WEBPACK_IMPORTED_MODULE_1__.getParenthesesRange)(input, start + 3);\n if (range) {\n return {\n start: start,\n end: range.end\n };\n }\n }\n return null;\n}\nfunction getVariablesMatches(input) {\n var ranges = [];\n var i = 0;\n var range;\n while (range = getVariableRange(input, i)) {\n var _range = range,\n start = _range.start,\n end = _range.end;\n ranges.push({\n start: start,\n end: end,\n value: input.substring(start, end)\n });\n i = range.end + 1;\n }\n return ranges;\n}\nfunction replaceVariablesMatches(input, replacer) {\n var matches = getVariablesMatches(input);\n var matchesCount = matches.length;\n if (matchesCount === 0) {\n return input;\n }\n var inputLength = input.length;\n var replacements = matches.map(function (m) {\n return replacer(m.value);\n });\n var parts = [];\n parts.push(input.substring(0, matches[0].start));\n for (var i = 0; i < matchesCount; i++) {\n parts.push(replacements[i]);\n var start = matches[i].end;\n var end = i < matchesCount - 1 ? matches[i + 1].start : inputLength;\n parts.push(input.substring(start, end));\n }\n return parts.join(\"\");\n}\nfunction getVariableNameAndFallback(match) {\n var commaIndex = match.indexOf(\",\");\n var name;\n var fallback;\n if (commaIndex >= 0) {\n name = match.substring(4, commaIndex).trim();\n fallback = match.substring(commaIndex + 1, match.length - 1).trim();\n } else {\n name = match.substring(4, match.length - 1).trim();\n fallback = \"\";\n }\n return {\n name: name,\n fallback: fallback\n };\n}\nfunction replaceCSSVariablesNames(value, nameReplacer, fallbackReplacer) {\n var matchReplacer = function matchReplacer(match) {\n var _getVariableNameAndFa = getVariableNameAndFallback(match),\n name = _getVariableNameAndFa.name,\n fallback = _getVariableNameAndFa.fallback;\n var newName = nameReplacer(name);\n if (!fallback) {\n return \"var(\".concat(newName, \")\");\n }\n var newFallback;\n if (isVarDependant(fallback)) {\n newFallback = replaceCSSVariablesNames(fallback, nameReplacer, fallbackReplacer);\n } else if (fallbackReplacer) {\n newFallback = fallbackReplacer(fallback);\n } else {\n newFallback = fallback;\n }\n return \"var(\".concat(newName, \", \").concat(newFallback, \")\");\n };\n return replaceVariablesMatches(value, matchReplacer);\n}\nfunction iterateVarDependencies(value, iterator) {\n replaceCSSVariablesNames(value, function (varName) {\n iterator(varName);\n return varName;\n });\n}\nfunction wrapBgColorVariableName(name) {\n return \"--adminify-bg\".concat(name);\n}\nfunction wrapTextColorVariableName(name) {\n return \"--adminify-text\".concat(name);\n}\nfunction wrapBorderColorVariableName(name) {\n return \"--adminify-border\".concat(name);\n}\nfunction wrapBgImgVariableName(name) {\n return \"--adminify-bgimg\".concat(name);\n}\nfunction isVariable(property) {\n return property.startsWith(\"--\");\n}\nfunction isVarDependant(value) {\n return value.includes(\"var(\");\n}\nfunction isConstructedColorVar(value) {\n return value.match(/^\\s*(rgb|hsl)a?\\(/);\n}\nfunction isTextColorProperty(property) {\n return property === \"color\" || property === \"caret-color\" || property === \"-webkit-text-fill-color\";\n}\n\n// ex. 131,123,132 | 1,341, 122\nvar rawValueRegex = /^\\d{1,3}, ?\\d{1,3}, ?\\d{1,3}$/;\nfunction parseRawValue(color) {\n if (rawValueRegex.test(color)) {\n // Convert the raw value into a useable rgb(...) value, such that it can\n // be properly used with other functions that expect such value.\n var splitted = color.split(\",\");\n var resultInRGB = \"rgb(\";\n splitted.forEach(function (number) {\n resultInRGB += \"\".concat(number.trim(), \", \");\n });\n resultInRGB = resultInRGB.substring(0, resultInRGB.length - 2);\n resultInRGB += \")\";\n return {\n isRaw: true,\n color: resultInRGB\n };\n }\n return {\n isRaw: false,\n color: color\n };\n}\nfunction handleRawValue(color, theme, modifyFunction) {\n var _parseRawValue = parseRawValue(color),\n isRaw = _parseRawValue.isRaw,\n newColor = _parseRawValue.color;\n var rgb = (0,_utils_color__WEBPACK_IMPORTED_MODULE_4__.parseColorWithCache)(newColor);\n if (rgb) {\n var outputColor = modifyFunction(rgb, theme);\n\n // If it's raw, we need to convert it back to the \"raw\" format.\n if (isRaw) {\n // This should technically never fail(returning an empty string),\n // but just to be safe, we will return outputColor.\n var outputInRGB = (0,_utils_color__WEBPACK_IMPORTED_MODULE_4__.parseColorWithCache)(outputColor);\n return outputInRGB ? \"\".concat(outputInRGB.r, \", \").concat(outputInRGB.g, \", \").concat(outputInRGB.b) : outputColor;\n }\n return outputColor;\n }\n return newColor;\n}\nfunction tryModifyBgColor(color, theme) {\n return handleRawValue(color, theme, _generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBackgroundColor);\n}\nfunction tryModifyTextColor(color, theme) {\n return handleRawValue(color, theme, _generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyForegroundColor);\n}\nfunction tryModifyBorderColor(color, theme) {\n return handleRawValue(color, theme, _generators_modify_colors__WEBPACK_IMPORTED_MODULE_0__.modifyBorderColor);\n}\nfunction insertVarValues(source, varValues) {\n var stack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();\n var containsUnresolvedVar = false;\n var matchReplacer = function matchReplacer(match) {\n var _getVariableNameAndFa2 = getVariableNameAndFallback(match),\n name = _getVariableNameAndFa2.name,\n fallback = _getVariableNameAndFa2.fallback;\n if (stack.has(name)) {\n containsUnresolvedVar = true;\n return null;\n }\n stack.add(name);\n var varValue = varValues.get(name) || fallback;\n var inserted = null;\n if (varValue) {\n if (isVarDependant(varValue)) {\n inserted = insertVarValues(varValue, varValues, stack);\n } else {\n inserted = varValue;\n }\n }\n if (!inserted) {\n containsUnresolvedVar = true;\n return null;\n }\n return inserted;\n };\n var replaced = replaceVariablesMatches(source, matchReplacer);\n if (containsUnresolvedVar) {\n return null;\n }\n return replaced;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/variables.js?"); |
| 170 |
|
| 171 |
/***/ }), |
| 172 |
|
| 173 |
/***/ "./dev/dark-mode/src/inject/dynamic-theme/watch.js": |
| 174 |
/*!*********************************************************!*\ |
| 175 |
!*** ./dev/dark-mode/src/inject/dynamic-theme/watch.js ***! |
| 176 |
\*********************************************************/ |
| 177 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 178 |
|
| 179 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ stopWatchingForStyleChanges: () => (/* binding */ stopWatchingForStyleChanges)\n/* harmony export */ });\nvar observers = [];\nvar observedRoots;\nvar elementsDefinitionCallback;\nvar undefinedGroups = new Map();\nfunction resetObservers() {\n observers.forEach(function (o) {\n return o.disconnect();\n });\n observers.splice(0, observers.length);\n observedRoots = new WeakSet();\n}\nfunction handleIsDefined(e) {\n canOptimizeUsingProxy = true;\n var tag = e.detail.tag;\n ASSERT(\"handleIsDefined() expects lower-case node names\", function () {\n return tag.toLowerCase() === tag;\n });\n definedCustomElements.add(tag);\n if (resolvers.has(tag)) {\n var r = resolvers.get(tag);\n resolvers[\"delete\"](tag);\n r.forEach(function (r) {\n return r();\n });\n }\n}\nfunction unsubscribeFromDefineCustomElements() {\n elementsDefinitionCallback = null;\n undefinedGroups.clear();\n document.removeEventListener(\"__adminify__isDefined\", handleIsDefined);\n}\nfunction stopWatchingForStyleChanges() {\n resetObservers();\n unsubscribeFromDefineCustomElements();\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/dynamic-theme/watch.js?"); |
| 180 |
|
| 181 |
/***/ }), |
| 182 |
|
| 183 |
/***/ "./dev/dark-mode/src/inject/utils/dom.js": |
| 184 |
/*!***********************************************!*\ |
| 185 |
!*** ./dev/dark-mode/src/inject/utils/dom.js ***! |
| 186 |
\***********************************************/ |
| 187 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 188 |
|
| 189 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addReadyStateCompleteListener: () => (/* binding */ addReadyStateCompleteListener),\n/* harmony export */ cleanReadyStateCompleteListeners: () => (/* binding */ cleanReadyStateCompleteListeners),\n/* harmony export */ isDOMReady: () => (/* binding */ isDOMReady),\n/* harmony export */ isReadyStateComplete: () => (/* binding */ isReadyStateComplete),\n/* harmony export */ iterateShadowHosts: () => (/* binding */ iterateShadowHosts),\n/* harmony export */ removeDOMReadyListener: () => (/* binding */ removeDOMReadyListener),\n/* harmony export */ removeNode: () => (/* binding */ removeNode),\n/* harmony export */ watchForNodePosition: () => (/* binding */ watchForNodePosition)\n/* harmony export */ });\n/* harmony import */ var _utils_throttle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/throttle */ \"./dev/dark-mode/src/utils/throttle.js\");\n/* harmony import */ var _utils_time__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/time */ \"./dev/dark-mode/src/utils/time.js\");\n\n\n// import { logWarn } from \"./log\";\n\n// **important**\nfunction watchForNodePosition(node, mode) {\n var onRestore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Function.prototype;\n var MAX_ATTEMPTS_COUNT = 10;\n var RETRY_TIMEOUT = (0,_utils_time__WEBPACK_IMPORTED_MODULE_1__.getDuration)({\n seconds: 2\n });\n var ATTEMPTS_INTERVAL = (0,_utils_time__WEBPACK_IMPORTED_MODULE_1__.getDuration)({\n seconds: 10\n });\n var prevSibling = node.previousSibling;\n var parent = node.parentNode;\n if (!parent) {\n throw new Error(\"Unable to watch for node position: parent element not found\");\n }\n if (mode === \"prev-sibling\" && !prevSibling) {\n throw new Error(\"Unable to watch for node position: there is no previous sibling\");\n }\n var attempts = 0;\n var start = null;\n var timeoutId = null;\n var restore = (0,_utils_throttle__WEBPACK_IMPORTED_MODULE_0__.throttle)(function () {\n if (timeoutId) {\n return;\n }\n attempts++;\n var now = Date.now();\n if (start == null) {\n start = now;\n } else if (attempts >= MAX_ATTEMPTS_COUNT) {\n if (now - start < ATTEMPTS_INTERVAL) {\n // logWarn(\n // `Node position watcher paused: retry in ${RETRY_TIMEOUT}ms`,\n // node,\n // prevSibling\n // );\n timeoutId = setTimeout(function () {\n start = null;\n attempts = 0;\n timeoutId = null;\n restore();\n }, RETRY_TIMEOUT);\n return;\n }\n start = now;\n attempts = 1;\n }\n if (mode === \"head\") {\n if (prevSibling && prevSibling.parentNode !== parent) {\n // logWarn(\n // \"Unable to restore node position: sibling parent changed\",\n // node,\n // prevSibling,\n // parent\n // );\n stop();\n return;\n }\n }\n if (mode === \"prev-sibling\") {\n if (prevSibling.parentNode == null) {\n // logWarn(\n // \"Unable to restore node position: sibling was removed\",\n // node,\n // prevSibling,\n // parent\n // );\n stop();\n return;\n }\n if (prevSibling.parentNode !== parent) {\n // logWarn(\"Style was moved to another parent\", node, prevSibling, parent);\n updateParent(prevSibling.parentNode);\n }\n }\n\n // If parent becomes disconnected from the DOM, fetches the new head and\n // save that as parent. Do this only for the head mode, as those are\n // important nodes to keep.\n if (mode === \"head\" && !parent.isConnected) {\n parent = document.head;\n // TODO: Set correct prevSibling, which needs to be the last `.adminify` in <head> that isn't .darkeader--sync or .adminify--cors.\n }\n\n // logWarn(\"Restoring node position\", node, prevSibling, parent);\n parent.insertBefore(node, prevSibling && prevSibling.isConnected ? prevSibling.nextSibling : parent.firstChild);\n observer.takeRecords();\n onRestore && onRestore();\n });\n var observer = new MutationObserver(function () {\n if (mode === \"head\" && (node.parentNode !== parent || !node.parentNode.isConnected) || mode === \"prev-sibling\" && node.previousSibling !== prevSibling) {\n restore();\n }\n });\n var run = function run() {\n // TODO: remove type cast after dependency update\n observer.observe(parent, {\n childList: true\n });\n };\n var stop = function stop() {\n // TODO: remove type cast after dependency update\n clearTimeout(timeoutId);\n observer.disconnect();\n restore.cancel();\n };\n var skip = function skip() {\n observer.takeRecords();\n };\n var updateParent = function updateParent(parentNode) {\n parent = parentNode;\n stop();\n run();\n };\n run();\n return {\n run: run,\n stop: stop,\n skip: skip\n };\n}\nfunction iterateShadowHosts(root, iterator) {\n if (root == null) {\n return;\n }\n var walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {\n acceptNode: function acceptNode(node) {\n return node.shadowRoot == null ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;\n }\n });\n for (var node = root.shadowRoot ? walker.currentNode : walker.nextNode(); node != null; node = walker.nextNode()) {\n if (node.classList.contains(\"surfingkeys_hints_host\")) {\n continue;\n }\n iterator(node);\n iterateShadowHosts(node.shadowRoot, iterator);\n }\n}\nvar readyStateCompleteListeners = new Set();\n\n// `interactive` can and will be fired when their are still stylesheets loading.\n// We use certain actions that can cause a forced layout change, which is bad.\nfunction isReadyStateComplete() {\n return document.readyState === \"complete\";\n}\nfunction addReadyStateCompleteListener(listener) {\n isReadyStateComplete() ? listener() : readyStateCompleteListeners.add(listener);\n}\nvar isDOMReady = function isDOMReady() {\n return document.readyState === \"complete\" || document.readyState === \"interactive\";\n};\n\n//remove\n\nvar readyStateListeners = new Set();\nfunction removeNode(node) {\n node && node.parentNode && node.parentNode.removeChild(node);\n}\nfunction removeDOMReadyListener(listener) {\n readyStateListeners[\"delete\"](listener);\n}\nfunction cleanReadyStateCompleteListeners() {\n readyStateCompleteListeners.clear();\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/inject/utils/dom.js?"); |
| 190 |
|
| 191 |
/***/ }), |
| 192 |
|
| 193 |
/***/ "./dev/dark-mode/src/main.js": |
| 194 |
/*!***********************************!*\ |
| 195 |
!*** ./dev/dark-mode/src/main.js ***! |
| 196 |
\***********************************/ |
| 197 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 198 |
|
| 199 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ run: () => (/* binding */ run)\n/* harmony export */ });\n/* harmony import */ var _inject_dynamic_theme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inject/dynamic-theme */ \"./dev/dark-mode/src/inject/dynamic-theme/index.js\");\n\nfunction run(config) {\n (0,_inject_dynamic_theme__WEBPACK_IMPORTED_MODULE_0__.run_createThemeAndWatchForUpdates)(config);\n}\nfunction remove() {\n (0,_inject_dynamic_theme__WEBPACK_IMPORTED_MODULE_0__.removeDynamicTheme)();\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/main.js?"); |
| 200 |
|
| 201 |
/***/ }), |
| 202 |
|
| 203 |
/***/ "./dev/dark-mode/src/utils/array.js": |
| 204 |
/*!******************************************!*\ |
| 205 |
!*** ./dev/dark-mode/src/utils/array.js ***! |
| 206 |
\******************************************/ |
| 207 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 208 |
|
| 209 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ forEach: () => (/* binding */ forEach),\n/* harmony export */ push: () => (/* binding */ push),\n/* harmony export */ toArray: () => (/* binding */ toArray)\n/* harmony export */ });\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 isArrayLike(items) {\n return items.length != null;\n}\n\n// NOTE: Iterating Array-like items using `for .. of` is 3x slower in Firefox\n// https://jsben.ch/kidOp\nfunction forEach(items, iterator) {\n if (isArrayLike(items)) {\n for (var i = 0, len = items.length; i < len; i++) {\n iterator(items[i]);\n }\n } else {\n var _iterator = _createForOfIteratorHelper(items),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var item = _step.value;\n iterator(item);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n}\n\n// NOTE: Pushing items like `arr.push(...items)` is 3x slower in Firefox\n// https://jsben.ch/nr9OF\nfunction push(array, addition) {\n forEach(addition, function (a) {\n return array.push(a);\n });\n}\n\n// NOTE: Using `Array.from()` is 2x (FF) — 5x (Chrome) slower for ArrayLike (not for Iterable)\n// https://jsben.ch/FJ1mO\n// https://jsben.ch/ZmViL\nfunction toArray(items) {\n var results = [];\n for (var i = 0, len = items.length; i < len; i++) {\n results.push(items[i]);\n }\n return results;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/array.js?"); |
| 210 |
|
| 211 |
/***/ }), |
| 212 |
|
| 213 |
/***/ "./dev/dark-mode/src/utils/async-queue.js": |
| 214 |
/*!************************************************!*\ |
| 215 |
!*** ./dev/dark-mode/src/utils/async-queue.js ***! |
| 216 |
\************************************************/ |
| 217 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 218 |
|
| 219 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ AsyncQueue)\n/* harmony export */ });\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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), 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// AsyncQueue is a class that helps with managing tasks.\n// More specifically, it helps with tasks that are often used.\n// It's fully asyncronous and uses promises and tries to get 60FPS.\nvar AsyncQueue = /*#__PURE__*/function () {\n function AsyncQueue() {\n _classCallCheck(this, AsyncQueue);\n this.queue = [];\n this.timerId = null;\n this.frameDuration = 1000 / 60;\n }\n return _createClass(AsyncQueue, [{\n key: \"addToQueue\",\n value: function addToQueue(entry) {\n this.queue.push(entry);\n this.startQueue();\n }\n }, {\n key: \"stopQueue\",\n value: function stopQueue() {\n if (this.timerId !== null) {\n cancelAnimationFrame(this.timerId);\n this.timerId = null;\n }\n this.queue = [];\n }\n\n // Ensures 60FPS.\n }, {\n key: \"startQueue\",\n value: function startQueue() {\n var _this = this;\n if (this.timerId) {\n return;\n }\n this.timerId = requestAnimationFrame(function () {\n _this.timerId = null;\n var start = Date.now();\n var cb;\n while (cb = _this.queue.shift()) {\n cb();\n if (Date.now() - start >= _this.frameDuration) {\n _this.startQueue();\n break;\n }\n }\n });\n }\n }]);\n}();\n\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/async-queue.js?"); |
| 220 |
|
| 221 |
/***/ }), |
| 222 |
|
| 223 |
/***/ "./dev/dark-mode/src/utils/color.js": |
| 224 |
/*!******************************************!*\ |
| 225 |
!*** ./dev/dark-mode/src/utils/color.js ***! |
| 226 |
\******************************************/ |
| 227 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 228 |
|
| 229 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clearColorCache: () => (/* binding */ clearColorCache),\n/* harmony export */ getSRGBLightness: () => (/* binding */ getSRGBLightness),\n/* harmony export */ hslToRGB: () => (/* binding */ hslToRGB),\n/* harmony export */ hslToString: () => (/* binding */ hslToString),\n/* harmony export */ lowerCalcExpression: () => (/* binding */ lowerCalcExpression),\n/* harmony export */ parse: () => (/* binding */ parse),\n/* harmony export */ parseColorWithCache: () => (/* binding */ parseColorWithCache),\n/* harmony export */ parseToHSLWithCache: () => (/* binding */ parseToHSLWithCache),\n/* harmony export */ rgbToHSL: () => (/* binding */ rgbToHSL),\n/* harmony export */ rgbToHexString: () => (/* binding */ rgbToHexString),\n/* harmony export */ rgbToString: () => (/* binding */ rgbToString)\n/* harmony export */ });\n/* harmony import */ var _math_eval__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-eval */ \"./dev/dark-mode/src/utils/math-eval.js\");\n/* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./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 _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\nvar hslaParseCache = new Map();\nvar rgbaParseCache = new Map();\nfunction parseColorWithCache($color) {\n $color = $color.trim();\n if (rgbaParseCache.has($color)) {\n return rgbaParseCache.get($color);\n }\n // We cannot _really_ parse any color which has the calc() expression,\n // so we try our best to remove those and then parse the value.\n if ($color.includes(\"calc(\")) {\n $color = lowerCalcExpression($color);\n }\n var color = parse($color);\n color && rgbaParseCache.set($color, color);\n return color;\n}\nfunction parseToHSLWithCache(color) {\n if (hslaParseCache.has(color)) {\n return hslaParseCache.get(color);\n }\n var rgb = parseColorWithCache(color);\n if (!rgb) {\n return null;\n }\n var hsl = rgbToHSL(rgb);\n hslaParseCache.set(color, hsl);\n return hsl;\n}\nfunction clearColorCache() {\n hslaParseCache.clear();\n rgbaParseCache.clear();\n}\n\n// https://en.wikipedia.org/wiki/HSL_and_HSV\nfunction hslToRGB(_ref) {\n var h = _ref.h,\n s = _ref.s,\n l = _ref.l,\n _ref$a = _ref.a,\n a = _ref$a === void 0 ? 1 : _ref$a;\n if (s === 0) {\n var _map = [l, l, l].map(function (x) {\n return Math.round(x * 255);\n }),\n _map2 = _slicedToArray(_map, 3),\n _r = _map2[0],\n _b = _map2[1],\n _g = _map2[2];\n return {\n r: _r,\n g: _g,\n b: _b,\n a: a\n };\n }\n var c = (1 - Math.abs(2 * l - 1)) * s;\n var x = c * (1 - Math.abs(h / 60 % 2 - 1));\n var m = l - c / 2;\n var _map3 = (h < 60 ? [c, x, 0] : h < 120 ? [x, c, 0] : h < 180 ? [0, c, x] : h < 240 ? [0, x, c] : h < 300 ? [x, 0, c] : [c, 0, x]).map(function (n) {\n return Math.round((n + m) * 255);\n }),\n _map4 = _slicedToArray(_map3, 3),\n r = _map4[0],\n g = _map4[1],\n b = _map4[2];\n return {\n r: r,\n g: g,\n b: b,\n a: a\n };\n}\n\n// https://en.wikipedia.org/wiki/HSL_and_HSV\nfunction rgbToHSL(_ref2) {\n var r255 = _ref2.r,\n g255 = _ref2.g,\n b255 = _ref2.b,\n _ref2$a = _ref2.a,\n a = _ref2$a === void 0 ? 1 : _ref2$a;\n var r = r255 / 255;\n var g = g255 / 255;\n var b = b255 / 255;\n var max = Math.max(r, g, b);\n var min = Math.min(r, g, b);\n var c = max - min;\n var l = (max + min) / 2;\n if (c === 0) {\n return {\n h: 0,\n s: 0,\n l: l,\n a: a\n };\n }\n var h = (max === r ? (g - b) / c % 6 : max === g ? (b - r) / c + 2 : (r - g) / c + 4) * 60;\n if (h < 0) {\n h += 360;\n }\n var s = c / (1 - Math.abs(2 * l - 1));\n return {\n h: h,\n s: s,\n l: l,\n a: a\n };\n}\nfunction toFixed(n) {\n var digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var fixed = n.toFixed(digits);\n if (digits === 0) {\n return fixed;\n }\n var dot = fixed.indexOf(\".\");\n if (dot >= 0) {\n var zerosMatch = fixed.match(/0+$/);\n if (zerosMatch) {\n if (zerosMatch.index === dot + 1) {\n return fixed.substring(0, dot);\n }\n return fixed.substring(0, zerosMatch.index);\n }\n }\n return fixed;\n}\nfunction rgbToString(rgb) {\n var r = rgb.r,\n g = rgb.g,\n b = rgb.b,\n a = rgb.a;\n if (a != null && a < 1) {\n return \"rgba(\".concat(toFixed(r), \", \").concat(toFixed(g), \", \").concat(toFixed(b), \", \").concat(toFixed(a, 2), \")\");\n }\n return \"rgb(\".concat(toFixed(r), \", \").concat(toFixed(g), \", \").concat(toFixed(b), \")\");\n}\nfunction rgbToHexString(_ref3) {\n var r = _ref3.r,\n g = _ref3.g,\n b = _ref3.b,\n a = _ref3.a;\n return \"#\".concat((a != null && a < 1 ? [r, g, b, Math.round(a * 255)] : [r, g, b]).map(function (x) {\n return \"\".concat(x < 16 ? \"0\" : \"\").concat(x.toString(16));\n }).join(\"\"));\n}\nfunction hslToString(hsl) {\n var h = hsl.h,\n s = hsl.s,\n l = hsl.l,\n a = hsl.a;\n if (a != null && a < 1) {\n return \"hsla(\".concat(toFixed(h), \", \").concat(toFixed(s * 100), \"%, \").concat(toFixed(l * 100), \"%, \").concat(toFixed(a, 2), \")\");\n }\n return \"hsl(\".concat(toFixed(h), \", \").concat(toFixed(s * 100), \"%, \").concat(toFixed(l * 100), \"%)\");\n}\nvar rgbMatch = /^rgba?\\([^\\(\\)]+\\)$/;\nvar hslMatch = /^hsla?\\([^\\(\\)]+\\)$/;\nvar hexMatch = /^#[0-9a-f]+$/i;\nfunction parse($color) {\n var c = $color.trim().toLowerCase();\n if (c.match(rgbMatch)) {\n return parseRGB(c);\n }\n if (c.match(hslMatch)) {\n return parseHSL(c);\n }\n if (c.match(hexMatch)) {\n return parseHex(c);\n }\n if (knownColors.has(c)) {\n return getColorByName(c);\n }\n if (systemColors.has(c)) {\n return getSystemColor(c);\n }\n if ($color === \"transparent\") {\n return {\n r: 0,\n g: 0,\n b: 0,\n a: 0\n };\n }\n return null;\n}\nfunction getNumbers($color) {\n var numbers = [];\n var prevPos = 0;\n var isMining = false;\n // Get the first `(`.\n var startIndex = $color.indexOf(\"(\");\n $color = $color.substring(startIndex + 1, $color.length - 1);\n for (var i = 0; i < $color.length; i++) {\n var c = $color[i];\n // Check if `c` is a digit.\n if (c >= \"0\" && c <= \"9\" || c === \".\" || c === \"+\" || c === \"-\") {\n // Enable the mining flag.\n isMining = true;\n } else if (isMining && (c === \" \" || c === \",\" || c === \"/\")) {\n // isMining is true and we got a terminating\n // character. So we can push the current number\n // into the array.\n numbers.push($color.substring(prevPos, i));\n // Disable the mining flag.\n isMining = false;\n // Ensure the prevPos is correct.\n prevPos = i + 1;\n } else if (!isMining) {\n // Ensure the prevPos is correct.\n prevPos = i + 1;\n }\n }\n // Push the last number.\n if (isMining) {\n numbers.push($color.substring(prevPos, $color.length));\n }\n return numbers;\n}\nfunction getNumbersFromString(str, range, units) {\n var raw = getNumbers(str);\n var unitsList = Object.entries(units);\n var numbers = raw.map(function (r) {\n return r.trim();\n }).map(function (r, i) {\n var n;\n var unit = unitsList.find(function (_ref4) {\n var _ref5 = _slicedToArray(_ref4, 1),\n u = _ref5[0];\n return r.endsWith(u);\n });\n if (unit) {\n n = parseFloat(r.substring(0, r.length - unit[0].length)) / unit[1] * range[i];\n } else {\n n = parseFloat(r);\n }\n if (range[i] > 1) {\n return Math.round(n);\n }\n return n;\n });\n return numbers;\n}\nvar rgbRange = [255, 255, 255, 1];\nvar rgbUnits = {\n \"%\": 100\n};\nfunction parseRGB($rgb) {\n var _getNumbersFromString = getNumbersFromString($rgb, rgbRange, rgbUnits),\n _getNumbersFromString2 = _slicedToArray(_getNumbersFromString, 4),\n r = _getNumbersFromString2[0],\n g = _getNumbersFromString2[1],\n b = _getNumbersFromString2[2],\n _getNumbersFromString3 = _getNumbersFromString2[3],\n a = _getNumbersFromString3 === void 0 ? 1 : _getNumbersFromString3;\n return {\n r: r,\n g: g,\n b: b,\n a: a\n };\n}\nvar hslRange = [360, 1, 1, 1];\nvar hslUnits = {\n \"%\": 100,\n deg: 360,\n rad: 2 * Math.PI,\n turn: 1\n};\nfunction parseHSL($hsl) {\n var _getNumbersFromString4 = getNumbersFromString($hsl, hslRange, hslUnits),\n _getNumbersFromString5 = _slicedToArray(_getNumbersFromString4, 4),\n h = _getNumbersFromString5[0],\n s = _getNumbersFromString5[1],\n l = _getNumbersFromString5[2],\n _getNumbersFromString6 = _getNumbersFromString5[3],\n a = _getNumbersFromString6 === void 0 ? 1 : _getNumbersFromString6;\n return hslToRGB({\n h: h,\n s: s,\n l: l,\n a: a\n });\n}\nfunction parseHex($hex) {\n var h = $hex.substring(1);\n switch (h.length) {\n case 3:\n case 4:\n {\n var _map5 = [0, 1, 2].map(function (i) {\n return parseInt(\"\".concat(h[i]).concat(h[i]), 16);\n }),\n _map6 = _slicedToArray(_map5, 3),\n r = _map6[0],\n g = _map6[1],\n b = _map6[2];\n var a = h.length === 3 ? 1 : parseInt(\"\".concat(h[3]).concat(h[3]), 16) / 255;\n return {\n r: r,\n g: g,\n b: b,\n a: a\n };\n }\n case 6:\n case 8:\n {\n var _map7 = [0, 2, 4].map(function (i) {\n return parseInt(h.substring(i, i + 2), 16);\n }),\n _map8 = _slicedToArray(_map7, 3),\n _r2 = _map8[0],\n _g2 = _map8[1],\n _b2 = _map8[2];\n var _a = h.length === 6 ? 1 : parseInt(h.substring(6, 8), 16) / 255;\n return {\n r: _r2,\n g: _g2,\n b: _b2,\n a: _a\n };\n }\n }\n return null;\n}\nfunction getColorByName($color) {\n var n = knownColors.get($color);\n return {\n r: n >> 16 & 255,\n g: n >> 8 & 255,\n b: n >> 0 & 255,\n a: 1\n };\n}\nfunction getSystemColor($color) {\n var n = systemColors.get($color);\n return {\n r: n >> 16 & 255,\n g: n >> 8 & 255,\n b: n >> 0 & 255,\n a: 1\n };\n}\n\n// lowerCalcExpression is a helper function that tries to remove `calc(...)`\n// expressions from the given string. It can only lower expressions to a certain\n// degree so we can keep this function easy and simple to understand.\nfunction lowerCalcExpression(color) {\n // searchIndex will be used as searchIndex and as a \"cursor\" within\n // the calc(...) expression.\n var searchIndex = 0;\n\n // Replace the content between two indices.\n var replaceBetweenIndices = function replaceBetweenIndices(start, end, replacement) {\n color = color.substring(0, start) + replacement + color.substring(end);\n };\n\n // Run this code until it doesn't find any `calc(...)`.\n while ((searchIndex = color.indexOf(\"calc(\")) !== -1) {\n // Get the parentheses ranges of `calc(...)`.\n var range = (0,_text__WEBPACK_IMPORTED_MODULE_1__.getParenthesesRange)(color, searchIndex);\n if (!range) {\n break;\n }\n\n // Get the content between the parentheses.\n var slice = color.slice(range.start + 1, range.end - 1);\n // Does the content include a percentage?\n var includesPercentage = slice.includes(\"%\");\n // Remove all percentages.\n slice = slice.split(\"%\").join(\"\");\n\n // Pass the content to the evalMath library and round its output.\n var output = Math.round((0,_math_eval__WEBPACK_IMPORTED_MODULE_0__.evalMath)(slice));\n\n // Replace `calc(...)` with the result.\n replaceBetweenIndices(range.start - 4, range.end, output + (includesPercentage ? \"%\" : \"\"));\n }\n return color;\n}\nvar knownColors = new Map(Object.entries({\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgrey: 0xa9a9a9,\n darkgreen: 0x006400,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n grey: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgrey: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n}));\nvar systemColors = new Map(Object.entries({\n ActiveBorder: 0x3b99fc,\n ActiveCaption: 0x000000,\n AppWorkspace: 0xaaaaaa,\n Background: 0x6363ce,\n ButtonFace: 0xffffff,\n ButtonHighlight: 0xe9e9e9,\n ButtonShadow: 0x9fa09f,\n ButtonText: 0x000000,\n CaptionText: 0x000000,\n GrayText: 0x7f7f7f,\n Highlight: 0xb2d7ff,\n HighlightText: 0x000000,\n InactiveBorder: 0xffffff,\n InactiveCaption: 0xffffff,\n InactiveCaptionText: 0x000000,\n InfoBackground: 0xfbfcc5,\n InfoText: 0x000000,\n Menu: 0xf6f6f6,\n MenuText: 0xffffff,\n Scrollbar: 0xaaaaaa,\n ThreeDDarkShadow: 0x000000,\n ThreeDFace: 0xc0c0c0,\n ThreeDHighlight: 0xffffff,\n ThreeDLightShadow: 0xffffff,\n ThreeDShadow: 0x000000,\n Window: 0xececec,\n WindowFrame: 0xaaaaaa,\n WindowText: 0x000000,\n \"-webkit-focus-ring-color\": 0xe59700\n}).map(function (_ref6) {\n var _ref7 = _slicedToArray(_ref6, 2),\n key = _ref7[0],\n value = _ref7[1];\n return [key.toLowerCase(), value];\n}));\n\n// https://en.wikipedia.org/wiki/Relative_luminance\nfunction getSRGBLightness(r, g, b) {\n return (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/color.js?"); |
| 230 |
|
| 231 |
/***/ }), |
| 232 |
|
| 233 |
/***/ "./dev/dark-mode/src/utils/ipv6.js": |
| 234 |
/*!*****************************************!*\ |
| 235 |
!*** ./dev/dark-mode/src/utils/ipv6.js ***! |
| 236 |
\*****************************************/ |
| 237 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 238 |
|
| 239 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compareIPV6: () => (/* binding */ compareIPV6),\n/* harmony export */ isIPV6: () => (/* binding */ isIPV6)\n/* harmony export */ });\nvar simpleIPV6Regex = /\\[[0-9:a-zA-Z]+?\\]/;\nfunction isIPV6(url) {\n var openingBracketIndex = simpleIPV6Regex.exec(url);\n if (!openingBracketIndex) {\n return false;\n }\n var queryIndex = url.indexOf(\"?\");\n if (queryIndex >= 0 && openingBracketIndex.index > queryIndex) {\n return false;\n }\n return true;\n}\nvar ipV6HostRegex = /\\[.*?\\](\\:\\d+)?/;\nfunction compareIPV6(firstURL, secondURL) {\n var firstHost = firstURL.match(ipV6HostRegex)[0];\n var secondHost = secondURL.match(ipV6HostRegex)[0];\n return firstHost === secondHost;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/ipv6.js?"); |
| 240 |
|
| 241 |
/***/ }), |
| 242 |
|
| 243 |
/***/ "./dev/dark-mode/src/utils/math-eval.js": |
| 244 |
/*!**********************************************!*\ |
| 245 |
!*** ./dev/dark-mode/src/utils/math-eval.js ***! |
| 246 |
\**********************************************/ |
| 247 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 248 |
|
| 249 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ evalMath: () => (/* binding */ evalMath)\n/* harmony export */ });\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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), 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// evalMath is a function that's able to evaluates a mathematical expression and return it's ouput.\n//\n// Internally it uses the Shunting Yard algoritm. First it produces a reverse polish notation(RPN) stack.\n// Example: 1 + 2 * 3 -> [1, 2, 3, *, +] which with parentheses means 1 (2 3 *) +\n//\n// Then it evaluates the RPN stack and returns the output.\nfunction evalMath(expression) {\n // Stack where operators & numbers are stored in RPN.\n var rpnStack = [];\n // The working stack where new tokens are pushed.\n var workingStack = [];\n var lastToken;\n // Iterate over the expression.\n for (var i = 0, len = expression.length; i < len; i++) {\n var token = expression[i];\n\n // Skip if the token is empty or a whitespace.\n if (!token || token === \" \") {\n continue;\n }\n\n // Is the token a operator?\n if (operators.has(token)) {\n var op = operators.get(token);\n\n // Go trough the workingstack and determine it's place in the workingStack\n while (workingStack.length) {\n var currentOp = operators.get(workingStack[0]);\n if (!currentOp) {\n break;\n }\n\n // Is the current operation equal or less than the current operation?\n // Then move that operation to the rpnStack.\n if (op.lessOrEqualThan(currentOp)) {\n rpnStack.push(workingStack.shift());\n } else {\n break;\n }\n }\n // Add the operation to the workingStack.\n workingStack.unshift(token);\n // Otherwise was the last token a operator?\n } else if (!lastToken || operators.has(lastToken)) {\n rpnStack.push(token);\n // Otherwise just append the result to the last token(e.g. multiple digits numbers).\n } else {\n rpnStack[rpnStack.length - 1] += token;\n }\n // Set the last token.\n lastToken = token;\n }\n\n // Push the working stack on top of the rpnStack.\n rpnStack.push.apply(rpnStack, workingStack);\n\n // Now evaluate the rpnStack.\n var stack = [];\n for (var _i = 0, _len = rpnStack.length; _i < _len; _i++) {\n var _op = operators.get(rpnStack[_i]);\n if (_op) {\n // Get the arguments of for the operation(first two in the stack).\n var args = stack.splice(0, 2);\n // Excute it, because of reverse notation we first pass second item then the first item.\n stack.push(_op.exec(args[1], args[0]));\n } else {\n // Add the number to the stack.\n stack.unshift(parseFloat(rpnStack[_i]));\n }\n }\n return stack[0];\n}\n\n// Operator class defines a operator that can be parsed & evaluated by evalMath.\nvar Operator = /*#__PURE__*/function () {\n function Operator(precedence, method) {\n _classCallCheck(this, Operator);\n this.precendce = precedence;\n this.execMethod = method;\n }\n return _createClass(Operator, [{\n key: \"exec\",\n value: function exec(left, right) {\n return this.execMethod(left, right);\n }\n }, {\n key: \"lessOrEqualThan\",\n value: function lessOrEqualThan(op) {\n return this.precendce <= op.precendce;\n }\n }]);\n}();\nvar operators = new Map([[\"+\", new Operator(1, function (left, right) {\n return left + right;\n})], [\"-\", new Operator(1, function (left, right) {\n return left - right;\n})], [\"*\", new Operator(2, function (left, right) {\n return left * right;\n})], [\"/\", new Operator(2, function (left, right) {\n return left / right;\n})]]);\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/math-eval.js?"); |
| 250 |
|
| 251 |
/***/ }), |
| 252 |
|
| 253 |
/***/ "./dev/dark-mode/src/utils/math.js": |
| 254 |
/*!*****************************************!*\ |
| 255 |
!*** ./dev/dark-mode/src/utils/math.js ***! |
| 256 |
\*****************************************/ |
| 257 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 258 |
|
| 259 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clamp: () => (/* binding */ clamp),\n/* harmony export */ multiplyMatrices: () => (/* binding */ multiplyMatrices),\n/* harmony export */ scale: () => (/* binding */ scale)\n/* harmony export */ });\nfunction scale(x, inLow, inHigh, outLow, outHigh) {\n return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;\n}\nfunction clamp(x, min, max) {\n return Math.min(max, Math.max(min, x));\n}\n\n// Note: the caller is responsible for ensuring that matrix dimensions make sense\nfunction multiplyMatrices(m1, m2) {\n var result = [];\n for (var i = 0, len = m1.length; i < len; i++) {\n result[i] = [];\n for (var j = 0, len2 = m2[0].length; j < len2; j++) {\n var sum = 0;\n for (var k = 0, len3 = m1[0].length; k < len3; k++) {\n sum += m1[i][k] * m2[k][j];\n }\n result[i][j] = sum;\n }\n }\n return result;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/math.js?"); |
| 260 |
|
| 261 |
/***/ }), |
| 262 |
|
| 263 |
/***/ "./dev/dark-mode/src/utils/network.js": |
| 264 |
/*!********************************************!*\ |
| 265 |
!*** ./dev/dark-mode/src/utils/network.js ***! |
| 266 |
\********************************************/ |
| 267 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 268 |
|
| 269 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadAsDataURL: () => (/* binding */ loadAsDataURL),\n/* harmony export */ readResponseAsDataURL: () => (/* binding */ readResponseAsDataURL)\n/* harmony export */ });\n/* harmony import */ var _platform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./platform */ \"./dev/dark-mode/src/utils/platform.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); }); }; }\n\nfunction getOKResponse(_x, _x2, _x3) {\n return _getOKResponse.apply(this, arguments);\n}\nfunction _getOKResponse() {\n _getOKResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, mimeType, origin) {\n var response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return fetch(url, {\n cache: \"force-cache\",\n credentials: \"omit\",\n referrer: origin\n });\n case 2:\n response = _context.sent;\n if (!(_platform__WEBPACK_IMPORTED_MODULE_0__.isFirefox && mimeType === \"text/css\" && url.startsWith(\"moz-extension://\") && url.endsWith(\".css\"))) {\n _context.next = 5;\n break;\n }\n return _context.abrupt(\"return\", response);\n case 5:\n if (!(mimeType && !response.headers.get(\"Content-Type\").startsWith(mimeType))) {\n _context.next = 7;\n break;\n }\n throw new Error(\"Mime type mismatch when loading \".concat(url));\n case 7:\n if (response.ok) {\n _context.next = 9;\n break;\n }\n throw new Error(\"Unable to load \".concat(url, \" \").concat(response.status, \" \").concat(response.statusText));\n case 9:\n return _context.abrupt(\"return\", response);\n case 10:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return _getOKResponse.apply(this, arguments);\n}\nfunction loadAsDataURL(_x4, _x5) {\n return _loadAsDataURL.apply(this, arguments);\n}\nfunction _loadAsDataURL() {\n _loadAsDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, mimeType) {\n var response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return getOKResponse(url, mimeType);\n case 2:\n response = _context2.sent;\n _context2.next = 5;\n return readResponseAsDataURL(response);\n case 5:\n return _context2.abrupt(\"return\", _context2.sent);\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _loadAsDataURL.apply(this, arguments);\n}\nfunction readResponseAsDataURL(_x6) {\n return _readResponseAsDataURL.apply(this, arguments);\n}\n\n// export async function loadAsText(url, mimeType, origin) {\n// const response = await getOKResponse(url, mimeType, origin);\n// return await response.text();\n// }\nfunction _readResponseAsDataURL() {\n _readResponseAsDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(response) {\n var blob, dataURL;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return response.blob();\n case 2:\n blob = _context3.sent;\n _context3.next = 5;\n return new Promise(function (resolve) {\n var reader = new FileReader();\n reader.onloadend = function () {\n return resolve(reader.result);\n };\n reader.readAsDataURL(blob);\n });\n case 5:\n dataURL = _context3.sent;\n return _context3.abrupt(\"return\", dataURL);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n }));\n return _readResponseAsDataURL.apply(this, arguments);\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/network.js?"); |
| 270 |
|
| 271 |
/***/ }), |
| 272 |
|
| 273 |
/***/ "./dev/dark-mode/src/utils/parsing.js": |
| 274 |
/*!********************************************!*\ |
| 275 |
!*** ./dev/dark-mode/src/utils/parsing.js ***! |
| 276 |
\********************************************/ |
| 277 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 278 |
|
| 279 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseGradient: () => (/* binding */ parseGradient)\n/* harmony export */ });\n/* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./text */ \"./dev/dark-mode/src/utils/text.js\");\n\nvar gradientLength = \"gradient\".length;\nvar conicGradient = \"conic-\";\nvar conicGradientLength = conicGradient.length;\nvar radialGradient = \"radial-\";\nvar linearGradient = \"linear-\";\n\n// Parse the value according to the specifiction.\n//\n// Specification: https://drafts.csswg.org/css-images-4/#gradients\nfunction parseGradient(value) {\n var result = [];\n\n // Loop trough the value until we find the first `gradient` keyword.\n // We will be using the indexOf to find the keyword. From their on\n // we will check which specific graidient we are dealing with.\n // Then we will try to parse the rest of the value as a gradient.\n var index = 0;\n var startIndex = conicGradient.length;\n var _loop = function _loop() {\n var typeGradient;\n // Now we check the type of gradient.\n // the current index starts at `g` of gradient.\n // So we have to do a reverse lookup to find the type of gradient.\n // Because each type of gradient has a different length\n // will we get the substring of the possible gradient types.\n [linearGradient, radialGradient, conicGradient].find(function (possibleType) {\n if (index - possibleType.length >= 0) {\n var possibleGradient = value.substring(index - possibleType.length, index);\n if (possibleGradient === possibleType) {\n // Check if the type has a `-` before the `type-gradient` keyword.\n // If it does, it's a repeating gradient.\n if (value.slice(index - possibleType.length - 10, index - possibleType.length - 1) === \"repeating\") {\n typeGradient = \"repeating-\".concat(possibleType, \"gradient\");\n return true;\n }\n if (value.slice(index - possibleType.length - 8, index - possibleType.length - 1) === \"-webkit\") {\n typeGradient = \"-webkit-\".concat(possibleType, \"gradient\");\n return true;\n }\n typeGradient = \"\".concat(possibleType, \"gradient\");\n return true;\n }\n }\n });\n if (!typeGradient) {\n return 1; // break\n }\n\n // Now we know the type of gradient.\n // We can go parse the rest of the value as a gradient.\n var _getParenthesesRange = (0,_text__WEBPACK_IMPORTED_MODULE_0__.getParenthesesRange)(value, index + gradientLength),\n start = _getParenthesesRange.start,\n end = _getParenthesesRange.end;\n var match = value.substring(start + 1, end - 1);\n startIndex = end + 1 + conicGradientLength;\n result.push({\n typeGradient: typeGradient,\n match: match,\n // <type>-gradient() is not within match, so in order to still \"skip\" that section\n // we add that length as offset.\n offset: typeGradient.length + 2,\n index: index - typeGradient.length + gradientLength,\n hasComma: true\n });\n };\n while ((index = value.indexOf(\"gradient\", startIndex)) !== -1) {\n if (_loop()) break;\n }\n\n // Set the last result to not have a comma.\n if (result.length) {\n result[result.length - 1].hasComma = false;\n }\n return result;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/parsing.js?"); |
| 280 |
|
| 281 |
/***/ }), |
| 282 |
|
| 283 |
/***/ "./dev/dark-mode/src/utils/platform.js": |
| 284 |
/*!*********************************************!*\ |
| 285 |
!*** ./dev/dark-mode/src/utils/platform.js ***! |
| 286 |
\*********************************************/ |
| 287 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 288 |
|
| 289 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ chromiumVersion: () => (/* binding */ chromiumVersion),\n/* harmony export */ compareChromeVersions: () => (/* binding */ compareChromeVersions),\n/* harmony export */ firefoxVersion: () => (/* binding */ firefoxVersion),\n/* harmony export */ isCSSColorSchemePropSupported: () => (/* binding */ isCSSColorSchemePropSupported),\n/* harmony export */ isFirefox: () => (/* binding */ isFirefox),\n/* harmony export */ isSafari: () => (/* binding */ isSafari),\n/* harmony export */ isShadowDomSupported: () => (/* binding */ isShadowDomSupported)\n/* harmony export */ });\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); }\nvar isShadowDomSupported = typeof ShadowRoot === \"function\";\nvar isFirefox = navigator.userAgent.indexOf(\"Firefox\") != -1;\nvar isSafari = navigator.userAgent.indexOf(\"Safari\") != -1;\nvar isCSSColorSchemePropSupported = function () {\n try {\n if (typeof document === \"undefined\") {\n return false;\n }\n var el = document.createElement(\"div\");\n if (!el || _typeof(el.style) !== \"object\") {\n return false;\n }\n if (typeof el.style.colorScheme === \"string\") {\n return true;\n }\n // TODO: remove the following code after enforcing strong CSP in all builds\n // This feature detection method requires weak or missing CSP in manifest.json\n el.setAttribute(\"style\", \"color-scheme: dark\");\n return el.style.colorScheme === \"dark\";\n } catch (e) {\n return false;\n }\n}();\nfunction compareChromeVersions($a, $b) {\n var a = $a.split(\".\").map(function (x) {\n return parseInt(x);\n });\n var b = $b.split(\".\").map(function (x) {\n return parseInt(x);\n });\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return a[i] < b[i] ? -1 : 1;\n }\n }\n return 0;\n}\nvar chromiumVersion = function () {\n var m = navigator.userAgent.match(/chrom(?:e|ium)(?:\\/| )([^ ]+)/);\n if (m && m[1]) {\n return m[1];\n }\n return \"\";\n}();\nvar firefoxVersion = function () {\n var m = navigator.userAgent.match(/(?:firefox|librewolf)(?:\\/| )([^ ]+)/);\n if (m && m[1]) {\n return m[1];\n }\n return \"\";\n}();\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/platform.js?"); |
| 290 |
|
| 291 |
/***/ }), |
| 292 |
|
| 293 |
/***/ "./dev/dark-mode/src/utils/text.js": |
| 294 |
/*!*****************************************!*\ |
| 295 |
!*** ./dev/dark-mode/src/utils/text.js ***! |
| 296 |
\*****************************************/ |
| 297 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 298 |
|
| 299 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ formatArray: () => (/* binding */ formatArray),\n/* harmony export */ formatCSS: () => (/* binding */ formatCSS),\n/* harmony export */ getMatches: () => (/* binding */ getMatches),\n/* harmony export */ getParenthesesRange: () => (/* binding */ getParenthesesRange),\n/* harmony export */ parseArray: () => (/* binding */ parseArray)\n/* harmony export */ });\n// export function getTextPositionMessage(text, index) {\n// if (!isFinite(index)) {\n// throw new Error(`Wrong char index ${index}`);\n// }\n// let message = \"\";\n// let line = 0;\n// let prevLn;\n// let nextLn = 0;\n// do {\n// line++;\n// prevLn = nextLn;\n// nextLn = text.indexOf(\"\\n\", prevLn + 1);\n// } while (nextLn >= 0 && nextLn <= index);\n// const column = index - prevLn;\n// message += `line ${line}, column ${column}`;\n// message += \"\\n\";\n// if (index < text.length) {\n// message += text.substring(prevLn + 1, nextLn);\n// } else {\n// message += text.substring(text.lastIndexOf(\"\\n\") + 1);\n// }\n// message += \"\\n\";\n// message += `${new Array(column).join(\"-\")}^`;\n// return message;\n// }\n\n// export function getTextDiffIndex(a, b) {\n// const short = Math.min(a.length, b.length);\n// for (let i = 0; i < short; i++) {\n// if (a[i] !== b[i]) {\n// return i;\n// }\n// }\n// if (a.length !== b.length) {\n// return short;\n// }\n// return -1;\n// }\n\nfunction parseArray(text) {\n return text.replace(/\\r/g, \"\").split(\"\\n\").map(function (s) {\n return s.trim();\n }).filter(function (s) {\n return s;\n });\n}\nfunction formatArray(arr) {\n return arr.concat(\"\").join(\"\\n\");\n}\nfunction getMatches(regex, input) {\n var group = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var matches = [];\n var m;\n while (m = regex.exec(input)) {\n matches.push(m[group]);\n }\n return matches;\n}\n\n// export function getStringSize(value) {\n// return value.length * 2;\n// }\n\nfunction formatCSS(text) {\n function trimLeft(text) {\n return text.replace(/^\\s+/, \"\");\n }\n function getIndent(depth) {\n if (depth === 0) {\n return \"\";\n }\n return \" \".repeat(4 * depth);\n }\n\n // Dont execute this kind of Regex on large CSS, as this isn't necessary.\n // Maxium of 50K characters.\n if (text.length < 50000) {\n var emptyRuleRegexp = /[^{}]+{\\s*}/;\n while (emptyRuleRegexp.test(text)) {\n text = text.replace(emptyRuleRegexp, \"\");\n }\n }\n var css = text.replace(/\\s{2,}/g, \" \") // Replacing multiple spaces to one\n .replace(/\\{/g, \"{\\n\") // {\n .replace(/\\}/g, \"\\n}\\n\") // }\n .replace(/\\;(?![^\\(|\\\"]*(\\)|\\\"))/g, \";\\n\") // ; and do not target between () and \"\"\n .replace(/\\,(?![^\\(|\\\"]*(\\)|\\\"))/g, \",\\n\") // , and do not target between () and \"\"\n .replace(/\\n\\s*\\n/g, \"\\n\") // Remove \\n Without any characters between it to the next \\n\n .split(\"\\n\");\n var depth = 0;\n var formatted = [];\n for (var x = 0, len = css.length; x < len; x++) {\n var line = \"\".concat(css[x], \"\\n\");\n if (line.includes(\"{\")) {\n // {\n formatted.push(getIndent(depth++) + trimLeft(line));\n } else if (line.includes(\"}\")) {\n // }\n formatted.push(getIndent(--depth) + trimLeft(line));\n } else {\n // CSS line\n formatted.push(getIndent(depth) + trimLeft(line));\n }\n }\n return formatted.join(\"\").trim();\n}\nfunction getParenthesesRange(input) {\n var searchStartIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var length = input.length;\n var depth = 0;\n var firstOpenIndex = -1;\n for (var i = searchStartIndex; i < length; i++) {\n if (depth === 0) {\n var openIndex = input.indexOf(\"(\", i);\n if (openIndex < 0) {\n break;\n }\n firstOpenIndex = openIndex;\n depth++;\n i = openIndex;\n } else {\n var closingIndex = input.indexOf(\")\", i);\n if (closingIndex < 0) {\n break;\n }\n var _openIndex = input.indexOf(\"(\", i);\n if (_openIndex < 0 || closingIndex < _openIndex) {\n depth--;\n if (depth === 0) {\n return {\n start: firstOpenIndex,\n end: closingIndex + 1\n };\n }\n i = closingIndex;\n } else {\n depth++;\n i = _openIndex;\n }\n }\n }\n return null;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/text.js?"); |
| 300 |
|
| 301 |
/***/ }), |
| 302 |
|
| 303 |
/***/ "./dev/dark-mode/src/utils/throttle.js": |
| 304 |
/*!*********************************************!*\ |
| 305 |
!*** ./dev/dark-mode/src/utils/throttle.js ***! |
| 306 |
\*********************************************/ |
| 307 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 308 |
|
| 309 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createAsyncTasksQueue: () => (/* binding */ createAsyncTasksQueue),\n/* harmony export */ throttle: () => (/* binding */ throttle)\n/* harmony export */ });\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread 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 _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\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 throttle(callback) {\n var pending = false;\n var frameId = null;\n var lastArgs;\n var throttled = function throttled() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n lastArgs = args;\n if (frameId) {\n pending = true;\n } else {\n callback.apply(void 0, _toConsumableArray(lastArgs));\n frameId = requestAnimationFrame(function () {\n frameId = null;\n if (pending) {\n callback.apply(void 0, _toConsumableArray(lastArgs));\n pending = false;\n }\n });\n }\n };\n var cancel = function cancel() {\n // TODO: reove cast once types are updated\n cancelAnimationFrame(frameId);\n pending = false;\n frameId = null;\n };\n return Object.assign(throttled, {\n cancel: cancel\n });\n}\nfunction createAsyncTasksQueue() {\n var tasks = [];\n var frameId = null;\n function runTasks() {\n var task;\n while (task = tasks.shift()) {\n task();\n }\n frameId = null;\n }\n function add(task) {\n tasks.push(task);\n if (!frameId) {\n frameId = requestAnimationFrame(runTasks);\n }\n }\n function cancel() {\n tasks.splice(0);\n // TODO: reove cast once types are updated\n cancelAnimationFrame(frameId);\n frameId = null;\n }\n return {\n add: add,\n cancel: cancel\n };\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/throttle.js?"); |
| 310 |
|
| 311 |
/***/ }), |
| 312 |
|
| 313 |
/***/ "./dev/dark-mode/src/utils/time.js": |
| 314 |
/*!*****************************************!*\ |
| 315 |
!*** ./dev/dark-mode/src/utils/time.js ***! |
| 316 |
\*****************************************/ |
| 317 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 318 |
|
| 319 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getDuration: () => (/* binding */ getDuration)\n/* harmony export */ });\n// export function parseTime($time) {\n// const parts = $time.split(\":\").slice(0, 2);\n// const lowercased = $time.trim().toLowerCase();\n// const isAM = lowercased.endsWith(\"am\") || lowercased.endsWith(\"a.m.\");\n// const isPM = lowercased.endsWith(\"pm\") || lowercased.endsWith(\"p.m.\");\n\n// let hours = parts.length > 0 ? parseInt(parts[0]) : 0;\n// if (isNaN(hours) || hours > 23) {\n// hours = 0;\n// }\n// if (isAM && hours === 12) {\n// hours = 0;\n// }\n// if (isPM && hours < 12) {\n// hours += 12;\n// }\n\n// let minutes = parts.length > 1 ? parseInt(parts[1]) : 0;\n// if (isNaN(minutes) || minutes > 59) {\n// minutes = 0;\n// }\n\n// return [hours, minutes];\n// }\n\n// function parse24HTime(time) {\n// return time.split(\":\").map((x) => parseInt(x));\n// }\n\n// function compareTime(time1, time2) {\n// if (time1[0] === time2[0] && time1[1] === time2[1]) {\n// return 0;\n// }\n// if (time1[0] < time2[0] || (time1[0] === time2[0] && time1[1] < time2[1])) {\n// return -1;\n// }\n// return 1;\n// }\n\n// export function nextTimeInterval(time0, time1, date = new Date()) {\n// const a = parse24HTime(time0);\n// const b = parse24HTime(time1);\n// const t = [date.getHours(), date.getMinutes()];\n\n// // Ensure a <= b\n// if (compareTime(a, b) > 0) {\n// return nextTimeInterval(time1, time0, date);\n// }\n\n// if (compareTime(a, b) === 0) {\n// return null;\n// }\n\n// if (compareTime(t, a) < 0) {\n// // t < a <= b\n// // Schedule for todate at time a\n// date.setHours(a[0]);\n// date.setMinutes(a[1]);\n// date.setSeconds(0);\n// date.setMilliseconds(0);\n// return date.getTime();\n// }\n\n// if (compareTime(t, b) < 0) {\n// // a <= t < b\n// // Schedule for today at time b\n// date.setHours(b[0]);\n// date.setMinutes(b[1]);\n// date.setSeconds(0);\n// date.setMilliseconds(0);\n// return date.getTime();\n// }\n\n// // a <= b <= t\n// // Schedule for tomorrow at time a\n// return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, a[0], a[1]).getTime();\n// }\n\n// export function isInTimeIntervalLocal(time0, time1, date = new Date()) {\n// const a = parse24HTime(time0);\n// const b = parse24HTime(time1);\n// const t = [date.getHours(), date.getMinutes()];\n// if (compareTime(a, b) > 0) {\n// return compareTime(a, t) <= 0 || compareTime(t, b) < 0;\n// }\n// return compareTime(a, t) <= 0 && compareTime(t, b) < 0;\n// }\n\n// function isInTimeIntervalUTC(time0, time1, timestamp) {\n// if (time1 < time0) {\n// return timestamp <= time1 || time0 <= timestamp;\n// }\n// return time0 < timestamp && timestamp < time1;\n// }\n\nfunction getDuration(time) {\n var duration = 0;\n if (time.seconds) {\n duration += time.seconds * 1000;\n }\n if (time.minutes) {\n duration += time.minutes * 60 * 1000;\n }\n if (time.hours) {\n duration += time.hours * 60 * 60 * 1000;\n }\n if (time.days) {\n duration += time.days * 24 * 60 * 60 * 1000;\n }\n return duration;\n}\n\n// export function getDurationInMinutes(time) {\n// return getDuration(time) / 1000 / 60;\n// }\n\n// function getSunsetSunriseUTCTime(latitude, longitude, date) {\n// const dec31 = Date.UTC(date.getUTCFullYear(), 0, 0, 0, 0, 0, 0);\n// const oneDay = getDuration({ days: 1 });\n// const dayOfYear = Math.floor((date.getTime() - dec31) / oneDay);\n\n// const zenith = 90.83333333333333;\n// const D2R = Math.PI / 180;\n// const R2D = 180 / Math.PI;\n\n// // convert the longitude to hour value and calculate an approximate time\n// const lnHour = longitude / 15;\n\n// function getTime(isSunrise) {\n// const t = dayOfYear + ((isSunrise ? 6 : 18) - lnHour) / 24;\n\n// // calculate the Sun's mean anomaly\n// const M = 0.9856 * t - 3.289;\n\n// // calculate the Sun's true longitude\n// let L = M + 1.916 * Math.sin(M * D2R) + 0.02 * Math.sin(2 * M * D2R) + 282.634;\n// if (L > 360) {\n// L -= 360;\n// } else if (L < 0) {\n// L += 360;\n// }\n\n// // calculate the Sun's right ascension\n// let RA = R2D * Math.atan(0.91764 * Math.tan(L * D2R));\n// if (RA > 360) {\n// RA -= 360;\n// } else if (RA < 0) {\n// RA += 360;\n// }\n\n// // right ascension value needs to be in the same qua\n// const Lquadrant = Math.floor(L / 90) * 90;\n// const RAquadrant = Math.floor(RA / 90) * 90;\n// RA += Lquadrant - RAquadrant;\n\n// // right ascension value needs to be converted into hours\n// RA /= 15;\n\n// // calculate the Sun's declination\n// const sinDec = 0.39782 * Math.sin(L * D2R);\n// const cosDec = Math.cos(Math.asin(sinDec));\n\n// // calculate the Sun's local hour angle\n// const cosH =\n// (Math.cos(zenith * D2R) - sinDec * Math.sin(latitude * D2R)) /\n// (cosDec * Math.cos(latitude * D2R));\n// if (cosH > 1) {\n// // always night\n// return {\n// alwaysDay: false,\n// alwaysNight: true,\n// time: 0,\n// };\n// } else if (cosH < -1) {\n// // always day\n// return {\n// alwaysDay: true,\n// alwaysNight: false,\n// time: 0,\n// };\n// }\n\n// const H = (isSunrise ? 360 - R2D * Math.acos(cosH) : R2D * Math.acos(cosH)) / 15;\n\n// // calculate local mean time of rising/setting\n// const T = H + RA - 0.06571 * t - 6.622;\n\n// // adjust back to UTC\n// let UT = T - lnHour;\n// if (UT > 24) {\n// UT -= 24;\n// } else if (UT < 0) {\n// UT += 24;\n// }\n\n// // convert to milliseconds\n// return {\n// alwaysDay: false,\n// alwaysNight: false,\n// time: Math.round(UT * getDuration({ hours: 1 })),\n// };\n// }\n\n// const sunriseTime = getTime(true);\n// const sunsetTime = getTime(false);\n\n// if (sunriseTime.alwaysDay || sunsetTime.alwaysDay) {\n// return {\n// alwaysDay: true,\n// alwaysNight: false,\n// sunriseTime: 0,\n// sunsetTime: 0,\n// };\n// } else if (sunriseTime.alwaysNight || sunsetTime.alwaysNight) {\n// return {\n// alwaysDay: false,\n// alwaysNight: true,\n// sunriseTime: 0,\n// sunsetTime: 0,\n// };\n// }\n\n// return {\n// alwaysDay: false,\n// alwaysNight: false,\n// sunriseTime: sunriseTime.time,\n// sunsetTime: sunsetTime.time,\n// };\n// }\n\n// export function isNightAtLocation(latitude, longitude, date = new Date()) {\n// const time = getSunsetSunriseUTCTime(latitude, longitude, date);\n\n// if (time.alwaysDay) {\n// return false;\n// } else if (time.alwaysNight) {\n// return true;\n// }\n\n// const sunriseTime = time.sunriseTime;\n// const sunsetTime = time.sunsetTime;\n// const currentTime =\n// date.getUTCHours() * getDuration({ hours: 1 }) +\n// date.getUTCMinutes() * getDuration({ minutes: 1 }) +\n// date.getUTCSeconds() * getDuration({ seconds: 1 }) +\n// date.getUTCMilliseconds();\n\n// return isInTimeIntervalUTC(sunsetTime, sunriseTime, currentTime);\n// }\n\n// export function nextTimeChangeAtLocation(latitude, longitude, date = new Date()) {\n// const time = getSunsetSunriseUTCTime(latitude, longitude, date);\n\n// if (time.alwaysDay) {\n// return date.getTime() + getDuration({ days: 1 });\n// } else if (time.alwaysNight) {\n// return date.getTime() + getDuration({ days: 1 });\n// }\n\n// const [firstTimeOnDay, lastTimeOnDay] =\n// time.sunriseTime < time.sunsetTime\n// ? [time.sunriseTime, time.sunsetTime]\n// : [time.sunsetTime, time.sunriseTime];\n// const currentTime =\n// date.getUTCHours() * getDuration({ hours: 1 }) +\n// date.getUTCMinutes() * getDuration({ minutes: 1 }) +\n// date.getUTCSeconds() * getDuration({ seconds: 1 }) +\n// date.getUTCMilliseconds();\n\n// if (currentTime <= firstTimeOnDay) {\n// // Timeline:\n// // --- firstTimeOnDay <---> lastTimeOnDay ---\n// // ^\n// // Current time\n// return Date.UTC(\n// date.getUTCFullYear(),\n// date.getUTCMonth(),\n// date.getUTCDate(),\n// 0,\n// 0,\n// 0,\n// firstTimeOnDay\n// );\n// }\n// if (currentTime <= lastTimeOnDay) {\n// // Timeline:\n// // --- firstTimeOnDay <---> lastTimeOnDay ---\n// // ^\n// // Current time\n// return Date.UTC(\n// date.getUTCFullYear(),\n// date.getUTCMonth(),\n// date.getUTCDate(),\n// 0,\n// 0,\n// 0,\n// lastTimeOnDay\n// );\n// }\n// // Timeline:\n// // --- firstTimeOnDay <---> lastTimeOnDay ---\n// // ^\n// // Current time\n// return Date.UTC(\n// date.getUTCFullYear(),\n// date.getUTCMonth(),\n// date.getUTCDate() + 1,\n// 0,\n// 0,\n// 0,\n// firstTimeOnDay\n// );\n// }\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/time.js?"); |
| 320 |
|
| 321 |
/***/ }), |
| 322 |
|
| 323 |
/***/ "./dev/dark-mode/src/utils/url.js": |
| 324 |
/*!****************************************!*\ |
| 325 |
!*** ./dev/dark-mode/src/utils/url.js ***! |
| 326 |
\****************************************/ |
| 327 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 328 |
|
| 329 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compareURLPatterns: () => (/* binding */ compareURLPatterns),\n/* harmony export */ fullyQualifiedDomainMatchesWildcard: () => (/* binding */ fullyQualifiedDomainMatchesWildcard),\n/* harmony export */ getAbsoluteURL: () => (/* binding */ getAbsoluteURL),\n/* harmony export */ isFullyQualifiedDomainWildcard: () => (/* binding */ isFullyQualifiedDomainWildcard),\n/* harmony export */ isRelativeHrefOnAbsolutePath: () => (/* binding */ isRelativeHrefOnAbsolutePath),\n/* harmony export */ isURLInList: () => (/* binding */ isURLInList),\n/* harmony export */ isURLMatched: () => (/* binding */ isURLMatched),\n/* harmony export */ parseURL: () => (/* binding */ parseURL),\n/* harmony export */ parsedURLCache: () => (/* binding */ parsedURLCache)\n/* harmony export */ });\n/* harmony import */ var _ipv6__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ipv6 */ \"./dev/dark-mode/src/utils/ipv6.js\");\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\nvar anchor;\nvar parsedURLCache = new Map();\nfunction fixBaseURL($url) {\n if (!anchor) {\n anchor = document.createElement(\"a\");\n }\n anchor.href = $url;\n return anchor.href;\n}\nfunction parseURL($url) {\n var $base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var key = \"\".concat($url).concat($base ? \";\".concat($base) : \"\");\n if (parsedURLCache.has(key)) {\n return parsedURLCache.get(key);\n }\n if ($base) {\n var _parsedURL = new URL($url, fixBaseURL($base));\n parsedURLCache.set(key, _parsedURL);\n return _parsedURL;\n }\n var parsedURL = new URL(fixBaseURL($url));\n parsedURLCache.set($url, parsedURL);\n return parsedURL;\n}\nfunction getAbsoluteURL($base, $relative) {\n if ($relative.match(/^data\\\\?\\:/)) {\n return $relative;\n }\n // Check if relative starts with `//hostname...`.\n // We have to add a protocol to make it absolute.\n if (/^\\/\\//.test($relative)) {\n return \"\".concat(location.protocol).concat($relative);\n }\n var b = parseURL($base);\n var a = parseURL($relative, b.href);\n return a.href;\n}\n\n// Check if any relative URL is on the window.location;\n// So that https://duck.com/ext.css would return true on https://duck.com/\n// But https://duck.com/styles/ext.css would return false on https://duck.com/\n// Visa versa https://duck.com/ext.css should return fasle on https://duck.com/search/\n// We're checking if any relative value within ext.css could potentially not be on the same path.\nfunction isRelativeHrefOnAbsolutePath(href) {\n if (href.startsWith(\"data:\")) {\n return true;\n }\n var url = parseURL(href);\n if (url.protocol !== location.protocol) {\n return false;\n }\n if (url.hostname !== location.hostname) {\n return false;\n }\n if (url.port !== location.port) {\n return false;\n }\n // Now check if the path is on the same path as the base\n // We do this by getting the pathname up until the last slash.\n return url.pathname === location.pathname;\n}\n\n// export function getURLHostOrProtocol($url) {\n// const url = new URL($url);\n// if (url.host) {\n// return url.host;\n// } else if (url.protocol === \"file:\") {\n// return url.pathname;\n// }\n// return url.protocol;\n// }\n\nfunction compareURLPatterns(a, b) {\n return a.localeCompare(b);\n}\n\n/**\n * Determines whether URL has a match in URL template list.\n * @param url Site URL.\n * @paramlist List to search into.\n */\nfunction isURLInList(url, list) {\n for (var i = 0; i < list.length; i++) {\n if (isURLMatched(url, list[i])) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Determines whether URL matches the template.\n * @param url URL.\n * @param urlTemplate URL template (\"google.*\", \"youtube.com\" etc).\n */\nfunction isURLMatched(url, urlTemplate) {\n var isFirstIPV6 = (0,_ipv6__WEBPACK_IMPORTED_MODULE_0__.isIPV6)(url);\n var isSecondIPV6 = (0,_ipv6__WEBPACK_IMPORTED_MODULE_0__.isIPV6)(urlTemplate);\n if (isFirstIPV6 && isSecondIPV6) {\n return (0,_ipv6__WEBPACK_IMPORTED_MODULE_0__.compareIPV6)(url, urlTemplate);\n } else if (!isFirstIPV6 && !isSecondIPV6) {\n var regex = createUrlRegex(urlTemplate);\n return regex !== null && Boolean(url.match(regex));\n }\n return false;\n}\nfunction createUrlRegex(urlTemplate) {\n try {\n urlTemplate = urlTemplate.trim();\n var exactBeginning = urlTemplate[0] === \"^\";\n var exactEnding = urlTemplate[urlTemplate.length - 1] === \"$\";\n var hasLastSlash = /\\/\\$?$/.test(urlTemplate);\n urlTemplate = urlTemplate.replace(/^\\^/, \"\") // Remove ^ at start\n .replace(/\\$$/, \"\") // Remove $ at end\n .replace(/^.*?\\/{2,3}/, \"\") // Remove scheme\n .replace(/\\?.*$/, \"\") // Remove query\n .replace(/\\/$/, \"\"); // Remove last slash\n\n var slashIndex;\n var beforeSlash;\n var afterSlash;\n if ((slashIndex = urlTemplate.indexOf(\"/\")) >= 0) {\n beforeSlash = urlTemplate.substring(0, slashIndex); // google.*\n afterSlash = urlTemplate.replace(/\\$/g, \"\").substring(slashIndex); // /login/abc\n } else {\n beforeSlash = urlTemplate.replace(/\\$/g, \"\");\n }\n\n //\n // SCHEME and SUBDOMAINS\n\n var result = exactBeginning ? \"^(.*?\\\\:\\\\/{2,3})?\" // Scheme\n : \"^(.*?\\\\:\\\\/{2,3})?([^/]*?\\\\.)?\"; // Scheme and subdomains\n\n //\n // HOST and PORT\n\n var hostParts = beforeSlash.split(\".\");\n result += \"(\";\n for (var i = 0; i < hostParts.length; i++) {\n if (hostParts[i] === \"*\") {\n hostParts[i] = \"[^\\\\.\\\\/]+?\";\n }\n }\n result += hostParts.join(\"\\\\.\");\n result += \")\";\n\n //\n // PATH and QUERY\n\n if (afterSlash) {\n result += \"(\";\n result += afterSlash.replace(\"/\", \"\\\\/\");\n result += \")\";\n }\n result += exactEnding ? \"(\\\\/?(\\\\?[^/]*?)?)$\" // All following queries\n : \"(\\\\/\".concat(hasLastSlash ? \"\" : \"?\", \".*?)$\"); // All following paths and queries\n\n //\n // Result\n\n return new RegExp(result, \"i\");\n } catch (e) {\n return null;\n }\n}\n\n// export function isFullyQualifiedDomain(candidate) {\n// return /^[a-z0-9\\.\\-]+$/i.test(candidate) && candidate.indexOf(\"..\") === -1;\n// }\n\nfunction isFullyQualifiedDomainWildcard(candidate) {\n if (!candidate.includes(\"*\") || !/^[a-z0-9\\.\\-\\*]+$/i.test(candidate)) {\n return false;\n }\n var labels = candidate.split(\".\");\n var _iterator = _createForOfIteratorHelper(labels),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var label = _step.value;\n if (label !== \"*\" && !/^[a-z0-9\\-]+$/i.test(label)) {\n return false;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return true;\n}\nfunction fullyQualifiedDomainMatchesWildcard(wildcard, candidate) {\n var wildcardLabels = wildcard.toLowerCase().split(\".\");\n var candidateLabels = candidate.toLowerCase().split(\".\");\n if (candidateLabels.length < wildcardLabels.length) {\n return false;\n }\n while (wildcardLabels.length) {\n var wildcardLabel = wildcardLabels.pop();\n var candidateLabel = candidateLabels.pop();\n if (wildcardLabel !== \"*\" && wildcardLabel !== candidateLabel) {\n return false;\n }\n }\n return true;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/url.js?"); |
| 330 |
|
| 331 |
/***/ }), |
| 332 |
|
| 333 |
/***/ "./dev/dark-mode/src/utils/visibility.js": |
| 334 |
/*!***********************************************!*\ |
| 335 |
!*** ./dev/dark-mode/src/utils/visibility.js ***! |
| 336 |
\***********************************************/ |
| 337 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 338 |
|
| 339 |
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ documentIsVisible: () => (/* binding */ documentIsVisible),\n/* harmony export */ removeDocumentVisibilityListener: () => (/* binding */ removeDocumentVisibilityListener),\n/* harmony export */ setDocumentVisibilityListener: () => (/* binding */ setDocumentVisibilityListener)\n/* harmony export */ });\n/**\n * The following code contains a workaround for extensions designed to prevent page from knowing when it is hidden\n * GitHub issue: https://github.com/darkreader/darkreader/issues/10004\n * GitHub PR: https://github.com/darkreader/darkreader/pull/10047\n *\n * Doue to the intntional breakage introduced by these extensions, this utility might incorrecly report that document\n * is visible while it is not, but it will never report document as hidden while it is visible.\n *\n * This code exploits the fact that most such extensions block only a subset of Page Lifecycle API,\n * which notifies page of being hidden but not of being shown, while Dark Reader really cares only about\n * page being shown.\n * Specifically:\n * - extensions block visibilitychange and blur event\n * - extensions do not block focus event; browsers deliver focus event when user switches to\n * a previously hidden tab or previously hidden window (assuming DevTools are closed so window gets the focus)\n * if document has focus, then we can assume that it is visible\n * - some extensions overwrite document.hidden but not document.visibilityState\n * - Firefox has a bug: if extension overwrites document.hidden and document.visibilityState via Object.defineProperty,\n * then Firefox will reset them to true and 'hidden' when tab is activated, but document.hasFocus() will be true\n * - Safari supports document.visibilityState === 'prerender' which makes document.hidden === true even when document\n * is visible to the user\n *\n * Note: This utility supports adding only one callback since currently calling code sets only one listener and Firefox\n * has issues optimizing code with multiple callbacks stored in array or in a set.\n */\n\nvar documentVisibilityListener = null;\nvar documentIsVisible_ = !document.hidden;\n\n// TODO: use EventListenerOptions class once it is updated\nvar listenerOptions = {\n capture: true,\n passive: true\n};\nfunction watchForDocumentVisibility() {\n document.addEventListener(\"visibilitychange\", documentVisibilityListener, listenerOptions);\n window.addEventListener(\"pageshow\", documentVisibilityListener, listenerOptions);\n window.addEventListener(\"focus\", documentVisibilityListener, listenerOptions);\n}\nfunction stopWatchingForDocumentVisibility() {\n document.removeEventListener(\"visibilitychange\", documentVisibilityListener, listenerOptions);\n window.removeEventListener(\"pageshow\", documentVisibilityListener, listenerOptions);\n window.removeEventListener(\"focus\", documentVisibilityListener, listenerOptions);\n}\nfunction setDocumentVisibilityListener(callback) {\n var alreadyWatching = Boolean(documentVisibilityListener);\n documentVisibilityListener = function documentVisibilityListener() {\n if (!document.hidden) {\n removeDocumentVisibilityListener();\n callback();\n documentIsVisible_ = true;\n }\n };\n if (!alreadyWatching) {\n watchForDocumentVisibility();\n }\n}\nfunction removeDocumentVisibilityListener() {\n stopWatchingForDocumentVisibility();\n documentVisibilityListener = null;\n}\nfunction documentIsVisible() {\n return documentIsVisible_;\n}\n\n//# sourceURL=webpack://adminify/./dev/dark-mode/src/utils/visibility.js?"); |
| 340 |
|
| 341 |
/***/ }) |
| 342 |
|
| 343 |
/******/ }); |
| 344 |
/************************************************************************/ |
| 345 |
/******/ // The module cache |
| 346 |
/******/ var __webpack_module_cache__ = {}; |
| 347 |
/******/ |
| 348 |
/******/ // The require function |
| 349 |
/******/ function __webpack_require__(moduleId) { |
| 350 |
/******/ // Check if module is in cache |
| 351 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 352 |
/******/ if (cachedModule !== undefined) { |
| 353 |
/******/ return cachedModule.exports; |
| 354 |
/******/ } |
| 355 |
/******/ // Create a new module (and put it into the cache) |
| 356 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 357 |
/******/ // no module.id needed |
| 358 |
/******/ // no module.loaded needed |
| 359 |
/******/ exports: {} |
| 360 |
/******/ }; |
| 361 |
/******/ |
| 362 |
/******/ // Execute the module function |
| 363 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 364 |
/******/ |
| 365 |
/******/ // Return the exports of the module |
| 366 |
/******/ return module.exports; |
| 367 |
/******/ } |
| 368 |
/******/ |
| 369 |
/************************************************************************/ |
| 370 |
/******/ /* webpack/runtime/define property getters */ |
| 371 |
/******/ (() => { |
| 372 |
/******/ // define getter functions for harmony exports |
| 373 |
/******/ __webpack_require__.d = (exports, definition) => { |
| 374 |
/******/ for(var key in definition) { |
| 375 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 376 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 377 |
/******/ } |
| 378 |
/******/ } |
| 379 |
/******/ }; |
| 380 |
/******/ })(); |
| 381 |
/******/ |
| 382 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 383 |
/******/ (() => { |
| 384 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 385 |
/******/ })(); |
| 386 |
/******/ |
| 387 |
/******/ /* webpack/runtime/make namespace object */ |
| 388 |
/******/ (() => { |
| 389 |
/******/ // define __esModule on exports |
| 390 |
/******/ __webpack_require__.r = (exports) => { |
| 391 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 392 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 393 |
/******/ } |
| 394 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 395 |
/******/ }; |
| 396 |
/******/ })(); |
| 397 |
/******/ |
| 398 |
/************************************************************************/ |
| 399 |
/******/ |
| 400 |
/******/ // startup |
| 401 |
/******/ // Load entry module and return exports |
| 402 |
/******/ // This entry module can't be inlined because the eval devtool is used. |
| 403 |
/******/ var __webpack_exports__ = __webpack_require__("./dev/dark-mode/index.js"); |
| 404 |
/******/ |
| 405 |
/******/ })() |
| 406 |
; |