import{t as l}from"./theme-change_index_commonjs-module.js";var d;function f(){return d?l.exports:(d=1,(function(n,g){function r(){var o=document.querySelector("[data-toggle-theme]"),t=o?o.getAttribute("data-key"):null;(function(e=localStorage.getItem(t||"theme")){localStorage.getItem(t||"theme")&&(document.documentElement.setAttribute("data-theme",e),o&&[...document.querySelectorAll("[data-toggle-theme]")].forEach(a=>{a.classList.add(o.getAttribute("data-act-class"))}))})(),o&&[...document.querySelectorAll("[data-toggle-theme]")].forEach(e=>{e.addEventListener("click",function(){var a=e.getAttribute("data-toggle-theme");if(a){var c=a.split(",");document.documentElement.getAttribute("data-theme")==c[0]?c.length==1?(document.documentElement.removeAttribute("data-theme"),localStorage.removeItem(t||"theme")):(document.documentElement.setAttribute("data-theme",c[1]),localStorage.setItem(t||"theme",c[1])):(document.documentElement.setAttribute("data-theme",c[0]),localStorage.setItem(t||"theme",c[0]))}[...document.querySelectorAll("[data-toggle-theme]")].forEach(i=>{i.classList.toggle(this.getAttribute("data-act-class"))})})})}function m(){var o=document.querySelector("[data-set-theme='']"),t=o?o.getAttribute("data-key"):null;(function(e=localStorage.getItem(t||"theme")){if(e!=null&&e!="")if(localStorage.getItem(t||"theme")&&localStorage.getItem(t||"theme")!=""){document.documentElement.setAttribute("data-theme",e);var a=document.querySelector("[data-set-theme='"+e.toString()+"']");a&&([...document.querySelectorAll("[data-set-theme]")].forEach(c=>{c.classList.remove(c.getAttribute("data-act-class"))}),a.getAttribute("data-act-class")&&a.classList.add(a.getAttribute("data-act-class")))}else{var a=document.querySelector("[data-set-theme='']");a.getAttribute("data-act-class")&&a.classList.add(a.getAttribute("data-act-class"))}})(),[...document.querySelectorAll("[data-set-theme]")].forEach(e=>{e.addEventListener("click",function(){document.documentElement.setAttribute("data-theme",this.getAttribute("data-set-theme")),localStorage.setItem(t||"theme",document.documentElement.getAttribute("data-theme")),[...document.querySelectorAll("[data-set-theme]")].forEach(a=>{a.classList.remove(a.getAttribute("data-act-class"))}),e.getAttribute("data-act-class")&&e.classList.add(e.getAttribute("data-act-class"))})})}function u(){var o=document.querySelector("select[data-choose-theme]"),t=o?o.getAttribute("data-key"):null;(function(e=localStorage.getItem(t||"theme")){if(localStorage.getItem(t||"theme")){document.documentElement.setAttribute("data-theme",e);var a=document.querySelector("select[data-choose-theme] [value='"+e.toString()+"']");a&&[...document.querySelectorAll("select[data-choose-theme] [value='"+e.toString()+"']")].forEach(c=>{c.selected=!0})}})(),o&&[...document.querySelectorAll("select[data-choose-theme]")].forEach(e=>{e.addEventListener("change",function(){document.documentElement.setAttribute("data-theme",this.value),localStorage.setItem(t||"theme",document.documentElement.getAttribute("data-theme")),[...document.querySelectorAll("select[data-choose-theme] [value='"+localStorage.getItem(t||"theme")+"']")].forEach(a=>{a.selected=!0})})})}function s(o=!0){o===!0?document.addEventListener("DOMContentLoaded",function(t){r(),u(),m()}):(r(),u(),m())}n.exports={themeChange:s}})(l),l.exports)}export{f as r};
