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-L6W7X4TF.js";import{i as d}from"./chunk-WH5WJFMZ.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:"Accepted follows"},{value:"rejected",label:"Rejected follows"},{value:"pending",label:"Pending follows"}]}];}};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:ae7e6707fc51a9e1f6f015929aece8afe43a92a094f09f07f0463afe6c89573f*///# sourceMappingURL=chunk-K4GS4TJ6.js.map