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