import{B as l,C as c,D as h,Fh as L,Kh as g,Y as A,aa as u,dd as w,hd as E,i as p,qf as P,ue as f}from"./chunk-R4Z6ZI3L.js";import{i as d}from"./chunk-P6NJDXIL.js";var s=class s{authHttp=u(E);restService=u(g);restExtractor=u(L);getFollowing(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=this.restService.addObjectParams(e,this.parseFollowsListFilters(a))),i&&(e=e.append("state",i)),n&&(e=e.append("actorType",n)),this.authHttp.get(s.BASE_APPLICATION_URL+"/following",{params:e}).pipe(l(m=>this.restExtractor.handleError(m)));}getFollowers(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=this.restService.addObjectParams(e,this.parseFollowsListFilters(a))),i&&(e=e.append("state",i)),n&&(e=e.append("actorType",n)),this.authHttp.get(s.BASE_APPLICATION_URL+"/followers",{params:e}).pipe(l(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(s.BASE_APPLICATION_URL+"/following",o).pipe(l(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(s.BASE_APPLICATION_URL+"/following/"+a);}),c(),l(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(`${s.BASE_APPLICATION_URL}/followers/${a}/accept`,{});}),c(),l(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(`${s.BASE_APPLICATION_URL}/followers/${a}/reject`,{});}),c(),l(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(`${s.BASE_APPLICATION_URL}/followers/${a}`);}),c(),l(t=>this.restExtractor.handleError(t)));}buildFollowsListFilters(){return[{title:"Imsizdigen leqqayen",children:[{value:"state:accepted",label:"Accepted follows"},{value:"state:rejected",label:"Rejected follows"},{value:"state:pending",label:"Pending follows"}]}];}parseFollowsListFilters(r){return this.restService.parseQueryStringFilter(r,{state:{prefix:"state:"}});}};d(s,"BASE_APPLICATION_URL",P.apiUrl+"/api/v1/server"),d(s,"\u0275fac",function(o){return new(o||s)();}),d(s,"\u0275prov",A({token:s,factory:s.ɵfac}));var I=s;export{I as a};/**i18n:138e9aba5923606215625ab5641fbdc103d8a34cfe13ae910386f40f27aea675*///# sourceMappingURL=chunk-2JYGWF65.js.map