").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(g),e.viewModelDom=i,a.__dom=i,"Popups"===f&&(e.cancelCommand=e.closeCommand=Cb.createCommand(e,function(){Ib.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),Pb.popupVisibilityNames.push(this.viewModelName),Cb.delegateRun(this,"onFocus",[],500)):(Cb.delegateRun(this,"onHide"),this.restoreKeyScope(),Pb.popupVisibilityNames.remove(this.viewModelName),h.delay(function(){b.viewModelDom.hide()},300))},e)),Db.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),Cb.delegateRun(e,"onBuild",[i]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),Db.runHook("view-model-post-build",[a.__name,e,i])):Cb.log("Cannot find view model position: "+f)}return a?a.__vm:null},u.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},u.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Db.runHook("view-model-on-hide",[a.__name,a.__vm]))},u.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),Cb.delegateRun(a.__vm,"onShow",b||[]),Db.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},u.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Cb.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,Cb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Cb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Cb.delegateRun(c.oCurrentScreen,"onHide"),Cb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),Cb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Cb.delegateRun(c.oCurrentScreen,"onShow"),Db.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Cb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),Cb.delegateRun(a.__vm,"onShow"),Cb.delegateRun(a.__vm,"onFocus",[],200),Db.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},u.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),h.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),h.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),Db.runHook("screen-pre-start",[a.screenName(),a]),Cb.delegateRun(a,"onStart"),Db.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),h.delay(function(){Lb.removeClass("rl-started-trigger").addClass("rl-started")},50)},u.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=Cb.isUnd(c)?!1:!!c,(Cb.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},u.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},Ib=new u,v.newInstanceFromJson=function(a){var b=new v;return b.initByJson(a)?b:null},v.prototype.name="",v.prototype.email="",v.prototype.privateType=null,v.prototype.clear=function(){this.email="",this.name="",this.privateType=null},v.prototype.validate=function(){return""!==this.name||""!==this.email},v.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},v.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},v.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=Ab.EmailType.Facebook),null===this.privateType&&(this.privateType=Ab.EmailType.Default)),this.privateType},v.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},v.prototype.parse=function(a){this.clear(),a=Cb.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},v.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=Cb.trim(a.Name),this.email=Cb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},v.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Cb.isUnd(b)?!1:!!b,c=Cb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'
")+'" target="_blank" tabindex="-1">'+Cb.encodeHtml(this.name)+"":c?Cb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Cb.encodeHtml('"'+this.name+'" <')+'
")+'" target="_blank" tabindex="-1">'+Cb.encodeHtml(d)+""+Cb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Cb.encodeHtml(d))):b&&(d='
'+Cb.encodeHtml(this.email)+""))),d},v.prototype.mailsoParse=function(a){if(a=Cb.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m
0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=Cb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Cb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Cb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0
},v.prototype.inputoTagLine=function(){return 0+$/,""),b=!0),b},y.prototype.isImage=function(){return-1e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},A.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(Cb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=v.newInstanceFromJson(a[b]),d&&e.push(d);return e},A.replyHelper=function(a,b,c){if(a&&0d;d++)Cb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},A.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(Ab.MessagePriority.Normal),this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isRtl(!1),this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(Ab.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},A.prototype.computeSenderEmail=function(){var a=Pb.data().sentFolder(),b=Pb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},A.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.hash=a.Hash,this.requestHash=a.RequestHash,this.size(Cb.pInt(a.Size)),this.from=A.initEmailsFromJson(a.From),this.to=A.initEmailsFromJson(a.To),this.cc=A.initEmailsFromJson(a.Cc),this.bcc=A.initEmailsFromJson(a.Bcc),this.replyTo=A.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(Cb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(A.emailsToLine(this.from,!0)),this.toEmailsString(A.emailsToLine(this.to,!0)),this.parentUid(Cb.pInt(a.ParentThread)),this.threads(Cb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Cb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},A.prototype.initUpdateByMessageJson=function(a){var b=!1,c=Ab.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Cb.pInt(a.Priority),this.priority(-1b;b++)d=y.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},A.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return Cb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},A.prototype.messageId=function(){return this.sMessageId},A.prototype.inReplyTo=function(){return this.sInReplyTo},A.prototype.references=function(){return this.sReferences},A.prototype.fromAsSingleEmail=function(){return Cb.isArray(this.from)&&this.from[0]?this.from[0].email:""},A.prototype.viewLink=function(){return Pb.link().messageViewLink(this.requestHash)},A.prototype.downloadLink=function(){return Pb.link().messageDownloadLink(this.requestHash)},A.prototype.replyEmails=function(a){var b=[],c=Cb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,c,b),0===b.length&&A.replyHelper(this.from,c,b),b},A.prototype.replyAllEmails=function(a){var b=[],c=[],d=Cb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,d,b),0===b.length&&A.replyHelper(this.from,d,b),A.replyHelper(this.to,d,b),A.replyHelper(this.cc,d,c),[b,c]},A.prototype.textBodyToString=function(){return this.body?this.body.html():""},A.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0=0&&e&&!f&&d.attr("src",e)}),c&&a.setTimeout(function(){d.print()},100))})},A.prototype.printMessage=function(){this.viewPopupMessage(!0)},A.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},A.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.hash=a.hash,this.requestHash=a.requestHash,this.subject(a.subject()),this.size(a.size()),this.dateTimeStampInUTC(a.dateTimeStampInUTC()),this.priority(a.priority()),this.fromEmailString(a.fromEmailString()),this.toEmailsString(a.toEmailsString()),this.emails=a.emails,this.from=a.from,this.to=a.to,this.cc=a.cc,this.bcc=a.bcc,this.replyTo=a.replyTo,this.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),this.isReadReceipt(a.isReadReceipt()),this.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(Ab.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(a.parentUid()),this.threads(a.threads()),this.threadsLen(a.threadsLen()),this.computeSenderEmail(),this},A.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=Cb.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),b("[data-x-src]",this.body).each(function(){a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",b(this).attr("data-x-src")).removeAttr("data-x-src"):b(this).attr("src",b(this).attr("data-x-src")).removeAttr("data-x-src")}),b("[data-x-style-url]",this.body).each(function(){var a=Cb.trim(b(this).attr("style"));a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+b(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(b("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b(".RL-MailMessageView .messageView .messageItem .content")[0]}),Mb.resize()),Cb.windowResize(500))},A.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),a=Cb.isUnd(a)?!1:a;var c=this;b("[data-x-src-cid]",this.body).each(function(){var d=c.findAttachmentByCid(b(this).attr("data-x-src-cid"));d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-src-location]",this.body).each(function(){var d=c.findAttachmentByContentLocation(b(this).attr("data-x-src-location"));d||(d=c.findAttachmentByCid(b(this).attr("data-x-src-location"))),d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-style-cid]",this.body).each(function(){var a="",d="",e=c.findAttachmentByCid(b(this).attr("data-x-style-cid"));e&&e.linkPreview&&(d=b(this).attr("data-x-style-cid-name"),""!==d&&(a=Cb.trim(b(this).attr("style")),a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+d+": url('"+e.linkPreview()+"')")))}),a&&!function(a,b){h.delay(function(){a.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b})},300)}(b("img.lazy",c.body),b(".RL-MailMessageView .messageView .messageItem .content")[0]),Cb.windowResize(500)}},A.prototype.storeDataToDom=function(){this.body&&(this.body.data("rl-is-rtl",!!this.isRtl()),this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw),Pb.data().allowOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser())))},A.prototype.storePgpVerifyDataToDom=function(){this.body&&Pb.data().allowOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},A.prototype.fetchDataToDom=function(){this.body&&(this.isRtl(!!this.body.data("rl-is-rtl")),this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=Cb.pString(this.body.data("rl-plain-raw")),Pb.data().allowOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},A.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var c=[],d=null,e=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",f=Pb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?Ab.SignedVerifyStatus.Unverified:Ab.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0').text(j)).html(),Qb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},A.prototype.decryptPgpEncryptedMessage=function(c){if(this.isPgpEncrypted()){var d=[],e=null,f=null,g=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",i=Pb.data().findPublicKeysByEmail(g),j=Pb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0').text(m)).html(),Qb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},A.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},B.newInstanceFromJson=function(a){var b=new B;return b.initByJson(a)?b.initComputed():null},B.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.canBeEdited=c.computed(function(){return Ab.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=c.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this),this.isSystemFolder=c.computed(function(){return Ab.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){Cb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Cb.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=c.computed(function(){var a=this.messageCountAll(),b=this.messageCountUnread(),c=this.type();if(Ab.FolderType.Inbox===c&&Pb.data().foldersInboxUnreadCount(b),a>0){if(Ab.FolderType.Draft===c)return""+a;if(b>0&&Ab.FolderType.Trash!==c&&Ab.FolderType.Archive!==c&&Ab.FolderType.SentItems!==c)return""+b}return""},this),this.canBeDeleted=c.computed(function(){var a=this.isSystemFolder();return!a&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=c.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){Cb.timeOutAction("folder-list-folder-visibility-change",function(){Mb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Fb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case Ab.FolderType.Inbox:b=Cb.i18n("FOLDER_LIST/INBOX_NAME");break;case Ab.FolderType.SentItems:b=Cb.i18n("FOLDER_LIST/SENT_NAME");break;case Ab.FolderType.Draft:b=Cb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case Ab.FolderType.Spam:b=Cb.i18n("FOLDER_LIST/SPAM_NAME");break;case Ab.FolderType.Trash:b=Cb.i18n("FOLDER_LIST/TRASH_NAME");break;case Ab.FolderType.Archive:b=Cb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Fb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case Ab.FolderType.Inbox:a="("+Cb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case Ab.FolderType.SentItems:a="("+Cb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case Ab.FolderType.Draft:a="("+Cb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case Ab.FolderType.Spam:a="("+Cb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case Ab.FolderType.Trash:a="("+Cb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case Ab.FolderType.Archive:a="("+Cb.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this.hasUnreadMessages=c.computed(function(){return 0"},D.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},D.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+Cb.quoteName(a)+'" <'+this.email()+">"},E.prototype.index=0,E.prototype.id="",E.prototype.guid="",E.prototype.user="",E.prototype.email="",E.prototype.armor="",E.prototype.isPrivate=!1,Cb.extendAsViewModel("PopupsFolderClearViewModel",F),F.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},F.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Cb.extendAsViewModel("PopupsFolderCreateViewModel",G),G.prototype.sNoParentText="",G.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Cb.trim(a))},G.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},G.prototype.onShow=function(){this.clearPopup()},G.prototype.onFocus=function(){this.folderName.focused(!0)},Cb.extendAsViewModel("PopupsFolderSystemViewModel",H),H.prototype.sChooseOnText="",H.prototype.sUnuseText="",H.prototype.onShow=function(a){var b="";switch(a=Cb.isUnd(a)?Ab.SetSystemFoldersNotification.None:a){case Ab.SetSystemFoldersNotification.Sent:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case Ab.SetSystemFoldersNotification.Draft:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case Ab.SetSystemFoldersNotification.Spam:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case Ab.SetSystemFoldersNotification.Trash:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case Ab.SetSystemFoldersNotification.Archive:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Cb.extendAsViewModel("PopupsComposeViewModel",I),I.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Ib.showScreenPopup(P,[function(b){a.editor(function(a){a.setPlain(b)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},I.prototype.reloadDraftFolder=function(){var a=Pb.data().draftFolder();""!==a&&(Pb.cache().setFolderHash(a,""),Pb.data().currentFolderFullNameRaw()===a?Pb.reloadMessageList(!0):Pb.folderInformation(a))},I.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};if(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Pb.data().accountEmail()]=Pb.data().accountEmail(),b)switch(a){case Ab.ComposeType.Empty:d=Pb.data().accountEmail();break;case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:case Ab.ComposeType.Forward:case Ab.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case Ab.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Pb.data().accountEmail();return d},I.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},I.prototype.formattedFrom=function(a){var b=Pb.data().displayName(),c=Pb.data().accountEmail();return""===b?c:(Cb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Cb.quoteName(b)+'" <'+c+">"},I.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),Ab.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Cb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&Ab.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Cb.trim(Cb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Cb.getNotification(c&&c.ErrorCode?c.ErrorCode:Ab.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Cb.getNotification(Ab.Notification.CantSendMessage)))),this.reloadDraftFolder()},I.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),Ab.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Pb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Pb.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0c;c++)e.push(a[c].toLine(!!b));return e.join(", ")};if(c=c||null,c&&Cb.isNormal(c)&&(v=Cb.isArray(c)&&1===c.length?c[0]:Cb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Cb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Cb.removeBlockquoteSwitcher(l),m=l.html(),w){case Ab.ComposeType.Empty:break;case Ab.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Cb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Cb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.references());break;case Ab.ComposeType.Forward:this.subject(Cb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.ComposeType.ForwardAsAttachment:this.subject(Cb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.ComposeType.Draft:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.bFromDraft=!0,this.draftFolder(v.folderFullNameRaw),this.draftUid(v.uid),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Cb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case Ab.ComposeType.EditAsNew:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Cb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences
}switch(w){case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Cb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":"+m+"
";break;case Ab.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m="
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Cb.encodeHtml(j)+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Cb.encodeHtml(k)+"
"+m;break;case Ab.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&Ab.ComposeType.EditAsNew!==w&&Ab.ComposeType.Draft!==w&&(m=this.convertSignature(r,x(v.from,!0))+"
"+m),this.editor(function(a){a.setHtml(m,!1),v.isHtml()||a.modeToggle(!1)})}else Ab.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),Ab.EditorDefaultType.Html!==Pb.data().editorDefaultType()&&a.modeToggle(!1)})):Cb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Cb.isNonEmptyArray(t)&&Pb.remote().messageUploadAttachments(function(a,b){if(Ab.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},t),this.triggerForResize()},I.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},I.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},I.prototype.tryToClosePopup=function(){var a=this;Ib.showScreenPopup(T,[Cb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Cb.delegateRun(a,"closeCommand")}])},I.prototype.onBuild=function(){this.initUploader();var a=this,c=null;j("ctrl+q, command+q",Ab.KeyState.Compose,function(){return a.identitiesDropdownTrigger(!0),!1}),j("ctrl+s, command+s",Ab.KeyState.Compose,function(){return a.saveCommand(),!1}),j("ctrl+enter, command+enter",Ab.KeyState.Compose,function(){return a.sendCommand(),!1}),j("esc",Ab.KeyState.Compose,function(){return a.tryToClosePopup(),!1}),Mb.on("resize",function(){a.triggerForResize()}),this.dropboxEnabled()&&(c=document.createElement("script"),c.type="text/javascript",c.src="https://www.dropbox.com/static/api/1/dropins.js",b(c).attr("id","dropboxjs").attr("data-app-key",Pb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},I.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;d>c;c++)if(b[c]&&a===b[c].id)return b[c];return null},I.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=Cb.pInt(Pb.settingsGet("AttachmentLimit")),c=new g({action:Pb.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});c?(c.on("onDragEnter",h.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",h.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",h.bind(function(b,c,d){var e=null;Cb.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this)).on("onSelect",h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=Cb.isUnd(d.FileName)?"":d.FileName.toString(),g=Cb.isNormal(d.Size)?Cb.pInt(d.Size):null,h=new z(a,f,g);return h.cancel=function(a){return function(){e.attachments.remove(function(b){return b&&b.id===a}),c&&c.cancel(a)}}(a),this.attachments.push(h),g>0&&b>0&&g>b?(h.error(Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Cb.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this)).on("onComplete",h.bind(function(b,c,d){var e="",f=null,g=null,h=this.getAttachmentById(b);g=c&&d&&d.Result&&d.Result.Attachment?d.Result.Attachment:null,f=d&&d.Result&&d.Result.ErrorCode?d.Result.ErrorCode:null,null!==f?e=Cb.getUploadErrorDescByCode(f):g||(e=Cb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Pb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),Ab.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Cb.getUploadErrorDescByCode(Ab.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},I.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Cb.isNonEmptyArray(a.attachments())?a.attachments():[],e=0,f=d.length,g=null,h=null,i=!1,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(Ab.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:i=h.isLinked;break;case Ab.ComposeType.Forward:case Ab.ComposeType.Draft:case Ab.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new z(h.download,h.fileName,h.estimatedSize,h.isInline,h.isLinked,h.cid,h.contentLocation),g.fromMessage=!0,g.cancel=j(h.download),g.waiting(!1).uploading(!0),this.attachments.push(g))}}},I.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},I.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(Cb.getUploadErrorDescByCode(Ab.UploadErrorCode.FileNoUploaded))},this)},I.prototype.isEmptyForm=function(a){a=Cb.isUnd(a)?!0:!!a;var b=a?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&b&&(!this.oEditor||""===this.oEditor.getData())},I.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},I.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},I.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Cb.extendAsViewModel("PopupsContactsViewModel",J),J.prototype.setShareToNone=function(){this.viewScopeType(Ab.ContactScopeType.Default)},J.prototype.setShareToAll=function(){this.viewScopeType(Ab.ContactScopeType.ShareAll)},J.prototype.addNewProperty=function(a){var b=new x(a,"");b.focused(!0),this.viewProperties.push(b)},J.prototype.addNewEmail=function(){this.addNewProperty(Ab.ContactPropertyType.EmailPersonal)},J.prototype.addNewPhone=function(){this.addNewProperty(Ab.ContactPropertyType.MobilePersonal)},J.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Pb.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});b&&b.on("onStart",h.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",h.bind(function(b,c,d){this.contacts.importing(!1),this.reloadContactList(),b&&c&&d&&d.Result||a.alert(Cb.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},J.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contacts().length,e=this.contactsCheckedOrSelected();0=d&&(this.bDropPageAfterDelete=!0),h.delay(function(){h.each(e,function(a){b.remove(a)})},500))},J.prototype.deleteSelectedContacts=function(){00?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1)},c,zb.Defaults.ContactsPerPage,this.search())},J.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,Ab.KeyState.ContactList);var d=this;j("delete",Ab.KeyState.ContactList,function(){return d.deleteCommand(),!1}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Cb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},J.prototype.onShow=function(){Ib.routeOff(),this.reloadContactList(!0)},J.prototype.onHide=function(){Ib.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},Cb.extendAsViewModel("PopupsAdvancedSearchViewModel",K),K.prototype.buildSearchStringValue=function(a){return-1 li"),e=c&&"tab"===c.shortcut,f=d.index(d.filter(".active"));return!e&&f>0?f--:e&&f-1&&g.eq(e).removeClass("focused"),38===f&&e>0?e--:40===f&&e1?" ("+(100>a?a:"99+")+")":""},$.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},$.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Pb.moveMessagesToFolder(Pb.data().currentFolderFullNameRaw(),Pb.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},$.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=Cb.draggeblePlace();return c.data("rl-folder",Pb.data().currentFolderFullNameRaw()),c.data("rl-uids",Pb.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Pb.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},$.prototype.onMessageResponse=function(a,b,c){var d=Pb.data();d.hideMessageBodies(),d.messageLoading(!1),Ab.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):Ab.StorageResultType.Unload===a?(d.message(null),d.messageError("")):Ab.StorageResultType.Abort!==a&&(d.message(null),d.messageError(Cb.getNotification(b&&b.ErrorCode?b.ErrorCode:Ab.Notification.UnknownError)))},$.prototype.populateMessageBody=function(a){a&&(Pb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Pb.data().messageLoading(!0):Cb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},$.prototype.setAction=function(a,b,c){var d=[],e=null,f=Pb.cache(),g=0;if(Cb.isUnd(c)&&(c=Pb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&01048576?(a.alert(Cb.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(){this.customThemeUploaderProgress(!0)},this)).on("onComplete",h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(Cb.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:Ab.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},Cb.addSettingsViewModel(mb,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),mb.prototype.addOpenPgpKey=function(){Ib.showScreenPopup(M)},mb.prototype.generateOpenPgpKey=function(){Ib.showScreenPopup(O)},mb.prototype.viewOpenPgpKey=function(a){a&&Ib.showScreenPopup(N,[a])},mb.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Pb.data().openpgpKeyring,d=function(b){return a===b};a&&c&&(this.openpgpkeys.remove(d),h.each(c.keys,function(c,d){-1===b&&c&&c.primaryKey&&a.guid===c.primaryKey.getFingerprint()&&a.isPrivate===c.isPrivate()&&(b=d)}),b>=0&&c.removeKey(b),c.store(),Pb.reloadOpenPgpKeys())}},nb.prototype.populateDataOnStart=function(){var a=Cb.pInt(Pb.settingsGet("Layout")),b=Pb.settingsGet("Languages"),c=Pb.settingsGet("Themes");Cb.isArray(b)&&this.languages(b),Cb.isArray(c)&&this.themes(c),this.mainLanguage(Pb.settingsGet("Language")),this.mainTheme(Pb.settingsGet("Theme")),this.allowCustomTheme(!!Pb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Pb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Pb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Pb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Pb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Pb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Pb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Pb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Pb.settingsGet("EditorDefaultType")),this.showImages(!!Pb.settingsGet("ShowImages")),this.contactsAutosave(!!Pb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Pb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Pb.settingsGet("MPP")),this.desktopNotifications(!!Pb.settingsGet("DesktopNotifications")),this.useThreads(!!Pb.settingsGet("UseThreads")),this.replySameFolder(!!Pb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Pb.settingsGet("UseCheckboxesInList")),this.layout(Ab.Layout.SidePreview),-10&&(c=this.messagesBodiesDom(),c&&(c.find(".rl-cache-class").each(function(){var c=b(this);d>c.data("rl-cache-count")&&(c.addClass("rl-cache-purge"),a++)}),a>0&&h.delay(function(){c.find(".rl-cache-purge").remove()},300)))},ob.prototype.populateDataOnStart=function(){nb.prototype.populateDataOnStart.call(this),this.accountEmail(Pb.settingsGet("Email")),this.accountIncLogin(Pb.settingsGet("IncLogin")),this.accountOutLogin(Pb.settingsGet("OutLogin")),this.projectHash(Pb.settingsGet("ProjectHash")),this.displayName(Pb.settingsGet("DisplayName")),this.replyTo(Pb.settingsGet("ReplyTo")),this.signature(Pb.settingsGet("Signature")),this.signatureToAll(!!Pb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Pb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Pb.local().get(Ab.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Pb.settingsGet("RemoteSuggestions"),this.devEmail=Pb.settingsGet("DevEmail"),this.devLogin=Pb.settingsGet("DevLogin"),this.devPassword=Pb.settingsGet("DevPassword")},ob.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Cb.isNormal(c)&&""!==c){if(Cb.isArray(d)&&03)i(Pb.link().notificationMailIcon(),Pb.data().accountEmail(),Cb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Pb.link().notificationMailIcon(),A.emailsToLine(A.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Pb.cache().setFolderUidNext(b,c)}},ob.prototype.folderResponseParseRec=function(a,b){var c=0,d=0,e=null,f=null,g="",h=[],i=[];for(c=0,d=b.length;d>c;c++)e=b[c],e&&(g=e.FullNameRaw,f=Pb.cache().getFolderFromCacheList(g),f||(f=B.newInstanceFromJson(e),f&&(Pb.cache().setFolderToCacheList(g,f),Pb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=zb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!Cb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Pb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Cb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Cb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Cb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},ob.prototype.setFolders=function(a){var b=[],c=!1,d=Pb.data(),e=function(a){return""===a||zb.Values.UnuseOptionValue===a||null!==Pb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])&&(Cb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Pb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Pb.settingsGet("SentFolder")+Pb.settingsGet("DraftFolder")+Pb.settingsGet("SpamFolder")+Pb.settingsGet("TrashFolder")+Pb.settingsGet("ArchiveFolder")+Pb.settingsGet("NullFolder")&&(Pb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Pb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Pb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Pb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Pb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Pb.settingsGet("SentFolder"))),d.draftFolder(e(Pb.settingsGet("DraftFolder"))),d.spamFolder(e(Pb.settingsGet("SpamFolder"))),d.trashFolder(e(Pb.settingsGet("TrashFolder"))),d.archiveFolder(e(Pb.settingsGet("ArchiveFolder"))),c&&Pb.remote().saveSystemFolders(Cb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},ob.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},ob.prototype.getNextFolderNames=function(a){a=Cb.isUnd(a)?!1:!!a;var b=[],c=10,d=f().unix(),e=d-300,g=[],i=function(b){h.each(b,function(b){b&&"INBOX"!==b.fullNameRaw&&b.selectable&&b.existen&&e>b.interval&&(!a||b.subScribed())&&g.push([b.interval,b.fullNameRaw]),b&&0b[0]?1:0}),h.find(g,function(a){var e=Pb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},ob.prototype.removeMessagesFromList=function(a,b,c,d){c=Cb.isNormal(c)?c:"",d=Cb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Cb.pInt(a)});var e=0,f=Pb.data(),g=Pb.cache(),i=f.messageList(),j=Pb.cache().getFolderFromCacheList(a),k=""===c?null:g.getFolderFromCacheList(c||""),l=f.currentFolderFullNameRaw(),m=f.message(),n=l===a?h.filter(i,function(a){return a&&-10&&j.messageCountUnread(0<=j.messageCountUnread()-e?j.messageCountUnread()-e:0)),k&&(k.messageCountAll(k.messageCountAll()+b.length),e>0&&k.messageCountUnread(k.messageCountUnread()+e),k.actionBlink(!0)),0').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Fb.iMessageBodyCacheCount),Cb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Cb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Pb.data().allowOpenPGP()&&Cb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Cb.pString(a.Result.PlainRaw),l=/---BEGIN PGP MESSAGE---/.test(n.plainRaw),l||(k=/-----BEGIN PGP SIGNED MESSAGE-----/.test(n.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(n.plainRaw)),Qb.empty(),k&&n.isPgpSigned()?j=Qb.append(b('').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Qb.append(b('').text(n.plainRaw)).html()),Qb.empty(),n.isPgpSigned(k),n.isPgpEncrypted(l)),g.html(j).addClass("b-text-part plain")):d=!1,n.isHtml(!!d),n.hasImages(!!e),n.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(this.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),n.storeDataToDom(),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Cb.initBlockquoteSwitcher(g)),Pb.cache().initMessageFlagsFromCache(n),n.unseen()&&Pb.setMessageSeen(n),Cb.windowResize())},ob.prototype.calculateMessageListHash=function(a){return h.map(a,function(a){return""+a.hash+"_"+a.threadsLen()+"_"+a.flagHash()}).join("|")},ob.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])){var c=Pb.data(),d=Pb.cache(),e=null,g=0,h=0,i=0,j=0,k=[],l=f().unix(),m=c.staticMessageList,n=null,o=null,p=null,q=0,r=!1;for(i=Cb.pInt(a.Result.MessageResultCount),j=Cb.pInt(a.Result.Offset),Cb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Pb.cache().getFolderFromCacheList(Cb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Pb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Cb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Cb.isNormal(a.Result.MessageUnseenCount)&&(Cb.pInt(p.messageCountUnread())!==Cb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Pb.cache().clearMessageFlagsFromCacheByFolder(p.fullNameRaw),g=0,h=a.Result["@Collection"].length;h>g;g++)n=a.Result["@Collection"][g],n&&"Object/Message"===n["@Object"]&&(o=m[g],o&&o.initByJson(n)||(o=A.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Pb.cache().initMessageFlagsFromCache(o):Pb.cache().storeMessageFlagsToCache(o),o.lastInCollapsedThread(e&&-11048576?(a.alert(Cb.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(){this.customThemeUploaderProgress(!0)},this)).on("onComplete",h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(Cb.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:Ab.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},Cb.addSettingsViewModel(mb,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),mb.prototype.addOpenPgpKey=function(){Ib.showScreenPopup(M)},mb.prototype.generateOpenPgpKey=function(){Ib.showScreenPopup(O)},mb.prototype.viewOpenPgpKey=function(a){a&&Ib.showScreenPopup(N,[a])},mb.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Pb.data().openpgpKeyring,d=function(b){return a===b};a&&c&&(this.openpgpkeys.remove(d),h.each(c.keys,function(c,d){-1===b&&c&&c.primaryKey&&a.guid===c.primaryKey.getFingerprint()&&a.isPrivate===c.isPrivate()&&(b=d)}),b>=0&&c.removeKey(b),c.store(),Pb.reloadOpenPgpKeys())}},nb.prototype.populateDataOnStart=function(){var a=Cb.pInt(Pb.settingsGet("Layout")),b=Pb.settingsGet("Languages"),c=Pb.settingsGet("Themes");Cb.isArray(b)&&this.languages(b),Cb.isArray(c)&&this.themes(c),this.mainLanguage(Pb.settingsGet("Language")),this.mainTheme(Pb.settingsGet("Theme")),this.allowCustomTheme(!!Pb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Pb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Pb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Pb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Pb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Pb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Pb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Pb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Pb.settingsGet("EditorDefaultType")),this.showImages(!!Pb.settingsGet("ShowImages")),this.contactsAutosave(!!Pb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Pb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Pb.settingsGet("MPP")),this.desktopNotifications(!!Pb.settingsGet("DesktopNotifications")),this.useThreads(!!Pb.settingsGet("UseThreads")),this.replySameFolder(!!Pb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Pb.settingsGet("UseCheckboxesInList")),this.layout(Ab.Layout.SidePreview),-10&&(c=this.messagesBodiesDom(),c&&(c.find(".rl-cache-class").each(function(){var c=b(this);d>c.data("rl-cache-count")&&(c.addClass("rl-cache-purge"),a++)}),a>0&&h.delay(function(){c.find(".rl-cache-purge").remove()},300)))},ob.prototype.populateDataOnStart=function(){nb.prototype.populateDataOnStart.call(this),this.accountEmail(Pb.settingsGet("Email")),this.accountIncLogin(Pb.settingsGet("IncLogin")),this.accountOutLogin(Pb.settingsGet("OutLogin")),this.projectHash(Pb.settingsGet("ProjectHash")),this.displayName(Pb.settingsGet("DisplayName")),this.replyTo(Pb.settingsGet("ReplyTo")),this.signature(Pb.settingsGet("Signature")),this.signatureToAll(!!Pb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Pb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Pb.local().get(Ab.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Pb.settingsGet("RemoteSuggestions"),this.devEmail=Pb.settingsGet("DevEmail"),this.devLogin=Pb.settingsGet("DevLogin"),this.devPassword=Pb.settingsGet("DevPassword")},ob.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Cb.isNormal(c)&&""!==c){if(Cb.isArray(d)&&03)i(Pb.link().notificationMailIcon(),Pb.data().accountEmail(),Cb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Pb.link().notificationMailIcon(),A.emailsToLine(A.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Pb.cache().setFolderUidNext(b,c)}},ob.prototype.folderResponseParseRec=function(a,b){var c=0,d=0,e=null,f=null,g="",h=[],i=[];for(c=0,d=b.length;d>c;c++)e=b[c],e&&(g=e.FullNameRaw,f=Pb.cache().getFolderFromCacheList(g),f||(f=B.newInstanceFromJson(e),f&&(Pb.cache().setFolderToCacheList(g,f),Pb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=zb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!Cb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Pb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Cb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Cb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Cb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},ob.prototype.setFolders=function(a){var b=[],c=!1,d=Pb.data(),e=function(a){return""===a||zb.Values.UnuseOptionValue===a||null!==Pb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])&&(Cb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Pb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Pb.settingsGet("SentFolder")+Pb.settingsGet("DraftFolder")+Pb.settingsGet("SpamFolder")+Pb.settingsGet("TrashFolder")+Pb.settingsGet("ArchiveFolder")+Pb.settingsGet("NullFolder")&&(Pb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Pb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Pb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Pb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Pb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Pb.settingsGet("SentFolder"))),d.draftFolder(e(Pb.settingsGet("DraftFolder"))),d.spamFolder(e(Pb.settingsGet("SpamFolder"))),d.trashFolder(e(Pb.settingsGet("TrashFolder"))),d.archiveFolder(e(Pb.settingsGet("ArchiveFolder"))),c&&Pb.remote().saveSystemFolders(Cb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},ob.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},ob.prototype.getNextFolderNames=function(a){a=Cb.isUnd(a)?!1:!!a;var b=[],c=10,d=f().unix(),e=d-300,g=[],i=function(b){h.each(b,function(b){b&&"INBOX"!==b.fullNameRaw&&b.selectable&&b.existen&&e>b.interval&&(!a||b.subScribed())&&g.push([b.interval,b.fullNameRaw]),b&&0b[0]?1:0}),h.find(g,function(a){var e=Pb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},ob.prototype.removeMessagesFromList=function(a,b,c,d){c=Cb.isNormal(c)?c:"",d=Cb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Cb.pInt(a)});var e=0,f=Pb.data(),g=Pb.cache(),i=f.messageList(),j=Pb.cache().getFolderFromCacheList(a),k=""===c?null:g.getFolderFromCacheList(c||""),l=f.currentFolderFullNameRaw(),m=f.message(),n=l===a?h.filter(i,function(a){return a&&-10&&j.messageCountUnread(0<=j.messageCountUnread()-e?j.messageCountUnread()-e:0)),k&&(k.messageCountAll(k.messageCountAll()+b.length),e>0&&k.messageCountUnread(k.messageCountUnread()+e),k.actionBlink(!0)),0').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Fb.iMessageBodyCacheCount),Cb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Cb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Pb.data().allowOpenPGP()&&Cb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Cb.pString(a.Result.PlainRaw),l=/---BEGIN PGP MESSAGE---/.test(n.plainRaw),l||(k=/-----BEGIN PGP SIGNED MESSAGE-----/.test(n.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(n.plainRaw)),Qb.empty(),k&&n.isPgpSigned()?j=Qb.append(b('').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Qb.append(b('').text(n.plainRaw)).html()),Qb.empty(),n.isPgpSigned(k),n.isPgpEncrypted(l)),g.html(j).addClass("b-text-part plain")):d=!1,n.isHtml(!!d),n.hasImages(!!e),n.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(this.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),n.storeDataToDom(),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Cb.initBlockquoteSwitcher(g)),Pb.cache().initMessageFlagsFromCache(n),n.unseen()&&Pb.setMessageSeen(n),Cb.windowResize())},ob.prototype.calculateMessageListHash=function(a){return h.map(a,function(a){return""+a.hash+"_"+a.threadsLen()+"_"+a.flagHash()}).join("|")},ob.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])){var c=Pb.data(),d=Pb.cache(),e=null,g=0,h=0,i=0,j=0,k=[],l=f().unix(),m=c.staticMessageList,n=null,o=null,p=null,q=0,r=!1;for(i=Cb.pInt(a.Result.MessageResultCount),j=Cb.pInt(a.Result.Offset),Cb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Pb.cache().getFolderFromCacheList(Cb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Pb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Cb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Cb.isNormal(a.Result.MessageUnseenCount)&&(Cb.pInt(p.messageCountUnread())!==Cb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Pb.cache().clearMessageFlagsFromCacheByFolder(p.fullNameRaw),g=0,h=a.Result["@Collection"].length;h>g;g++)n=a.Result["@Collection"][g],n&&"Object/Message"===n["@Object"]&&(o=m[g],o&&o.initByJson(n)||(o=A.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Pb.cache().initMessageFlagsFromCache(o):Pb.cache().storeMessageFlagsToCache(o),o.lastInCollapsedThread(e&&-1(new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&00?(this.defaultRequest(a,"Message",{},null,"Message/"+Eb.urlsafe_encode([b,c,Pb.data().projectHash(),Pb.data().threading()&&Pb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},qb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},qb.prototype.folderInformation=function(a,b,c){var d=!0,e=Pb.cache(),f=[];Cb.isArray(c)&&0 ").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Pb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),Cb.delegateRun(e,"onBuild",[i])):Cb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Cb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Cb.delegateRun(d.oCurrentSubScreen,"onShow"),Cb.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),h.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),Cb.windowResize()})):Ib.setHash(Pb.link().settings(),!1,!0)},tb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Cb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},tb.prototype.onBuild=function(){h.each(Gb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Gb["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!h.find(Gb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},tb.prototype.routes=function(){var a=h.find(Gb.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",c={subname:/^(.*)$/,normalize_:function(a,c){return c.subname=Cb.isUnd(c.subname)?b:Cb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(ub.prototype,t.prototype),ub.prototype.onShow=function(){Pb.setTitle("")},h.extend(vb.prototype,t.prototype),vb.prototype.oLastRoute={},vb.prototype.setNewTitle=function(){var a=Pb.data().accountEmail(),b=Pb.data().foldersInboxUnreadCount();Pb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Cb.i18n("TITLES/MAILBOX"))},vb.prototype.onShow=function(){this.setNewTitle(),Pb.data().keyScope(Ab.KeyState.MessageList)},vb.prototype.onRoute=function(a,b,c,d){if(Cb.isUnd(d)?1:!d){var e=Pb.data(),f=Pb.cache().getFolderFullNameRaw(a),g=Pb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),Ab.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Pb.reloadMessageList())}else Ab.Layout.NoPreview!==Pb.data().layout()||Pb.data().message()||Pb.historyBack()},vb.prototype.onStart=function(){var a=Pb.data(),b=function(){Cb.windowResize()};(Pb.settingsGet("AllowAdditionalAccounts")||Pb.settingsGet("AllowIdentities"))&&Pb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Pb.folderInformation("INBOX")},1e3),h.delay(function(){Pb.quota()},5e3),h.delay(function(){Pb.remote().appDelayStart(Cb.emptyFunction)},35e3),Lb.toggleClass("rl-no-preview-pane",Ab.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Lb.toggleClass("rl-no-preview-pane",Ab.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},vb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Cb.pString(b[0]),b[1]=Cb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Cb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2]),!1]},c=function(a,b){return b[0]=Cb.pString(b[0]),b[1]=Cb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:c}],[/^message-preview$/,{normalize_:a}],[/^([^\/]*)$/,{normalize_:b}]]},h.extend(wb.prototype,tb.prototype),wb.prototype.onShow=function(){Pb.setTitle(this.sSettingsTitle),Pb.data().keyScope(Ab.KeyState.Settings)},h.extend(xb.prototype,r.prototype),xb.prototype.oSettings=null,xb.prototype.oPlugins=null,xb.prototype.oLocal=null,xb.prototype.oLink=null,xb.prototype.oSubs={},xb.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):(Fb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},xb.prototype.link=function(){return null===this.oLink&&(this.oLink=new k),this.oLink},xb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new q),this.oLocal},xb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Cb.isNormal(Jb)?Jb:{}),Cb.isUnd(this.oSettings[a])?null:this.oSettings[a]},xb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Cb.isNormal(Jb)?Jb:{}),this.oSettings[a]=b},xb.prototype.setTitle=function(b){b=(Cb.isNormal(b)&&0