import{Bf as P,C as s,D as c,De as f,E as h,Z as A,ba as u,ih as L,j as p,nd as w,nh as I,qd as E}from"./chunk-EKZJWO2J.js";import{i as d}from"./chunk-BODC7FZN.js";var l=class l{authHttp=u(E);restService=u(I);restExtractor=u(L);listSubscriptions(r){let{pagination:o,sort:t,search:a,state:i,actorType:n}=r,e=new w();return e=this.restService.addRestGetParams(e,o,t),a&&(e=e.append("search",a)),i&&(e=e.append("state",i)),n&&(e=e.append("actorType",n)),this.authHttp.get(l.BASE_APPLICATION_URL+"/following",{params:e}).pipe(s(m=>this.restExtractor.handleError(m)));}listFollowers(r){let{pagination:o,sort:t,search:a,state:i,actorType:n}=r,e=new w();return e=this.restService.addRestGetParams(e,o,t),a&&(e=e.append("search",a)),i&&(e=e.append("state",i)),n&&(e=e.append("actorType",n)),this.authHttp.get(l.BASE_APPLICATION_URL+"/followers",{params:e}).pipe(s(m=>this.restExtractor.handleError(m)));}follow(r){let o={handles:r.filter(t=>t.includes("@")),hosts:r.filter(t=>!t.includes("@"))};return this.authHttp.post(l.BASE_APPLICATION_URL+"/following",o).pipe(s(t=>this.restExtractor.handleError(t)));}unfollow(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.following.name+"@"+t.following.host;return this.authHttp.delete(l.BASE_APPLICATION_URL+"/following/"+a);}),c(),s(t=>this.restExtractor.handleError(t)));}acceptFollower(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${l.BASE_APPLICATION_URL}/followers/${a}/accept`,{});}),c(),s(t=>this.restExtractor.handleError(t)));}rejectFollower(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${l.BASE_APPLICATION_URL}/followers/${a}/reject`,{});}),c(),s(t=>this.restExtractor.handleError(t)));}removeFollower(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.delete(`${l.BASE_APPLICATION_URL}/followers/${a}`);}),c(),s(t=>this.restExtractor.handleError(t)));}buildFollowsListFilters(){return[{type:"options",key:"state",title:"Follow state",options:[{value:"all",label:"All follows"},{value:"accepted",label:"Seguiments acceptats"},{value:"rejected",label:"Seguiments rebutjats"},{value:"pending",label:"Seguiments pendents"}]}];}};d(l,"BASE_APPLICATION_URL",P.apiUrl+"/api/v1/server"),d(l,"\u0275fac",function(o){return new(o||l)();}),d(l,"\u0275prov",A({token:l,factory:l.ɵfac}));var R=l;export{R as a};/**i18n:e079feaac094a2c754af8c2d9f82a9400e546e6b8cdd8ff7d538e47a33fc4649*///# sourceMappingURL=chunk-XYEO36EG.js.map