import{i as S,j as g}from"./chunk-Q2CF2JQV.js";import{D as m,E as A,c as v,e as d}from"./chunk-I7GW4F3B.js";import{O as a,Sa as j,T as h,be as k,ha as u,ka as f,na as U,q as c,r as i,ta as p,x as n,xa as s}from"./chunk-WL5U2YIT.js";import{e as I}from"./chunk-ADEKKGI2.js";var E,w=I(()=>{U();j();k();d();A();g();E=(()=>{let e=class e{constructor(t,r,l){this.oauthService=t,this.currentUserService=r,this.authService=l}canActivate(t,r){if(this.oauthService.hasValidAccessToken())return this.ensureUserIsInit();if(this.oauthService.getAccessToken())return c(this.oauthService.refreshToken()).pipe(a(()=>(this.authService.logout(),i(!1))),u(()=>this.ensureUserIsInit()));this.oauthService.initCodeFlow()}ensureUserIsInit(){return this.currentUserService.currentUserSnapshot?i(!0):this.currentUserService.init().pipe(h(1),f(t=>{if(!t)return this.authService.logout(),i(!1)}),n(t=>t))}};e.\u0275fac=function(r){return new(r||e)(s(v),s(m),s(S))},e.\u0275prov=p({token:e,factory:e.\u0275fac,providedIn:"root"});let o=e;return o})()});export{E as a,w as b};
