@moezx/react-darkreader
Version:
A React Hook for adding a dark / night mode to your site inspired by darkreader
16 lines (14 loc) • 115 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).reactDarkreader={},e.React)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function c(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}var l=c((function(e,t){!function(e){
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function n(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return u([e,t])}}function u(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&o[3]>i[1])){a.label=i[1];break}if(6===i[0]&&o[1]>a.label){a.label=o[1],o=i;break}if(o&&o[2]>a.label){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function a(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;i>o;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var s={UI_GET_DATA:"ui-get-data",UI_GET_ACTIVE_TAB_INFO:"ui-get-active-tab-info",UI_SUBSCRIBE_TO_CHANGES:"ui-subscribe-to-changes",UI_UNSUBSCRIBE_FROM_CHANGES:"ui-unsubscribe-from-changes",UI_CHANGE_SETTINGS:"ui-change-settings",UI_SET_THEME:"ui-set-theme",UI_SET_SHORTCUT:"ui-set-shortcut",UI_TOGGLE_URL:"ui-toggle-url",UI_MARK_NEWS_AS_READ:"ui-mark-news-as-read",UI_LOAD_CONFIG:"ui-load-config",UI_APPLY_DEV_DYNAMIC_THEME_FIXES:"ui-apply-dev-dynamic-theme-fixes",UI_RESET_DEV_DYNAMIC_THEME_FIXES:"ui-reset-dev-dynamic-theme-fixes",UI_APPLY_DEV_INVERSION_FIXES:"ui-apply-dev-inversion-fixes",UI_RESET_DEV_INVERSION_FIXES:"ui-reset-dev-inversion-fixes",UI_APPLY_DEV_STATIC_THEMES:"ui-apply-dev-static-themes",UI_RESET_DEV_STATIC_THEMES:"ui-reset-dev-static-themes",UI_SAVE_FILE:"ui-save-file",UI_REQUEST_EXPORT_CSS:"ui-request-export-css",BG_CHANGES:"bg-changes",BG_ADD_CSS_FILTER:"bg-add-css-filter",BG_ADD_STATIC_THEME:"bg-add-static-theme",BG_ADD_SVG_FILTER:"bg-add-svg-filter",BG_ADD_DYNAMIC_THEME:"bg-add-dynamic-theme",BG_EXPORT_CSS:"bg-export-css",BG_UNSUPPORTED_SENDER:"bg-unsupported-sender",BG_CLEAN_UP:"bg-clean-up",BG_RELOAD:"bg-reload",BG_FETCH_RESPONSE:"bg-fetch-response",BG_UI_UPDATE:"bg-ui-update",BG_CSS_UPDATE:"bg-css-update",CS_COLOR_SCHEME_CHANGE:"cs-color-scheme-change",CS_FRAME_CONNECT:"cs-frame-connect",CS_FRAME_FORGET:"cs-frame-forget",CS_FRAME_FREEZE:"cs-frame-freeze",CS_FRAME_RESUME:"cs-frame-resume",CS_EXPORT_CSS_RESPONSE:"cs-export-css-response",CS_FETCH:"cs-fetch"},u="undefined"==typeof navigator?"some useragent":navigator.userAgent.toLowerCase(),c="undefined"==typeof navigator?"some platform":navigator.platform.toLowerCase(),l=u.includes("chrome")||u.includes("chromium"),d=u.includes("thunderbird"),h=u.includes("firefox")||d;u.includes("vivaldi"),u.includes("yabrowser"),u.includes("opr")||u.includes("opera"),u.includes("edg");var f=u.includes("safari")&&!l,p=c.startsWith("win"),m=c.startsWith("mac");u.includes("mobile");var v="function"==typeof ShadowRoot,g="function"==typeof MediaQueryList&&"function"==typeof MediaQueryList.prototype.addEventListener;u.match(/chrom[e|ium]\/([^ ]+)/);var b=function(){try{return document.querySelector(":defined"),!0}catch(e){return!1}}();function y(e,t,o){return n(this,void 0,void 0,(function(){var n;return r(this,(function(r){switch(r.label){case 0:return[4,fetch(e,{cache:"force-cache",credentials:"omit",referrer:o})];case 1:if(n=r.sent(),h&&"text/css"===t&&e.startsWith("moz-extension://")&&e.endsWith(".css"))return[2,n];if(t&&!n.headers.get("Content-Type").startsWith(t))throw Error("Mime type mismatch when loading "+e);if(!n.ok)throw Error("Unable to load "+e+" "+n.status+" "+n.statusText);return[2,n]}}))}))}function S(e,t){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,y(e,t)];case 1:return[4,w(n.sent())];case 2:return[2,n.sent()]}}))}))}function w(e){return n(this,void 0,void 0,(function(){var t;return r(this,(function(n){switch(n.label){case 0:return[4,e.blob()];case 1:return t=n.sent(),[4,new Promise((function(e){var n=new FileReader;n.onloadend=function(){return e(n.result)},n.readAsDataURL(t)}))];case 2:return[2,n.sent()]}}))}))}globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.getManifest&&globalThis.chrome.runtime.getManifest();var k=function(e){return n(void 0,void 0,void 0,(function(){return r(this,(function(t){return[2,Promise.reject(Error(["Embedded Dark Reader cannot access a cross-origin resource",e,"Overview your URLs and CORS policies or use `DarkReader.setFetchMethod(fetch: (url) => Promise<Response>))`. See if using `DarkReader.setFetchMethod(window.fetch)` before `DarkReader.enable()` works."].join(" ")))]}))}))},_=k;function E(e){_=e||k}function C(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,_(e)];case 1:return[2,t.sent()]}}))}))}window.chrome||(window.chrome={}),chrome.runtime||(chrome.runtime={});var x=new Set;function T(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,n,o,i,a,u;return r(this,(function(r){switch(r.label){case 0:if(!e[0]||e[0].type!==s.CS_FETCH)return[3,8];t=e[0].id,r.label=1;case 1:return r.trys.push([1,7,,8]),o=(n=e[0].data).responseType,[4,C(n.url)];case 2:return i=r.sent(),"data-url"!==o?[3,4]:[4,w(i)];case 3:return a=r.sent(),[3,6];case 4:return[4,i.text()];case 5:a=r.sent(),r.label=6;case 6:return x.forEach((function(e){return e({type:s.BG_FETCH_RESPONSE,data:a,error:null,id:t})})),[3,8];case 7:return u=r.sent(),console.error(u),x.forEach((function(e){return e({type:s.BG_FETCH_RESPONSE,data:null,error:u,id:t})})),[3,8];case 8:return[2]}}))}))}function M(e){x.add(e)}if("function"==typeof chrome.runtime.sendMessage){var R=chrome.runtime.sendMessage;chrome.runtime.sendMessage=function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];T.apply(void 0,a([],i(e),!1)),R.apply(chrome.runtime,e)}}else chrome.runtime.sendMessage=T;if(chrome.runtime.onMessage||(chrome.runtime.onMessage={}),"function"==typeof chrome.runtime.onMessage.addListener){var $=chrome.runtime.onMessage.addListener;chrome.runtime.onMessage.addListener=function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];M(e[0]),$.apply(chrome.runtime.onMessage,e)}}else chrome.runtime.onMessage.addListener=function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];return M(e[0])};var O={cssFilter:"cssFilter",svgFilter:"svgFilter",staticTheme:"staticTheme",dynamicTheme:"dynamicTheme"},D={darkScheme:{background:"#181a1b",text:"#e8e6e3"},lightScheme:{background:"#dcdad7",text:"#181a1b"}},A={mode:1,brightness:100,contrast:100,grayscale:0,sepia:0,useFont:!1,fontFamily:m?"Helvetica Neue":p?"Segoe UI":"Open Sans",textStroke:0,engine:O.dynamicTheme,stylesheet:"",darkSchemeBackgroundColor:D.darkScheme.background,darkSchemeTextColor:D.darkScheme.text,lightSchemeBackgroundColor:D.lightScheme.background,lightSchemeTextColor:D.lightScheme.text,scrollbarColor:m?"":"auto",selectionColor:"auto",styleSystemControls:!0,lightColorScheme:"Default",darkColorScheme:"Default"};function P(e){return null!=e.length}function V(e,t){var n,r;if(P(e))for(var i=0,a=e.length;a>i;i++)t(e[i]);else try{for(var s=o(e),u=s.next();!u.done;u=s.next())t(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function I(e,t){V(t,(function(t){return e.push(t)}))}function L(e){for(var t=[],n=0,r=e.length;r>n;n++)t.push(e[n]);return t}function j(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t]}function N(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t]}function U(e){var t,n=!1,r=null;return Object.assign((function(){for(var o=[],s=0;arguments.length>s;s++)o[s]=arguments[s];t=o,r?n=!0:(e.apply(void 0,a([],i(t),!1)),r=requestAnimationFrame((function(){r=null,n&&(e.apply(void 0,a([],i(t),!1)),n=!1)})))}),{cancel:function(){cancelAnimationFrame(r),n=!1,r=null}})}function F(){var e=[],t=null;function n(){for(var n;n=e.shift();)n();t=null}function r(r){e.push(r),t||(t=requestAnimationFrame(n))}function o(){e.splice(0),cancelAnimationFrame(t),t=null}return{add:r,cancel:o}}function H(e){var t=0;return e.seconds&&(t+=1e3*e.seconds),e.minutes&&(t+=60*e.minutes*1e3),e.hours&&(t+=60*e.hours*60*1e3),e.days&&(t+=24*e.days*60*60*1e3),t}function B(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function W(e,t,n){void 0===n&&(n=Function.prototype);var r=10,o=H({seconds:2}),i=H({seconds:10}),a=e.previousSibling,s=e.parentNode;if(!s)throw Error("Unable to watch for node position: parent element not found");if("prev-sibling"===t&&!a)throw Error("Unable to watch for node position: there is no previous sibling");var u=0,c=null,l=null,d=U((function(){if(!l){u++;var f=Date.now();if(null==c)c=f;else if(u>=r){if(i>f-c)return N("Node position watcher paused: retry in "+o+"ms",e,a),void(l=setTimeout((function(){c=null,u=0,l=null,d()}),o));c=f,u=1}if("parent"===t&&a&&a.parentNode!==s)return N("Unable to restore node position: sibling parent changed",e,a,s),void p();if("prev-sibling"===t){if(null==a.parentNode)return N("Unable to restore node position: sibling was removed",e,a,s),void p();a.parentNode!==s&&(N("Style was moved to another parent",e,a,s),v(a.parentNode))}N("Restoring node position",e,a,s),s.insertBefore(e,a?a.nextSibling:s.firstChild),h.takeRecords(),n&&n()}})),h=new MutationObserver((function(){("parent"===t&&e.parentNode!==s||"prev-sibling"===t&&e.previousSibling!==a)&&d()})),f=function(){h.observe(s,{childList:!0})},p=function(){clearTimeout(l),h.disconnect(),d.cancel()},m=function(){h.takeRecords()},v=function(e){s=e,p(),f()};return f(),{run:f,stop:p,skip:m}}function q(e,t){if(null!=e)for(var n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return null==e.shadowRoot?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}}),r=e.shadowRoot?n.currentNode:n.nextNode();null!=r;r=n.nextNode())t(r),q(r.shadowRoot,t)}function z(){return"complete"===document.readyState||"interactive"===document.readyState}var G=new Set;function X(e){G.add(e)}function K(e){G.delete(e)}function Q(){return"complete"===document.readyState}var Y=new Set;function Z(e){Y.add(e)}function J(){Y.clear()}if(!z()){var ee=function(){z()&&(G.forEach((function(e){return e()})),G.clear(),Q()&&(document.removeEventListener("readystatechange",ee),Y.forEach((function(e){return e()})),Y.clear()))};document.addEventListener("readystatechange",ee)}var te=1e3;function ne(e){if(e.length>te)return!0;for(var t=0,n=0;e.length>n;n++)if((t+=e[n].addedNodes.length)>te)return!0;return!1}function re(e){var t=new Set,n=new Set,r=new Set;e.forEach((function(e){V(e.addedNodes,(function(e){e instanceof Element&&e.isConnected&&t.add(e)})),V(e.removedNodes,(function(e){e instanceof Element&&(e.isConnected?(r.add(e),t.delete(e)):n.add(e))}))}));var o=[],i=[];return t.forEach((function(e){t.has(e.parentElement)&&o.push(e)})),n.forEach((function(e){n.has(e.parentElement)&&i.push(e)})),o.forEach((function(e){return t.delete(e)})),i.forEach((function(e){return n.delete(e)})),{additions:t,moves:r,deletions:n}}var oe,ie=new Map,ae=new WeakMap;function se(e,t){var n,r,o;if(ie.has(e))n=ie.get(e),r=ae.get(n);else{var i=!1,a=!1;(n=new MutationObserver((function(t){if(ne(t))!i||z()?r.forEach((function(t){return(0,t.onHugeMutations)(e)})):a||(X(o=function(){return r.forEach((function(t){return(0,t.onHugeMutations)(e)}))}),a=!0),i=!0;else{var n=re(t);r.forEach((function(e){return(0,e.onMinorMutations)(n)}))}}))).observe(e,{childList:!0,subtree:!0}),ie.set(e,n),r=new Set,ae.set(n,r)}return r.add(t),{disconnect:function(){r.delete(t),o&&K(o),0===r.size&&(n.disconnect(),ae.delete(n),ie.delete(e))}}}var ue=new Map;function ce(e){return oe||(oe=document.createElement("a")),oe.href=e,oe.href}function le(e,t){void 0===t&&(t=null);var n=e+(t?";"+t:"");if(ue.has(n))return ue.get(n);if(t){var r=new URL(e,ce(t));return ue.set(n,r),r}var o=new URL(ce(e));return ue.set(e,o),o}function de(e,t){if(t.match(/^data\\?\:/))return t;if(/^\/\//.test(t))return""+location.protocol+t;var n=le(e);return le(t,n.href).href}function he(e){if(e.startsWith("data:"))return!0;var t=le(e);return t.protocol===location.protocol&&t.hostname===location.hostname&&t.port===location.port&&t.pathname===location.pathname}function fe(e,t,n){V(e,(function(e){if(e.selectorText)t(e);else if(e.href)try{fe(e.styleSheet.cssRules,t,n)}catch(e){j("Found a non-loaded link."),n&&n()}else if(e.media){var r=Array.from(e.media),o=r.some((function(e){return e.startsWith("screen")||e.startsWith("all")||e.startsWith("(")})),i=r.some((function(e){return e.startsWith("print")||e.startsWith("speech")}));!o&&i||fe(e.cssRules,t,n)}else e.conditionText?CSS.supports(e.conditionText)&&fe(e.cssRules,t,n):N("CSSRule type not supported",e)}))}var pe=["background","border","border-color","border-bottom","border-left","border-right","border-top","outline","outline-color"],me=f?pe.map((function(e){return[e,RegExp(e+":\\s*(.*?)\\s*;")]})):null;function ve(e,t){V(e,(function(n){var r=e.getPropertyValue(n).trim();r&&t(n,r)}));var n=e.cssText;n.includes("var(")&&(f?me.forEach((function(e){var r=i(e,2),o=r[0],a=n.match(r[1]);if(a&&a[1]){var s=a[1].trim();t(o,s)}})):pe.forEach((function(n){var r=e.getPropertyValue(n);r&&r.includes("var(")&&t(n,r)})))}var ge=/url\((('.+?')|(".+?")|([^\)]*?))\)/g,be=/@import\s*(url\()?(('.+?')|(".+?")|([^\)]*?))\)? ?(screen)?;?/g;function ye(e){return e.replace(/^url\((.*)\)$/,"$1").trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function Se(e){var t=le(e);return""+t.origin+t.pathname.replace(/\?.*$/,"").replace(/(\/)([^\/]+)$/i,"$1")}function we(e,t){return e.replace(ge,(function(e){var n=ye(e);try{return'url("'+de(t,n)+'")'}catch(t){return N("Not able to replace relative URL with Absolute URL, skipping"),e}}))}var ke=/\/\*[\s\S]*?\*\//g;function _e(e){return e.replace(ke,"")}var Ee=/@font-face\s*{[^}]*}/g;function Ce(e){return e.replace(Ee,"")}function xe(e){var t=e.h,n=e.s,r=e.l,o=e.a,a=void 0===o?1:o;if(0===n){var s=i([r,r,r].map((function(e){return Math.round(255*e)})),3);return{r:s[0],g:s[2],b:s[1],a:a}}var u=(1-Math.abs(2*r-1))*n,c=u*(1-Math.abs(t/60%2-1)),l=r-u/2,d=i((60>t?[u,c,0]:120>t?[c,u,0]:180>t?[0,u,c]:240>t?[0,c,u]:300>t?[c,0,u]:[u,0,c]).map((function(e){return Math.round(255*(e+l))})),3);return{r:d[0],g:d[1],b:d[2],a:a}}function Te(e){var t=e.a,n=void 0===t?1:t,r=e.r/255,o=e.g/255,i=e.b/255,a=Math.max(r,o,i),s=Math.min(r,o,i),u=a-s,c=(a+s)/2;if(0===u)return{h:0,s:0,l:c,a:n};var l=60*(a===r?(o-i)/u%6:a===o?(i-r)/u+2:(r-o)/u+4);return 0>l&&(l+=360),{h:l,s:u/(1-Math.abs(2*c-1)),l:c,a:n}}function Me(e,t){void 0===t&&(t=0);var n=e.toFixed(t);if(0===t)return n;var r=n.indexOf(".");if(r>=0){var o=n.match(/0+$/);if(o)return n.substring(0,o.index===r+1?r:o.index)}return n}function Re(e){var t=e.r,n=e.g,r=e.b,o=e.a;return null!=o&&1>o?"rgba("+Me(t)+", "+Me(n)+", "+Me(r)+", "+Me(o,2)+")":"rgb("+Me(t)+", "+Me(n)+", "+Me(r)+")"}function $e(e){var t=e.r,n=e.g,r=e.b,o=e.a;return"#"+(null!=o&&1>o?[t,n,r,Math.round(255*o)]:[t,n,r]).map((function(e){return(16>e?"0":"")+e.toString(16)})).join("")}function Oe(e){var t=e.h,n=e.s,r=e.l,o=e.a;return null!=o&&1>o?"hsla("+Me(t)+", "+Me(100*n)+"%, "+Me(100*r)+"%, "+Me(o,2)+")":"hsl("+Me(t)+", "+Me(100*n)+"%, "+Me(100*r)+"%)"}var De=/^rgba?\([^\(\)]+\)$/,Ae=/^hsla?\([^\(\)]+\)$/,Pe=/^#[0-9a-f]+$/i;function Ve(e){var t=e.trim().toLowerCase();if(t.match(De))return Ue(t);if(t.match(Ae))return Be(t);if(t.match(Pe))return We(t);if(Qe.has(t))return qe(t);if(Ye.has(t))return ze(t);if("transparent"===e)return{r:0,g:0,b:0,a:0};throw Error("Unable to parse "+e)}function Ie(e){var t=[],n=0,r=!1,o=e.indexOf("(");e=e.substring(o+1,e.length-1);for(var i=0;e.length>i;i++){var a=e[i];a>="0"&&"9">=a||"."===a||"+"===a||"-"===a?r=!0:!r||" "!==a&&","!==a?r||(n=i+1):(t.push(e.substring(n,i)),r=!1,n=i+1)}return r&&t.push(e.substring(n,e.length)),t}function Le(e,t,n){var r=Ie(e),o=Object.entries(n);return r.map((function(e){return e.trim()})).map((function(e,n){var r,a=o.find((function(t){var n=i(t,1);return e.endsWith(n[0])}));return r=a?parseFloat(e.substring(0,e.length-a[0].length))/a[1]*t[n]:parseFloat(e),t[n]>1?Math.round(r):r}))}var je=[255,255,255,1],Ne={"%":100};function Ue(e){var t=i(Le(e,je,Ne),4),n=t[3];return{r:t[0],g:t[1],b:t[2],a:void 0===n?1:n}}var Fe=[360,1,1,1],He={"%":100,deg:360,rad:2*Math.PI,turn:1};function Be(e){var t=i(Le(e,Fe,He),4),n=t[3];return xe({h:t[0],s:t[1],l:t[2],a:void 0===n?1:n})}function We(e){var t=e.substring(1);switch(t.length){case 3:case 4:var n=i([0,1,2].map((function(e){return parseInt(""+t[e]+t[e],16)})),3);return{r:n[0],g:n[1],b:n[2],a:3===t.length?1:parseInt(""+t[3]+t[3],16)/255};case 6:case 8:var r=i([0,2,4].map((function(e){return parseInt(t.substring(e,e+2),16)})),3);return{r:r[0],g:r[1],b:r[2],a:6===t.length?1:parseInt(t.substring(6,8),16)/255}}throw Error("Unable to parse "+e)}function qe(e){var t=Qe.get(e);return{r:t>>16&255,g:t>>8&255,b:t>>0&255,a:1}}function ze(e){var t=Ye.get(e);return{r:t>>16&255,g:t>>8&255,b:t>>0&255,a:1}}var Ge=function(e){return e>="0"&&"9">=e},Xe=function(e){return Math.floor(Math.log10(e))+1};function Ke(e){for(var t=0,n=function(t,n,r){e=e.substring(0,t)+r+e.substring(n)},r=function(){for(var n=0,r=1;4>r;r++){var o=e[t+r];if(" "===o)break;if(!Ge(o))break;n*=10,n+=Number(o)}var i=Xe(n);if("%"===e[(t+=i)+1])return t++,n};0!==(t=e.indexOf("calc("));){var o=t;t+=4;var i=r();if(!i)break;if(" "!==e[t+1])break;t++;var a=e[t+1];if("+"!==a&&"-"!==a)break;if(t++," "!==e[t+1])break;t++;var s=r();if(!s)break;n(o,t+2,"+"===a?i+s+"%":i-s+"%")}return e}var Qe=new Map(Object.entries({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgrey:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,grey:8421504,green:32768,greenyellow:11403055,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgrey:13882323,lightgreen:9498256,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074})),Ye=new Map(Object.entries({ActiveBorder:3906044,ActiveCaption:0,AppWorkspace:11184810,Background:6513614,ButtonFace:16777215,ButtonHighlight:15329769,ButtonShadow:10461343,ButtonText:0,CaptionText:0,GrayText:8355711,Highlight:11720703,HighlightText:0,InactiveBorder:16777215,InactiveCaption:16777215,InactiveCaptionText:0,InfoBackground:16514245,InfoText:0,Menu:16185078,MenuText:16777215,Scrollbar:11184810,ThreeDDarkShadow:0,ThreeDFace:12632256,ThreeDHighlight:16777215,ThreeDLightShadow:16777215,ThreeDShadow:0,Window:15527148,WindowFrame:11184810,WindowText:0,"-webkit-focus-ring-color":15046400}).map((function(e){var t=i(e,2),n=t[1];return[t[0].toLowerCase(),n]})));function Ze(e,t,n,r,o){return(e-t)*(o-r)/(n-t)+r}function Je(e,t,n){return Math.min(n,Math.max(t,e))}function et(e,t){for(var n=[],r=0,o=e.length;o>r;r++){n[r]=[];for(var i=0,a=t[0].length;a>i;i++){for(var s=0,u=0,c=e[0].length;c>u;u++)s+=e[r][u]*t[u][i];n[r][i]=s}}return n}function tt(e,t,n){void 0===n&&(n=0);for(var r,o=[];r=e.exec(t);)o.push(r[n]);return o}function nt(e){function t(e){return e.replace(/^\s+/,"")}function n(e){return 0===e?"":" ".repeat(4*e)}if(5e4>e.length)for(var r=/[^{}]+{\s*}/;r.test(e);)e=e.replace(r,"");for(var o=e.replace(/\s{2,}/g," ").replace(/\{/g,"{\n").replace(/\}/g,"\n}\n").replace(/\;(?![^\(|\"]*(\)|\"))/g,";\n").replace(/\,(?![^\(|\"]*(\)|\"))/g,",\n").replace(/\n\s*\n/g,"\n").split("\n"),i=0,a=[],s=0,u=o.length;u>s;s++){var c=o[s]+"\n";c.includes("{")?a.push(n(i++)+t(c)):c.includes("}")?a.push(n(--i)+t(c)):a.push(n(i)+t(c))}return a.join("").trim()}function rt(e,t){void 0===t&&(t=0);for(var n=e.length,r=0,o=-1,i=t;n>i;i++)if(0===r){if(0>(a=e.indexOf("(",i)))break;o=a,r++,i=a}else{var a,s=e.indexOf(")",i);if(0>s)break;if(0>(a=e.indexOf("(",i))||a>s){if(0==--r)return{start:o,end:s+1};i=s}else r++,i=a}return null}function ot(e){var t=at.identity();return 0!==e.sepia&&(t=et(t,at.sepia(e.sepia/100))),0!==e.grayscale&&(t=et(t,at.grayscale(e.grayscale/100))),100!==e.contrast&&(t=et(t,at.contrast(e.contrast/100))),100!==e.brightness&&(t=et(t,at.brightness(e.brightness/100))),1===e.mode&&(t=et(t,at.invertNHue())),t}function it(e,t){var n=i(e,3),r=et(t,[[n[0]/255],[n[1]/255],[n[2]/255],[1],[1]]);return[0,1,2].map((function(e){return Je(Math.round(255*r[e][0]),0,255)}))}var at={identity:function(){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]]},invertNHue:function(){return[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0],[0,0,0,0,1]]},brightness:function(e){return[[e,0,0,0,0],[0,e,0,0,0],[0,0,e,0,0],[0,0,0,1,0],[0,0,0,0,1]]},contrast:function(e){var t=(1-e)/2;return[[e,0,0,0,t],[0,e,0,0,t],[0,0,e,0,t],[0,0,0,1,0],[0,0,0,0,1]]},sepia:function(e){return[[.393+.607*(1-e),.769-.769*(1-e),.189-.189*(1-e),0,0],[.349-.349*(1-e),.686+.314*(1-e),.168-.168*(1-e),0,0],[.272-.272*(1-e),.534-.534*(1-e),.131+.869*(1-e),0,0],[0,0,0,1,0],[0,0,0,0,1]]},grayscale:function(e){return[[.2126+.7874*(1-e),.7152-.7152*(1-e),.0722-.0722*(1-e),0,0],[.2126-.2126*(1-e),.7152+.2848*(1-e),.0722-.0722*(1-e),0,0],[.2126-.2126*(1-e),.7152-.7152*(1-e),.0722+.9278*(1-e),0,0],[0,0,0,1,0],[0,0,0,0,1]]}};function st(e){return e[1===e.mode?"darkSchemeBackgroundColor":"lightSchemeBackgroundColor"]}function ut(e){return e[1===e.mode?"darkSchemeTextColor":"lightSchemeTextColor"]}var ct=new Map,lt=new Map;function dt(e){if(lt.has(e))return lt.get(e);var t=Te(Ve(e));return lt.set(e,t),t}function ht(){ct.clear(),lt.clear()}var ft=["r","g","b","a"],pt=["mode","brightness","contrast","grayscale","sepia","darkSchemeBackgroundColor","darkSchemeTextColor","lightSchemeBackgroundColor","lightSchemeTextColor"];function mt(e,t){var n="";return ft.forEach((function(t){n+=e[t]+";"})),pt.forEach((function(e){n+=t[e]+";"})),n}function vt(e,t,n,r,o){var a;ct.has(n)?a=ct.get(n):(a=new Map,ct.set(n,a));var s=mt(e,t);if(a.has(s))return a.get(s);var u=xe(n(Te(e),null==r?null:dt(r),null==o?null:dt(o))),c=u.a,l=i(it([u.r,u.g,u.b],ot(t)),3),d=l[0],h=l[1],f=l[2],p=1===c?$e({r:d,g:h,b:f}):Re({r:d,g:h,b:f,a:c});return a.set(s,p),p}function gt(e){return e}function bt(e,t){return vt(e,t,gt)}function yt(e,t){var n=st(t);return vt(e,t,St,ut(t),n)}function St(e,t,n){var r=e.h,o=e.s,i=e.l,a=e.a,s=.5>i,u=r,c=i;return(s?.2>i||.12>o:.24>o||i>.8&&r>200&&280>r)&&(s?(u=t.h,c=t.s):(u=n.h,c=n.s)),{h:u,s:c,l:Ze(i,0,1,t.l,n.l),a:a}}var wt=.4;function kt(e,t){var n=e.h,r=e.s,o=e.l,i=e.a,a=.12>r||o>.8&&n>200&&280>n;if(.5>o){var s=Ze(o,0,.5,0,wt);return a?{h:t.h,s:t.s,l:s,a:i}:{h:n,s:r,l:s,a:i}}var u=Ze(o,.5,1,wt,t.l);if(a)return{h:t.h,s:t.s,l:u,a:i};var c=n;return n>60&&180>n&&(c=n>120?Ze(n,120,180,135,180):Ze(n,60,120,60,105)),{h:c,s:r,l:u,a:i}}function _t(e,n){if(0===n.mode)return yt(e,n);var r=st(n);return vt(e,t(t({},n),{mode:0}),kt,r)}var Et,Ct=.55;function xt(e){return Ze(e,205,245,205,220)}function Tt(e,t){var n=e.h,r=e.s,o=e.l,i=e.a,a=.2>o||.24>r,s=!a&&n>205&&245>n;if(o>.5){var u=Ze(o,.5,1,Ct,t.l);if(a)return{h:t.h,s:t.s,l:u,a:i};var c=n;return s&&(c=xt(n)),{h:c,s:r,l:u,a:i}}if(a)return{h:t.h,s:t.s,l:Ze(o,0,.5,t.l,Ct),a:i};var l,d=n;return s?(d=xt(n),l=Ze(o,0,.5,t.l,Math.min(1,Ct+.05))):l=Ze(o,0,.5,t.l,Ct),{h:d,s:r,l:l,a:i}}function Mt(e,n){if(0===n.mode)return yt(e,n);var r=ut(n);return vt(e,t(t({},n),{mode:0}),Tt,r)}function Rt(e,t,n){var r=e.s,o=e.l,i=e.a,a=e.h,s=r;return(.2>o||.24>r)&&(.5>o?(a=t.h,s=t.s):(a=n.h,s=n.s)),{h:a,s:s,l:Ze(o,0,1,.5,.2),a:i}}function $t(e,n){if(0===n.mode)return yt(e,n);var r=ut(n),o=st(n);return vt(e,t(t({},n),{mode:0}),Rt,r,o)}function Ot(e,t){return _t(e,t)}function Dt(e,t){return _t(e,t)}function At(e){var t=[];return t.push('*:not(pre, pre *, code, .far, .fa, .glyphicon, [class*="vjs-"], .fab, .fa-github, .fas, .material-icons, .icofont, .typcn, mu, [class*="mu-"], .glyphicon, .icon) {'),e.useFont&&e.fontFamily&&t.push(" font-family: "+e.fontFamily+" !important;"),e.textStroke>0&&(t.push(" -webkit-text-stroke: "+e.textStroke+"px !important;"),t.push(" text-stroke: "+e.textStroke+"px !important;")),t.push("}"),t.join("\n")}function Pt(e){var t=[];return e.mode===Et.dark&&t.push("invert(100%) hue-rotate(180deg)"),100!==e.brightness&&t.push("brightness("+e.brightness+"%)"),100!==e.contrast&&t.push("contrast("+e.contrast+"%)"),0!==e.grayscale&&t.push("grayscale("+e.grayscale+"%)"),0!==e.sepia&&t.push("sepia("+e.sepia+"%)"),0===t.length?null:t.join(" ")}function Vt(e){return e.slice(0,4).map((function(e){return e.map((function(e){return e.toFixed(3)})).join(" ")})).join(" ")}function It(e){return Vt(ot(e))}!function(e){e[e.light=0]="light",e[e.dark=1]="dark"}(Et||(Et={}));var Lt=0,jt=new Map,Nt=new Map;function Ut(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){return[2,new Promise((function(t,n){var r=++Lt;jt.set(r,t),Nt.set(r,n),chrome.runtime.sendMessage({type:s.CS_FETCH,data:e,id:r})}))]}))}))}chrome.runtime.onMessage.addListener((function(e){var t=e.data,n=e.error,r=e.id;if(e.type===s.BG_FETCH_RESPONSE){var o=jt.get(r),i=Nt.get(r);jt.delete(r),Nt.delete(r),n?i&&i(n):o&&o(t)}}));var Ft=new(function(){function e(){this.queue=[],this.timerId=null,this.frameDuration=1e3/60}return e.prototype.addToQueue=function(e){this.queue.push(e),this.startQueue()},e.prototype.stopQueue=function(){null!==this.timerId&&(cancelAnimationFrame(this.timerId),this.timerId=null),this.queue=[]},e.prototype.startQueue=function(){var e=this;this.timerId||(this.timerId=requestAnimationFrame((function(){e.timerId=null;for(var t,n=Date.now();t=e.queue.shift();)if(t(),Date.now()-n>=e.frameDuration){e.startQueue();break}})))},e}());function Ht(e){return n(this,void 0,void 0,(function(){var o=this;return r(this,(function(i){return[2,new Promise((function(i,a){return n(o,void 0,void 0,(function(){var n,o,s,u;return r(this,(function(r){switch(r.label){case 0:return e.startsWith("data:")?(n=e,[3,4]):[3,1];case 1:return r.trys.push([1,3,,4]),[4,Bt(e)];case 2:return n=r.sent(),[3,4];case 3:return o=r.sent(),a(o),[2];case 4:return r.trys.push([4,6,,7]),[4,Wt(n)];case 5:return s=r.sent(),Ft.addToQueue((function(){i(t({src:e,dataURL:n,width:s.naturalWidth,height:s.naturalHeight},Yt(s)))})),[3,7];case 6:return u=r.sent(),a(u),[3,7];case 7:return[2]}}))}))}))]}))}))}function Bt(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return new URL(e).origin!==location.origin?[3,2]:[4,S(e)];case 1:return[2,t.sent()];case 2:return[4,Ut({url:e,responseType:"data-url"})];case 3:return[2,t.sent()]}}))}))}function Wt(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){return[2,new Promise((function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=function(){return n("Unable to load image "+e)},r.src=e}))]}))}))}var qt,zt,Gt=1024;function Xt(){var e=Gt,t=Gt;(qt=document.createElement("canvas")).width=e,qt.height=t,(zt=qt.getContext("2d")).imageSmoothingEnabled=!1}function Kt(){qt=null,zt=null}var Qt=5242880;function Yt(e){qt||Xt();var t=e.naturalWidth,n=e.naturalHeight;if(0===n||0===t)return N("logWarn(Image is empty "+e.currentSrc+")"),null;if(t*n*4>Qt)return j("Skipped large image analyzing(Larger than 5mb in memory)"),{isDark:!1,isLight:!1,isTransparent:!1,isLarge:!1,isTooLarge:!0};var r=t*n,o=Math.min(1,Math.sqrt(Gt/r)),i=Math.ceil(t*o),a=Math.ceil(n*o);zt.clearRect(0,0,i,a),zt.drawImage(e,0,0,t,n,0,0,i,a);var s,u,c,l,d=zt.getImageData(0,0,i,a).data,h=.05,f=.4,p=.7,m=0,v=0,g=0;for(c=0;a>c;c++)for(u=0;i>u;u++)h>d[3+(s=4*(c*i+u))]/255?m++:(f>(l=d[s+0]/255*.2126+d[s+1]/255*.7152+d[s+2]/255*.0722)&&v++,l>p&&g++);var b=i*a,y=b-m;return{isDark:v/y>=.7,isLight:g/y>=.7,isTransparent:m/b>=.1,isLarge:r>=48e4,isTooLarge:!1}}function Zt(e,t){var n=e.dataURL,r=e.width,o=e.height,i=It(t);return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+r+'" height="'+o+'"><defs><filter id="darkreader-image-filter"><feColorMatrix type="matrix" values="'+i+'" /></filter></defs><image width="'+r+'" height="'+o+'" filter="url(#darkreader-image-filter)" xlink:href="'+n+'" /></svg>')}function Jt(){Ft&&Ft.stopQueue(),Kt()}function en(e,t){return!(!e||!e.getPropertyPriority(t))}function tn(e,t,n,r,o,i){if(e.startsWith("--")){if(a=Sn(r,e,t,n,o,i))return{property:e,value:a,important:en(n.style,e),sourceValue:t}}else if(t.includes("var(")){if(a=wn(r,e,t))return{property:e,value:a,important:en(n.style,e),sourceValue:t}}else if(e.includes("color")&&"-webkit-print-color-adjust"!==e||"fill"===e||"stroke"===e||"stop-color"===e){if(a=hn(e,t))return{property:e,value:a,important:en(n.style,e),sourceValue:t}}else if("background-image"===e||"list-style-image"===e){if(a=gn(t,n,o,i))return{property:e,value:a,important:en(n.style,e),sourceValue:t}}else if(e.includes("shadow")){var a;if(a=yn(t))return{property:e,value:a,important:en(n.style,e),sourceValue:t}}return null}function nn(e,t,n){var r=[];return t||(r.push("html {"),r.push(" background-color: "+_t({r:255,g:255,b:255},e)+" !important;"),r.push("}")),r.push((t?"":"html, body, ")+(n?"input, textarea, select, button":"")+" {"),r.push(" background-color: "+_t({r:255,g:255,b:255},e)+";"),r.push("}"),r.push("html, body, "+(n?"input, textarea, select, button":"")+" {"),r.push(" border-color: "+$t({r:76,g:76,b:76},e)+";"),r.push(" color: "+Mt({r:0,g:0,b:0},e)+";"),r.push("}"),r.push("a {"),r.push(" color: "+Mt({r:0,g:64,b:255},e)+";"),r.push("}"),r.push("table {"),r.push(" border-color: "+$t({r:128,g:128,b:128},e)+";"),r.push("}"),r.push("::placeholder {"),r.push(" color: "+Mt({r:169,g:169,b:169},e)+";"),r.push("}"),r.push("input:-webkit-autofill,"),r.push("textarea:-webkit-autofill,"),r.push("select:-webkit-autofill {"),r.push(" background-color: "+_t({r:250,g:255,b:189},e)+" !important;"),r.push(" color: "+Mt({r:0,g:0,b:0},e)+" !important;"),r.push("}"),e.scrollbarColor&&r.push(an(e)),e.selectionColor&&r.push(on(e)),r.join("\n")}function rn(e){var n,r;if("auto"===e.selectionColor)n=_t({r:0,g:96,b:212},t(t({},e),{grayscale:0})),r=Mt({r:255,g:255,b:255},t(t({},e),{grayscale:0}));else{var o=Te(Ve(e.selectionColor));n=e.selectionColor,r=.5>o.l?"#FFF":"#000"}return{backgroundColorSelection:n,foregroundColorSelection:r}}function on(e){var t=[],n=rn(e),r=n.backgroundColorSelection,o=n.foregroundColorSelection;return["::selection","::-moz-selection"].forEach((function(e){t.push(e+" {"),t.push(" background-color: "+r+" !important;"),t.push(" color: "+o+" !important;"),t.push("}")})),t.join("\n")}function an(e){var n,r,o,i,a,s,u=[];if("auto"===e.scrollbarColor)n=_t({r:241,g:241,b:241},e),r=Mt({r:96,g:96,b:96},e),o=_t({r:176,g:176,b:176},e),i=_t({r:144,g:144,b:144},e),a=_t({r:96,g:96,b:96},e),s=_t({r:255,g:255,b:255},e);else{var c=Te(Ve(e.scrollbarColor)),l=c.l>.5,d=function(e){return t(t({},c),{l:Je(c.l+e,0,1)})},f=function(e){return t(t({},c),{l:Je(c.l-e,0,1)})};n=Oe(f(.4)),r=Oe(l?f(.4):d(.4)),o=Oe(c),i=Oe(d(.1)),a=Oe(d(.2))}return u.push("::-webkit-scrollbar {"),u.push(" background-color: "+n+";"),u.push(" color: "+r+";"),u.push("}"),u.push("::-webkit-scrollbar-thumb {"),u.push(" background-color: "+o+";"),u.push("}"),u.push("::-webkit-scrollbar-thumb:hover {"),u.push(" background-color: "+i+";"),u.push("}"),u.push("::-webkit-scrollbar-thumb:active {"),u.push(" background-color: "+a+";"),u.push("}"),u.push("::-webkit-scrollbar-corner {"),u.push(" background-color: "+s+";"),u.push("}"),h&&(u.push("* {"),u.push(" scrollbar-color: "+o+" "+n+";"),u.push("}")),u.join("\n")}function sn(e,t){var n=t.strict,r=[],o=location.hostname.endsWith("microsoft.com");return r.push("html, body, "+(n?"body :not(iframe)"+(o?':not(div[style^="position:absolute;top:0;left:-"]':""):"body > :not(iframe)")+" {"),r.push(" background-color: "+_t({r:255,g:255,b:255},e)+" !important;"),r.push(" border-color: "+$t({r:64,g:64,b:64},e)+" !important;"),r.push(" color: "+Mt({r:0,g:0,b:0},e)+" !important;"),r.push("}"),r.join("\n")}var un=new Set(["inherit","transparent","initial","currentcolor","none","unset"]),cn=new Map;function ln(e){if(e=e.trim(),cn.has(e))return cn.get(e);e.includes("calc(")&&(e=Ke(e));var t=Ve(e);return cn.set(e,t),t}function dn(e){try{return ln(e)}catch(e){return null}}function hn(e,t){if(un.has(t.toLowerCase()))return t;try{var n=ln(t);return e.includes("background")?function(e){return _t(n,e)}:e.includes("border")||e.includes("outline")?function(e){return $t(n,e)}:function(e){return Mt(n,e)}}catch(e){return N("Color parse error",e),null}}var fn=/[\-a-z]+gradient\(([^\(\)]*(\(([^\(\)]*(\(.*?\)))*[^\(\)]*\))){0,15}[^\(\)]*\)/g,pn=new Map,mn=new Map;function vn(e,t){if(!e||0===t.length)return!1;if(t.some((function(e){return"*"===e})))return!0;for(var n=e.split(/,\s*/g),r=function(e){var r=t[e];if(n.some((function(e){return e===r})))return{value:!0}},o=0;t.length>o;o++){var i=r(o);if("object"==typeof i)return i.value}return!1}function gn(e,o,i,a){var s=this;try{var u=tt(fn,e),c=tt(ge,e);if(0===c.length&&0===u.length)return e;var l=function(t){var n=0;return t.map((function(t){var r=e.indexOf(t,n);return n=r+t.length,{match:t,index:r}}))},d=l(c).map((function(e){return t({type:"url"},e)})).concat(l(u).map((function(e){return t({type:"gradient"},e)}))).sort((function(e,t){return e.index-t.index})),h=function(e){var t=e.match(/^(.*-gradient)\((.*)\)$/),n=t[1],r=/^(from|color-stop|to)\(([^\(\)]*?,\s*)?(.*?)\)$/,o=tt(/([^\(\),]+(\([^\(\)]*(\([^\(\)]*\)*[^\(\)]*)?\))?[^\(\),]*),?/g,t[2],1).map((function(e){var t=dn(e=e.trim());if(t)return function(e){return Dt(t,e)};var n=e.lastIndexOf(" ");if(t=dn(e.substring(0,n)))return function(r){return Dt(t,r)+" "+e.substring(n+1)};var o=e.match(r);return o&&(t=dn(o[3]))?function(e){return o[1]+"("+(o[2]?o[2]+", ":"")+Dt(t,e)+")"}:function(){return e}}));return function(e){return n+"("+o.map((function(t){return t(e)})).join(", ")+")"}},f=function(e){var t;if(vn(o.selectorText,i))return null;var u=ye(e),c=o.parentStyleSheet,l=c&&c.href?Se(c.href):(null===(t=c.ownerNode)||void 0===t?void 0:t.baseURI)||location.origin,d='url("'+(u=de(l,u))+'")';return function(e){return n(s,void 0,void 0,(function(){var t,n;return r(this,(function(r){switch(r.label){case 0:return pn.has(u)?(t=pn.get(u),[3,7]):[3,1];case 1:return r.trys.push([1,6,,7]),mn.has(u)?(n=mn.get(u),[4,new Promise((function(e){return n.push(e)}))]):[3,3];case 2:return(t=r.sent())?[3,5]:[2,null];case 3:return mn.set(u,[]),[4,Ht(u)];case 4:t=r.sent(),pn.set(u,t),mn.get(u).forEach((function(e){return e(t)})),mn.delete(u),r.label=5;case 5:return a()?[2,null]:[3,7];case 6:return N(r.sent()),mn.has(u)&&(mn.get(u).forEach((function(e){return e(null)})),mn.delete(u)),[2,d];case 7:return[2,p(t,e)||d]}}))}))}},p=function(e,n){var r,o=e.isLight,i=e.isTransparent,a=e.isLarge;return e.isTooLarge?r='url("'+e.src+'")':e.isDark&&i&&1===n.mode&&!a&&e.width>2?(j("Inverting dark image "+e.src),r='url("'+Zt(e,t(t({},n),{sepia:Je(n.sepia+10,0,100)}))+'")'):o&&!i&&1===n.mode?a?r="none":(j("Dimming light image "+e.src),r='url("'+Zt(e,n)+'")'):0===n.mode&&o&&!a?(j("Applying filter to image "+e.src),r='url("'+Zt(e,t(t({},n),{brightness:Je(n.brightness-10,5,200),sepia:Je(n.sepia+10,0,100)}))+'")'):r=null,r},m=[],v=0;return d.forEach((function(t,n){var r=t.match,o=t.type,i=t.index,a=v,s=i+r.length;v=s,m.push((function(){return e.substring(a,i)})),m.push("url"===o?f(r):h(r)),n===d.length-1&&m.push((function(){return e.substring(s)}))})),function(e){var t=m.filter(Boolean).map((function(t){return t(e)}));return t.some((function(e){return e instanceof Promise}))?Promise.all(t).then((function(e){return e.join("")})):t.join("")}}catch(t){return N("Unable to parse gradient "+e,t),null}}function bn(e){try{var t=0,n=tt(/(^|\s)(?!calc)([a-z]+\(.+?\)|#[0-9a-f]+|[a-z]+)(.*?(inset|outset)?($|,))/gi,e,2),r=0,o=n.map((function(o,i){var a=t,s=e.indexOf(o,t),u=s+o.length;t=u;var c=dn(o);return c?function(t){return""+e.substring(a,s)+Ot(c,t)+(i===n.length-1?e.substring(u):"")}:(r++,function(){return e.substring(a,u)})}));return function(e){var t=o.map((function(t){return t(e)})).join("");return{matchesLength:n.length,unparseableMatchesLength:r,result:t}}}catch(t){return N("Unable to parse shadow "+e,t),null}}function yn(e){var t=bn(e);return t?function(e){return t(e).result}:null}function Sn(e,t,n,r,o,i){return e.getModifierForVariable({varName:t,sourceValue:n,rule:r,ignoredImgSelectors:o,isCancelled:i})}function wn(e,t,n){return e.getModifierForVarDependant(t,n)}function kn(){cn.clear(),ht(),pn.clear(),Jt(),mn.clear()}var _n=1,En=2,Cn=4,xn=8,Tn=new(function(){function e(){this.varTypes=new Map,this.rulesQueue=[],this.definedVars=new Set,this.varRefs=new Map,this.unknownColorVars=new Set,this.unknownBgVars=new Set,this.undefinedVars=new Set,this.initialVarTypes=new Map,this.changedTypeVars=new Set,this.typeChangeSubscriptions=new Map,this.unstableVarValues=new Map}return e.prototype.clear=function(){this.varTypes.clear(),this.rulesQueue.splice(0),this.definedVars.clear(),this.varRefs.clear(),this.unknownColorVars.clear(),this.unknownBgVars.clear(),this.undefinedVars.clear(),this.initialVarTypes.clear(),this.changedTypeVars.clear(),this.typeChangeSubscriptions.clear(),this.unstableVarValues.clear()},e.prototype.isVarType=function(e,t){return this.varTypes.has(e)&&(this.varTypes.get(e)&t)>0},e.prototype.addRulesForMatching=function(e){this.rulesQueue.push(e)},e.prototype.matchVariablesAndDependants=function(){var e=this;this.changedTypeVars.clear(),this.initialVarTypes=new Map(this.varTypes),this.collectRootVariables(),this.collectVariablesAndVarDep(this.rulesQueue),this.rulesQueue.splice(0),this.collectRootVarDependants(),this.varRefs.forEach((function(t,n){t.forEach((function(t){e.varTypes.has(n)&&e.resolveVariableType(t,e.varTypes.get(n))}))})),this.unknownColorVars.forEach((function(t){e.unknownBgVars.has(t)?(e.unknownColorVars.delete(t),e.unknownBgVars.delete(t),e.resolveVariableType(t,_n)):e.isVarType(t,_n|En|Cn)?e.unknownColorVars.delete(t):e.undefinedVars.add(t)})),this.unknownBgVars.forEach((function(t){null!=e.findVarRef(t,(function(t){return e.unknownColorVars.has(t)||e.isVarType(t,En|Cn)}))?e.itarateVarRefs(t,(function(t){e.resolveVariableType(t,_n)})):e.isVarType(t,_n|xn)?e.unknownBgVars.delete(t):e.undefinedVars.add(t)})),this.changedTypeVars.forEach((function(t){e.typeChangeSubscriptions.has(t)&&e.typeChangeSubscriptions.get(t).forEach((function(e){e()}))})),this.changedTypeVars.clear()},e.prototype.getModifierForVariable=function(e){var t=this;return function(n){var r=e.varName,o=e.sourceValue,i=e.rule,a=e.ignoredImgSelectors,s=e.isCancelled,u=function(){var e=[],u=function(i,a,s){if(t.isVarType(r,i)){var u,c=a(r);if(Nn(o))if(Un(o)){var l=Gn(o,t.unstableVarValues);l||(l=i===_n?"#ffffff":"#000000"),u=s(l,n)}else u=Dn(o,(function(e){return a(e)}),(function(e){return s(e,n)}));else u=s(o,n);e.push({property:c,value:u})}};if(u(_n,Pn,Wn),u(En,Vn,qn),u(Cn,In,zn),t.isVarType(r,xn)){var c=Ln(r),l=o;Nn(o)&&(l=Dn(o,(function(e){return Pn(e)}),(function(e){return Wn(e,n)})));var d=gn(l,i,a,s);l="function"==typeof d?d(n):d,e.push({property:c,value:l})}return e},c=new Set,l=function(e){var n=function(){var t=u();e(t)};c.add(n),t.subscribeForVarTypeChange(r,n)},d=function(){c.forEach((function(e){t.unsubscribeFromVariableTypeChanges(r,e)}))};return{declarations:u(),onTypeChange:{addListener:l,removeListeners:d}}}},e.prototype.getModifierForVarDependant=function(e,t){var n=this;if(t.match(/^\s*(rgb|hsl)a?\(/)){var r=e.startsWith("background"),o="color"===e||"caret-color"===e;return function(e){var i=Gn(t,n.unstableVarValues);return i||(i=r?"#ffffff":"#000000"),(r?Wn:o?qn:zn)(i,e)}}return"background-color"===e?function(e){return Dn(t,(function(e){return Pn(e)}),(function(t){return Wn(t,e)}))}:"color"===e||"caret-color"===e?function(e){return Dn(t,(function(e){return Vn(e)}),(function(t){return qn(t,e)}))}:"background"===e||"background-image"===e||"box-shadow"===e?function(r){var o=new Set,i=function(){var i=Dn(t,(function(e){return n.isVarType(e,_n)?Pn(e):n.isVarType(e,xn)?Ln(e):(o.add(e),e)}),(function(e){return Wn(e,r)}));if("box-shadow"===e){var a=bn(i)(r);if(a.unparseableMatchesLength!==a.matchesLength)return a.result}return i},a=i();return o.size>0?new Promise((function(e){var t=o.values().next().value,r=function(){n.unsubscribeFromVariableTypeChanges(t,r);var o=i();e(o)};n.subscribeForVarTypeChange(t,r)})):a}:e.startsWith("border")||e.startsWith("outline")?function(e){return Dn(t,(function(e){return In(e)}),(function(t){return zn(t,e)}))}:null},e.prototype.subscribeForVarTypeChange=function(e,t){this.typeChangeSubscriptions.has(e)||this.typeChangeSubscriptions.set(e,new Set);var n=this.typeChangeSubscriptions.get(e);n.has(t)||n.add(t)},e.prototype.unsubscribeFromVariableTypeChanges=function(e,t){this.typeChangeSubscriptions.has(e)&&this.typeChangeSubscriptions.get(e).delete(t)},e.prototype.collectVariablesAndVarDep=function(e){var t=this;e.forEach((function(e){fe(e,(function(e){e.style&&ve(e.style,(function(e,n){jn(e)&&t.inspectVariable(e,n),Nn(n)&&t.inspectVarDependant(e,n)}))}))}))},e.prototype.collectRootVariables=function(){var e=this;ve(document.documentElement.style,(function(t,n){jn(t)&&e.inspectVariable(t,n)}))},e.prototype.inspectVariable=function(e,t){this.unstableVarValues.set(e,t),Nn(t)&&Un(t)&&(this.unknownColorVars.add(e),this.definedVars.add(e)),this.definedVars.has(e)||(this.definedVars.add(e),dn(t)?this.unknownColorVars.add(e):(t.includes("url(")||t.includes("linear-gradient(")||t.includes("radial-gradient("))&&this.resolveVariableType(e,xn))},e.prototype.resolveVariableType=function(e,t){var n=this.initialVarTypes.get(e)||0,r=(this.varTypes.get(e)||0)|t;this.varTypes.set(e,r),(r!==n||this.undefinedVars.has(e))&&(this.changedTypeVars.add(e),this.undefinedVars.delete(e)),this.unknownColorVars.delete(e),this.unknownBgVars.delete(e)},e.prototype.collectRootVarDependants=function(){var e=this;ve(document.documentElement.style,(function(t,n){Nn(n)&&e.inspectVarDependant(t,n)}))},e.prototype.inspectVarDependant=function(e,t){var n=this;jn(e)?this.iterateVarDeps(t,(function(t){n.varRefs.has(e)||n.varRefs.set(e,new Set),n.varRefs.get(e).add(t)})):"background-color"===e||"box-shadow"===e?this.iterateVarDeps(t,(function(e){return n.resolveVariableType(e,_n)})):"color"===e||"caret-color"===e?this.iterateVarDeps(t,(function(e){return n.resolveVariableType(e,En)})):e.startsWith("border")||e.startsWith("outline")?this.iterateVarDeps(t,(function(e){return n.resolveVariableType(e,Cn)})):"background"!==e&&"background-image"!==e||this.iterateVarDeps(t,(function(e){if(!n.isVarType(e,_n|xn)){var t=null!=n.findVarRef(e,(function(e){return n.unknownColorVars.has(e)||n.isVarType(e,En|Cn)}));n.itarateVarRefs(e,(function(e){t?n.resolveVariableType(e,_n):n.unknownBgVars.add(e)}))}}))},e.prototype.iterateVarDeps=function(e,t){var n=new Set;An(e,(function(e){return n.add(e)})),n.forEach((function(e){return t(e)}))},e.prototype.findVarRef=function(e,t,n){var r,i;if(void 0===n&&(n=new Set),n.has(e))return null;if(n.add(e),t(e))retu