diff --git a/dev/ViewModels/MailBoxMessageListViewModel.js b/dev/ViewModels/MailBoxMessageListViewModel.js index b177eff1b..0439bdcaa 100644 --- a/dev/ViewModels/MailBoxMessageListViewModel.js +++ b/dev/ViewModels/MailBoxMessageListViewModel.js @@ -507,6 +507,68 @@ MailBoxMessageListViewModel.prototype.listUnsetFlags = function () this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, RL.data().messageListCheckedOrSelected()); }; +MailBoxMessageListViewModel.prototype.flagMessages = function (oCurrentMessage) +{ + var + aChecked = this.messageListCheckedOrSelected(), + aCheckedUids = [] + ; + + if (oCurrentMessage) + { + if (0 < aChecked.length) + { + aCheckedUids = _.map(aChecked, function (oMessage) { + return oMessage.uid; + }); + } + + if (0 < aCheckedUids.length && -1 < Utils.inArray(oCurrentMessage.uid, aCheckedUids)) + { + this.setAction(oCurrentMessage.folderFullNameRaw, oCurrentMessage.flagged() ? + Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked); + } + else + { + this.setAction(oCurrentMessage.folderFullNameRaw, oCurrentMessage.flagged() ? + Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oCurrentMessage]); + } + } +}; + +MailBoxMessageListViewModel.prototype.flagMessagesFast = function () +{ + var + aChecked = this.messageListCheckedOrSelected(), + aFlagged = [] + ; + + if (0 < aChecked.length) + { + aFlagged = _.filter(aChecked, function (oMessage) { + return oMessage.flagged(); + }); + + this.setAction(aChecked[0].folderFullNameRaw, + aChecked.length === aFlagged.length ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked); + } +}; + +MailBoxMessageListViewModel.prototype.seenMessagesFast = function () +{ + var + aChecked = this.messageListCheckedOrSelected(), + aUnseen = [] + ; + + aUnseen = _.filter(aChecked, function (oMessage) { + return oMessage.unseen(); + }); + + this.setAction(aChecked[0].folderFullNameRaw, + 0 < aUnseen.length ? Enums.MessageSetAction.SetSeen : Enums.MessageSetAction.UnsetSeen, aChecked); +}; + MailBoxMessageListViewModel.prototype.onBuild = function (oDom) { var @@ -572,33 +634,7 @@ MailBoxMessageListViewModel.prototype.onBuild = function (oDom) self.checkAll(!self.checkAll()); }) .on('click', '.messageList .messageListItem .flagParent', function () { - - var - oMessage = ko.dataFor(this), - aChecked = oData.messageListCheckedOrSelected(), - aCheckedUids = [] - ; - - if (oMessage) - { - if (0 < aChecked.length) - { - aCheckedUids = _.map(aChecked, function (oMessage) { - return oMessage.uid; - }); - } - - if (0 < aCheckedUids.length && -1 < Utils.inArray(oMessage.uid, aCheckedUids)) - { - self.setAction(oMessage.folderFullNameRaw, oMessage.flagged() ? - Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked); - } - else - { - self.setAction(oMessage.folderFullNameRaw, oMessage.flagged() ? - Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]); - } - } + self.flagMessages(ko.dataFor(this)); }) ; @@ -668,6 +704,24 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function () } }); + // star/flag messages + key('s', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts()) + { + self.flagMessagesFast(); + return false; + } + }); + + // mark as read/unread + key('m', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts()) + { + self.seenMessagesFast(); + return false; + } + }); + // shortcuts help key('shift+/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts()) @@ -677,6 +731,14 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function () } }); + key('shift+f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts()) + { + self.multyForwardCommand(); + return false; + } + }); + // search input focus key('/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts()) diff --git a/dev/ViewModels/MailBoxMessageViewViewModel.js b/dev/ViewModels/MailBoxMessageViewViewModel.js index 64b00a881..2e50f565c 100644 --- a/dev/ViewModels/MailBoxMessageViewViewModel.js +++ b/dev/ViewModels/MailBoxMessageViewViewModel.js @@ -415,8 +415,8 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // reply - key('r', Enums.KeyState.MessageView, function () { - if (oData.useKeyboardShortcuts()) + key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts() && oData.message()) { self.replyCommand(); return false; @@ -424,8 +424,8 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // replaAll - key('a', Enums.KeyState.MessageView, function () { - if (oData.useKeyboardShortcuts()) + key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts() && oData.message()) { self.replyAllCommand(); return false; @@ -433,8 +433,8 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // forward - key('f', Enums.KeyState.MessageView, function () { - if (oData.useKeyboardShortcuts()) + key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts() && oData.message()) { self.forwardCommand(); return false; @@ -442,7 +442,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // message information - key('i', Enums.KeyState.MessageView, function () { + key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts()) { self.showFullInfo(!self.showFullInfo()); @@ -451,7 +451,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // toggle message blockquotes - key('b', Enums.KeyState.MessageView, function () { + key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts() && oData.message() && oData.message().body) { Utils.toggleMessageBlockquote(oData.message().body); @@ -488,15 +488,6 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () } }); - // archive -// key('delete', Enums.KeyState.MessageView, function () { -// if (oData.useKeyboardShortcuts()) -// { -// self.archiveCommand(); -// return false; -// } -// }); - // delete key('delete, shift+delete', Enums.KeyState.MessageView, function (event, handler) { if (oData.useKeyboardShortcuts() && event) diff --git a/rainloop/v/0.0.0/static/js/app.js b/rainloop/v/0.0.0/static/js/app.js index 92079af7c..985045321 100644 --- a/rainloop/v/0.0.0/static/js/app.js +++ b/rainloop/v/0.0.0/static/js/app.js @@ -12273,6 +12273,68 @@ MailBoxMessageListViewModel.prototype.listUnsetFlags = function () this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, RL.data().messageListCheckedOrSelected()); }; +MailBoxMessageListViewModel.prototype.flagMessages = function (oCurrentMessage) +{ + var + aChecked = this.messageListCheckedOrSelected(), + aCheckedUids = [] + ; + + if (oCurrentMessage) + { + if (0 < aChecked.length) + { + aCheckedUids = _.map(aChecked, function (oMessage) { + return oMessage.uid; + }); + } + + if (0 < aCheckedUids.length && -1 < Utils.inArray(oCurrentMessage.uid, aCheckedUids)) + { + this.setAction(oCurrentMessage.folderFullNameRaw, oCurrentMessage.flagged() ? + Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked); + } + else + { + this.setAction(oCurrentMessage.folderFullNameRaw, oCurrentMessage.flagged() ? + Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oCurrentMessage]); + } + } +}; + +MailBoxMessageListViewModel.prototype.flagMessagesFast = function () +{ + var + aChecked = this.messageListCheckedOrSelected(), + aFlagged = [] + ; + + if (0 < aChecked.length) + { + aFlagged = _.filter(aChecked, function (oMessage) { + return oMessage.flagged(); + }); + + this.setAction(aChecked[0].folderFullNameRaw, + aChecked.length === aFlagged.length ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked); + } +}; + +MailBoxMessageListViewModel.prototype.seenMessagesFast = function () +{ + var + aChecked = this.messageListCheckedOrSelected(), + aUnseen = [] + ; + + aUnseen = _.filter(aChecked, function (oMessage) { + return oMessage.unseen(); + }); + + this.setAction(aChecked[0].folderFullNameRaw, + 0 < aUnseen.length ? Enums.MessageSetAction.SetSeen : Enums.MessageSetAction.UnsetSeen, aChecked); +}; + MailBoxMessageListViewModel.prototype.onBuild = function (oDom) { var @@ -12338,33 +12400,7 @@ MailBoxMessageListViewModel.prototype.onBuild = function (oDom) self.checkAll(!self.checkAll()); }) .on('click', '.messageList .messageListItem .flagParent', function () { - - var - oMessage = ko.dataFor(this), - aChecked = oData.messageListCheckedOrSelected(), - aCheckedUids = [] - ; - - if (oMessage) - { - if (0 < aChecked.length) - { - aCheckedUids = _.map(aChecked, function (oMessage) { - return oMessage.uid; - }); - } - - if (0 < aCheckedUids.length && -1 < Utils.inArray(oMessage.uid, aCheckedUids)) - { - self.setAction(oMessage.folderFullNameRaw, oMessage.flagged() ? - Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked); - } - else - { - self.setAction(oMessage.folderFullNameRaw, oMessage.flagged() ? - Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]); - } - } + self.flagMessages(ko.dataFor(this)); }) ; @@ -12434,6 +12470,24 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function () } }); + // star/flag messages + key('s', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts()) + { + self.flagMessagesFast(); + return false; + } + }); + + // mark as read/unread + key('m', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts()) + { + self.seenMessagesFast(); + return false; + } + }); + // shortcuts help key('shift+/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts()) @@ -12443,6 +12497,14 @@ MailBoxMessageListViewModel.prototype.initShortcuts = function () } }); + key('shift+f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts()) + { + self.multyForwardCommand(); + return false; + } + }); + // search input focus key('/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts()) @@ -13017,8 +13079,8 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // reply - key('r', Enums.KeyState.MessageView, function () { - if (oData.useKeyboardShortcuts()) + key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts() && oData.message()) { self.replyCommand(); return false; @@ -13026,8 +13088,8 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // replaAll - key('a', Enums.KeyState.MessageView, function () { - if (oData.useKeyboardShortcuts()) + key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts() && oData.message()) { self.replyAllCommand(); return false; @@ -13035,8 +13097,8 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // forward - key('f', Enums.KeyState.MessageView, function () { - if (oData.useKeyboardShortcuts()) + key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { + if (oData.useKeyboardShortcuts() && oData.message()) { self.forwardCommand(); return false; @@ -13044,7 +13106,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // message information - key('i', Enums.KeyState.MessageView, function () { + key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts()) { self.showFullInfo(!self.showFullInfo()); @@ -13053,7 +13115,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () }); // toggle message blockquotes - key('b', Enums.KeyState.MessageView, function () { + key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { if (oData.useKeyboardShortcuts() && oData.message() && oData.message().body) { Utils.toggleMessageBlockquote(oData.message().body); @@ -13090,15 +13152,6 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function () } }); - // archive -// key('delete', Enums.KeyState.MessageView, function () { -// if (oData.useKeyboardShortcuts()) -// { -// self.archiveCommand(); -// return false; -// } -// }); - // delete key('delete, shift+delete', Enums.KeyState.MessageView, function (event, handler) { if (oData.useKeyboardShortcuts() && event) diff --git a/rainloop/v/0.0.0/static/js/app.min.js b/rainloop/v/0.0.0/static/js/app.min.js index 97e44104b..4b4dc5622 100644 --- a/rainloop/v/0.0.0/static/js/app.min.js +++ b/rainloop/v/0.0.0/static/js/app.min.js @@ -4,7 +4,7 @@ }function pb(){this.oRequests={}}function qb(){pb.call(this),this.oRequests={}}function rb(){this.oEmailsPicsHashes={},this.oServices={}}function sb(){rb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function tb(a){t.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function ub(){t.call(this,"login",[V])}function vb(){t.call(this,"mailbox",[X,Z,$,_]),this.oLastRoute={}}function wb(){tb.call(this,[Y,ab,bb]),Cb.initOnStartOrLangChange(function(){this.sSettingsTitle=Cb.i18n("TITLES/SETTINGS")},this,function(){Ob.setTitle(this.sSettingsTitle)})}function xb(){r.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=c.observableArray([]),this.popupVisibility=c.computed(function(){return 0').appendTo("body"),Lb.on("error",function(a){Ob&&a&&a.originalEvent&&a.originalEvent.message&&-1===Cb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Ob.remote().jsError(Cb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Kb.attr("class"),Cb.microtime()-Fb.now)})}function yb(){xb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=h.debounce(this.messagesMoveTrigger,500),a.setInterval(function(){Ob.pub("interval.30s")},3e4),a.setInterval(function(){Ob.pub("interval.1m")},6e4),a.setInterval(function(){Ob.pub("interval.2m")},12e4),a.setInterval(function(){Ob.pub("interval.3m")},18e4),a.setInterval(function(){Ob.pub("interval.5m")},3e5),a.setInterval(function(){Ob.pub("interval.10m")},6e5),b.wakeUp(function(){Ob.remote().jsVersion(function(b,c){Ab.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Ob.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Ob.settingsGet("Version"))},{},36e5)}var zb={},Ab={},Bb={},Cb={},Db={},Eb={},Fb={},Gb={settings:[],"settings-removed":[],"settings-disabled":[]},Hb=null,Ib=a.rainloopAppData||{},Jb=a.rainloopI18N||{},Kb=b("html"),Lb=b(a),Mb=b(a.document),Nb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Ob=null,Pb=b("
");Fb.now=(new Date).getTime(),Fb.momentTrigger=c.observable(!0),Fb.langChangeTrigger=c.observable(!0),Fb.iAjaxErrorCount=0,Fb.iTokenErrorCount=0,Fb.iMessageBodyCacheCount=0,Fb.bUnload=!1,Fb.sUserAgent=(navigator.userAgent||"").toLowerCase(),Fb.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},Cb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=Cb.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},Cb.timeOutAction=function(){var b={};return function(c,d,e){Cb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),Cb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),Cb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Fb.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),Cb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},Cb.i18n=function(a,b,c){var d="",e=Cb.isUnd(Jb[a])?Cb.isUnd(c)?a:c:Jb[a];if(!Cb.isUnd(b)&&!Cb.isNull(b))for(d in b)Cb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},Cb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(Cb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(Cb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",Cb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",Cb.i18n(c)))})})},Cb.i18nToDoc=function(){a.rainloopI18N&&(Jb=a.rainloopI18N||{},Cb.i18nToNode(Mb),Fb.langChangeTrigger(!Fb.langChangeTrigger())),a.rainloopI18N={}},Cb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Fb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Fb.langChangeTrigger.subscribe(a,b)},Cb.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)},Cb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},Cb.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},Cb.replySubjectAdd=function(b,c,d){var e=null,f=Cb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||Cb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||Cb.isUnd(e[1])||Cb.isUnd(e[2])||Cb.isUnd(e[3])?b+": "+c:e[1]+(Cb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(Cb.isUnd(d)?!0:d)?Cb.fixLongSubject(f):f},Cb.fixLongSubject=function(a){var b=0,c=null;a=Cb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||Cb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=Cb.isUnd(c[2])?1:0+Cb.pInt(c[2]),b+=Cb.isUnd(c[4])?1:0+Cb.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},Cb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Cb.friendlySize=function(a){return a=Cb.pInt(a),a>=1073741824?Cb.roundNumber(a/1073741824,1)+"GB":a>=1048576?Cb.roundNumber(a/1048576,1)+"MB":a>=1024?Cb.roundNumber(a/1024,0)+"KB":a+"B"},Cb.log=function(b){a.console&&a.console.log&&a.console.log(b)},Cb.getNotification=function(a,b){return a=Cb.pInt(a),Ab.Notification.ClientViewError===a&&b?b:Cb.isUnd(Bb[a])?"":Bb[a]},Cb.initNotificationLanguage=function(){Bb[Ab.Notification.InvalidToken]=Cb.i18n("NOTIFICATIONS/INVALID_TOKEN"),Bb[Ab.Notification.AuthError]=Cb.i18n("NOTIFICATIONS/AUTH_ERROR"),Bb[Ab.Notification.AccessError]=Cb.i18n("NOTIFICATIONS/ACCESS_ERROR"),Bb[Ab.Notification.ConnectionError]=Cb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Bb[Ab.Notification.CaptchaError]=Cb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Bb[Ab.Notification.SocialFacebookLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.SocialTwitterLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.SocialGoogleLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.DomainNotAllowed]=Cb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Bb[Ab.Notification.AccountNotAllowed]=Cb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Bb[Ab.Notification.AccountTwoFactorAuthRequired]=Cb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Bb[Ab.Notification.AccountTwoFactorAuthError]=Cb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Bb[Ab.Notification.CantGetMessageList]=Cb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Bb[Ab.Notification.CantGetMessage]=Cb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Bb[Ab.Notification.CantDeleteMessage]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Bb[Ab.Notification.CantMoveMessage]=Cb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Bb[Ab.Notification.CantCopyMessage]=Cb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Bb[Ab.Notification.CantSaveMessage]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Bb[Ab.Notification.CantSendMessage]=Cb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Bb[Ab.Notification.InvalidRecipients]=Cb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Bb[Ab.Notification.CantCreateFolder]=Cb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Bb[Ab.Notification.CantRenameFolder]=Cb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Bb[Ab.Notification.CantDeleteFolder]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Bb[Ab.Notification.CantDeleteNonEmptyFolder]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Bb[Ab.Notification.CantSubscribeFolder]=Cb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Bb[Ab.Notification.CantUnsubscribeFolder]=Cb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Bb[Ab.Notification.CantSaveSettings]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Bb[Ab.Notification.CantSavePluginSettings]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Bb[Ab.Notification.DomainAlreadyExists]=Cb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Bb[Ab.Notification.CantInstallPackage]=Cb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Bb[Ab.Notification.CantDeletePackage]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Bb[Ab.Notification.InvalidPluginPackage]=Cb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Bb[Ab.Notification.UnsupportedPluginPackage]=Cb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Bb[Ab.Notification.LicensingServerIsUnavailable]=Cb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Bb[Ab.Notification.LicensingExpired]=Cb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Bb[Ab.Notification.LicensingBanned]=Cb.i18n("NOTIFICATIONS/LICENSING_BANNED"),Bb[Ab.Notification.DemoSendMessageError]=Cb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Bb[Ab.Notification.AccountAlreadyExists]=Cb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Bb[Ab.Notification.MailServerError]=Cb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Bb[Ab.Notification.UnknownNotification]=Cb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Bb[Ab.Notification.UnknownError]=Cb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Cb.getUploadErrorDescByCode=function(a){var b="";switch(Cb.pInt(a)){case Ab.UploadErrorCode.FileIsTooBig:b=Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Ab.UploadErrorCode.FilePartiallyUploaded:b=Cb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Ab.UploadErrorCode.FileNoUploaded:b=Cb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Ab.UploadErrorCode.MissingTempFolder:b=Cb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Ab.UploadErrorCode.FileOnSaveingError:b=Cb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Ab.UploadErrorCode.FileType:b=Cb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=Cb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},Cb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=Cb.pInt(d),0>=d?a[b].apply(a,Cb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,Cb.isArray(c)?c:[])},d))},Cb.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===Ab.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===Ab.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},Cb.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=Cb.isUnd(d)?!0:d,e.canExecute=c.computed(Cb.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},Cb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(Ab.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(Ab.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Fb.sAnimationType=Ab.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(Ab.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return Ab.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Fb.bMobileDevice||a===Ab.InterfaceAnimation.None)Kb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Fb.sAnimationType=Ab.InterfaceAnimation.None;else switch(a){case Ab.InterfaceAnimation.Full:Kb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Fb.sAnimationType=a;break;case Ab.InterfaceAnimation.Normal:Kb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Fb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=Ab.DesktopNotifications.NotSupported;if(Nb&&Nb.permission)switch(Nb.permission.toLowerCase()){case"granted":c=Ab.DesktopNotifications.Allowed;break;case"denied":c=Ab.DesktopNotifications.Denied;break;case"default":c=Ab.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&Ab.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();Ab.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):Ab.DesktopNotifications.NotAllowed===c?Nb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),Ab.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1=b.diff(c,"hours")?d:b.format("L")===c.format("L")?Cb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?Cb.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},Cb.isFolderExpanded=function(a){var b=Ob.local().get(Ab.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},Cb.setExpandedFolder=function(a,b){var c=Ob.local().get(Ab.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Ob.local().set(Ab.ClientSideKeyName.ExpandedFolders,c)},Cb.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Ob.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Ob.local().set(d,b.size.width),f.css({left:""+b.size.width+"px"}))};null!==g&&(e.css({width:""+g+"px"}),f.css({left:""+g+"px"})),e.resizable({helper:"ui-resizable-helper",minWidth:120,maxWidth:400,handles:"e",stop:h})},Cb.initBlockquoteSwitcher=function(a){if(a){var c=b("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===b(this).parent().closest("blockquote",a).length});c&&0100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),Cb.windowResize()}).after("
").before("
"))})}},Cb.removeBlockquoteSwitcher=function(a){a&&(b(a).find("blockquote.rl-bq-switcher").each(function(){b(this).removeClass("rl-bq-switcher hidden-bq")}),b(a).find(".rlBlockquoteSwitcher").each(function(){b(this).remove()}))},Cb.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},Cb.extendAsViewModel=function(a,b,c){b&&(c||(c=s),b.__name=a,Db.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},Cb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Gb.settings.push(a)},Cb.removeSettingsViewModel=function(a){Gb["settings-removed"].push(a)},Cb.disableSettingsViewModel=function(a){Gb["settings-disabled"].push(a)},Cb.convertThemeName=function(a){return Cb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Cb.quoteName=function(a){return a.replace(/["]/g,'\\"')},Cb.microtime=function(){return(new Date).getTime()},Cb.convertLangName=function(a,b){return Cb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},Cb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=Cb.isUnd(a)?32:Cb.pInt(a);b.length/g,">").replace(/")},Cb.draggeblePlace=function(){return b('
 
').appendTo("#rl-hidden")},Cb.defautOptionsAfterRender=function(a,b){b&&!Cb.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},Cb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+Cb.fakeMd5()+"__",j=b("#"+d);a[i]=function(){if(h&&h.document.body&&j&&j[0]){var d=b(h.document.body);b("#rl-content",d).html(j.html()),b("html",h.document).addClass("external "+b("html").attr("class")),Cb.i18nToNode(d),u.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+Cb.encodeHtml(e)+'
'),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},Cb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=Cb.isUnd(d)?1e3:Cb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?Ab.SaveSettingsStep.TrueResult:Ab.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,Ab.SaveSettingsStep.Idle)},d)}},Cb.settingsSaveHelperSimpleFunction=function(a,b){return Cb.settingsSaveHelperFunction(null,a,b,1e3)},Cb.htmlToPlain=function(a){var c="",d="> ",e=function(){if(arguments&&1\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1]*>(.|[\s\S\r\n]*)<\/div>/gim,f),a="\n"+b.trim(a)+"\n"),a}return""},g=function(){return arguments&&1/g,">"):""},h=function(){if(arguments&&1/gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/]*>/gim,"\n_______________________________\n\n").replace(/]*>/gim,"").replace(/]*>(.|[\s\S\r\n]*)<\/div>/gim,f).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Cb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Cb.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},Cb.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:Cb.isUnd(c)?a.toString():c.toString(),custom:Cb.isUnd(c)?!1:!0,title:Cb.isUnd(c)?"":a.toString(),value:a.toString()};(Cb.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},Cb.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},Cb.disableKeyFilter=function(){a.key&&(j.filter=function(){return!0})},Cb.restoreKeyFilter=function(){a.key&&(j.filter=function(a){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)})},Eb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Eb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Eb._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Eb._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;cd?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!Fb.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top"; b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+Cb.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!Cb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!Cb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Fb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){Cb.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Cb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Cb.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=Cb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Cb.pInt(e[2]),g=Lb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!Fb.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),Cb.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),Cb.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null,!!a.shiftKey)},b(d).draggable(k).on("mousedown",function(){Cb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Fb.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){Fb.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append('  ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c();d.inputosaurus({parseOnBlur:!0,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Ob.getAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=Cb.trim(a),c=null;return""!==b?(c=new v,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(){d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(Cb.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},Cb.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Cb.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Cb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Cb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},k.prototype.root=function(){return this.sBase},k.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},k.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},k.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},k.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},k.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},k.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},k.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},k.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},k.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},k.prototype.settings=function(a){var b=this.sBase+"settings";return Cb.isUnd(a)||""===a||(b+="/"+a),b},k.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},k.prototype.mailBox=function(a,b,c){b=Cb.isNormal(b)?Cb.pInt(b):1,c=Cb.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},k.prototype.phpInfo=function(){return this.sServer+"Info"},k.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},k.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},k.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},k.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},k.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},k.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.js"},k.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Db.oViewModelsHooks={},Db.oSimpleHooks={},Db.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Db.addHook=function(a,b){Cb.isFunc(b)&&(Cb.isArray(Db.oSimpleHooks[a])||(Db.oSimpleHooks[a]=[]),Db.oSimpleHooks[a].push(b))},Db.runHook=function(a,b){Cb.isArray(Db.oSimpleHooks[a])&&(b=b||[],h.each(Db.oSimpleHooks[a],function(a){a.apply(null,b)}))},Db.mainSettingsGet=function(a){return Ob?Ob.settingsGet(a):null},Db.remoteRequest=function(a,b,c,d,e,f){Ob&&Ob.remote().defaultRequest(a,b,c,d,e,f)},Db.settingsGet=function(a,b){var c=Db.mainSettingsGet("Plugins");return c=c&&Cb.isUnd(c[a])?null:c[a],c?Cb.isUnd(c[b])?null:c[b]:null},l.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},l.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},l.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},l.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},l.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},l.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},l.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},l.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},l.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},l.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Fb.oHtmlEditorDefaultConfig,d=Ob.settingsGet("Language"),e=!!Ob.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Fb.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("key",function(a){return a&&a.data&&9===a.data.keyCode?!1:void 0}),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},l.prototype.focus=function(){this.editor&&this.editor.focus()},l.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},l.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},l.prototype.clear=function(a){this.setHtml("",a)},m.prototype.selectItemCallbacks=function(a,b){(this.oCallbacks.onItemSelect||this.emptyFunction)(a,b)},m.prototype.goDown=function(a){this.newSelectPosition(Ab.EventKeyCode.Down,!1,a)},m.prototype.goUp=function(a){this.newSelectPosition(Ab.EventKeyCode.Up,!1,a)},m.prototype.init=function(a,d,e){if(this.oContentVisible=a,this.oContentScrollable=d,e=e||"all",this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){return f.actionClick(c.dataFor(this),a,!0),!1}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.sLastUid=f.getItemUid(b),b.selected()?(b.checked(!1),f.selectedItem(null)):b.checked(!b.checked())))}),j("enter",e,function(){return f.bAutoSelect?void 0:(f.focusedItem()&&f.actionClick(f.focusedItem()),!1)}),j("ctrl+up, command+up, ctrl+down, command+down",e,function(){return!1}),j("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",e,function(a,b){if(a&&b&&b.shortcut){var c=0;switch(b.shortcut){case"up":case"shift+up":c=Ab.EventKeyCode.Up;break;case"down":case"shift+down":c=Ab.EventKeyCode.Down;break;case"insert":c=Ab.EventKeyCode.Insert;break;case"space":c=Ab.EventKeyCode.Space;break;case"home":c=Ab.EventKeyCode.Home;break;case"end":c=Ab.EventKeyCode.End;break;case"pageup":c=Ab.EventKeyCode.PageUp;break;case"pagedown":c=Ab.EventKeyCode.PageDown}if(c>0)return f.newSelectPosition(c,j.shift),!1}})}},m.prototype.selectByUid=function(a,b){b=Cb.isUnd(b)?!0:!!b,this.useItemSelectCallback=b;var c=h.find(this.list(),function(b){return a===this.getItemUid(b)},this);c&&this.selectedItem(c),this.useItemSelectCallback=!0},m.prototype.useKeyboard=function(a){this.bUseKeyboard=!!a},m.prototype.autoSelect=function(a){this.bAutoSelect=!!a},m.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},m.prototype.newSelectPosition=function(b,c,d){var e=this,f=0,g=10,i=!1,j=!1,k=null,l=this.list(),m=l?l.length:0,n=this.focusedItem();if(m>0)if(n){if(n)if(Ab.EventKeyCode.Down===b||Ab.EventKeyCode.Up===b||Ab.EventKeyCode.Insert===b||Ab.EventKeyCode.Space===b)h.each(l,function(a){if(!j)switch(b){case Ab.EventKeyCode.Up:n===a?j=!0:k=a;break;case Ab.EventKeyCode.Down:case Ab.EventKeyCode.Insert:case Ab.EventKeyCode.Space:i?(k=a,j=!0):n===a&&(i=!0)}});else if(Ab.EventKeyCode.Home===b||Ab.EventKeyCode.End===b)Ab.EventKeyCode.Home===b?k=l[0]:Ab.EventKeyCode.End===b&&(k=l[l.length-1]);else if(Ab.EventKeyCode.PageDown===b){for(;m>f;f++)if(n===l[f]){f+=g,f=f>m-1?m-1:f,k=l[f];break}}else if(Ab.EventKeyCode.PageUp===b)for(f=m;f>=0;f--)if(n===l[f]){f-=g,f=0>f?0:f,k=l[f];break}}else Ab.EventKeyCode.Down===b||Ab.EventKeyCode.Insert===b||Ab.EventKeyCode.Space===b||Ab.EventKeyCode.Home===b||Ab.EventKeyCode.PageUp===b?k=l[0]:(Ab.EventKeyCode.Up===b||Ab.EventKeyCode.End===b||Ab.EventKeyCode.PageDown===b)&&(k=l[l.length-1]);k?(n&&(c?(Ab.EventKeyCode.Up===b||Ab.EventKeyCode.Down===b)&&n.checked(!n.checked()):(Ab.EventKeyCode.Insert===b||Ab.EventKeyCode.Space===b)&&n.checked(!n.checked())),this.focusedItem(k),(this.bAutoSelect||d)&&Ab.EventKeyCode.Space!==b&&(a.clearTimeout(this.iSelectTimer),this.iSelectTimer=a.setTimeout(function(){e.iSelectTimer=0,e.actionClick(k)},300)),this.scrollToFocused()):n&&(!c||Ab.EventKeyCode.Up!==b&&Ab.EventKeyCode.Down!==b?(Ab.EventKeyCode.Insert===b||Ab.EventKeyCode.Space===b)&&n.checked(!n.checked()):n.checked(!n.checked()))},m.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemFocusedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(this.oContentScrollable.scrollTop(d.top<0?this.oContentScrollable.scrollTop()+d.top-a:this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},m.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},m.prototype.actionClick=function(a,b,c){if(a){var d=!0,e=this.getItemUid(a);b&&(b.shiftKey?(d=!1,""===this.sLastUid&&(this.sLastUid=e),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(d=!1,this.sLastUid=e,a.checked(!a.checked()))),d&&(c&&(a.__clicked=!0),this.selectedItem(a))}},m.prototype.on=function(a,b){this.oCallbacks[a]=b},n.supported=function(){return!0},n.prototype.set=function(a,c){var d=b.cookie(zb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(zb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},n.prototype.get=function(a){var c=b.cookie(zb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Cb.isUnd(d[a])?d[a]:null}catch(e){}return d},o.supported=function(){return!!a.localStorage},o.prototype.set=function(b,c){var d=a.localStorage[zb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[zb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},o.prototype.get=function(b){var c=a.localStorage[zb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Cb.isUnd(d[b])?d[b]:null}catch(e){}return d},p.prototype.item="armoredRainLoopKeys",p.prototype.load=function(){var b=0,c=0,d=[],e=JSON.parse(a.localStorage.getItem(this.item));if(e&&0b;b++)d.push(a.openpgp.key.readArmored(e[b]).keys[0]);return d},p.prototype.store=function(b){for(var c=0,d=b.length,e=[];d>c;c++)e.push(b[c].armor());a.localStorage.setItem(this.item,JSON.stringify(e))},q.prototype.oDriver=null,q.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},q.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},r.prototype.bootstart=function(){},s.prototype.sPosition="",s.prototype.sTemplate="",s.prototype.viewModelName="",s.prototype.viewModelDom=null,s.prototype.viewModelTemplate=function(){return this.sTemplate},s.prototype.viewModelPosition=function(){return this.sPosition},s.prototype.cancelCommand=s.prototype.closeCommand=function(){},s.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=Ob.data().keyScope(),Ob.data().keyScope(this.sDefaultKeyScope)},s.prototype.restoreKeyScope=function(){Ob.data().keyScope(this.sCurrentKeyScope)},s.prototype.registerPopupEscapeKey=function(){var a=this;Lb.on("keydown",function(b){return b&&Ab.EventKeyCode.Esc===b.keyCode&&a.modalVisibility&&a.modalVisibility()?(Cb.delegateRun(a,"cancelCommand"),!1):!0})},t.prototype.oCross=null,t.prototype.sScreenName="",t.prototype.aViewModels=[],t.prototype.viewModels=function(){return this.aViewModels},t.prototype.screenName=function(){return this.sScreenName},t.prototype.routes=function(){return null},t.prototype.__cross=function(){return this.oCross},t.prototype.__start=function(){var a=this.routes(),b=null,c=null;Cb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Cb.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},u.constructorEnd=function(a){Cb.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},u.prototype.sDefaultScreenName="",u.prototype.oScreens={},u.prototype.oBoot=null,u.prototype.oCurrentScreen=null,u.prototype.hideLoading=function(){b("#rl-loading").hide()},u.prototype.routeOff=function(){e.changed.active=!1},u.prototype.routeOn=function(){e.changed.active=!0},u.prototype.setBoot=function(a){return Cb.isNormal(a)&&(this.oBoot=a),this},u.prototype.screen=function(a){return""===a||Cb.isUnd(this.oScreens[a])?null:this.oScreens[a]},u.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=Ob.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b("
").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=Cb.createCommand(e,function(){Hb.hideScreenPopup(a)})),Db.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),Cb.delegateRun(e,"onBuild",[h]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),Db.runHook("view-model-post-build",[a.__name,e,h])):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),Cb.delegateRun(a.__vm,"onHide"),a.__vm.restoreKeyScope(),Ob.popupVisibilityNames.remove(a.__name),Db.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},u.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),Cb.delegateRun(a.__vm,"onShow",b||[]),a.__vm.storeAndSetKeyScope(),Ob.popupVisibilityNames.push(a.__name),Db.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),Cb.delegateRun(a.__vm,"onFocus",[],500)))},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(){Kb.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},Hb=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;m0&&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=Ob.data().sentFolder(),b=Ob.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 Ob.link().messageViewLink(this.requestHash)},A.prototype.downloadLink=function(){return Ob.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]}),Lb.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),Ob.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&&Ob.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")),Ob.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=Ob.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(),Pb.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=Ob.data().findPublicKeysByEmail(g),j=Ob.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(),Pb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},A.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},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&&Ob.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(){Lb.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;Hb.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=Ob.data().draftFolder();""!==a&&(Ob.cache().setFolderHash(a,""),Ob.data().currentFolderFullNameRaw()===a?Ob.reloadMessageList(!0):Ob.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[Ob.data().accountEmail()]=Ob.data().accountEmail(),b)switch(a){case Ab.ComposeType.Empty:d=Ob.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=Ob.data().accountEmail();return d},I.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},I.prototype.formattedFrom=function(a){var b=Ob.data().displayName(),c=Ob.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=Ob.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Ob.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!==Ob.data().editorDefaultType()&&a.modeToggle(!1)})):Cb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Cb.isNonEmptyArray(t)&&Ob.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;Hb.showScreenPopup(T,[Cb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Cb.delegateRun(a,"closeCommand")}])},I.prototype.useShortcuts=function(){return Ob.data().useKeyboardShortcuts()},I.prototype.onBuild=function(){this.initUploader();var a=this,c=Ob.data(),d=null;j("ctrl+s, command+s",Ab.KeyState.Compose,function(){return c.useKeyboardShortcuts()?(a.saveCommand(),!1):void 0}),j("ctrl+enter, command+enter",Ab.KeyState.Compose,function(){return c.useKeyboardShortcuts()?(a.sendCommand(),!1):void 0}),j("esc",Ab.KeyState.Compose,function(){return c.useKeyboardShortcuts()?(a.tryToClosePopup(),!1):void 0}),Lb.on("resize",function(){a.triggerForResize()}),this.dropboxEnabled()&&(d=document.createElement("script"),d.type="text/javascript",d.src="https://www.dropbox.com/static/api/1/dropins.js",b(d).attr("id","dropboxjs").attr("data-app-key",Ob.settingsGet("DropboxApiKey")),document.body.appendChild(d)) -},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(Ob.settingsGet("AttachmentLimit")),c=new g({action:Ob.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):(Ob.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:Ob.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),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},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 Ob.data().useKeyboardShortcuts()?(d.deleteCommand(),!1):void 0}),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(){Hb.routeOff(),this.reloadContactList(!0)},J.prototype.onHide=function(){Hb.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-11?" ("+(100>a?a:"99+")+")":""},$.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},$.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Ob.moveMessagesToFolder(Ob.data().currentFolderFullNameRaw(),Ob.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},$.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=Cb.draggeblePlace();return c.data("rl-folder",Ob.data().currentFolderFullNameRaw()),c.data("rl-uids",Ob.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Ob.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},$.prototype.onMessageResponse=function(a,b,c){var d=Ob.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&&(Ob.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Ob.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=Ob.cache(),g=0;if(Cb.isUnd(c)&&(c=Ob.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(){Hb.showScreenPopup(M)},mb.prototype.generateOpenPgpKey=function(){Hb.showScreenPopup(O)},mb.prototype.viewOpenPgpKey=function(a){a&&Hb.showScreenPopup(N,[a])},mb.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Ob.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(),Ob.reloadOpenPgpKeys())}},nb.prototype.populateDataOnStart=function(){var a=Cb.pInt(Ob.settingsGet("Layout")),b=Ob.settingsGet("Languages"),c=Ob.settingsGet("Themes");Cb.isArray(b)&&this.languages(b),Cb.isArray(c)&&this.themes(c),this.mainLanguage(Ob.settingsGet("Language")),this.mainTheme(Ob.settingsGet("Theme")),this.allowCustomTheme(!!Ob.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Ob.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Ob.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Ob.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Ob.settingsGet("AllowThemes")),this.allowCustomLogin(!!Ob.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Ob.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Ob.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Ob.settingsGet("EditorDefaultType")),this.showImages(!!Ob.settingsGet("ShowImages")),this.contactsAutosave(!!Ob.settingsGet("ContactsAutosave")),this.interfaceAnimation(Ob.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Ob.settingsGet("MPP")),this.desktopNotifications(!!Ob.settingsGet("DesktopNotifications")),this.useThreads(!!Ob.settingsGet("UseThreads")),this.replySameFolder(!!Ob.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Ob.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(Ob.settingsGet("Email")),this.accountIncLogin(Ob.settingsGet("IncLogin")),this.accountOutLogin(Ob.settingsGet("OutLogin")),this.projectHash(Ob.settingsGet("ProjectHash")),this.displayName(Ob.settingsGet("DisplayName")),this.replyTo(Ob.settingsGet("ReplyTo")),this.signature(Ob.settingsGet("Signature")),this.signatureToAll(!!Ob.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Ob.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Ob.local().get(Ab.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Ob.settingsGet("RemoteSuggestions"),this.devEmail=Ob.settingsGet("DevEmail"),this.devLogin=Ob.settingsGet("DevLogin"),this.devPassword=Ob.settingsGet("DevPassword")},ob.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Cb.isNormal(c)&&""!==c){if(Cb.isArray(d)&&03)i(Ob.link().notificationMailIcon(),Ob.data().accountEmail(),Cb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Ob.link().notificationMailIcon(),A.emailsToLine(A.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Ob.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=Ob.cache().getFolderFromCacheList(g),f||(f=B.newInstanceFromJson(e),f&&(Ob.cache().setFolderToCacheList(g,f),Ob.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&&Ob.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=Ob.data(),e=function(a){return""===a||zb.Values.UnuseOptionValue===a||null!==Ob.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(!!Ob.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Ob.settingsGet("SentFolder")+Ob.settingsGet("DraftFolder")+Ob.settingsGet("SpamFolder")+Ob.settingsGet("TrashFolder")+Ob.settingsGet("ArchiveFolder")+Ob.settingsGet("NullFolder")&&(Ob.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Ob.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Ob.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Ob.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Ob.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Ob.settingsGet("SentFolder"))),d.draftFolder(e(Ob.settingsGet("DraftFolder"))),d.spamFolder(e(Ob.settingsGet("SpamFolder"))),d.trashFolder(e(Ob.settingsGet("TrashFolder"))),d.archiveFolder(e(Ob.settingsGet("ArchiveFolder"))),c&&Ob.remote().saveSystemFolders(Cb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Ob.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=Ob.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=Ob.data(),g=Ob.cache(),i=!1,j=!1,k=null,l=f.messageList(),m=Ob.cache().getFolderFromCacheList(a),n=""===c?null:g.getFolderFromCacheList(c||""),o=f.currentFolderFullNameRaw(),p=f.message(),q=o===a?h.filter(l,function(a){return a&&-10&&m.messageCountUnread(0<=m.messageCountUnread()-e?m.messageCountUnread()-e:0)),n&&(n.messageCountAll(n.messageCountAll()+b.length),e>0&&n.messageCountUnread(n.messageCountUnread()+e),n.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())&&Ob.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)),Pb.empty(),k&&n.isPgpSigned()?j=Pb.append(b('
').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Pb.append(b('
').text(n.plainRaw)).html()),Pb.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)),Ob.cache().initMessageFlagsFromCache(n),n.unseen()&&Ob.setMessageSeen(n),Cb.windowResize())},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=Ob.data(),d=Ob.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=Ob.cache().getFolderFromCacheList(Cb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Ob.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&&Ob.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?Ob.cache().initMessageFlagsFromCache(o):Ob.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,Ob.data().projectHash(),Ob.data().threading()&&Ob.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=Ob.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=Ob.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()})):Hb.setHash(Ob.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(){Ob.setTitle("")},h.extend(vb.prototype,t.prototype),vb.prototype.oLastRoute={},vb.prototype.setNewTitle=function(){var a=Ob.data().accountEmail(),b=Ob.data().foldersInboxUnreadCount();Ob.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Cb.i18n("TITLES/MAILBOX"))},vb.prototype.onShow=function(){this.setNewTitle(),Ob.data().keyScope(Ab.KeyState.MessageList)},vb.prototype.onHide=function(){Ob.data().keyScope(Ab.KeyState.All)},vb.prototype.onRoute=function(a,b,c,d){if(Cb.isUnd(d)?1:!d){var e=Ob.data(),f=Ob.cache().getFolderFullNameRaw(a),g=Ob.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),Ab.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Ob.reloadMessageList())}else Ab.Layout.NoPreview!==Ob.data().layout()||Ob.data().message()||Ob.historyBack()},vb.prototype.onStart=function(){var a=Ob.data(),b=function(){Cb.windowResize()};(Ob.settingsGet("AllowAdditionalAccounts")||Ob.settingsGet("AllowIdentities"))&&Ob.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Ob.folderInformation("INBOX")},1e3),h.delay(function(){Ob.quota()},5e3),h.delay(function(){Ob.remote().appDelayStart(Cb.emptyFunction)},35e3),Kb.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){Kb.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(){Ob.setTitle(this.sSettingsTitle)},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(Ib)?Ib:{}),Cb.isUnd(this.oSettings[a])?null:this.oSettings[a]},xb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Cb.isNormal(Ib)?Ib:{}),this.oSettings[a]=b},xb.prototype.setTitle=function(b){b=(Cb.isNormal(b)&&0l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(Ab.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0c;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(Ob.settingsGet("AttachmentLimit")),c=new g({action:Ob.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):(Ob.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:Ob.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),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},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 Ob.data().useKeyboardShortcuts()?(d.deleteCommand(),!1):void 0}),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(){Hb.routeOff(),this.reloadContactList(!0)},J.prototype.onHide=function(){Hb.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-11?" ("+(100>a?a:"99+")+")":""},$.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},$.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Ob.moveMessagesToFolder(Ob.data().currentFolderFullNameRaw(),Ob.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},$.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=Cb.draggeblePlace();return c.data("rl-folder",Ob.data().currentFolderFullNameRaw()),c.data("rl-uids",Ob.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Ob.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},$.prototype.onMessageResponse=function(a,b,c){var d=Ob.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&&(Ob.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Ob.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=Ob.cache(),g=0;if(Cb.isUnd(c)&&(c=Ob.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(){Hb.showScreenPopup(M)},mb.prototype.generateOpenPgpKey=function(){Hb.showScreenPopup(O)},mb.prototype.viewOpenPgpKey=function(a){a&&Hb.showScreenPopup(N,[a])},mb.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Ob.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(),Ob.reloadOpenPgpKeys())}},nb.prototype.populateDataOnStart=function(){var a=Cb.pInt(Ob.settingsGet("Layout")),b=Ob.settingsGet("Languages"),c=Ob.settingsGet("Themes");Cb.isArray(b)&&this.languages(b),Cb.isArray(c)&&this.themes(c),this.mainLanguage(Ob.settingsGet("Language")),this.mainTheme(Ob.settingsGet("Theme")),this.allowCustomTheme(!!Ob.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Ob.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Ob.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Ob.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Ob.settingsGet("AllowThemes")),this.allowCustomLogin(!!Ob.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Ob.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Ob.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Ob.settingsGet("EditorDefaultType")),this.showImages(!!Ob.settingsGet("ShowImages")),this.contactsAutosave(!!Ob.settingsGet("ContactsAutosave")),this.interfaceAnimation(Ob.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Ob.settingsGet("MPP")),this.desktopNotifications(!!Ob.settingsGet("DesktopNotifications")),this.useThreads(!!Ob.settingsGet("UseThreads")),this.replySameFolder(!!Ob.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Ob.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(Ob.settingsGet("Email")),this.accountIncLogin(Ob.settingsGet("IncLogin")),this.accountOutLogin(Ob.settingsGet("OutLogin")),this.projectHash(Ob.settingsGet("ProjectHash")),this.displayName(Ob.settingsGet("DisplayName")),this.replyTo(Ob.settingsGet("ReplyTo")),this.signature(Ob.settingsGet("Signature")),this.signatureToAll(!!Ob.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Ob.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Ob.local().get(Ab.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Ob.settingsGet("RemoteSuggestions"),this.devEmail=Ob.settingsGet("DevEmail"),this.devLogin=Ob.settingsGet("DevLogin"),this.devPassword=Ob.settingsGet("DevPassword")},ob.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Cb.isNormal(c)&&""!==c){if(Cb.isArray(d)&&03)i(Ob.link().notificationMailIcon(),Ob.data().accountEmail(),Cb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Ob.link().notificationMailIcon(),A.emailsToLine(A.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Ob.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=Ob.cache().getFolderFromCacheList(g),f||(f=B.newInstanceFromJson(e),f&&(Ob.cache().setFolderToCacheList(g,f),Ob.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&&Ob.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=Ob.data(),e=function(a){return""===a||zb.Values.UnuseOptionValue===a||null!==Ob.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(!!Ob.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Ob.settingsGet("SentFolder")+Ob.settingsGet("DraftFolder")+Ob.settingsGet("SpamFolder")+Ob.settingsGet("TrashFolder")+Ob.settingsGet("ArchiveFolder")+Ob.settingsGet("NullFolder")&&(Ob.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Ob.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Ob.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Ob.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Ob.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Ob.settingsGet("SentFolder"))),d.draftFolder(e(Ob.settingsGet("DraftFolder"))),d.spamFolder(e(Ob.settingsGet("SpamFolder"))),d.trashFolder(e(Ob.settingsGet("TrashFolder"))),d.archiveFolder(e(Ob.settingsGet("ArchiveFolder"))),c&&Ob.remote().saveSystemFolders(Cb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Ob.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=Ob.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=Ob.data(),g=Ob.cache(),i=!1,j=!1,k=null,l=f.messageList(),m=Ob.cache().getFolderFromCacheList(a),n=""===c?null:g.getFolderFromCacheList(c||""),o=f.currentFolderFullNameRaw(),p=f.message(),q=o===a?h.filter(l,function(a){return a&&-10&&m.messageCountUnread(0<=m.messageCountUnread()-e?m.messageCountUnread()-e:0)),n&&(n.messageCountAll(n.messageCountAll()+b.length),e>0&&n.messageCountUnread(n.messageCountUnread()+e),n.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())&&Ob.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)),Pb.empty(),k&&n.isPgpSigned()?j=Pb.append(b('
').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Pb.append(b('
').text(n.plainRaw)).html()),Pb.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)),Ob.cache().initMessageFlagsFromCache(n),n.unseen()&&Ob.setMessageSeen(n),Cb.windowResize())},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=Ob.data(),d=Ob.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=Ob.cache().getFolderFromCacheList(Cb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Ob.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&&Ob.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?Ob.cache().initMessageFlagsFromCache(o):Ob.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,Ob.data().projectHash(),Ob.data().threading()&&Ob.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=Ob.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=Ob.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()})):Hb.setHash(Ob.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(){Ob.setTitle("")},h.extend(vb.prototype,t.prototype),vb.prototype.oLastRoute={},vb.prototype.setNewTitle=function(){var a=Ob.data().accountEmail(),b=Ob.data().foldersInboxUnreadCount();Ob.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Cb.i18n("TITLES/MAILBOX"))},vb.prototype.onShow=function(){this.setNewTitle(),Ob.data().keyScope(Ab.KeyState.MessageList)},vb.prototype.onHide=function(){Ob.data().keyScope(Ab.KeyState.All)},vb.prototype.onRoute=function(a,b,c,d){if(Cb.isUnd(d)?1:!d){var e=Ob.data(),f=Ob.cache().getFolderFullNameRaw(a),g=Ob.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),Ab.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Ob.reloadMessageList())}else Ab.Layout.NoPreview!==Ob.data().layout()||Ob.data().message()||Ob.historyBack()},vb.prototype.onStart=function(){var a=Ob.data(),b=function(){Cb.windowResize()};(Ob.settingsGet("AllowAdditionalAccounts")||Ob.settingsGet("AllowIdentities"))&&Ob.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Ob.folderInformation("INBOX")},1e3),h.delay(function(){Ob.quota()},5e3),h.delay(function(){Ob.remote().appDelayStart(Cb.emptyFunction)},35e3),Kb.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){Kb.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(){Ob.setTitle(this.sSettingsTitle)},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(Ib)?Ib:{}),Cb.isUnd(this.oSettings[a])?null:this.oSettings[a]},xb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Cb.isNormal(Ib)?Ib:{}),this.oSettings[a]=b},xb.prototype.setTitle=function(b){b=(Cb.isNormal(b)&&0l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(Ab.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0