import{B as l,C as c,D as h,Sc as w,Wc as E,Y as A,aa as u,be as f,i as p,jg as L,lf as P,pg as g}from"./chunk-XBTZE2EC.js";import{i as d}from"./chunk-WHYNGVB3.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:"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0439 \u0444\u0438\u043B\u044C\u0442\u0440",children:[{value:"state:accepted",label:"\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0443"},{value:"state:rejected",label:"\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0443"},{value:"state:pending",label:"\u0412 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u0438 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0438"}]}];}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:56bde403ffba090cdb11aaac0f86ffb9ae7c2bab95df4b44d5dba510264fcf4f*///# sourceMappingURL=chunk-CPBBYFI4.js.map