import{i as m,j as A}from"./chunk-AAP4EWOX.js";import{P as v,Q as k,c as p,e as j}from"./chunk-FYLDFXYJ.js";import{Gd as d,O as n,T as a,ha as u,ka as h,ma as I,na as U,q as o,r as i,sa as f,x as c,xa as s}from"./chunk-JSJB5BKT.js";import{e as l}from"./chunk-SZAW6ZBW.js";var F,g=l(()=>{I();U();d();j();k();A();F=(()=>{class t{constructor(e,r,S){this.oauthService=e,this.currentUserService=r,this.authService=S}canActivate(e,r){if(this.oauthService.hasValidAccessToken())return this.ensureUserIsInit();if(this.oauthService.getAccessToken())return o(this.oauthService.refreshToken()).pipe(n(()=>(this.authService.logout(),i(!1))),u(()=>this.ensureUserIsInit()));this.oauthService.initCodeFlow()}ensureUserIsInit(){return this.currentUserService.currentUserSnapshot?i(!0):this.currentUserService.init().pipe(a(1),h(e=>{if(!e)return this.authService.logout(),i(!1)}),c(e=>e))}static{this.\u0275fac=function(r){return new(r||t)(s(p),s(v),s(m))}}static{this.\u0275prov=f({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})()});export{F as a,g as b};
