import{C as i,D as p,E as h,Kc as w,Oc as E,Rf as L,Td as f,Xf as g,Ye as P,Z as A,aa as u,i as c}from"./chunk-4JM6MIZ5.js";import{i as d}from"./chunk-QJQRWPYR.js";var s=class s{authHttp;restService;restExtractor;constructor(e,o,t){this.authHttp=e,this.restService=o,this.restExtractor=t;}getFollowing(e){let{pagination:o,sort:t,search:a,state:l,actorType:n}=e,r=new w();return r=this.restService.addRestGetParams(r,o,t),a&&(r=this.restService.addObjectParams(r,this.parseFollowsListFilters(a))),l&&(r=r.append("state",l)),n&&(r=r.append("actorType",n)),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:l,actorType:n}=e,r=new w();return r=this.restService.addRestGetParams(r,o,t),a&&(r=this.restService.addObjectParams(r,this.parseFollowsListFilters(a))),l&&(r=r.append("state",l)),n&&(r=r.append("actorType",n)),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=f(e);return c(o).pipe(h(t=>{let a=t.following.name+"@"+t.following.host;return this.authHttp.delete(s.BASE_APPLICATION_URL+"/following/"+a);}),p(),i(t=>this.restExtractor.handleError(t)));}acceptFollower(e){let o=f(e);return c(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/accept`,{});}),p(),i(t=>this.restExtractor.handleError(t)));}rejectFollower(e){let o=f(e);return c(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/reject`,{});}),p(),i(t=>this.restExtractor.handleError(t)));}removeFollower(e){let o=f(e);return c(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.delete(`${s.BASE_APPLICATION_URL}/followers/${a}`);}),p(),i(t=>this.restExtractor.handleError(t)));}buildFollowsListFilters(){return[{title:"\u0627\u0644\u062A\u0631\u0634\u064A\u062D \u0627\u0644\u0645\u062A\u0642\u062F\u0645",children:[{value:"state:accepted",label:"\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0627\u062A \u0627\u0644\u0645\u0642\u0628\u0648\u0644\u0629"},{value:"state:rejected",label:"\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0627\u062A \u0627\u0644\u0645\u0631\u0641\u0648\u0636\u0629"},{value:"state:pending",label:"\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0627\u062A \u0642\u064A\u062F \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631"}]}];}parseFollowsListFilters(e){return this.restService.parseQueryStringFilter(e,{state:{prefix:"state:"}});}};d(s,"BASE_APPLICATION_URL",P.apiUrl+"/api/v1/server"),d(s,"\u0275fac",function(o){return new(o||s)(u(E),u(g),u(L));}),d(s,"\u0275prov",A({token:s,factory:s.ɵfac}));var I=s;export{I as a};/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*///# sourceMappingURL=chunk-6V2GUMYE.js.map