const darkModeDefault="auto",DARK_MODE_CSS="dark-mode",DARK_MODE_STORAGE="dark-mode",DARK_MODE_ICON="icon-darkmode",DARK_MODE_BUTTON="dark-mode-button",DARK_MODE_MODES=["auto","dark","light"],systemModeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),modeSymbols={dark:` `,light:` `,auto:` `},darkModeToggleText={en:"Toggle Dark Mode",de:"Dark Mode umschalten",fr:"Activer le mode sombre",es:"Alternar Modo Obscuro",hu:"S\xF6t\xE9t m\xF3d be/ki",it:"Attiva/Disattiva modalit\xE0 scura",nl:"Toggle Dark Mode",pl:"Toggle Dark Mode",pt:"Alternar Modo Escuro",ru:"\u0421\u043C\u0435\u043D\u0430 \u043E\u0444\u043E\u0440\u043C\u043B\u0435\u043D\u0438\u044F",he:"\u05DE\u05E6\u05D1 \u05DC\u05D9\u05DC\u05D4",hi:"\u0921\u093E\u0930\u094D\u0915 \u092E\u094B\u0921"}[defaultUserLanguage()]||"Toggle Dark Mode",toggleButton=``;function getDarkModeSetting(){let a=localStorage.getItem(DARK_MODE_STORAGE);return(null===a||-1==DARK_MODE_MODES.indexOf(a))&&localStorage.setItem(DARK_MODE_STORAGE,darkModeDefault),localStorage.getItem(DARK_MODE_STORAGE)}function getDarkModeIcon(){return``}function toggleDarkMode(){const a=DARK_MODE_MODES[(DARK_MODE_MODES.indexOf(getDarkModeSetting())+1)%DARK_MODE_MODES.length];localStorage.setItem(DARK_MODE_STORAGE,a),maybeModeChange(),updateButton(a)}function switchToMode(a){"dark"==a?document.body.classList.add(DARK_MODE_CSS):document.body.classList.remove(DARK_MODE_CSS)}function maybeModeChange(){const a=getDarkModeSetting(),b=systemModeMediaQuery.matches?"dark":"light";"auto"===a?switchToMode(b):switchToMode(a)}function updateButton(a){const b=$(`#${DARK_MODE_BUTTON}`);b.html(getDarkModeIcon()),b.attr("data-title",`${darkModeToggleText}, current: ${a}`)}function addDarkModeToggle(){const a=$(".rcx-sidebar-topbar .rcx-button-group").first();if(!a.is(":visible"))return void setTimeout(addDarkModeToggle,250);var b=$(`#${DARK_MODE_BUTTON}`);b.is(":visible")||(b=$(toggleButton).prependTo(a),updateButton(getDarkModeSetting()),b.on("click",function(){toggleDarkMode(),$(this).blur()}),systemModeMediaQuery.addEventListener("change",maybeModeChange),maybeModeChange())}$(addDarkModeToggle);