import{$ as u,B as i,C as h,D as f,Jc as w,Nc as E,Td as d,Xf as L,Y as A,bf as P,bg as g,i as p}from"./chunk-QXV2GR6R.js";import{i as l}from"./chunk-JJ4RDTEF.js";var s=class s{constructor(e,o,t){l(this,"authHttp");l(this,"restService");l(this,"restExtractor");this.authHttp=e,this.restService=o,this.restExtractor=t;}getFollowing(e){let{pagination:o,sort:t,search:a,state:n,actorType:c}=e,r=new w();return r=this.restService.addRestGetParams(r,o,t),a&&(r=this.restService.addObjectParams(r,this.parseFollowsListFilters(a))),n&&(r=r.append("state",n)),c&&(r=r.append("actorType",c)),this.authHttp.get(s.BASE_APPLICATION_URL+"/following",{params:r}).pipe(i(m=>this.restExtractor.handleError(m)));}getFollowers(e){let{pagination:o,sort:t,search:a,state:n,actorType:c}=e,r=new w();return r=this.restService.addRestGetParams(r,o,t),a&&(r=this.restService.addObjectParams(r,this.parseFollowsListFilters(a))),n&&(r=r.append("state",n)),c&&(r=r.append("actorType",c)),this.authHttp.get(s.BASE_APPLICATION_URL+"/followers",{params:r}).pipe(i(m=>this.restExtractor.handleError(m)));}follow(e){let o={handles:e.filter(t=>t.includes("@")),hosts:e.filter(t=>!t.includes("@"))};return this.authHttp.post(s.BASE_APPLICATION_URL+"/following",o).pipe(i(t=>this.restExtractor.handleError(t)));}unfollow(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.following.name+"@"+t.following.host;return this.authHttp.delete(s.BASE_APPLICATION_URL+"/following/"+a);}),h(),i(t=>this.restExtractor.handleError(t)));}acceptFollower(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/accept`,{});}),h(),i(t=>this.restExtractor.handleError(t)));}rejectFollower(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/reject`,{});}),h(),i(t=>this.restExtractor.handleError(t)));}removeFollower(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.delete(`${s.BASE_APPLICATION_URL}/followers/${a}`);}),h(),i(t=>this.restExtractor.handleError(t)));}buildFollowsListFilters(){return[{title:"\u03A0\u03C1\u03BF\u03B7\u03B3\u03BC\u03AD\u03BD\u03B1 \u03C6\u03AF\u03BB\u03C4\u03C1\u03B1",children:[{value:"state:accepted",label:"Accepted follows"},{value:"state:rejected",label:"Rejected follows"},{value:"state:pending",label:"Pending follows"}]}];}parseFollowsListFilters(e){return this.restService.parseQueryStringFilter(e,{state:{prefix:"state:"}});}};l(s,"BASE_APPLICATION_URL",P.apiUrl+"/api/v1/server"),l(s,"\u0275fac",function(o){return new(o||s)(u(E),u(g),u(L));}),l(s,"\u0275prov",A({token:s,factory:s.ɵfac}));var I=s;export{I as a};/**i18n:224bcada6943fe8b17ea60808c2d370cec9507c3bd670ebe71692d099a3befa1*///# sourceMappingURL=chunk-GTGWJ4QE.js.map