import{r as t,c as s,h as a,H as i}from"./p-cb5076d4.js";import"./p-06588791.js";import"./p-944da115.js";import"./p-d343a062.js";import{c as e,I as o,M as p,C as r,a as c}from"./p-c4bbdd1e.js";import{g as n,m}from"./p-3a5f9c0f.js";import"./p-eebad85b.js";import"./p-0e4ae084.js";import"./p-8a308033.js";import"./p-0db2169b.js";import"./p-3b35e507.js";import"./p-1c5c6afa.js";import"./p-97c18602.js";import"./p-ecbaf6d8.js";import"./p-d50d0ec8.js";import"./p-c705c477.js";import"./p-4f99fb23.js";import"./p-d27cb594.js";import"./p-56d4255d.js";import"./p-73aa5f56.js";import"./p-138d8bf9.js";import"./p-814af281.js";import"./p-e929429b.js";const d=class{constructor(a){t(this,a),this.acceptApplication=s(this,"acceptApplication",7),this.isProgressing=!1,this.isInvitationSent=!1,this.onInviteClick=async()=>{const{context:{organisationId:t},headers:s}=n(),a=this.item,{role:i,firstName:d,lastName:l,email:j,language:f}=a,h=function(t,s){var a={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&s.indexOf(i)<0&&(a[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(i=Object.getOwnPropertySymbols(t);e<i.length;e++)s.indexOf(i[e])<0&&Object.prototype.propertyIsEnumerable.call(t,i[e])&&(a[i[e]]=t[i[e]])}return a}(a,["role","firstName","lastName","email","language","_id","applicationStatus","createdAt"]);this.isProgressing=!0;const b=e(m,s),u=await b.importUser(t,i,{email:j,firstName:d,lastName:l,metadata:{data:h}}).catch((t=>{this.error=t,this.isProgressing=!1}));u&&await b.createInvitation(new o({accountType:i,firstName:d,invitee:new p(u._id,r.Users),issuedFor:j,language:f,lastName:l,organisation:new p(t,r.Organisations),skills:[],status:c.Pending})).catch((t=>{this.error=t,this.isProgressing=!1}))&&(this.isInvitationSent=!0,this.isProgressing=!1,this.acceptApplication.emit())}}render(){const t="invited"===this.item.applicationStatus||this.isInvitationSent;return a(i,{class:"d-block"},a("dvn-button",{leaned:!0,scale:"small",tagMode:t,tint:t?"secondary":"primary",view:t?"ghost":"solid",onClick:this.onInviteClick,progressing:this.isProgressing,disabled:this.isProgressing},t?"Invited":"Accept & Invite"))}};export{d as mentornity_accept_application_button}