(self.webpackChunkdebug_log_viewer=self.webpackChunkdebug_log_viewer||[]).push([[773],{773:(e,t,i)=>{var r=i(669);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function n(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.STORAGE_KEY="debug-log-viewer-theme",this.THEMES={LIGHT:"light",DARK:"dark",AUTO:"auto"},this.init()},(t=[{key:"init",value:function(){var e=this,t=localStorage.getItem(this.STORAGE_KEY)||this.THEMES.AUTO;this.applyTheme(t),r((function(){e.setupThemeToggle()})),window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(function(){e.getCurrentTheme()===e.THEMES.AUTO&&e.applyTheme(e.THEMES.AUTO)}))}},{key:"setupThemeToggle",value:function(){var e=this,t=r("#debug-log-viewer-theme-toggle"),i=t.find(".theme-icon"),o=t.find(".theme-text");if(0!==t.length){var a=function(){var r=e.isDarkTheme();i.removeClass("fa-moon fa-sun").addClass(r?"fa-sun":"fa-moon"),o.text(r?"Light":"Dark"),t.attr("title",r?"Switch to Light Theme":"Switch to Dark Theme")};t.on("click",(function(){e.toggle(),a()})),r(window).on("debugLogViewerThemeChanged",a),a()}}},{key:"applyTheme",value:function(e){var t=document.documentElement,i=r("#wpbody-content");t.classList.remove("debug-log-viewer-dark-theme"),t.classList.remove("debug-log-viewer-force-light"),i.removeClass("debug-log-viewer-dark-theme debug-log-viewer-force-light");var o=e;switch(e===this.THEMES.AUTO&&(o=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.THEMES.DARK:this.THEMES.LIGHT),t.setAttribute("data-bs-theme",o),i.attr("data-bs-theme",o),e){case this.THEMES.LIGHT:t.classList.add("debug-log-viewer-force-light"),i.addClass("debug-log-viewer-force-light");break;case this.THEMES.DARK:t.classList.add("debug-log-viewer-dark-theme"),i.addClass("debug-log-viewer-dark-theme");break;case this.THEMES.AUTO:o===this.THEMES.DARK&&(t.classList.add("debug-log-viewer-dark-theme"),i.addClass("debug-log-viewer-dark-theme"))}localStorage.setItem(this.STORAGE_KEY,e),r(window).trigger("debugLogViewerThemeChanged",{theme:this.getEffectiveTheme()})}},{key:"getCurrentTheme",value:function(){return localStorage.getItem(this.STORAGE_KEY)||this.THEMES.AUTO}},{key:"getEffectiveTheme",value:function(){var e=this.getCurrentTheme();return e===this.THEMES.AUTO?window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.THEMES.DARK:this.THEMES.LIGHT:e}},{key:"toggle",value:function(){var e=this.getEffectiveTheme()===this.THEMES.LIGHT?this.THEMES.DARK:this.THEMES.LIGHT;return this.applyTheme(e),e}},{key:"isDarkTheme",value:function(){return this.getEffectiveTheme()===this.THEMES.DARK}}])&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();r((function(){window.debugLogViewerTheme=new s})),e.exports&&(e.exports=s)}}]);