var __spreadArray=this&&this.__spreadArray||function(e,t){for(var i=0,a=t.length,r=e.length;i<a;i++,r++)e[r]=t[i];return e};System.register(["./p-8fde6e09.system.js","./p-a333270e.system.js","./p-637a7d5a.system.js","./p-118612f6.system.js","./p-dfb1d72b.system.js","./p-3bb22ffb.system.js","./p-5a06f6ce.system.js","./p-dbc597c0.system.js","./p-ff50522c.system.js","./p-d200c939.system.js","./p-2975a410.system.js","./p-a0c1f16a.system.js","./p-77e9a1cf.system.js","./p-0bbf3c73.system.js","./p-da593370.system.js","./p-8293eefa.system.js","./p-5ccc23db.system.js"],(function(e){"use strict";var t,i,a,r,s,n,o,m,d,l,f,u,p,c,b,y,v,h;return{setters:[function(e){t=e.g},function(e){i=e.N},function(e){a=e.T},function(e){r=e.F;s=e.M},function(e){n=e.V},function(e){o=e.T},function(e){m=e.A},function(e){d=e.c;l=e.f},function(e){f=e.a;u=e.s;p=e.b},function(e){c=e.c},function(e){b=e.a},function(e){y=e.N},function(){},function(){},function(){},function(e){v=e.m},function(e){h=e.g}],execute:function(){e({a:g,b:M,g:F});var _={formView:{fetchError:"Fetching data failed.",retry:"Retry",submit:"Update Info"},formFields:{bio:"Bio",firstName:"First name",lastName:"Last name",pairLimit:"Pair limit",skills:"Professional Expertise",title:"Title"}};var j={formView:{fetchError:"Veri alırken hata oluştu.",retry:"Tekrar Dene",submit:"Bilgileri Güncelle"},formFields:{bio:"Kısaca kendinizi tanıtın",firstName:"İsim",lastName:"Soyisim",pairLimit:"Eşleşme sınırı",skills:"Uzmanlık Alanlarınız",title:"Ünvan"}};var w=undefined&&undefined.__rest||function(e,t){var i={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0)i[a]=e[a];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++){if(t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r]))i[a[r]]=e[a[r]]}return i};var N=function(){function e(e,t,i){this.user=e;this.userMetadata=t;this.userMentorship=i;var a=h().headers;this.api=d(v,a)}e.prototype.onSubmit=function(e){var t=this;var i=e.detail.values;var a=i.firstName,r=i.lastName,s=i.bio,n=i.skills,o=i.title,m=i.subscriptionLimit,d=w(i,["firstName","lastName","bio","skills","title","subscriptionLimit"]);var l={firstName:a,lastName:r,bio:s,skills:n,title:o};var f={subscriptionLimit:parseInt(m)};var u=d;return new Promise((function(e,i){var a=[t.api.update("users",t.user._id,l)];if(t.userMetadata){a.push(t.api.update("metadatas",t.userMetadata._id,{data:u}))}if(t.userMentorship&&m!==undefined){a.push(t.api.update("mentorships",t.userMentorship._id,f))}Promise.all(a).then((function(){return e({events:[new y(b.congratulate("Info updated"))]})})).catch((function(){i(["Unexpected error"])}))}))};return e}();function M(e,t,i,a,r){var s={firstName:i.firstName,lastName:i.lastName,bio:i.bio,title:i.title,skills:i.skills};var n=e.role;var o=n==="mentor"?t.metadatas.mentorsCanEditMetadata:t.metadatas.menteesCanEditMetadata;if(o){var m=((n==="mentor"?t.metadatas.mentor:t.metadatas.mentee)||[]).map(f);m.forEach((function(e){s[e.id]=a.data[e.id]}))}if(r){s.subscriptionLimit=r.subscriptionLimit}return s}function g(e,t,i,a,s,n,d){var l;if(!i){return null}var f=t==="tr"?j:_;var u=e.role;var p=F(f,u,i);var b=((l=a===null||a===void 0?void 0:a.dvnAppViewConfig)===null||l===void 0?void 0:l.ui.fields)||c(p);var y=u==="mentor"?i.metadatas.mentorsCanEditMetadata:i.metadatas.menteesCanEditMetadata;return r.decode({_id:"update-membership-info-page",base:"mentornity",title:"My info",table:o.decode({name:"mentees",fields:p}),type:m.FormView,handler:new N(s,y?n:undefined,d),ui:{fields:b,i18n:f.formView}})}function F(e,r,o){var m=r==="mentor"?o.profileFieldVisibilities.mentor:o.profileFieldVisibilities.mentee;var d=__spreadArray([new a("firstName",e.formFields.firstName).addInterceptor("onSubmit",new n(2,32)).addInterceptor("onSubmit",new s).require(),new a("lastName",e.formFields.lastName).addInterceptor("onSubmit",new n(2,32)).addInterceptor("onSubmit",new s).require()],[new a("title",e.formFields.title).addInterceptor("onSubmit",new s),new a("bio",e.formFields.bio).setLines(3).setLinesMax(10),t({id:"skills",title:e.formFields.skills,type:"multiple-choice",inputType:"select",options:u.map((function(e){return{label:p[e],value:e}}))})].filter((function(e){return m[e.id]})));var c=r==="mentor"?o.metadatas.mentorsCanEditMetadata:o.metadatas.menteesCanEditMetadata;var b=[];if(c){b=((r==="mentor"?o.metadatas.mentor:o.metadatas.mentee)||[]).map(f)}var y=o.mentorMenteeSubscription===l.Restricted;var v=r==="mentor"&&y?__spreadArray(__spreadArray(__spreadArray([],d),[new i("subscriptionLimit",e.formFields.pairLimit)]),b):__spreadArray(__spreadArray([],d),b);return v}}}}));