import{r as s,c as t,h as i,H as a}from"./p-ec7718e6.js";import"./p-2d511d0e.js";import"./p-d66fb38c.js";import"./p-e249790d.js";import"./p-552063c3.js";import"./p-9c626387.js";import"./p-25c0eb4f.js";import"./p-551d2360.js";import"./p-6279360b.js";import"./p-a8682d9e.js";import"./p-d343a062.js";import"./p-3df73e7b.js";import{c as e,I as o,M as p,C as r,a as n}from"./p-c637c3d6.js";import{g as c,m}from"./p-a5d71685.js";const d=class{constructor(i){s(this,i),this.acceptApplication=t(this,"acceptApplication",7),this.isProgressing=!1,this.isInvitationSent=!1,this.onInviteClick=async()=>{const{context:{organisationId:s},headers:t}=c(),{role:i,firstName:a,lastName:d,email:h,language:l}=this.item;this.isProgressing=!0;const j=e(m,t),g=await j.importUser(s,i,{email:h,firstName:a,lastName:d,metadata:{}}).catch((s=>{this.error=s,this.isProgressing=!1}));g&&await j.createInvitation(new o({accountType:i,firstName:a,invitee:new p(g._id,r.Users),issuedFor:h,language:l,lastName:d,organisation:new p(s,r.Organisations),skills:[],status:n.Pending})).catch((s=>{this.error=s,this.isProgressing=!1}))&&(this.isInvitationSent=!0,this.isProgressing=!1,this.acceptApplication.emit())}}render(){const s="invited"===this.item.applicationStatus||this.isInvitationSent;return i(a,{class:"d-block"},i("dvn-button",{leaned:!0,scale:"small",tagMode:s,tint:s?"secondary":"primary",view:s?"ghost":"solid",onClick:this.onInviteClick,progressing:this.isProgressing,disabled:this.isProgressing},s?"Invited":"Accept & Invite"))}};export{d as mentornity_accept_application_button}