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-9424fd5c.system.js","./p-5f835359.system.js","./p-fa32c614.system.js","./p-04a8d136.system.js","./p-dfb1d72b.system.js","./p-1b089731.system.js","./p-c23ad828.system.js","./p-3b429006.system.js","./p-f386a539.system.js","./p-d747c434.system.js","./p-2975a410.system.js","./p-a0c1f16a.system.js","./p-805e81fb.system.js","./p-0bbf3c73.system.js","./p-da593370.system.js","./p-2957c5d8.system.js"],(function(e){"use strict";var t,i,a,r,n,s,o,m,d,l,u,f,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;n=e.M},function(e){s=e.V},function(e){o=e.T},function(e){m=e.A},function(e){d=e.c;l=e.d},function(e){u=e.c;f=e.s;p=e.a},function(e){c=e.c},function(e){b=e.a},function(e){y=e.N},function(){},function(){},function(){},function(e){v=e.g;h=e.m}],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 w={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 j=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=v().headers;this.api=d(h,a)}e.prototype.onSubmit=function(e){var t=this;var i=e.detail.values;var a=i.firstName,r=i.lastName,n=i.bio,s=i.skills,o=i.title,m=i.subscriptionLimit,d=j(i,["firstName","lastName","bio","skills","title","subscriptionLimit"]);var l={firstName:a,lastName:r,bio:n,skills:s,title:o};var u={subscriptionLimit:parseInt(m)};var f=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:f}))}if(t.userMentorship&&m!==undefined){a.push(t.api.update("mentorships",t.userMentorship._id,u))}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 n={firstName:i.firstName,lastName:i.lastName,bio:i.bio,title:i.title,skills:i.skills};var s=e.role;var o=s==="mentor"?t.metadatas.mentorsCanEditMetadata:t.metadatas.menteesCanEditMetadata;if(o){var m=((s==="mentor"?t.metadatas.mentor:t.metadatas.mentee)||[]).map(u);m.forEach((function(e){n[e.id]=a.data[e.id]}))}if(r){n.subscriptionLimit=r.subscriptionLimit}return n}function g(e,t,i,a,n,s,d){var l;if(!i){return null}var u=t==="tr"?w:_;var f=e.role;var p=F(u,f,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=f==="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(n,y?s:undefined,d),ui:{fields:b,i18n:u.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 s(2,32)).addInterceptor("onSubmit",new n).require(),new a("lastName",e.formFields.lastName).addInterceptor("onSubmit",new s(2,32)).addInterceptor("onSubmit",new n).require()],[new a("title",e.formFields.title).addInterceptor("onSubmit",new n),new a("bio",e.formFields.bio).setLines(3).setLinesMax(10),t({id:"skills",title:e.formFields.skills,type:"multiple-choice",inputType:"select",options:f.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(u)}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}}}}));