").addClass("rl-view-model").addClass("RL-"+d.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+d.viewModelTemplate()+'"}, i18nInit: true'),s.appendTo(g),d.viewModelDom=s,a.__dom=s,"Popups"===l&&(d.cancelCommand=d.closeCommand=c.createCommand(d,function(){r.hideScreenPopup(a)})),x.runHook("view-model-pre-build",[a.__name,d,s]),e.applyBindings(d,
-s[0]),this.delegateRun(d,"onBuild",[s]),x.runHook("view-model-post-build",[a.__name,d,s])):c.log("Cannot find view model position: "+l)}return a?a.__vm:null};E.prototype.applyExternal=function(a,b){a&&b&&e.applyBindings(a,b)};E.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")}))};E.prototype.showScreenPopup=function(a,b){a&&
+function(){return this.sScreenName};J.prototype.routes=function(){return null};J.prototype.__cross=function(){return this.oCross};J.prototype.__start=function(){var a=this.routes(),b=null,d=null;c.isNonEmptyArray(a)&&(d=i.bind(this.onRoute||c.emptyFunction,this),b=Ta.create(),i.each(a,function(a){b.addRoute(a[0],d).rules=a[1]}),this.oCross=b)};E.prototype.sDefaultScreenName="";E.prototype.oScreens={};E.prototype.oBoot=null;E.prototype.oCurrentScreen=null;E.prototype.showLoading=function(){j("#rl-loading").show()};
+E.prototype.hideLoading=function(){j("#rl-loading").hide()};E.prototype.routeOff=function(){P.changed.active=!1};E.prototype.routeOn=function(){P.changed.active=!0};E.prototype.setBoot=function(a){c.isNormal(a)&&(this.oBoot=a);return this};E.prototype.screen=function(a){return""!==a&&!c.isUnd(this.oScreens[a])?this.oScreens[a]:null};E.prototype.delegateRun=function(a,b,d){a&&a[b]&&a[b].apply(a,c.isArray(d)?d:[])};E.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var d=new a(b),l=d.viewModelPosition(),
+g=j("#rl-content #rl-"+l.toLowerCase()),q=null;a.__builded=!0;a.__vm=d;d.data=f.data();d.viewModelName=a.__name;g&&1===g.length?(q=j("
").addClass("rl-view-model").addClass("RL-"+d.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+d.viewModelTemplate()+'"}, i18nInit: true'),q.appendTo(g),d.viewModelDom=q,a.__dom=q,"Popups"===l&&(d.cancelCommand=d.closeCommand=c.createCommand(d,function(){s.hideScreenPopup(a)})),x.runHook("view-model-pre-build",[a.__name,d,q]),e.applyBindings(d,
+q[0]),this.delegateRun(d,"onBuild",[q]),x.runHook("view-model-post-build",[a.__name,d,q])):c.log("Cannot find view model position: "+l)}return a?a.__vm:null};E.prototype.applyExternal=function(a,b){a&&b&&e.applyBindings(a,b)};E.prototype.hideScreenPopup=function(a){a&&(a.__vm&&a.__dom)&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),i.defer(function(){a.__dom.find(".ko-select2").select2("close")}))};E.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),x.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};E.prototype.screenOnRoute=function(a,b){var d=this,f=null,e=null;""===c.pString(a)&&(a=this.sDefaultScreenName);if(""!==a){f=this.screen(a);if(!f&&(f=this.screen(this.sDefaultScreenName)))b=a+"/"+b,a=this.sDefaultScreenName;f&&f.__started&&(f.__builded||(f.__builded=!0,c.isNonEmptyArray(f.viewModels())&&
-h.each(f.viewModels(),function(a){this.buildViewModel(a,f)},this),this.delegateRun(f,"onBuild")),h.defer(function(){if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onHide");c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&h.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);d.delegateRun(a.__vm,"onHide")}})}d.oCurrentScreen=f;if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onShow");x.runHook("screen-on-show",
-[d.oCurrentScreen.screenName(),d.oCurrentScreen]);c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&h.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);d.delegateRun(a.__vm,"onShow");x.runHook("view-model-on-show",[a.__name,a.__vm])}},d)}(e=f.__cross())&&e.parse(b)}))}};E.prototype.startScreens=function(a){h.each(a,function(a){var d=(a=new a)?a.screenName():"";a&&""!==d&&(""===this.sDefaultScreenName&&
-(this.sDefaultScreenName=d),this.oScreens[d]=a)},this);h.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),x.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),x.runHook("screen-post-start",[a.screenName(),a]))},this);a=Ta.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this));P.initialized.add(a.parse,a);P.changed.add(a.parse,a);P.init()};E.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1):
-a;a="/"===a.substr(0,1)?a.substr(1):a;(c.isUnd(b)?0:b)?(P.changed.active=!1,P.setHash(a),P.changed.active=!0):(P.changed.active=!0,P.setHash(a))};E.prototype.bootstart=function(){this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart();return this};r=new E;F.newInstanceFromJson=function(a){var b=new F;return b.initByJson(a)?b:null};F.prototype.name="";F.prototype.email="";F.prototype.privateType=null;F.prototype.validate=function(){return""!==this.name||""!==this.email};F.prototype.hash=function(a){return"#"+
+i.each(f.viewModels(),function(a){this.buildViewModel(a,f)},this),this.delegateRun(f,"onBuild")),i.defer(function(){if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onHide");c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);d.delegateRun(a.__vm,"onHide")}})}d.oCurrentScreen=f;if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onShow");x.runHook("screen-on-show",
+[d.oCurrentScreen.screenName(),d.oCurrentScreen]);c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);d.delegateRun(a.__vm,"onShow");x.runHook("view-model-on-show",[a.__name,a.__vm])}},d)}(e=f.__cross())&&e.parse(b)}))}};E.prototype.startScreens=function(a){i.each(a,function(a){var d=(a=new a)?a.screenName():"";a&&""!==d&&(""===this.sDefaultScreenName&&
+(this.sDefaultScreenName=d),this.oScreens[d]=a)},this);i.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),x.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),x.runHook("screen-post-start",[a.screenName(),a]))},this);a=Ta.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));P.initialized.add(a.parse,a);P.changed.add(a.parse,a);P.init()};E.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1):
+a;a="/"===a.substr(0,1)?a.substr(1):a;(c.isUnd(b)?0:b)?(P.changed.active=!1,P.setHash(a),P.changed.active=!0):(P.changed.active=!0,P.setHash(a))};E.prototype.bootstart=function(){this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart();return this};s=new E;F.newInstanceFromJson=function(a){var b=new F;return b.initByJson(a)?b:null};F.prototype.name="";F.prototype.email="";F.prototype.privateType=null;F.prototype.validate=function(){return""!==this.name||""!==this.email};F.prototype.hash=function(a){return"#"+
(a?"":this.name)+"#"+this.email+"#"};F.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};F.prototype.type=function(){if(null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=g.EmailType.Facebook),null===this.privateType))this.privateType=g.EmailType.Default;return this.privateType};F.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};F.prototype.parse=function(a){var a=c.trim(a),
b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g.exec(a);b?(this.name=b[1]||"",this.email=b[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)};F.prototype.initByJson=function(a){var b=!1;a&&"Object/Email"===a["@Object"]&&(this.name=c.trim(a.Name),this.email=c.trim(a.Email),b=""!==this.email,this.clearDuplicateName());return b};F.prototype.toLine=function(a,b){var d="";""!==this.email&&(b=c.isUnd(b)?!1:!!b,a&&""!==this.name?d=b?'
")+'" target="_blank" tabindex="-1">'+c.encodeHtml(this.name)+"":this.name:(d=this.email,""!==this.name?d=b?c.encodeHtml('"'+this.name+'" <')+'
")+'" target="_blank" tabindex="-1">'+c.encodeHtml(d)+""+c.encodeHtml(">"):'"'+this.name+'" <'+d+">":b&&(d='
'+c.encodeHtml(this.email)+"")));return d};F.prototype.select2Result=function(){var a=
"",b=f.cache().getUserPic(this.email),a=""!==b?a+('
+')
'):a+('
.emptyContactPic()+')
');g.EmailType.Facebook===this.type()?(a+=""+(0
'):a+=""+(0
('+this.name+")":this.email);return a+""};F.prototype.select2Selection=
-function(a){var b="";if(g.EmailType.Facebook===this.type()){if(b=0").text(b).appendTo(a),a.append(''),null}else b=0").text(b).appendTo(a),a.append(''),null}else b=0+$/,""),b=!0);return b};D.prototype.isImage=function(){return"image/"===this.mimeType.substr(0,6)};D.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)};D.prototype.linkDownload=function(){return f.link().attachmentDownload(this.download)};D.prototype.linkPreview=
-function(){return f.link().attachmentPreview(this.download)};D.prototype.linkPreviewAsPlain=function(){return f.link().attachmentPreviewAsPlain(this.download)};D.prototype.generateTransferDownloadUrl=function(){var a=this.linkDownload();"http"!==a.substr(0,4)&&(a=j.location.protocol+"//"+j.location.host+j.location.pathname+a);return this.mimeType+":"+this.fileName+":"+a};D.prototype.eventDragStart=function(a,b){var d=b.originalEvent||b;a&&(d&&d.dataTransfer&&d.dataTransfer.setData)&&d.dataTransfer.setData("DownloadURL",
+function(){return f.link().attachmentPreview(this.download)};D.prototype.linkPreviewAsPlain=function(){return f.link().attachmentPreviewAsPlain(this.download)};D.prototype.generateTransferDownloadUrl=function(){var a=this.linkDownload();"http"!==a.substr(0,4)&&(a=h.location.protocol+"//"+h.location.host+h.location.pathname+a);return this.mimeType+":"+this.fileName+":"+a};D.prototype.eventDragStart=function(a,b){var d=b.originalEvent||b;a&&(d&&d.dataTransfer&&d.dataTransfer.setData)&&d.dataTransfer.setData("DownloadURL",
this.generateTransferDownloadUrl());return!0};D.prototype.iconClass=function(){var a=this.mimeType.toLocaleString().split("/"),b="icon-file";a&&a[1]&&("image"===a[0]?b="icon-image":"text"===a[0]?b="icon-file-xml":"audio"===a[0]?b="icon-music":"video"===a[0]?b="icon-film":-1+$/,""),b=h.find(d,function(b){return a===b.cidWithOutTags}));return b||null};m.prototype.messageId=function(){return this.sMessageId};m.prototype.inReplyTo=function(){return this.sInReplyTo};m.prototype.references=function(){return this.sReferences};m.prototype.fromAsSingleEmail=function(){return c.isArray(this.from)&&
+function(){return!!i.find(this.attachments(),function(a){return!a.isLinked})};m.prototype.findAttachmentByCid=function(a){var b=null,d=this.attachments();c.isNonEmptyArray(d)&&(a=a.replace(/^<+/,"").replace(/>+$/,""),b=i.find(d,function(b){return a===b.cidWithOutTags}));return b||null};m.prototype.messageId=function(){return this.sMessageId};m.prototype.inReplyTo=function(){return this.sInReplyTo};m.prototype.references=function(){return this.sReferences};m.prototype.fromAsSingleEmail=function(){return c.isArray(this.from)&&
this.from[0]?this.from[0].email:""};m.prototype.viewLink=function(){return f.link().messageViewLink(this.requestHash)};m.prototype.downloadLink=function(){return f.link().messageDownloadLink(this.requestHash)};m.prototype.replyEmails=function(a){var b=[],a=c.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a,b);return b};m.prototype.replyAllEmails=function(a){var b=[],d=[],a=c.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a,
-b);m.replyHelper(this.to,a,b);m.replyHelper(this.cc,a,d);return[b,d]};m.prototype.textBodyToString=function(){return this.body?this.body.html():""};m.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0
"+k+":
"+o+"
";break;case g.ComposeType.Forward:K=q.fromToLine(!1,!0);s=q.toToLine(!1,!0);w=q.ccToLine(!1,!0);o="
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+K+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+s+(0"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+w:"")+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+
-": "+c.encodeHtml(k)+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+c.encodeHtml(j)+"
"+o;break;case g.ComposeType.ForwardAsAttachment:o=""}this.oEditor.setRawText(o,q.isHtml)}}else this.oEditor&&g.ComposeType.Empty===a?this.oEditor.setRawText("
"+c.convertPlainTextToHtml(f.data().signature()),g.EditorDefaultType.Html===f.data().editorDefaultType()):c.isNonEmptyArray(b)&&h.each(b,function(a){e.addMessageAsAttachment(a)});q=this.getAttachmentsDownloadsForUpload();c.isNonEmptyArray(q)&&
-f.remote().messageUploadAttachments(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result){var d=null,c="";if(!e.viewModelVisibility())for(c in b.Result)b.Result.hasOwnProperty(c)&&(d=e.getAttachmentById(b.Result[c]))&&d.tempName(c)}else e.setMessageAttachmentFailedDowbloadText()},q);this.triggerForResize()};y.prototype.onBuild=function(){this.initEditor();this.initUploader();var a=this,b=null;R.on("keydown",function(b){var c=!0;b&&(a.modalVisibility()&&f.data().useKeyboardShortcuts())&&(b.ctrlKey&&
-g.EventKeyCode.S===b.keyCode)&&(a.saveCommand(),c=!1);return c});R.on("resize",function(){a.triggerForResize()});this.dropboxEnabled()&&(b=document.createElement("script"),b.type="text/javascript",b.src="https://www.dropbox.com/static/api/1/dropins.js",i(b).attr("id","dropboxjs").attr("data-app-key",f.settingsGet("DropboxApiKey")),document.body.appendChild(b))};y.prototype.getAttachmentById=function(a){for(var b=this.attachments(),d=0,c=b.length;d
"+k+":
"+o+"
";break;case g.ComposeType.Forward:K=r.fromToLine(!1,!0);q=r.toToLine(!1,!0);w=r.ccToLine(!1,!0);o="
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+K+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+q+(0"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+w:"")+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+
+": "+c.encodeHtml(k)+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+c.encodeHtml(h)+"
"+o;break;case g.ComposeType.ForwardAsAttachment:o=""}this.oEditor.setRawText(o,r.isHtml)}}else this.oEditor&&g.ComposeType.Empty===a?this.oEditor.setRawText("
"+c.convertPlainTextToHtml(f.data().signature()),g.EditorDefaultType.Html===f.data().editorDefaultType()):c.isNonEmptyArray(b)&&i.each(b,function(a){e.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload();c.isNonEmptyArray(r)&&
+f.remote().messageUploadAttachments(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result){var d=null,c="";if(!e.viewModelVisibility())for(c in b.Result)b.Result.hasOwnProperty(c)&&(d=e.getAttachmentById(b.Result[c]))&&d.tempName(c)}else e.setMessageAttachmentFailedDowbloadText()},r);this.triggerForResize()};y.prototype.onBuild=function(){this.initEditor();this.initUploader();var a=this,b=null;R.on("keydown",function(b){var c=!0;b&&(a.modalVisibility()&&f.data().useKeyboardShortcuts())&&(b.ctrlKey&&
+g.EventKeyCode.S===b.keyCode)&&(a.saveCommand(),c=!1);return c});R.on("resize",function(){a.triggerForResize()});this.dropboxEnabled()&&(b=document.createElement("script"),b.type="text/javascript",b.src="https://www.dropbox.com/static/api/1/dropins.js",j(b).attr("id","dropboxjs").attr("data-app-key",f.settingsGet("DropboxApiKey")),document.body.appendChild(b))};y.prototype.getAttachmentById=function(a){for(var b=this.attachments(),d=0,c=b.length;d').hide(),c.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,h.html(a.Result.Html.toString()).addClass("b-text-part html")):c.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,h.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,j.append(h),h.data("rl-is-html",d),h.data("rl-has-images",
-e),k.isHtml(h.data("rl-is-html")),k.hasImages(h.data("rl-has-images")),k.body=h,g&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0)):(k.isHtml(e.data("rl-is-html")),k.hasImages(e.data("rl-has-images")),k.body=e),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),h&&c.initBlockquoteSwitcher(h);f.cache().initMessageFlagsFromCache(k);k.unseen()&&f.setMessageSeen(k);c.windowResize()}};T.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===
-a.Result["@Object"]&&a.Result["@Collection"]&&c.isArray(a.Result["@Collection"])){var d=f.data(),e=f.cache(),h=null,i=0,j=0,k=0,r=0,o=[],q=d.staticMessageList,t=null,p=null,n=null,u=0,v=!1,k=c.pInt(a.Result.MessageResultCount),r=c.pInt(a.Result.Offset);c.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(h=a.Result.LastCollapsedThreadUids);if((n=f.cache().getFolderFromCacheList(c.isNormal(a.Result.Folder)?a.Result.Folder:""))&&!b)f.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),c.isNormal(a.Result.MessageCount)&&
-n.messageCountAll(a.Result.MessageCount),c.isNormal(a.Result.MessageUnseenCount)&&(c.pInt(n.messageCountUnread())!==c.pInt(a.Result.MessageUnseenCount)&&(v=!0),n.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(n.fullNameRaw,a.Result.UidNext,a.Result.NewMessages);v&&n&&f.cache().clearMessageFlagsFromCacheByFolder(n.fullNameRaw);i=0;for(j=a.Result["@Collection"].length;i=u&&(u++,p.newForAnimation(!0)),p.deleted(!1),b?f.cache().initMessageFlagsFromCache(p):f.cache().storeMessageFlagsToCache(p),p.lastInCollapsedThread(h&&-1(new j.Date).getTime()-k);o&&s.oRequests[o]&&(s.oRequests[o].__aborted&&(f="abort"),s.oRequests[o]=null);s.defaultResponse(a,o,f,d,e,b)});o&&(0').hide(),c.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,i.html(a.Result.Html.toString()).addClass("b-text-part html")):c.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,i.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,h.append(i),i.data("rl-is-html",d),i.data("rl-has-images",
+e),k.isHtml(i.data("rl-is-html")),k.hasImages(i.data("rl-has-images")),k.body=i,g&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0)):(k.isHtml(e.data("rl-is-html")),k.hasImages(e.data("rl-has-images")),k.body=e),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),i&&c.initBlockquoteSwitcher(i);f.cache().initMessageFlagsFromCache(k);k.unseen()&&f.setMessageSeen(k);c.windowResize()}};T.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===
+a.Result["@Object"]&&a.Result["@Collection"]&&c.isArray(a.Result["@Collection"])){var d=f.data(),e=f.cache(),i=null,h=0,j=0,k=0,s=0,o=[],r=d.staticMessageList,t=null,p=null,n=null,u=0,v=!1,k=c.pInt(a.Result.MessageResultCount),s=c.pInt(a.Result.Offset);c.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(i=a.Result.LastCollapsedThreadUids);if((n=f.cache().getFolderFromCacheList(c.isNormal(a.Result.Folder)?a.Result.Folder:""))&&!b)f.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),c.isNormal(a.Result.MessageCount)&&
+n.messageCountAll(a.Result.MessageCount),c.isNormal(a.Result.MessageUnseenCount)&&(c.pInt(n.messageCountUnread())!==c.pInt(a.Result.MessageUnseenCount)&&(v=!0),n.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(n.fullNameRaw,a.Result.UidNext,a.Result.NewMessages);v&&n&&f.cache().clearMessageFlagsFromCacheByFolder(n.fullNameRaw);h=0;for(j=a.Result["@Collection"].length;h=u&&(u++,p.newForAnimation(!0)),p.deleted(!1),b?f.cache().initMessageFlagsFromCache(p):f.cache().storeMessageFlagsToCache(p),p.lastInCollapsedThread(i&&-1(new h.Date).getTime()-k);o&&q.oRequests[o]&&(q.oRequests[o].__aborted&&(f="abort"),q.oRequests[o]=null);q.defaultResponse(a,o,f,d,e,b)});o&&(0").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+
-g.__rlSettingsData.Template+'"}, i18nInit: true'),s.appendTo(j),d.data=f.data(),d.viewModelDom=s,d.__rlSettingsData=g.__rlSettingsData,g.__dom=s,g.__builded=!0,g.__vm=d,e.applyBindings(d,s[0]),r.delegateRun(d,"onBuild",[s])):c.log("Cannot find sub settings view model position: SettingsSubScreen"),d&&h.defer(function(){if(b.oCurrentSubScreen){r.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide()}b.oCurrentSubScreen=d;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();
-r.delegateRun(b.oCurrentSubScreen,"onShow");h.each(b.menu(),function(a){a.selected(d&&d.__rlSettingsData&&a.route===d.__rlSettingsData.Route)})}c.windowResize()}))};fa.prototype.onBuild=function(){h.each(Da,function(a){a&&(a.__rlSettingsData&&!h.find(Qa,function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:e.observable(!1),disabled:!!h.find(Ra,function(b){return b&&b===a})})},this)};fa.prototype.routes=function(){var a=h.find(Da,function(a){return a&&
-a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,f){f.subname=c.isUnd(f.subname)?b:c.pString(f.subname);return[f.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};h.extend(Aa.prototype,J.prototype);Aa.prototype.onShow=function(){f.setTitle(c.i18n("TITLES/LOGIN"))};h.extend(V.prototype,J.prototype);V.prototype.oLastRoute={};V.prototype.onShow=function(){var a=f.data().accountEmail();f.setTitle((""===a?"":a+
+(this.oMessageFlagsCache[a]={});this.oMessageFlagsCache[a][b]=c};v.prototype.clearMessageFlagsFromCacheByFolder=function(a){this.oMessageFlagsCache[a]={}};v.prototype.initMessageFlagsFromCache=function(a){if(a){var b=this,d=this.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid),f=null,e=null;d&&4===d.length&&(a.unseen(d[0]),a.flagged(d[1]),a.answered(d[2]),a.forwarded(d[3]));0
").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+
+g.__rlSettingsData.Template+'"}, i18nInit: true'),q.appendTo(h),d.data=f.data(),d.viewModelDom=q,d.__rlSettingsData=g.__rlSettingsData,g.__dom=q,g.__builded=!0,g.__vm=d,e.applyBindings(d,q[0]),s.delegateRun(d,"onBuild",[q])):c.log("Cannot find sub settings view model position: SettingsSubScreen"),d&&i.defer(function(){if(b.oCurrentSubScreen){s.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide()}b.oCurrentSubScreen=d;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();
+s.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),function(a){a.selected(d&&d.__rlSettingsData&&a.route===d.__rlSettingsData.Route)})}c.windowResize()}))};fa.prototype.onBuild=function(){i.each(Da,function(a){a&&(a.__rlSettingsData&&!i.find(Qa,function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:e.observable(!1),disabled:!!i.find(Ra,function(b){return b&&b===a})})},this)};fa.prototype.routes=function(){var a=i.find(Da,function(a){return a&&
+a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,f){f.subname=c.isUnd(f.subname)?b:c.pString(f.subname);return[f.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(Aa.prototype,J.prototype);Aa.prototype.onShow=function(){f.setTitle(c.i18n("TITLES/LOGIN"))};i.extend(V.prototype,J.prototype);V.prototype.oLastRoute={};V.prototype.onShow=function(){var a=f.data().accountEmail();f.setTitle((""===a?"":a+
" - ")+c.i18n("TITLES/MAILBOX"));this.mailBoxScreenVisibily(!0)};V.prototype.onHide=function(){this.mailBoxScreenVisibily(!1)};V.prototype.onRoute=function(a,b,c){var e=f.data(),a=f.cache().getFolderFullNameRaw(a);if(a=f.cache().getFolderFromCacheList(a))e.currentFolder(a).messageListPage(b).messageListSearch(c),!e.usePreviewPane()&&e.message()&&e.message(null),f.reloadMessageList()};V.prototype.onStart=function(){var a=f.data(),b=function(){c.windowResize()};f.settingsGet("AllowAdditionalAccounts")&&
-f.accounts();h.delay(function(){f.quota()},5E3);h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&f.folderInformation("INBOX")},1E3);h.delay(function(){f.remote().appDelayStart(c.emptyFunction)},35E3);j.setInterval(function(){f.folderInformation("INBOX")},12E4);j.setInterval(function(){f.quota()},3E5);Z.toggleClass("rl-no-preview-pane",!a.usePreviewPane());a.folderList.subscribe(b);a.messageList.subscribe(b);a.message.subscribe(b);a.usePreviewPane.subscribe(function(b){Z.toggleClass("rl-no-preview-pane",
-!b);a.messageList.valueHasMutated()})};V.prototype.onBuild=function(){h.defer(h.bind(function(){c.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",this.resizeTrigger)},this))};V.prototype.routes=function(){var a=function(a,d){d[0]=c.pString(d[0]);d[1]=c.pInt(d[1]);d[1]=0>=d[1]?1:d[1];d[2]=c.pString(d[2]);""===a&&(d[0]="Inbox",d[1]=1);return[decodeURI(d[0]),d[1],decodeURI(d[2])]};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_:function(a,d){d[0]=c.pString(d[0]);d[1]=c.pString(d[1]);""===a&&(d[0]="Inbox");return[decodeURI(d[0]),1,decodeURI(d[1])]}}],[/^([^\/]*)$/,{normalize_:a}]]};h.extend(Oa.prototype,fa.prototype);Oa.prototype.onShow=function(){f.setTitle(this.sSettingsTitle)};h.extend(I.prototype,Ua.prototype);I.prototype.oSettings=null;I.prototype.oLink=null;I.prototype.download=function(a){na?this.iframe.attr("src",a):j.open(a)};I.prototype.link=function(){null===
+f.accounts();i.delay(function(){f.quota()},5E3);i.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&f.folderInformation("INBOX")},1E3);i.delay(function(){f.remote().appDelayStart(c.emptyFunction)},35E3);h.setInterval(function(){f.folderInformation("INBOX")},12E4);h.setInterval(function(){f.quota()},3E5);Z.toggleClass("rl-no-preview-pane",!a.usePreviewPane());a.folderList.subscribe(b);a.messageList.subscribe(b);a.message.subscribe(b);a.usePreviewPane.subscribe(function(b){Z.toggleClass("rl-no-preview-pane",
+!b);a.messageList.valueHasMutated()})};V.prototype.onBuild=function(){i.defer(i.bind(function(){c.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",this.resizeTrigger)},this))};V.prototype.routes=function(){var a=function(a,d){d[0]=c.pString(d[0]);d[1]=c.pInt(d[1]);d[1]=0>=d[1]?1:d[1];d[2]=c.pString(d[2]);""===a&&(d[0]="Inbox",d[1]=1);return[decodeURI(d[0]),d[1],decodeURI(d[2])]};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_:function(a,d){d[0]=c.pString(d[0]);d[1]=c.pString(d[1]);""===a&&(d[0]="Inbox");return[decodeURI(d[0]),1,decodeURI(d[1])]}}],[/^([^\/]*)$/,{normalize_:a}]]};i.extend(Oa.prototype,fa.prototype);Oa.prototype.onShow=function(){f.setTitle(this.sSettingsTitle)};i.extend(I.prototype,Ua.prototype);I.prototype.oSettings=null;I.prototype.oLink=null;I.prototype.download=function(a){na?this.iframe.attr("src",a):h.open(a)};I.prototype.link=function(){null===
this.oLink&&(this.oLink=new B);return this.oLink};I.prototype.local=function(){null===this.oLocal&&(this.oLocal=new ua);return this.oLocal};I.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=c.isNormal(Ba)?Ba:{});return c.isUnd(this.oSettings[a])?null:this.oSettings[a]};I.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=c.isNormal(Ba)?Ba:{});this.oSettings[a]=b};I.prototype.setTitle=function(a){a=(0