System.register(["./p-5b6828db.system.js","./p-a0c1f16a.system.js","./p-805e81fb.system.js","./p-0bbf3c73.system.js","./p-da593370.system.js","./p-3b429006.system.js","./p-2957c5d8.system.js","./p-58f2f536.system.js","./p-9424fd5c.system.js","./p-f1345828.system.js","./p-fa32c614.system.js","./p-ac291838.system.js","./p-b42ad17a.system.js","./p-5f835359.system.js","./p-9cd38fce.system.js","./p-23628d1c.system.js","./p-62034033.system.js","./p-1b089731.system.js","./p-90b7d919.system.js","./p-2db4f08c.system.js","./p-c67a319b.system.js","./p-cae65cfa.system.js","./p-fe1f76a3.system.js","./p-66d9c61b.system.js"],(function(s){"use strict";var t,n,i,e,o,r,c,f;return{setters:[function(s){t=s.r;n=s.c;i=s.h;e=s.H},function(s){o=s.I},function(){},function(){},function(){},function(s){r=s.c},function(s){c=s.g;f=s.m},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){var a=s("mentornity_follow_button",function(){function s(s){var i=this;t(this,s);this.action=n(this,"action",7);this.invalidation=n(this,"invalidation",7);this.isProgressing=false;this.toggleFollowStatus=function(){var s=i.item.subscription;var t=(s===null||s===void 0?void 0:s.isFollowing)||false;i.isProgressing=true;if(s){r(f,c().headers).followUnfollowSubscription(s._id,t?"unfollow":"follow").then((function(){i.invalidation.emit(new o("mentornity-follow-button","mentornity-user-detail-page"))})).finally((function(){return i.isProgressing=false}))}else{var n=i.data.mentornityCookieContext,e=n.groupId,a=n.userId;var u=!!e;var l=i.item.mentorship;var p=l.organisation;r(f,c().headers).createSubscription({organisation:{_type:"reference",_class:"organisations",_id:p._id},subscribed:{_type:"reference",_class:"users",_id:a},subscriber:{_type:"reference",_class:u?"groups":"users",_id:u?e:a},createdBy:{_type:"reference",_class:"users",_id:a},mentorship:{_type:"reference",_class:"mentorships",_id:l._id},status:"active",isFollowing:true}).then((function(){i.invalidation.emit(new o("mentornity-follow-button","mentornity-user-detail-page"))})).finally((function(){return i.isProgressing=false}))}}}s.prototype.render=function(){var s;var t=((s=this.item.subscription)===null||s===void 0?void 0:s.isFollowing)||false;return i(e,{class:"d-flex"},i("dvn-button",{disabled:this.isProgressing,onClick:this.toggleFollowStatus,tint:"primary",view:"flat"},t?"Unfollow":"Follow"))};return s}())}}}));