import {w as w$1,L}from'./chunk-hFqCPJht.js';import {J,ec as ND,a5 as fh,c as tS,H as ul,b3 as w,ag as lp,ei as I4,aJ as hf,ah as ot,bK as G,bJ as F,aa as ye,N as Sr,bd as K,am as Dh,ad as ce}from'./main-WUGO6e7n.js';var u,A=J(()=>{u=class{constructor(o){this.subscriptionCount=0,this.subscriberCount=0,this.subscribers=[],this.subscriptions=[],o&&(this.id=o.id,this.name=o.name,this.subscribers=o.subscribers||[],this.subscriptions=o.subscriptions||[],this.subscriberCount=this.subscribers.length,this.subscriptionCount=this.subscriptions.length);}};});var O,x=J(()=>{ND();fh();A();tS();ul();w();w$1();lp();O=(()=>{class r extends I4{constructor(s,e,i,b){super(s,e),this.subscriberFactoryService=i,this.assetServices=b;}get(s){return this.assetServices.GetSubscriberGroup(s).pipe(hf(e=>this.handleGetApiResult(e)),ot(e=>this.returnWhenSuccessful(e,()=>this.normalizeSubscribersInGroup(e.data))))}getAll(){return this.assetServices.GetAllSubscriberGroups().pipe(hf(s=>this.handleGetApiResult(s)),ot(s=>this.returnWhenSuccessful(s,()=>this.normalizeSubscribersInGroups(s.data))))}getAllAsViewModel(){return this.getAll().pipe(ot(s=>s?this.toViewModels(this.normalizeSubscribersInGroups(s)):null))}save(s){let e=this.toSaveModel(s);return this.assetServices.SaveSubscriberGroup(e).pipe(hf(i=>this.handleSaveApiResult(i)),ot(i=>this.returnWhenSuccessful(i,()=>i.data)))}delete(s){return this.assetServices.DeleteSubscriberGroup(s).pipe(hf(e=>this.handleDeleteApiResult(e)),ot(e=>this.isSuccessful(e)))}normalizeSubscribersInGroup(s){return G(F({},s),{subscribers:this.subscriberFactoryService.toSubscribers(s.subscribers)})}normalizeSubscribersInGroups(s){return (s||[]).map(e=>this.normalizeSubscribersInGroup(e))}toViewModel(s){return new u(s)}toViewModels(s){return (s||[]).map(e=>this.toViewModel(e))}toSaveModel(s){let e=(i,b,G)=>G.indexOf(i)===b;return G(F({},s),{subscribers:[],subscriptions:[],subscriberIds:s.subscriberIds.filter(e).filter(i=>!!i)})}static{this.\u0275fac=function(e){return new(e||r)(ye(Sr),ye(K),ye(L),ye(Dh))};}static{this.\u0275prov=ce({token:r,factory:r.\u0275fac,providedIn:"root"});}}return r})();});export{O,x};