import{h}from"./chunk-LZAJN7X2.js";import{h as u}from"./chunk-HQJI5M5I.js";import{a as l}from"./chunk-PTMJTNEU.js";import{$ as c,C as a,U as p,ea as r,h as o,m as s,y as n}from"./chunk-PCDQIHDN.js";var C=(()=>{let t=class t{constructor(){this.httpClient=r(u),this.authService=r(h),this.serviceEndpoint=`${l.endpoints.api}/update`,this.pollCycle=6e5,this.updateAvailabilitySubject=new o(1),this.updateAvailability=this.updateAvailabilitySubject.asObservable(),this.authService.loginStateChanged.subscribe(i=>{i?this.startUpdateMonitoring():this.stopUpdateMonitoring()})}startUpdateMonitoring(){this.updateSubscription=n(0,this.pollCycle).pipe(p(()=>this.httpClient.get(`${this.serviceEndpoint}/getversion`).pipe(a(i=>(console.warn("Failed to query update-info",i),s(null)))))).subscribe(i=>this.updateAvailabilitySubject.next(i))}stopUpdateMonitoring(){this.updateSubscription&&this.updateSubscription.unsubscribe()}};t.\u0275fac=function(b){return new(b||t)},t.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"});let e=t;return e})();export{C as a};
