import{r as t,c as s,h as i,H as a}from"./p-a0569a5f.js";import"./p-e476a838.js";import"./p-944da115.js";import"./p-d343a062.js";import{c as e,I as p,M as r,C as o,a as m}from"./p-2cf91d8b.js";import{m as n}from"./p-d4bb09bf.js";import{g as c}from"./p-6fb74cfc.js";import"./p-eebad85b.js";import"./p-8fd375f7.js";import"./p-8e1b37ed.js";import"./p-429e49d9.js";import"./p-b7a1e5c3.js";import"./p-3b35e507.js";import"./p-c67a5881.js";import"./p-cc3f853d.js";import"./p-40e6d149.js";import"./p-cd9003fd.js";import"./p-da9525c7.js";import"./p-7737f905.js";import"./p-9224a4e9.js";import"./p-d27cb594.js";import"./p-a4d551dd.js";import"./p-74e6e642.js";import"./p-1bea6126.js";import"./p-31309282.js";import"./p-814af281.js";import"./p-e929429b.js";let d=class{constructor(i){t(this,i),this.acceptApplication=s(this,"acceptApplication",7),this.isProgressing=!1,this.isInvitationSent=!1,this.onInviteClick=async()=>{const{context:{organisationId:t},headers:s}=c(),i=this.item,{role:a,firstName:d,lastName:l,email:j,language:f}=i,h=function(t,s){var i={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(i[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(a=Object.getOwnPropertySymbols(t);e<a.length;e++)s.indexOf(a[e])<0&&Object.prototype.propertyIsEnumerable.call(t,a[e])&&(i[a[e]]=t[a[e]])}return i}(i,["role","firstName","lastName","email","language","_id","applicationStatus","createdAt"]);this.isProgressing=!0;const b=e(n,s),g=await b.importUser(t,a,{email:j,firstName:d,lastName:l,metadata:{data:h}}).catch((t=>{this.error=t,this.isProgressing=!1}));g&&await b.createInvitation(new p({accountType:a,firstName:d,invitee:new r(g._id,o.Users),issuedFor:j,language:f,lastName:l,organisation:new r(t,o.Organisations),skills:[],status:m.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 i(a,{class:"d-flex align-items-center",style:{height:"30px"}},i("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}