var __extends=this&&this.__extends||function(){var e=function(r,t){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t))e[t]=r[t]};return e(r,t)};return function(r,t){if(typeof t!=="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");e(r,t);function n(){this.constructor=r}r.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();import{D as DataModel}from"./data-model-88af49fc.js";import{T as TableConfig,d as decodeFields,S as Space}from"./table-config-d73a72ab.js";import{c as capitalize}from"./string-3065a411.js";import{U as User}from"./User-72c4643a.js";var MembershipConfig=function(e){__extends(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.decode=function(e){var t=Object.assign(Object.create(r.prototype),e);t.fields=decodeFields(t.fields);t.space=Space.decode(t.space);return t};r.prototype.roleNameCapital=function(){return capitalize(this.roleName)};return r}(TableConfig);var isMembershipActive=function(e){return e.status==="active"};var doesMembershipNeedAgreementConsent=function(e){var r=e.config.agreements||[];var t=e.consents||[];return r.filter((function(e){return!t.some((function(r){return r.agreement._id===e._id}))})).length>0};var doesMembershipNeedDataCompletion=function(e){if(!e.config.enforceRequiredInfo){return false}var r=e.config.fields||[];for(var t=0;t<r.length;t++){var n=r[t];if(n.required&&!e[n.id]){return true}}return false};var Membership=function(e){__extends(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.decode=function(e){var t=Object.assign(Object.create(r.prototype),e);t.config=MembershipConfig.decode(t.config);t.user=t.user?User.decode(t.user):t.user;return t};r.prototype.requireDataCompletion=function(){if(!this.config.enforceRequiredInfo){return false}var e=this.config.fields||[];for(var r=0;r<e.length;r++){var t=e[r];if(t.required&&!this[t.id]){return true}}return false};return r}(DataModel);export{Membership as M,doesMembershipNeedDataCompletion as a,MembershipConfig as b,doesMembershipNeedAgreementConsent as d,isMembershipActive as i};