import{D as l,E as U}from"./chunk-I7GW4F3B.js";import{a as g,b as S}from"./chunk-SM7EQ7ST.js";import{c as j,d as v}from"./chunk-RWCAFOHA.js";import{b,c as O}from"./chunk-YBNTOQCK.js";import{O as h,Sa as d,be as p,g as n,ka as u,na as f,r as a,ta as o,xa as r}from"./chunk-WL5U2YIT.js";import{e as m}from"./chunk-ADEKKGI2.js";var k,I=m(()=>{S();f();d();p();O();v();U();k=(()=>{let e=class e extends g{constructor(t,i,c){super(t,i),this.currentUserService=c,this.cachingObject={subject:new n,items:null,isPending:!1,userId:null}}get items(){return this.cachingObject.items}notifyCaching(t){this.isSameUser()?(this.cachingObject.isPending=!1,this.cachingObject.items=[...t],this.cachingObject.subject.next(t),this.cachingObject.subject.complete()):this.invalidateCache()}invalidateCache(){this.cachingObject.items=null,this.cachingObject.isPending=!1,this.cachingObject.userId=null}getCache(t=!1,i){return(t||!this.isSameUser())&&this.invalidateCache(),this.cachingObject.items?a([...this.cachingObject.items]):this.cachingObject.isPending?this.cachingObject.subject:(this.cachingObject.userId=this.currentUserService.currentUserId,this.cachingObject.isPending=!0,this.cachingObject.subject=new n,i.pipe(u(c=>this.notifyCaching(c||[])),h(()=>{let c=this.cachingObject.subject;return this.invalidateCache(),c.complete(),a(null)})).subscribe(),this.cachingObject.subject)}isSameUser(){return!this.currentUserService.currentUserSnapshot||!this.currentUserService.currentUserId?!1:this.cachingObject.userId&&this.cachingObject.userId===this.currentUserService.currentUserId}};e.\u0275fac=function(i){return new(i||e)(r(b),r(j),r(l))},e.\u0275prov=o({token:e,factory:e.\u0275fac,providedIn:"root"});let s=e;return s})()});export{k as a,I as b};
