import{a as d}from"./chunk-PQ5Q7HJL.js";import{j as p}from"./chunk-72CHOCZD.js";import{S as c,X as n,p as l}from"./chunk-56X5LYJH.js";var u=class s{constructor(r,a){this.http=r;this.translate=a;this.translate.onLangChange.subscribe(e=>{let i=e.lang,o=Array.from(this.loadedFeatures).map(t=>t.split("_")[0]);this.loadedFeatures.clear(),o.forEach(t=>this.loadFeature(t,!0))})}loadedFeatures=new Set;loadFeature(r,a=!1){let e=this.translate.currentLang||"en",i=`${r}_${e}`;if(!a&&this.loadedFeatures.has(i))return Promise.resolve();let o=`assets/i18n/${r}/${e}.json`;return l(this.http.get(o)).then(t=>{this.translate.setTranslation(e,t,!0),this.loadedFeatures.add(i),this.translate.use(e)}).catch(t=>{throw console.error(`Failed to load translation feature: ${r}`,t),t})}static \u0275fac=function(a){return new(a||s)(n(p),n(d))};static \u0275prov=c({token:s,factory:s.\u0275fac,providedIn:"root"})};export{u as a};
