var __spreadArray=this&&this.__spreadArray||function(e,i){for(var t=0,r=i.length,n=e.length;t<r;t++,n++)e[n]=i[t];return e};import"./index-ebde6a66.js";import{R as ReferenceField}from"./index-6a1cf9c1.js";import{T as TextField}from"./index-403e215e.js";import{c as convertMentornityFieldToDevingenField,l as legacyProfileFields}from"./mentorinty-bridge-api-946adc0d.js";import{a as AttachmentField}from"./attachment-32decf79.js";function convertFieldsToFieldReferences(e){return e.map((function(e){return{fieldId:e.id}}))}function getViewConfigForViewName(e,i){return e.find((function(e){return e.viewName===i}))}function getMembershipFields(e,i,t){return __spreadArray(__spreadArray(__spreadArray([],getAvailableLegacyProfileFields(e,i)),getAvailableMetadataFields(t,e)),[new ReferenceField("user","User","firstName","imageUrl","users",[new AttachmentField("imageUrl",""),new TextField("firstName","First Name")])])}function getUserDetailFields(e,i,t){return __spreadArray(__spreadArray([],getAvailableLegacyProfileFields(e,i)),getAvailableMetadataFields(t,e))}function getUserDetailViewFieldConfigs(e,i,t,r,n){var a;if(r){a=convertFieldsToFieldReferences(getUserDetailFields(e,i,t)).map((function(e){return Object.assign(Object.assign({},e),{lines:1,maxItems:3})}))}else{a=convertFieldsToFieldReferences(getUserDetailFields(e,i,t))}if(n){a=a.slice(0,n)}return a}function getAvailableLegacyProfileFields(e,i){var t=i==="mentor"?e.profileFieldVisibilities.mentor:e.profileFieldVisibilities.mentee;return legacyProfileFields.filter((function(e){return t[e.id]}))}function getAvailableMetadataFields(e,i){var t=i.metadataVisibility[e]!=="none";return(t?(e==="mentor"?i.metadatas.mentee:i.metadatas.mentor)||[]:[]).map((function(e){return convertMentornityFieldToDevingenField(e)}))}function getPairConfigOptionsFromOrganisationConfig(e){var i=e.subscriptionConfig;return{isMentorSelectionOn:i.mentorVisibilityStatus==="showAvailableMentors",canMentorEndSubscription:i.mentorsCanEndSubscription,pairLimitForMentees:e.subscriptionConfig.menteeSubscriptionLimit,selectionLimitForMentees:e.subscriptionConfig.menteeSelectionLimit}}export{getAvailableMetadataFields as a,getPairConfigOptionsFromOrganisationConfig as b,convertFieldsToFieldReferences as c,getMembershipFields as d,getUserDetailViewFieldConfigs as e,getAvailableLegacyProfileFields as f,getViewConfigForViewName as g};