(function(){var d=window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark",a=localStorage.getItem("theme")??d;document.documentElement.setAttribute("saved-theme",a);var n=e=>{let m=new CustomEvent("themechange",{detail:{theme:e}});document.dispatchEvent(m)};document.addEventListener("nav",()=>{let e=()=>{let t=document.documentElement.getAttribute("saved-theme")==="dark"?"light":"dark";document.documentElement.setAttribute("saved-theme",t),localStorage.setItem("theme",t),n(t)},m=t=>{let o=t.matches?"dark":"light";document.documentElement.setAttribute("saved-theme",o),localStorage.setItem("theme",o),n(o)};for(let t of document.getElementsByClassName("darkmode"))t.addEventListener("click",e),window.addCleanup(()=>t.removeEventListener("click",e));let c=window.matchMedia("(prefers-color-scheme: dark)");c.addEventListener("change",m),window.addCleanup(()=>c.removeEventListener("change",m))})})(),(function(){var d=!1,a=n=>{let e=new CustomEvent("readermodechange",{detail:{mode:n}});document.dispatchEvent(e)};document.addEventListener("nav",()=>{let n=()=>{d=!d;let e=d?"on":"off";document.documentElement.setAttribute("reader-mode",e),a(e)};for(let e of document.getElementsByClassName("readermode"))e.addEventListener("click",n),window.addCleanup(()=>e.removeEventListener("click",n));document.documentElement.setAttribute("reader-mode",d?"on":"off")})})();
