import{r as t,c as s,h as i,H as a}from"./p-9f21f85f.js";import{S as p}from"./p-c2c9e896.js";import"./p-25d382ec.js";import"./p-3968aca6.js";import"./p-d343a062.js";import{g as e,c as o,I as r,M as c,C as m,a as n,m as j}from"./p-c44f96b9.js";import{s as f,M as l,m as d}from"./p-cb585cde.js";import"./p-105f7627.js";import"./p-6a6f355f.js";import"./p-aa5ffe14.js";import"./p-293acc32.js";import"./p-f2965a61.js";import"./p-0563ceba.js";import"./p-1e47e7bd.js";import"./p-31e77e7b.js";import"./p-825ab276.js";import"./p-6c8be41c.js";import"./p-1187cc7c.js";import"./p-881a2bb8.js";import"./p-968ee2ec.js";import"./p-d27cb594.js";import"./p-9c82afa0.js";import"./p-d6c479ab.js";import"./p-10cfccbb.js";import"./p-8d2ddf16.js";import"./p-814af281.js";import"./p-e929429b.js";import"./p-905285ef.js";import"./p-a86d8cf2.js";import"./p-3ccedaa0.js";import"./p-9aa2fafd.js";import"./p-0988b316.js";import"./p-65eb3f89.js";import"./p-42939000.js";import"./p-3d141e05.js";import"./p-d59ffc5b.js";const h=class{constructor(i){t(this,i),this.acceptApplication=s(this,"acceptApplication",7),this.isProgressing=!1,this.isInvitationSent=!1,this.setDictionaryLanguage=async()=>{const t=(new p).setLanguage(this.item.language).setContents(f);this.strings=await t.getContent(l,d)},this.onInviteClick=async()=>{const{context:{organisationId:t},headers:s}=e(),i=this.item,{role:a,firstName:p,lastName:f,email:l,language:d}=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 p=0;for(a=Object.getOwnPropertySymbols(t);p<a.length;p++)s.indexOf(a[p])<0&&Object.prototype.propertyIsEnumerable.call(t,a[p])&&(i[a[p]]=t[a[p]])}return i}(i,["role","firstName","lastName","email","language","_id","applicationStatus","createdAt"]);this.isProgressing=!0;const b=o(j,s),g=await b.importUser(t,a,{email:l,firstName:p,lastName:f,metadata:{data:h}}).catch((t=>{this.error=t,this.isProgressing=!1}));g&&await b.createInvitation(new r({accountType:a,firstName:p,invitee:new c(g._id,m.Users),issuedFor:l,language:d,lastName:f,organisation:new c(t,m.Organisations),skills:[],status:n.Pending})).catch((t=>{this.error=t,this.isProgressing=!1}))&&(this.isInvitationSent=!0,this.isProgressing=!1,this.acceptApplication.emit())}}componentWillLoad(){this.setDictionaryLanguage()}render(){const t="invited"===this.item.applicationStatus||this.isInvitationSent;if(this.strings)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?this.strings.invited:this.strings.acceptAndInvite))}};export{h as mentornity_accept_application_button}