(function(){window.CommunityMembershipService=function(c){const d=new b(c);this.getOwnMembershipOf=function(){return d.getMembershipOf(currentUser.id)};this.getMembers=function(){return d.getMembers()};this.join=function(){return d.join()};this.validateJoinRequest=function(e,f,g){return d.validateJoinRequest(e,f,g)};this.leave=function(e){return d.leave(e)}};const a=function(){this.type="CommunityMember";this.$onInit=function(){}};const b=function(e){const g=webContext+"/services/community/"+e.componentInstanceId+"/memberships";const d=RESTAdapter.get(g,a);const c=webContext+"/Rcommunity/"+e.componentInstanceId;const f=RESTAdapter.get(c,a);this.getMembershipOf=function(h){let targetedUser=h===currentUser.id?"me":h;return d.find({url:d.url+"/users/"+targetedUser})};this.getMembers=function(){let criteria=d.criteria({page:{number:1,size:1}});return d.find({url:d.url+"/members",criteria:criteria}).then(function(i){const h=i.memberships;h.realSize=i.realSize;return h})};this.join=function(){return f.post(f.url+"/members/join",{})};this.validateJoinRequest=function(h,i,j){const k=new FormData();k.set("accept",i);k.set("message",j);return f.post(f.url+"/members/join/validate/"+h.id,k)};this.leave=function(i){const h=new FormData();h.set("reason",i.reason);h.set("message",i.message);h.set("contactInFuture",i.contactInFuture);return f.post(f.url+"/members/leave",h)}};window.CommunityMembershipService.prototype.Constants={MembershipStatus:{COMMITTED:"COMMITTED",PENDING:"PENDING",REFUSED:"REFUSED",REMOVED:"REMOVED"}}})();