import {C,m,w as w$1,s,u,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 B,z=J(()=>{ND();fh();C();m();tS();ul();w();w$1();lp();B=(()=>{class o extends I4{constructor(e,t,r,f){super(e,t),this.subscriberFactoryService=r,this.assetServices=f;}get(e){return this.assetServices.GetSubscriber(e).pipe(hf(t=>this.handleGetApiResult(t)),ot(t=>this.returnWhenSuccessful(t,()=>this.normalizeSubscriber(t.data))))}getAll(){return this.assetServices.GetAllSubscribers().pipe(hf(e=>this.handleGetApiResult(e)),ot(e=>this.returnWhenSuccessful(e,()=>this.toViewModels(this.normalizeSubscribers(e.data)))))}save(e){if(e.type===s.Syslog){let t=this.getSyslogSubscriberSaveVersion(e);return this.assetServices.SaveSyslogSubscriber(t).pipe(hf(r=>this.handleSaveApiResult(r)),ot(r=>this.returnWhenSuccessful(r,()=>r.data)))}else return this.assetServices.SaveEmailSubscriber(e).pipe(hf(t=>this.handleSaveApiResult(t)),ot(t=>this.returnWhenSuccessful(t,()=>t.data)))}delete(e){return this.assetServices.DeleteSubscriber(e).pipe(hf(t=>this.handleDeleteApiResult(t)),ot(t=>this.isSuccessful(t)))}normalizeSubscriber(e){return this.subscriberFactoryService.toSubscriber(e)}normalizeSubscribers(e){return e.map(this.subscriberFactoryService.toSubscriber)}toViewModel(e){return G(F({},e),{subscriptions:e.subscriptions||[],groups:e.groups||[],subscriptionCount:(e.subscriptions||[]).length,groupCount:(e.groups||[]).length,type:e.type,typeDisplayValue:this.translatorService.translateEnum(s,e.type)})}toViewModels(e){return e.map(t=>this.toViewModel(t))}getSyslogSubscriberSaveVersion(e){let t=new u(e);return t.useDefaultSettings&&(t.hostname=null,t.port=null,t.protocol=null),t}static{this.\u0275fac=function(t){return new(t||o)(ye(Sr),ye(K),ye(L),ye(Dh))};}static{this.\u0275prov=ce({token:o,factory:o.\u0275fac,providedIn:"root"});}}return o})();});export{B,z};