import './polyfills.server.mjs';
import{c as f}from"./chunk-DJIE5ZIO.mjs";import{p as o}from"./chunk-UL5Q63VB.mjs";import{Ca as c,Yc as u,Z as l,ca as n,ib as p,va as i,ya as g}from"./chunk-IT3JGK4C.mjs";var y=class s{platformId=n(g);renderer=n(p).createRenderer(null,null);mode=i(this.getInitialMode());customColor=i(o(this.platformId)&&localStorage.getItem("custom-color")||"#6750A4");constructor(){c(()=>{let e=this.mode(),t=this.customColor();o(this.platformId)&&(localStorage.setItem("theme-mode",e),localStorage.setItem("custom-color",t),this.applyTheme(e,t))})}getInitialMode(){return o(this.platformId)&&localStorage.getItem("theme-mode")||"system"}applyTheme(e,t){if(!o(this.platformId))return;let a=document.documentElement,r=e==="dark";e==="system"&&(r=window.matchMedia("(prefers-color-scheme: dark)").matches),r?this.renderer.addClass(a,"dark-mode"):this.renderer.removeClass(a,"dark-mode"),this.renderer.setProperty(a.style,"color-scheme",r?"dark":"light"),e==="custom"?(a.style.setProperty("--mat-sys-primary",t),a.style.setProperty("--mat-sys-on-primary","#ffffff"),a.style.setProperty("--mat-sys-primary-container",`${t}33`)):(a.style.removeProperty("--mat-sys-primary"),a.style.removeProperty("--mat-sys-on-primary"),a.style.removeProperty("--mat-sys-primary-container"))}static \u0275fac=function(t){return new(t||s)};static \u0275prov=l({token:s,factory:s.\u0275fac,providedIn:"root"})};var h=class s{translocoService=n(f);platformId=n(g);request=n(u,{optional:!0});languages=[{code:"en",label:"toolbar.language.english",flagClass:"flag--us"},{code:"es",label:"toolbar.language.spanish",flagClass:"flag--es"},{code:"pt-BR",label:"toolbar.language.portuguese",flagClass:"flag--br"}];currentLanguage=i(this.getInitialLanguage());constructor(){c(()=>{let e=this.currentLanguage();this.translocoService.setActiveLang(e),o(this.platformId)&&(localStorage.setItem("app-language",e),document.cookie=`app-language=${e};path=/;max-age=31536000;SameSite=Lax`)})}setLanguage(e){this.currentLanguage.set(e)}getInitialLanguage(){if(!o(this.platformId)){let d=(this.request?.headers?.cookie||"").split("; ").find(m=>m.startsWith("app-language="))?.split("=")[1];return d&&this.languages.find(m=>m.code===d)?d:"en"}let e=document.cookie.split("; ").find(r=>r.startsWith("app-language="))?.split("=")[1];if(e&&this.languages.find(r=>r.code===e))return e;let t=localStorage.getItem("app-language");if(t&&this.languages.find(r=>r.code===t))return t;let a=navigator.language.split("-")[0];return a==="pt"?"pt-BR":this.languages.find(r=>r.code===a)?a:"en"}static \u0275fac=function(t){return new(t||s)};static \u0275prov=l({token:s,factory:s.\u0275fac,providedIn:"root"})};export{y as a,h as b};
