import{k as o}from"./chunk-QBEVFUYY.js";import{Ba as n,Z as i,ca as m,gb as c,ua as l,xa as d}from"./chunk-QXTL7CSW.js";var y=class s{platformId=m(d);renderer=m(c).createRenderer(null,null);mode=l(this.getInitialMode());customColor=l(o(this.platformId)&&localStorage.getItem("custom-color")||"#6750A4");constructor(){n(()=>{let t=this.mode(),r=this.customColor();o(this.platformId)&&(localStorage.setItem("theme-mode",t),localStorage.setItem("custom-color",r),this.applyTheme(t,r))})}getInitialMode(){return o(this.platformId)&&localStorage.getItem("theme-mode")||"system"}applyTheme(t,r){if(!o(this.platformId))return;let e=document.documentElement,a=t==="dark";t==="system"&&(a=window.matchMedia("(prefers-color-scheme: dark)").matches),a?this.renderer.addClass(e,"dark-mode"):this.renderer.removeClass(e,"dark-mode"),this.renderer.setProperty(e.style,"color-scheme",a?"dark":"light"),t==="custom"?(e.style.setProperty("--mat-sys-primary",r),e.style.setProperty("--mat-sys-on-primary","#ffffff"),e.style.setProperty("--mat-sys-primary-container",`${r}33`)):(e.style.removeProperty("--mat-sys-primary"),e.style.removeProperty("--mat-sys-on-primary"),e.style.removeProperty("--mat-sys-primary-container"))}static \u0275fac=function(r){return new(r||s)};static \u0275prov=i({token:s,factory:s.\u0275fac,providedIn:"root"})};export{y as a};
