(function(){"use strict";u8.Crm.EmailMessage=function(i){$.extend(this,i);this._complement()};$.extend(u8.Crm.EmailMessage.prototype,{getRecipients:function(i){var e=[];if(this.recipients){var t=typeof i.isActive!="undefined";for(var s=0;s<this.recipients.length;s++){var n=this.recipients[s];if(t&&i&&n.isActive!==i.isActive){continue}if(i&&n.participationType!==i.participationType){continue}if(i&&i.emailAddress&&!n.emailAddress){continue}e.push(n)}}return e.length&&e||null},getRecipientEmailAddresses:function(i){var e=this.getRecipients(i),t=[];if(!e){return e}for(var s=0;s<e.length;s++){var n=e[s];if(n&&n.emailAddress){t.push(n.emailAddress)}}return t.length>0&&t||null},_complement:function(){this.from=i(this.from);if(this.recipients){this.recipients=this.recipients.map(i)}else{this.recipients=[]}if(!this.attachments){this.attachments=[]}}});function i(i){if(!i){i={}}else if(typeof i=="string"){i={emailAddress:i}}if(!i.__type){if(i.uid){i.__type="EmailRecordParticipant"}else if(i.repId){i.__type="EmailRepParticipant"}else{i.__type="EmailParticipantBase"}}if(!("isActive"in i)){i.isActive=true}if(!i.participationType){i.participationType="Required"}return i}})();