import{P as j,Q as S}from"./chunk-JE2X3YFA.js";import{s as g,t as v}from"./chunk-GDJMZZ4C.js";import{g as f,h as O}from"./chunk-V3J5YJ3L.js";import{b as o,c as p}from"./chunk-YTY7HHO3.js";import{O as a,Rd as d,g as n,ka as h,ma as m,na as b,r as s,sa as u,xa as r}from"./chunk-4HFZZ7HS.js";import{e as l}from"./chunk-SZAW6ZBW.js";var E,U=l(()=>{v();m();b();d();p();O();S();E=(()=>{class i extends g{constructor(e,t,c){super(e,t),this.currentUserService=c,this.cachingObject={subject:new n,items:null,isPending:!1,userId:null}}get items(){return this.cachingObject.items}notifyCaching(e){this.isSameUser()?(this.cachingObject.isPending=!1,this.cachingObject.subject.next(e),this.cachingObject.items=[...e]):this.invalidateCache()}invalidateCache(){this.cachingObject.items=null,this.cachingObject.isPending=!1,this.cachingObject.userId=null}getCache(e=!1,t){return(e||!this.isSameUser())&&this.invalidateCache(),this.cachingObject.items?s([...this.cachingObject.items]):this.cachingObject.isPending?this.cachingObject.subject:(this.cachingObject.userId=this.currentUserService.currentUserId,this.cachingObject.isPending=!0,t.pipe(h(c=>this.notifyCaching(c||[])),a(()=>(this.invalidateCache(),s(null)))))}isSameUser(){return!this.currentUserService.currentUserSnapshot||!this.currentUserService.currentUserId?!1:this.cachingObject.userId&&this.cachingObject.userId===this.currentUserService.currentUserId}static{this.\u0275fac=function(t){return new(t||i)(r(o),r(f),r(j))}}static{this.\u0275prov=u({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})()});export{E as a,U as b};
