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-e78d5616.js";import"./p-3968aca6.js";import"./p-d343a062.js";import{c as e,I as o,M as r,C as m,a as c}from"./p-a3d5ad34.js";import{s as n,M as j,m as l,g as h,a as d}from"./p-f88474bf.js";import"./p-105f7627.js";import"./p-62d6b6a7.js";import"./p-0563ceba.js";import"./p-1e47e7bd.js";import"./p-31e77e7b.js";import"./p-825ab276.js";import"./p-6c8be41c.js";import"./p-9f31253b.js";import"./p-1187cc7c.js";import"./p-881a2bb8.js";import"./p-968ee2ec.js";import"./p-3c7a3a90.js";import"./p-7737f905.js";import"./p-0ff0ee91.js";import"./p-d27cb594.js";import"./p-902ec37a.js";import"./p-74e6e642.js";import"./p-84876749.js";import"./p-03b520ca.js";import"./p-814af281.js";import"./p-e929429b.js";import"./p-2c9430cc.js";import"./p-5209de98.js";import"./p-19efc983.js";import"./p-e7d62c6a.js";import"./p-67d3bdb0.js";import"./p-1ba76ce7.js";import"./p-0988b316.js";import"./p-65eb3f89.js";import"./p-42939000.js";const f=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(n);this.strings=await t.getContent(j,l)},this.onInviteClick=async()=>{const{context:{organisationId:t},headers:s}=h(),i=this.item,{role:a,firstName:p,lastName:n,email:j,language:l}=i,f=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=e(d,s),g=await b.importUser(t,a,{email:j,firstName:p,lastName:n,metadata:{data:f}}).catch((t=>{this.error=t,this.isProgressing=!1}));g&&await b.createInvitation(new o({accountType:a,firstName:p,invitee:new r(g._id,m.Users),issuedFor:j,language:l,lastName:n,organisation:new r(t,m.Organisations),skills:[],status:c.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{f as mentornity_accept_application_button}