import{Ah as g,B as l,C as c,D as h,Y as A,Zc as w,aa as u,bd as E,i as p,le as f,vh as L,wg as P}from"./chunk-QIQJDAPQ.js";import{i as d}from"./chunk-3HGMGVFC.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:"\xCDtarlegar s\xEDur",children:[{value:"state:accepted",label:"Sam\xFEykktar fylgjendabei\xF0nir"},{value:"state:rejected",label:"Hafna\xF0ar fylgjendabei\xF0nir"},{value:"state:pending",label:"Fylgjendabei\xF0nir \xED bi\xF0"}]}];}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:d946b30bd8b2b104e368c275b91cb34bb911fa22291c946a5e8c8a6facd9306d*///# sourceMappingURL=chunk-FCZ32F7O.js.map