import{f as w}from"./chunk-VXSFLKKM.js";import{a as v}from"./chunk-KZKY3ROD.js";import{x as $,z as g}from"./chunk-ZTKV4AIV.js";import{b as S}from"./chunk-5JDCLYZA.js";import{h as y}from"./chunk-73IMXZSJ.js";import{E as p,G as l,K as c,aa as f,bb as i,cb as d,h as o,ha as U,m as h,na as m,p as u,u as r}from"./chunk-FWZCAEAJ.js";var n=class{constructor(t){this.id=t.id,this.name=`${t.firstname} ${t.surname}`,this.emailAddress=t.emailAddress,this.firstname=t.firstname,this.surname=t.surname,this.isAdmin=t.role==="ADMIN"}};var M=(()=>{let t=class t{constructor(){this.httpClient=m(y),this.authStatus$=m(w).status$,this.lumber=g("MyUserService"),this.manualUserChange=new o,this.myUserLoaded$=this.authStatus$.pipe(f(e=>e==="LOGGED_IN"?this.httpClient.get("/user/myself").pipe(r(a=>new n(a))):h)),this.myUserState=d({status:"UNSET",manualOverwritten:!1}),this.user=i(()=>this.myUserState().myUser),this.status=i(()=>this.myUserState().status),this.manualOverwritten=i(()=>this.myUserState().manualOverwritten),this.user$=S(this.user),v(this.myUserState,p(this.manualUserChange.pipe(r(e=>({myUser:e,manualOverwritten:!0}))),this.myUserLoaded$.pipe(r(e=>({myUser:e,status:"LOADED"})),c(()=>u({status:"UNSET"})))))}setUser(e){this.manualUserChange.next(e)}getUser$(){return this.user$.pipe(l($))}};t.\u0275fac=function(a){return new(a||t)},t.\u0275prov=U({token:t,factory:t.\u0275fac,providedIn:"root"});let s=t;return s})();export{M as a};
