").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=nb.createCommand(e,function(){sb.hideScreenPopup(a)})),ob.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),this.delegateRun(e,"onBuild",[h]),ob.runHook("view-model-post-build",[a.__name,e,h])):nb.log("Cannot find view model position: "+f)}return a?a.__vm:null},r.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},r.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),h.defer(function(){a.__dom.find(".ko-select2").select2("close")}))},r.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),ob.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},r.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===nb.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,nb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),this.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onHide"),nb.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),c.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onShow"),ob.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),nb.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),c.delegateRun(a.__vm,"onShow"),ob.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},r.prototype.startScreens=function(a){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(),ob.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),ob.runHook("screen-post-start",[a.screenName(),a]))},this);var b=d.create();b.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this)),e.initialized.add(b.parse,b),e.changed.add(b.parse,b),e.init()},r.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=nb.isUnd(c)?!1:!!c,(nb.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)},r.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},sb=new r,s.newInstanceFromJson=function(a){var b=new s;return b.initByJson(a)?b:null},s.prototype.name="",s.prototype.email="",s.prototype.privateType=null,s.prototype.validate=function(){return""!==this.name||""!==this.email},s.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},s.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},s.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=lb.EmailType.Facebook),null===this.privateType&&(this.privateType=lb.EmailType.Default)),this.privateType},s.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},s.prototype.parse=function(a){a=nb.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)},s.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=nb.trim(a.Name),this.email=nb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},s.prototype.toLine=function(a,b){var c="";return""!==this.email&&(b=nb.isUnd(b)?!1:!!b,a&&""!==this.name?c=b?'
")+'" target="_blank" tabindex="-1">'+nb.encodeHtml(this.name)+"":this.name:(c=this.email,""!==this.name?c=b?nb.encodeHtml('"'+this.name+'" <')+'
")+'" target="_blank" tabindex="-1">'+nb.encodeHtml(c)+""+nb.encodeHtml(">"):'"'+this.name+'" <'+c+">":b&&(c='
'+nb.encodeHtml(this.email)+""))),c},s.prototype.select2Result=function(){var a="",b=zb.cache().getUserPic(this.email);return a+=""!==b?'
':'
',lb.EmailType.Facebook===this.type()?(a+=""+(0
'):a+=""+(0
('+this.name+")":this.email),a+""},s.prototype.select2Selection=function(a){var c="";if(lb.EmailType.Facebook===this.type()){if(c=0").text(c).appendTo(a),a.append(''),null}else c=0+$/,""),b=!0),b},u.prototype.isImage=function(){return-1e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},w.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(nb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=s.newInstanceFromJson(a[b]),d&&e.push(d);return e},w.replyHelper=function(a,b,c){if(a&&0d;d++)nb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},w.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(nb.pInt(a.Size)),this.from=w.initEmailsFromJson(a.From),this.to=w.initEmailsFromJson(a.To),this.cc=w.initEmailsFromJson(a.Cc),this.bcc=w.initEmailsFromJson(a.Bcc),this.replyTo=w.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(nb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(w.emailsToLine(this.from,!0)),this.toEmailsString(w.emailsToLine(this.to,!0)),this.parentUid(nb.pInt(a.ParentThread)),this.threads(nb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(nb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},w.prototype.computeSenderEmail=function(){var a=zb.data().sentFolder(),b=zb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},w.prototype.initUpdateByMessageJson=function(a){var b=!1,c=lb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=nb.pInt(a.Priority),this.priority(-1b;b++)d=u.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},w.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return nb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},w.prototype.messageId=function(){return this.sMessageId},w.prototype.inReplyTo=function(){return this.sInReplyTo},w.prototype.references=function(){return this.sReferences},w.prototype.fromAsSingleEmail=function(){return nb.isArray(this.from)&&this.from[0]?this.from[0].email:""},w.prototype.viewLink=function(){return zb.link().messageViewLink(this.requestHash)},w.prototype.downloadLink=function(){return zb.link().messageDownloadLink(this.requestHash)},w.prototype.replyEmails=function(a){var b=[],c=nb.isUnd(a)?{}:a;return w.replyHelper(this.replyTo,c,b),0===b.length&&w.replyHelper(this.from,c,b),b},w.prototype.replyAllEmails=function(a){var b=[],c=[],d=nb.isUnd(a)?{}:a;return w.replyHelper(this.replyTo,d,b),0===b.length&&w.replyHelper(this.from,d,b),w.replyHelper(this.to,d,b),w.replyHelper(this.cc,d,c),[b,c]},w.prototype.textBodyToString=function(){return this.body?this.body.html():""},w.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))})},w.prototype.printMessage=function(){this.viewPopupMessage(!0)},w.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},w.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,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.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(lb.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},w.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=nb.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=nb.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]}),wb.resize()),nb.windowResize(500))},w.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){a=nb.isUnd(a)?!1:a;var c=this;this.body.data("rl-init-internal-images",!0),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=nb.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]),nb.windowResize(500)}},x.newInstanceFromJson=function(a){var b=new x;return b.initByJson(a)?b.initComputed():null},x.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},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 lb.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){nb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){nb.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();return b>0&&(lb.FolderType.Inbox===c||lb.FolderType.Spam===c)?""+b:a>0&&lb.FolderType.Draft===c?""+a:""},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(){nb.timeOutAction("folder-list-folder-visibility-change",function(){wb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){qb.langChangeTick();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case lb.FolderType.Inbox:b=nb.i18n("FOLDER_LIST/INBOX_NAME");break;case lb.FolderType.SentItems:b=nb.i18n("FOLDER_LIST/SENT_NAME");break;case lb.FolderType.Draft:b=nb.i18n("FOLDER_LIST/DRAFTS_NAME");break;
case lb.FolderType.Spam:b=nb.i18n("FOLDER_LIST/SPAM_NAME");break;case lb.FolderType.Trash:b=nb.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){qb.langChangeTick();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case lb.FolderType.Inbox:a="("+nb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case lb.FolderType.SentItems:a="("+nb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case lb.FolderType.Draft:a="("+nb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case lb.FolderType.Spam:a="("+nb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case lb.FolderType.Trash:a="("+nb.i18n("FOLDER_LIST/TRASH_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},x.prototype.fullName="",x.prototype.fullNameRaw="",x.prototype.fullNameHash="",x.prototype.delimiter="",x.prototype.namespace="",x.prototype.deep=0,x.prototype.isNamespaceFolder=!1,x.prototype.isGmailFolder=!1,x.prototype.isUnpaddigFolder=!1,x.prototype.collapsedCss=function(){return this.hasSubScribedSubfolders()?this.collapsed()?"icon-arrow-right-3 e-collapsed-sign":"icon-arrow-down-3 e-collapsed-sign":"icon-none e-collapsed-sign"},x.prototype.initByJson=function(a){var b=!1;return a&&"Object/Folder"===a["@Object"]&&(this.name(a.Name),this.delimiter=a.Delimiter,this.fullName=a.FullName,this.fullNameRaw=a.FullNameRaw,this.fullNameHash=a.FullNameHash,this.deep=a.FullNameRaw.split(this.delimiter).length-1,this.selectable=!!a.IsSelectable,this.existen=!!a.IsExisten,this.subScribed(!!a.IsSubscribed),this.type("INBOX"===this.fullNameRaw?lb.FolderType.Inbox:lb.FolderType.User),b=!0),b},x.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},y.prototype.email="",y.prototype.changeAccountLink=function(){return zb.link().change(this.email)},z.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},z.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},z.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+nb.quoteName(a)+'" <'+this.email()+">"},nb.extendAsViewModel("PopupsFolderClearViewModel",A),A.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},A.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},nb.extendAsViewModel("PopupsFolderCreateViewModel",B),B.prototype.sNoParentText="",B.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(nb.trim(a))},B.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.focusTrigger(!1)},B.prototype.onShow=function(){this.clearPopup(),this.focusTrigger(!0)},nb.extendAsViewModel("PopupsFolderSystemViewModel",C),C.prototype.sChooseOnText="",C.prototype.sUnuseText="",C.prototype.onShow=function(a){var b="";switch(a=nb.isUnd(a)?lb.SetSystemFoldersNotification.None:a){case lb.SetSystemFoldersNotification.Sent:b=nb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case lb.SetSystemFoldersNotification.Draft:b=nb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case lb.SetSystemFoldersNotification.Spam:b=nb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case lb.SetSystemFoldersNotification.Trash:b=nb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},nb.extendAsViewModel("PopupsComposeViewModel",D),D.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};switch(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[zb.data().accountEmail()]=zb.data().accountEmail(),a){case lb.ComposeType.Empty:d=zb.data().accountEmail();break;case lb.ComposeType.Reply:case lb.ComposeType.ReplyAll:case lb.ComposeType.Forward:case lb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.сс,b.bсс),e);break;case lb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}return d},D.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},D.prototype.formattedFrom=function(a){var b=zb.data().displayName(),c=zb.data().accountEmail();return""===b?c:(nb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+nb.quoteName(b)+'" <'+c+">"},D.prototype.sendMessageResponse=function(b,c){var d=!1;this.sending(!1),lb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&sb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&lb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(nb.trim(nb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),a.alert(nb.getNotification(c.ErrorCode?c.ErrorCode:lb.Notification.CantSendMessage))))},D.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),lb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=zb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&zb.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.draftID(c.Result.NewID),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0
"+n+":
"+m+"
";break;case lb.ComposeType.Forward:f=t.fromToLine(!1,!0),g=t.toToLine(!1,!0),i=t.ccToLine(!1,!0),m="
"+nb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+nb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+nb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+nb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+nb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+nb.encodeHtml(j)+"
"+nb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+nb.encodeHtml(k)+"
"+m;break;case lb.ComposeType.ForwardAsAttachment:m=""}this.oEditor.setRawText(m,t.isHtml())}}else this.oEditor&&lb.ComposeType.Empty===v?this.oEditor.setRawText("
"+nb.convertPlainTextToHtml(zb.data().signature()),lb.EditorDefaultType.Html===zb.data().editorDefaultType()):nb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload(),nb.isNonEmptyArray(r)&&zb.remote().messageUploadAttachments(function(a,b){if(lb.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()},r),u&&this.oEditor&&this.oEditor.focus(),this.triggerForResize()},D.prototype.onBuild=function(){this.initEditor(),this.initUploader();var a=this,c=null;wb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&zb.data().useKeyboardShortcuts()&&(b.ctrlKey&&lb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&lb.EventKeyCode.Enter===b.keyCode&&(a.sendCommand(),c=!1)),c}),wb.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",zb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},D.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},D.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new j(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}}),this.oEditor.initLanguage(nb.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),nb.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),nb.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}},D.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=nb.pInt(zb.settingsGet("AttachmentLimit")),c=new g({action:zb.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace(),onDragEnter:h.bind(function(){this.dragAndDropOver(!0)},this),onDragLeave:h.bind(function(){this.dragAndDropOver(!1)},this),onBodyDragEnter:h.bind(function(){this.dragAndDropVisible(!0)},this),onBodyDragLeave:h.bind(function(){this.dragAndDropVisible(!1)},this),onProgress:h.bind(function(b,c,d){var e=null;nb.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this),onSelect:h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=nb.isUnd(d.FileName)?"":d.FileName.toString(),g=nb.isNormal(d.Size)?nb.pInt(d.Size):null,h=new v(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(nb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:h.bind(function(b){var c=null;nb.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this),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=nb.getUploadErrorDescByCode(f):g||(e=nb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(nb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(zb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),lb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(nb.getUploadErrorDescByCode(lb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},D.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=nb.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(lb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case lb.ComposeType.Reply:case lb.ComposeType.ReplyAll:i=h.isLinked;break;case lb.ComposeType.Forward:case lb.ComposeType.Draft:i=!0}i=!0,i&&(g=new v(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))}}},D.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},D.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(nb.getUploadErrorDescByCode(lb.UploadErrorCode.FileNoUploaded))},this)},D.prototype.isEmptyForm=function(a){a=nb.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.getTextForRequest()},D.prototype.reset=function(){this.to([]),this.cc([]),this.bcc([]),this.subject(""),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bReloadFolder=!1,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.draftID(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear()},D.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},D.prototype.triggerForResize=function(){this.resizer(!this.resizer())},nb.extendAsViewModel("PopupsContactsViewModel",E),E.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contactsCheckedOrSelected();00&&g.messageCountUnread(0<=g.messageCountUnread()-e?g.messageCountUnread()-e:0)),i&&!d&&(i.messageCountAll(i.messageCountAll()+b.length),e>0&&i.messageCountUnread(i.messageCountUnread()+e)),00&&(lb.EventKeyCode.Backspace===c||lb.EventKeyCode.Esc===c)&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!nb.inFocus()&&e.message()&&(d.fullScreenMode(!1),e.usePreviewPane()||e.message(null),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&zb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},P.prototype.isDraftFolder=function(){return zb.data().message()&&zb.data().draftFolder()===zb.data().message().folderFullNameRaw},P.prototype.isSentFolder=function(){return zb.data().message()&&zb.data().sentFolder()===zb.data().message().folderFullNameRaw},P.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},P.prototype.composeClick=function(){sb.showScreenPopup(D)},P.prototype.editMessage=function(){zb.data().message()&&sb.showScreenPopup(D,[lb.ComposeType.Draft,zb.data().message()])},P.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},P.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},nb.extendAsViewModel("SettingsMenuViewModel",Q),Q.prototype.link=function(a){return zb.link().settings(a)},Q.prototype.backToMailBoxClick=function(){sb.setHash(zb.link().inbox())},nb.extendAsViewModel("SettingsPaneViewModel",R),R.prototype.onShow=function(){zb.data().message(null)},R.prototype.backToMailBoxClick=function(){sb.setHash(zb.link().inbox())},nb.addSettingsViewModel(S,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),S.prototype.onBuild=function(){var a=this;h.delay(function(){var c=zb.data(),d=nb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(lb.SaveSettingsStep.Animate),b.ajax({url:zb.link().langLink(c),dataType:"script",cache:!0}).done(function(){nb.i18nToDoc(),a.languageTrigger(lb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(lb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(lb.SaveSettingsStep.Idle)},1e3)}),zb.remote().saveSettings(nb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){zb.remote().saveSettings(nb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){zb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){zb.remote().saveSettings(nb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){zb.remote().saveSettings(nb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){nb.timeOutAction("SaveDesktopNotifications",function(){zb.remote().saveSettings(nb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){nb.timeOutAction("SaveReplySameFolder",function(){zb.remote().saveSettings(nb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),zb.remote().saveSettings(nb.emptyFunction,{UseThreads:a?"1":"0"})}),c.usePreviewPane.subscribe(function(a){c.messageList([]),zb.remote().saveSettings(nb.emptyFunction,{UsePreviewPane:a?"1":"0"})}),c.useCheckboxesInList.subscribe(function(a){zb.remote().saveSettings(nb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},S.prototype.onShow=function(){zb.data().desktopNotifications.valueHasMutated()},S.prototype.selectLanguage=function(){sb.showScreenPopup(I)},nb.addSettingsViewModel(T,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),T.prototype.addNewAccount=function(){sb.showScreenPopup(G)},T.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);var b=function(b){return a===b};a&&(this.accounts.remove(b),zb.remote().accountDelete(function(){zb.accountsAndIdentities()},a.email))}},nb.addSettingsViewModel(U,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),U.prototype.onBuild=function(){var a=this;h.delay(function(){var b=zb.data(),c=nb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=nb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=nb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){zb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){zb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){zb.remote().saveSettings(e,{Signature:a})})},50)},nb.addSettingsViewModel(V,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),V.prototype.addNewIdentity=function(){sb.showScreenPopup(H)},V.prototype.editIdentity=function(a){sb.showScreenPopup(H,[a])},V.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),zb.remote().identityDelete(function(){zb.accountsAndIdentities()},a.id))}},V.prototype.onBuild=function(a){var b=this;a.on("click",".identity-item .e-action",function(){var a=c.dataFor(this);a&&b.editIdentity(a)}),h.delay(function(){var a=zb.data(),c=nb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=nb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=nb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){zb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){zb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){zb.remote().saveSettings(e,{Signature:a})})},50)},nb.addSettingsViewModel(W,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),nb.addSettingsViewModel(X,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),X.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},X.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),lb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},nb.addSettingsViewModel(Y,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),Y.prototype.folderEditOnEnter=function(a){var b=a?nb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(zb.local().set(lb.ClientSideKeyName.FoldersLashHash,""),zb.data().foldersRenaming(!0),zb.remote().folderRename(function(a,b){zb.data().foldersRenaming(!1),lb.StorageResultType.Success===a&&b&&b.Result||zb.data().foldersListError(b&&b.ErrorCode?nb.getNotification(b.ErrorCode):nb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),zb.folders(!1)},a.fullNameRaw,b),zb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},Y.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},Y.prototype.onShow=function(){zb.data().foldersListError("")},Y.prototype.createFolder=function(){sb.showScreenPopup(B)},Y.prototype.systemFolder=function(){sb.showScreenPopup(C)},Y.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){return a===c?!0:(c.subFolders.remove(b),!1)};a&&(zb.local().set(lb.ClientSideKeyName.FoldersLashHash,""),zb.data().folderList.remove(b),zb.data().foldersDeleting(!0),zb.remote().folderDelete(function(a,b){zb.data().foldersDeleting(!1),lb.StorageResultType.Success===a&&b&&b.Result||zb.data().foldersListError(b&&b.ErrorCode?nb.getNotification(b.ErrorCode):nb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),zb.folders(!1)},a.fullNameRaw),zb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 01048576?(a.alert(nb.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:h.bind(function(){this.customThemeUploaderProgress(!0)},this),onComplete:h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(d&&d.ErrorCode?nb.getUploadErrorDescByCode(d.ErrorCode):nb.getUploadErrorDescByCode(lb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)});return!!b}return!1},$.prototype.populateDataOnStart=function(){var a=zb.settingsGet("Languages"),b=zb.settingsGet("Themes");nb.isArray(a)&&this.languages(a),nb.isArray(b)&&this.themes(b),this.mainLanguage(zb.settingsGet("Language")),this.mainTheme(zb.settingsGet("Theme")),this.allowCustomTheme(!!zb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!zb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!zb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!zb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!zb.settingsGet("AllowThemes")),this.allowCustomLogin(!!zb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!zb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!zb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(zb.settingsGet("EditorDefaultType")),this.showImages(!!zb.settingsGet("ShowImages")),this.interfaceAnimation(zb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(zb.settingsGet("MPP")),this.desktopNotifications(!!zb.settingsGet("DesktopNotifications")),this.useThreads(!!zb.settingsGet("UseThreads")),this.replySameFolder(!!zb.settingsGet("ReplySameFolder")),this.usePreviewPane(!!zb.settingsGet("UsePreviewPane")),this.useCheckboxesInList(!!zb.settingsGet("UseCheckboxesInList")),this.facebookEnable(!!zb.settingsGet("AllowFacebookSocial")),this.facebookAppID(zb.settingsGet("FacebookAppID")),this.facebookAppSecret(zb.settingsGet("FacebookAppSecret")),this.twitterEnable(!!zb.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(zb.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(zb.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!zb.settingsGet("AllowGoogleSocial")),this.googleClientID(zb.settingsGet("GoogleClientID")),this.googleClientSecret(zb.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!zb.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(zb.settingsGet("DropboxApiKey")),this.contactsIsSupported(!!zb.settingsGet("ContactsIsSupported")),this.contactsIsAllowed(!!zb.settingsGet("ContactsIsAllowed"))},h.extend(_.prototype,$.prototype),_.prototype.purgeMessageBodyCache=function(){var a=0,c=null,d=qb.iMessageBodyCacheCount-kb.Values.iMessageBodyCacheLimit;d>0&&(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)))},_.prototype.populateDataOnStart=function(){$.prototype.populateDataOnStart.call(this),this.accountEmail(zb.settingsGet("Email")),this.accountIncLogin(zb.settingsGet("IncLogin")),this.accountOutLogin(zb.settingsGet("OutLogin")),this.projectHash(zb.settingsGet("ProjectHash")),this.displayName(zb.settingsGet("DisplayName")),this.replyTo(zb.settingsGet("ReplyTo")),this.signature(zb.settingsGet("Signature")),this.lastFoldersHash=zb.local().get(lb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!zb.settingsGet("RemoteSuggestions"),this.devEmail=zb.settingsGet("DevEmail"),this.devLogin=zb.settingsGet("DevLogin"),this.devPassword=zb.settingsGet("DevPassword")},_.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&nb.isNormal(c)&&""!==c){if(nb.isArray(d)&&03)i(zb.link().notificationMailIcon(),zb.data().accountEmail(),nb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(zb.link().notificationMailIcon(),w.emailsToLine(w.initEmailsFromJson(d[f].From),!1),d[f].Subject)}zb.cache().setFolderUidNext(b,c)}},_.prototype.folderResponseParseRec=function(a,b,c){var d=0,e=0,f=null,g=null,h="",i=[],j=[];for(c=!!c,d=0,e=b.length;e>d;d++)f=b[d],f&&(h=f.FullNameRaw,g=zb.cache().getFolderFromCacheList(h),g||(g=x.newInstanceFromJson(f),g&&(zb.cache().setFolderToCacheList(h,g),zb.cache().setFolderFullNameRaw(g.fullNameHash,h),g.isGmailFolder=kb.Values.GmailFolderName.toLowerCase()===h.toLowerCase(),""!==a&&a===g.fullNameRaw+g.delimiter&&(g.isNamespaceFolder=!0),(g.isNamespaceFolder||g.isGmailFolder)&&(g.isUnpaddigFolder=!0))),g&&(g.collapsed(!nb.isFolderExpanded(g.fullNameHash)),!c&&f.Extended&&(f.Extended.Hash&&zb.cache().setFolderHash(g.fullNameRaw,f.Extended.Hash),nb.isNormal(f.Extended.MessageCount)&&g.messageCountAll(f.Extended.MessageCount),nb.isNormal(f.Extended.MessageUnseenCount)&&g.messageCountUnread(f.Extended.MessageUnseenCount)),i=f.SubFolders,i&&"Collection/FolderCollection"===i["@Object"]&&i["@Collection"]&&nb.isArray(i["@Collection"])&&g.subFolders(this.folderResponseParseRec(a,i["@Collection"],c)),j.push(g)));return j},_.prototype.setFolders=function(a,b){var c=[],d=!1,e=zb.data(),f=e.folderList(),g=0===f.length,h=function(a){return""===a||kb.Values.UnuseOptionValue===a||null!==zb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&nb.isArray(a.Result["@Collection"])&&(nb.isUnd(a.Result.Namespace)||(e.namespace=a.Result.Namespace),this.threading(!!zb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),c=this.folderResponseParseRec(e.namespace,a.Result["@Collection"],!!b),e.folderList(c),a.Result.SystemFolders&&""==""+zb.settingsGet("SentFolder")+zb.settingsGet("DraftFolder")+zb.settingsGet("SpamFolder")+zb.settingsGet("TrashFolder")&&(zb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),zb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),zb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),zb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),d=!0),e.sentFolder(h(zb.settingsGet("SentFolder"))),e.draftFolder(h(zb.settingsGet("DraftFolder"))),e.spamFolder(h(zb.settingsGet("SpamFolder"))),e.trashFolder(h(zb.settingsGet("TrashFolder"))),d&&zb.remote().saveSystemFolders(nb.emptyFunction,{SentFolder:e.sentFolder(),DraftFolder:e.draftFolder(),SpamFolder:e.spamFolder(),TrashFolder:e.trashFolder()}),b||zb.local().set(lb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash),g&&b&&zb.folders(!1))},_.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},_.prototype.setMessage=function(a,c){var d=!1,e=!1,f=!1,g=null,h=null,i="",j=this.messagesBodiesDom(),k=this.message();a&&k&&a.Result&&"Object/Message"===a.Result["@Object"]&&k.folderFullNameRaw===a.Result.Folder&&k.uid===a.Result.Uid&&(this.messageError(""),k.initUpdateByMessageJson(a.Result),zb.cache().addRequestedMessage(k.folderFullNameRaw,k.uid),c||k.initFlagsByJson(a.Result),j=j&&j[0]?j:null,j&&(i="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),h=j.find("#"+i),h&&h[0]?(h.data("rl-cache-count",++qb.iMessageBodyCacheCount),k.isRtl(!!h.data("rl-is-rtl")),k.isHtml(!!h.data("rl-is-html")),k.hasImages(!!h.data("rl-has-images")),k.body=h):(e=!!a.Result.HasExternals,f=!!a.Result.HasInternals,g=b('').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++qb.iMessageBodyCacheCount),nb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):nb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,g.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,a.Result.Rtl&&(g.data("rl-is-rtl",!0),g.addClass("rtl-text-part")),j.append(g),g.data("rl-is-html",d),g.data("rl-has-images",e),k.isRtl(!!g.data("rl-is-rtl")),k.isHtml(!!g.data("rl-is-html")),k.hasImages(!!g.data("rl-has-images")),k.body=g,f&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),g&&nb.initBlockquoteSwitcher(g)),zb.cache().initMessageFlagsFromCache(k),k.unseen()&&zb.setMessageSeen(k),nb.windowResize())},_.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&nb.isArray(a.Result["@Collection"])){var c=zb.data(),d=zb.cache(),e=null,f=0,g=0,h=0,i=0,j=[],k=c.staticMessageList,l=null,m=null,n=null,o=0,p=!1;for(h=nb.pInt(a.Result.MessageResultCount),i=nb.pInt(a.Result.Offset),nb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),n=zb.cache().getFolderFromCacheList(nb.isNormal(a.Result.Folder)?a.Result.Folder:""),n&&!b&&(zb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),nb.isNormal(a.Result.MessageCount)&&n.messageCountAll(a.Result.MessageCount),nb.isNormal(a.Result.MessageUnseenCount)&&(nb.pInt(n.messageCountUnread())!==nb.pInt(a.Result.MessageUnseenCount)&&(p=!0),n.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(n.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),p&&n&&zb.cache().clearMessageFlagsFromCacheByFolder(n.fullNameRaw),f=0,g=a.Result["@Collection"].length;g>f;f++)l=a.Result["@Collection"][f],l&&"Object/Message"===l["@Object"]&&(m=k[f],m&&m.initByJson(l)||(m=w.newInstanceFromJson(l)),m&&(d.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=o&&(o++,m.newForAnimation(!0)),m.deleted(!1),b?zb.cache().initMessageFlagsFromCache(m):zb.cache().storeMessageFlagsToCache(m),m.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/"+pb.urlsafe_encode([b,c,zb.data().projectHash(),zb.data().threading()&&zb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},bb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},bb.prototype.folderInformation=function(a,b,c){var d=!0,e=zb.cache(),f=[];nb.isArray(c)&&0 ").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=zb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),sb.delegateRun(e,"onBuild",[i])):nb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(sb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),sb.delegateRun(d.oCurrentSubScreen,"onShow"),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)),nb.windowResize()})):sb.setHash(zb.link().settings(),!1,!0)},eb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(sb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},eb.prototype.onBuild=function(){h.each(rb.settings,function(a){a&&a.__rlSettingsData&&!h.find(rb["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(rb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},eb.prototype.routes=function(){var a=h.find(rb.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=nb.isUnd(c.subname)?b:nb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(fb.prototype,q.prototype),fb.prototype.onShow=function(){zb.setTitle(nb.i18n("TITLES/LOGIN"))},h.extend(gb.prototype,q.prototype),gb.prototype.oLastRoute={},gb.prototype.onShow=function(){var a=zb.data().accountEmail();zb.setTitle((""===a?"":a+" - ")+nb.i18n("TITLES/MAILBOX"))},gb.prototype.onRoute=function(a,b,c){var d=zb.data(),e=zb.cache().getFolderFullNameRaw(a),f=zb.cache().getFolderFromCacheList(e);f&&(d.currentFolder(f).messageListPage(b).messageListSearch(c),!d.usePreviewPane()&&d.message()&&d.message(null),zb.reloadMessageList())},gb.prototype.onStart=function(){var b=zb.data(),c=function(){nb.windowResize()};(zb.settingsGet("AllowAdditionalAccounts")||zb.settingsGet("AllowIdentities"))&&zb.accountsAndIdentities(),h.delay(function(){zb.quota()},5e3),h.delay(function(){"INBOX"!==b.currentFolderFullNameRaw()&&zb.folderInformation("INBOX")},1e3),h.delay(function(){var a=zb.data().spamFolder();a!==b.currentFolderFullNameRaw()&&zb.folderInformation(a)},1500),h.delay(function(){var a=zb.data().draftFolder();a!==b.currentFolderFullNameRaw()&&zb.folderInformation(a)},2e3),h.delay(function(){zb.remote().appDelayStart(nb.emptyFunction)},35e3),a.setInterval(function(){zb.folderInformation("INBOX")},12e4),a.setInterval(function(){zb.quota()},3e5),vb.toggleClass("rl-no-preview-pane",!b.usePreviewPane()),b.folderList.subscribe(c),b.messageList.subscribe(c),b.message.subscribe(c),b.usePreviewPane.subscribe(function(a){vb.toggleClass("rl-no-preview-pane",!a)})},gb.prototype.onBuild=function(){qb.bMobileDevice||h.defer(function(){nb.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",350,800,350,350,lb.ClientSideKeyName.MailBoxListSize)})},gb.prototype.routes=function(){var a=function(a,b){return b[0]=nb.pString(b[0]),b[1]=nb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=nb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2])]},b=function(a,b){return b[0]=nb.pString(b[0]),b[1]=nb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:b}],[/^([^\/]*)$/,{normalize_:a}]]},h.extend(hb.prototype,eb.prototype),hb.prototype.onShow=function(){zb.setTitle(this.sSettingsTitle)},h.extend(ib.prototype,o.prototype),ib.prototype.oSettings=null,ib.prototype.oLink=null,ib.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):(qb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},ib.prototype.link=function(){return null===this.oLink&&(this.oLink=new i),this.oLink},ib.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new n),this.oLocal},ib.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=nb.isNormal(tb)?tb:{}),nb.isUnd(this.oSettings[a])?null:this.oSettings[a]},ib.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=nb.isNormal(tb)?tb:{}),this.oSettings[a]=b},ib.prototype.setTitle=function(b){b=(0