snappymail/rainloop/v/1.3.8.476/static/js/app.min.js
RainLoop Team 45f3bf61e2 v1.3.8.476
2013-11-02 02:19:20 +04:00

392 lines
No EOL
198 KiB
JavaScript

(function(h,j,f,Qa,S,ea,wa,i){function C(){this.sBase="#/";this.sCdnStaticDomain=e.settingsGet("CdnStaticDomain");this.sVersion=e.settingsGet("Version");this.sSpecSuffix=e.settingsGet("AuthAccountHash")||"0";this.sServer=(e.settingsGet("IndexFile")||"./")+"?";this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function u(a,b,c,l){this.oOptions=l=j.extend({DisableHtml:!1,onSwitch:!1,LangSwitcherConferm:"EDITOR_TEXT_SWITCHER_CONFIRM",
LangSwitcherTextLabel:"EDITOR_SWITCHER_TEXT_LABEL",LangSwitcherHtmlLabel:"EDITOR_SWITCHER_HTML_LABEL"},d.isUnd(l)?{}:l);this.bOnlyPlain=!!this.oOptions.DisableHtml;this.fOnSwitch=this.oOptions.onSwitch;this.textarea=j(a).empty().addClass("editorTextArea");this.htmlarea=j(b).empty().addClass("editorHtmlArea").prop("contentEditable","true");this.toolbar=j(c).empty().addClass("editorToolbar");u.htmlInitEditor.apply(this);u.htmlInitToolbar.apply(this);u.htmlAttachEditorEvents.apply(this);this.bOnlyPlain&&
this.toolbar.hide()}function N(a,b,c,l,e){this.list=a;this.selectedItem=b;this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.oContentScrollable=this.oContentVisible=null;this.sItemSelector=c;this.sItemSelectedSelector=l;this.sItemCheckedSelector=e;this.sLastUid="";this.oCallbacks={};this.iSelectTimer=0;this.bUseKeyboard=!0;this.emptyFunction=function(){};this.useItemSelectCallback=!0;this.throttleSelection=!1;this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&
(this.throttleSelection?(this.throttleSelection=!1,this.selectItemCallbacksThrottle(a)):this.selectItemCallbacks(a))},this);var f=this,g=[],k=null;this.list.subscribe(function(){var a=this,b=this.list();d.isArray(b)&&i.each(b,function(b){b.checked()&&g.push(a.getItemUid(b));null===k&&b.selected()&&(k=a.getItemUid(b))})},this,"beforeChange");this.list.subscribe(function(a){this.useItemSelectCallback=!1;this.selectedItem(null);if(d.isArray(a)){var b=this,c=g.length;i.each(a,function(a){0<c&&-1<d.inArray(b.getItemUid(a),
g)&&(a.checked(!0),c--);null!==k&&k===b.getItemUid(a)&&(a.selected(!0),k=null,b.selectedItem(a))})}this.useItemSelectCallback=!0;g=[];k=null},this);this.list.setSelectedByUid=function(a){f.selectByUid(a,!1)};this.selectItemCallbacksThrottle=i.debounce(this.selectItemCallbacks,300)}function xa(){}function ya(){}function za(){var a=i.find([ya,xa],function(a){return a.supported()});a&&(this.oDriver=new a)}function Ra(){}function D(a,b){this.sPosition=d.pString(a);this.sTemplate=d.pString(b);this.viewModelName=
"";this.viewModelVisibility=f.observable(!1);"Popups"===this.sPosition&&(this.modalVisibility=f.observable(!1));this.viewModelDom=null}function M(a,b){this.sScreenName=a;this.aViewModels=d.isArray(b)?b:[]}function F(){this.sDefaultScreenName="";this.oScreens={};this.oCurrentScreen=this.oBoot=null;this.popupVisibility=f.observable(!1);this.popupVisibility.subscribe(function(a){e&&e.popupVisibility(a)})}function G(a,b){this.email=a||"";this.name=b||"";this.privateType=null;this.clearDuplicateName()}
function pa(){this.idContact=0;this.name=this.listName=this.imageHash="";this.emails=[];this.checked=f.observable(!1);this.selected=f.observable(!1);this.deleted=f.observable(!1)}function E(){this.fileName=this.mimeType="";this.estimatedSize=0;this.friendlySize="";this.isLinked=this.isInline=!1;this.mimeIndex=this.uid=this.folder=this.download=this.contentLocation=this.cidWithOutTags=this.cid=""}function O(a,b,c,l,e,t,g){this.id=a;this.isInline=d.isUnd(l)?!1:!!l;this.isLinked=d.isUnd(e)?!1:!!e;this.CID=
d.isUnd(t)?"":t;this.contentLocation=d.isUnd(g)?"":g;this.fromMessage=!1;this.fileName=f.observable(b);this.size=f.observable(d.isUnd(c)?null:c);this.tempName=f.observable("");this.progress=f.observable("");this.error=f.observable("");this.waiting=f.observable(!0);this.uploading=f.observable(!1);this.enabled=f.observable(!0);this.friendlySize=f.computed(function(){return null===this.size()?"":d.friendlySize(this.size())},this)}function m(){this.requestHash=this.uid=this.folderFullNameRaw="";this.subject=
f.observable("");this.size=f.observable(0);this.dateTimeStampInUTC=f.observable(0);this.priority=f.observable(g.MessagePriority.Normal);this.fromEmailString=f.observable("");this.toEmailsString=f.observable("");this.senderEmailsString=f.observable("");this.prefetched=!1;this.emails=[];this.from=[];this.to=[];this.cc=[];this.bcc=[];this.replyTo=[];this.newForAnimation=f.observable(!1);this.deleted=f.observable(!1);this.unseen=f.observable(!1);this.flagged=f.observable(!1);this.answered=f.observable(!1);
this.forwarded=f.observable(!1);this.selected=f.observable(!1);this.checked=f.observable(!1);this.hasAttachments=f.observable(!1);this.attachmentsMainType=f.observable("");this.moment=f.observable(ea());this.attachmentIconClass=f.computed(function(){var a="";if(this.hasAttachments())switch(a="icon-attachment",this.attachmentsMainType()){case "image":a="icon-image";break;case "archive":a="icon-file-zip";break;case "doc":a="icon-file";break;case "pdf":a="icon-file-pdf"}return a},this);this.fullFormatDateValue=
f.computed(function(){return m.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this);this.fullFormatDateValue=f.computed(function(){return m.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this);this.momentDate=d.createMomentDate(this);this.momentShortDate=d.createMomentShortDate(this);this.dateTimeStampInUTC.subscribe(function(a){var b=ea().unix();this.moment(ea.unix(b<a?b:a))},this);this.body=null;this.isRtl=f.observable(!1);this.isHtml=f.observable(!1);this.hasImages=f.observable(!1);
this.attachments=f.observableArray([]);this.priority=f.observable(g.MessagePriority.Normal);this.aDraftInfo=[];this.sReferences=this.sInReplyTo=this.sMessageId="";this.parentUid=f.observable(0);this.threads=f.observableArray([]);this.threadsLen=f.observable(0);this.hasUnseenSubMessage=f.observable(!1);this.hasFlaggedSubMessage=f.observable(!1);this.lastInCollapsedThread=f.observable(!1);this.lastInCollapsedThreadLoading=f.observable(!1);this.threadsLenResult=f.computed(function(){var a=this.threadsLen();
return 0===this.parentUid()&&0<a?a+1:""},this)}function I(){this.name=f.observable("");this.namespace=this.delimiter=this.fullNameHash=this.fullNameRaw=this.fullName="";this.deep=0;this.selectable=!1;this.existen=!0;this.isUnpaddigFolder=this.isGmailFolder=this.isNamespaceFolder=!1;this.type=f.observable(g.FolderType.User);this.selected=f.observable(!1);this.edited=f.observable(!1);this.collapsed=f.observable(!0);this.subScribed=f.observable(!0);this.subFolders=f.observableArray([]);this.deleteAccess=
f.observable(!1);this.actionBlink=f.observable(!1).extend({falseTimeout:1E3});this.nameForEdit=f.observable("");this.name.subscribe(function(a){this.nameForEdit(a)},this);this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this);this.canBeEdited=f.computed(function(){return g.FolderType.User===this.type()},this);this.privateMessageCountAll=f.observable(0);this.privateMessageCountUnread=f.observable(0);this.collapsedPrivate=f.observable(!0)}function Ka(a,b){this.email=a;this.deleteAccess=
f.observable(!1);this.canBeDalete=f.observable(b)}function Aa(){D.call(this,"Popups","PopupsFolderClear");this.selectedFolder=f.observable(null);this.clearingProcess=f.observable(!1);this.clearingError=f.observable("");this.folderFullNameForClear=f.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this);this.folderNameForClear=f.computed(function(){var a=this.selectedFolder();return a?a.localName():""},this);this.dangerDescHtml=f.computed(function(){return d.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",
{FOLDER:this.folderNameForClear()})},this);this.clearCommand=d.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(e.data().message(null),e.data().messageList([]),this.clearingProcess(!0),e.cache().setFolderHash(b.fullNameRaw,""),e.remote().folderClear(function(b,l){a.clearingProcess(!1);g.StorageResultType.Success===b&&l&&l.Result?(e.reloadMessageList(!0),a.cancelCommand()):l&&l.ErrorCode?a.clearingError(d.getNotification(l.ErrorCode)):a.clearingError(d.getNotification(g.Notification.MailServerError))},
b.fullNameRaw))},function(){var a=this.selectedFolder();return!this.clearingProcess()&&null!==a})}function ha(){D.call(this,"Popups","PopupsFolderCreate");d.initOnStartOrLangChange(function(){this.sNoParentText=d.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this);this.folderName=f.observable("");this.focusTrigger=f.observable(!1);this.selectedParentValue=f.observable(p.Values.UnuseOptionValue);this.parentFolderSelectList=f.computed(function(){var a=e.data(),b=[],c=null,l=a.folderList();b.push(["",
this.sNoParentText]);""!==a.namespace&&(c=function(b){return a.namespace!==b.fullNameRaw.substr(0,a.namespace.length)});return e.folderListOptionsBuilder([],l,[],b,null,c,null,function(a){return a?a.isSystemFolder()?a.name()+" "+a.manageFolderSystemName():a.name():""})},this);this.createFolder=d.createCommand(this,function(){var a=e.data(),b=this.selectedParentValue();""===b&&1<a.namespace.length&&(b=a.namespace.substr(0,a.namespace.length-1));a.foldersCreating(!0);e.remote().folderCreate(function(a,
b){e.data().foldersCreating(!1);g.StorageResultType.Success===a&&b&&b.Result?e.folders(!1):e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"))},this.folderName(),b);this.cancelCommand()},function(){return this.simpleFolderNameValidation(this.folderName())});this.defautOptionsAfterRender=d.defautOptionsAfterRender}function ba(){D.call(this,"Popups","PopupsFolderSystem");d.initOnStartOrLangChange(function(){this.sChooseOnText=d.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE");
this.sUnuseText=d.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME")},this);this.notification=f.observable("");this.folderSelectList=f.computed(function(){return e.folderListOptionsBuilder([],e.data().folderList(),e.data().folderListSystemNames(),[["",this.sChooseOnText],[p.Values.UnuseOptionValue,this.sUnuseText]])},this);var a=e.data(),b=this,c=null,l=null;this.sentFolder=a.sentFolder;this.draftFolder=a.draftFolder;this.spamFolder=a.spamFolder;this.trashFolder=a.trashFolder;c=i.debounce(function(){e.settingsSet("SentFolder",
b.sentFolder());e.settingsSet("DraftFolder",b.draftFolder());e.settingsSet("SpamFolder",b.spamFolder());e.settingsSet("TrashFolder",b.trashFolder());e.remote().saveSystemFolders(d.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder()})},1E3);l=function(){e.settingsSet("SentFolder",b.sentFolder());e.settingsSet("DraftFolder",b.draftFolder());e.settingsSet("SpamFolder",b.spamFolder());e.settingsSet("TrashFolder",b.trashFolder());c()};
this.sentFolder.subscribe(l);this.draftFolder.subscribe(l);this.spamFolder.subscribe(l);this.trashFolder.subscribe(l);this.defautOptionsAfterRender=d.defautOptionsAfterRender}function z(){D.call(this,"Popups","PopupsCompose");this.aDraftInfo=this.oEditor=null;this.sInReplyTo="";this.bFromDraft=!1;this.sReferences="";this.bReloadFolder=!1;var a=this,b=function(a){for(var b=0,c=a.length,d=[];b<c;b++)d.push(a[b].toLine(!1));return d.join(", ")},c=function(a){!1===this.showCcAndBcc()&&0<a.length&&this.showCcAndBcc(!0)};
this.resizer=f.observable(!1).extend({throttle:50});this.to=f.observableArray([]);this.cc=f.observableArray([]);this.bcc=f.observableArray([]);this.subject=f.observable("");this.sendError=f.observable(!1);this.sendSuccessButSaveError=f.observable(!1);this.savedError=f.observable(!1);this.savedTime=f.observable(0);this.savedOrSendingText=f.observable("");this.emptyToError=f.observable(!1);this.showCcAndBcc=f.observable(!1);this.cc.subscribe(c,this);this.bcc.subscribe(c,this);this.draftFolder=f.observable("");
this.draftUid=f.observable("");this.draftID=f.observable("");this.sending=f.observable(!1);this.saving=f.observable(!1);this.attachments=f.observableArray([]);this.attachmentsInProcess=f.computed(function(){return i.filter(this.attachments(),function(a){return a&&""===a.tempName()})},this);this.attachmentsInReady=f.computed(function(){return i.filter(this.attachments(),function(a){return a&&""!==a.tempName()})},this);this.attachments.subscribe(function(){this.triggerForResize()},this);this.isDraftFolderMessage=
f.computed(function(){return""!==this.draftFolder()&&""!==this.draftUid()&&""!==this.draftID()},this);this.composeUploaderButton=f.observable(null);this.composeUploaderDropPlace=f.observable(null);this.dragAndDropEnabled=f.observable(!1);this.dragAndDropOver=f.observable(!1).extend({throttle:1});this.dragAndDropVisible=f.observable(!1).extend({throttle:1});this.attacheMultipleAllowed=f.observable(!1);this.addAttachmentEnabled=f.observable(!1);this.composeEditorTextArea=f.observable(null);this.composeEditorHtmlArea=
f.observable(null);this.composeEditorToolbar=f.observable(null);this.to.subscribe(function(a){this.emptyToError()&&0<a.length&&this.emptyToError(!1)},this);this.canBeSended=f.computed(function(){return!this.sending()&&!this.saving()&&0===this.attachmentsInProcess().length&&0<this.to().length},this);this.canBeSendedOrSaved=f.computed(function(){return!this.sending()&&!this.saving()},this);this.deleteCommand=d.createCommand(this,function(){var a=null,b=this.draftFolder(),c=this.draftUid();this.bFromDraft&&
(a=e.data().message())&&(b===a.folderFullNameRaw&&c===a.uid)&&e.data().message(null);e.data().currentFolderFullNameRaw()===this.draftFolder()&&i.each(e.data().messageList(),function(a){a&&(b===a.folderFullNameRaw&&c===a.uid)&&a.deleted(true)});e.data().messageListIsNotCompleted(!0);e.remote().messagesDelete(function(){e.cache().setFolderHash(b,"");e.reloadMessageList()},this.draftFolder(),[this.draftUid()]);this.bReloadFolder=!1;o.hideScreenPopup(z)},function(){return this.isDraftFolderMessage()});
this.sendMessageResponse=i.bind(this.sendMessageResponse,this);this.saveMessageResponse=i.bind(this.saveMessageResponse,this);this.sendCommand=d.createCommand(this,function(){var a=this.to(),c=e.data().sentFolder(),f=[];if(0===a.length)this.emptyToError(!0);else if(e.data().replySameFolder()&&d.isArray(this.aDraftInfo)&&(3===this.aDraftInfo.length&&d.isNormal(this.aDraftInfo[2])&&0<this.aDraftInfo[2].length)&&(c=this.aDraftInfo[2]),""===c)o.showScreenPopup(ba,[g.SetSystemFoldersNotification.Sent]);
else{this.sendError(!1);this.sending(!0);this.bReloadFolder=!0;if(d.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&(f=e.cache().getMessageFlagsFromCache(this.aDraftInfo[2],this.aDraftInfo[1])))"forward"===this.aDraftInfo[0]?f[3]=!0:f[2]=!0,e.cache().setMessageFlagsToCache(this.aDraftInfo[2],this.aDraftInfo[1],f),e.reloadFlagsCurrentMessageListAndMessageFromCache();c=p.Values.UnuseOptionValue===c?"":c;e.cache().setFolderHash(this.draftFolder(),"");e.cache().setFolderHash(c,"");e.remote().sendMessage(this.sendMessageResponse,
this.draftFolder(),this.draftUid(),this.draftID(),c,b(a),b(this.cc()),b(this.bcc()),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences)}},this.canBeSendedOrSaved);this.saveCommand=d.createCommand(this,function(){e.data().draftFolderNotEnabled()?o.showScreenPopup(ba,[g.SetSystemFoldersNotification.Draft]):(this.savedError(!1),this.saving(!0),this.bReloadFolder=!0,e.cache().setFolderHash(e.data().draftFolder(),
""),e.remote().saveMessage(this.saveMessageResponse,this.draftFolder(),this.draftUid(),this.draftID(),e.data().draftFolder(),b(this.to()),b(this.cc()),b(this.bcc()),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences))},this.canBeSendedOrSaved);n.minuteTick.subscribe(function(){this.modalVisibility()&&(!e.data().draftFolderNotEnabled()&&!this.isEmptyForm(!1)&&!this.saving()&&!this.sending()&&
!this.savedError())&&this.saveCommand()},this);d.initOnStartOrLangChange(null,this,function(){this.oEditor&&this.oEditor.initLanguage(d.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),d.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),d.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))});this.showCcAndBcc.subscribe(function(){this.triggerForResize()},this);this.dropboxEnabled=f.observable(e.settingsGet("DropboxApiKey")?!0:!1);this.dropboxCommand=d.createCommand(this,function(){h.Dropbox&&h.Dropbox.choose({success:function(b){b&&
(b[0]&&b[0].link)&&a.addDropboxAttachment(b[0])},linkType:"direct",multiselect:!1});return!0},function(){return this.dropboxEnabled()});this.modalVisibility.subscribe(function(a){!a&&this.bReloadFolder&&(this.bReloadFolder=!1,e.reloadMessageList())},this);this.driveEnabled=f.observable(!1);this.driveCommand=d.createCommand(this,function(){return!0},function(){return this.driveEnabled()})}function P(){D.call(this,"Popups","PopupsContacts");var a=this;this.imageUploader=f.observable(null);this.imageDom=
f.observable(null);this.imageTrigger=f.observable(!1);this.search=f.observable("");this.contacts=f.observableArray([]);this.contacts.loading=f.observable(!1).extend({throttle:200});this.currentContact=f.observable(null);this.emptySelection=f.observable(!0);this.viewClearSearch=f.observable(!1);this.viewID=f.observable("");this.viewName=f.observable("");this.viewName.focused=f.observable(!1);this.viewEmail=f.observable("").validateEmail();this.viewEmail.focused=f.observable(!1);this.viewImageUrl=f.observable(e.link().emptyContactPic());
this.viewSaving=f.observable(!1);this.useCheckboxesInList=e.data().useCheckboxesInList;this.search.subscribe(function(){this.reloadContactList()},this);this.contacts.subscribe(function(){d.windowResize()},this);this.viewImageUrl.subscribe(function(a){this.imageDom().src=a},this);this.contactsChecked=f.computed(function(){return i.filter(this.contacts(),function(a){return a.checked()})},this);this.contactsCheckedOrSelected=f.computed(function(){var a=this.contactsChecked(),c=this.currentContact();
return i.union(a,c?[c]:[])},this);this.contactsCheckedOrSelectedUids=f.computed(function(){return i.map(this.contactsCheckedOrSelected(),function(a){return a.idContact})},this);this.newCommand=d.createCommand(this,function(){this.populateViewContact(null)});this.selector=new N(this.contacts,this.currentContact,".e-contact-item .actionHandle",".e-contact-item.selected",".e-contact-item .checkboxItem");this.selector.on("onItemSelect",i.bind(function(a){this.populateViewContact(a?a:null)},this));this.selector.on("onItemGetUid",
function(a){return a?a.generateUid():""});this.selector.on("onDelete",i.bind(function(){this.deleteCommand()},this));this.newCommand=d.createCommand(this,function(){this.populateViewContact(null);this.currentContact(null)});this.deleteCommand=d.createCommand(this,function(){this.deleteSelectedContacts()},function(){return 0<this.contactsCheckedOrSelected().length});this.newMessageCommand=d.createCommand(this,function(){var a=this.contactsCheckedOrSelected(),c=[];d.isNonEmptyArray(a)&&(c=i.map(a,function(a){return a&&
a.emails&&(a=new G(a.emails[0]||"",a.name),a.validate())?a:null}),c=i.compact(c));d.isNonEmptyArray(a)&&(o.hideScreenPopup(P),o.showScreenPopup(z,[g.ComposeType.Empty,null,c]))},function(){return 0<this.contactsCheckedOrSelected().length});this.clearCommand=d.createCommand(this,function(){this.search("")});this.saveCommand=d.createCommand(this,function(){var b=d.fakeMd5(),c=this.imageTrigger();this.viewSaving(!0);e.remote().contactSave(function(l,L){a.viewSaving(!1);g.StorageResultType.Success===
l&&(L&&L.Result&&L.Result.RequestUid===b&&0<d.pInt(L.Result.ResultID))&&(""===a.viewID()&&a.viewID(d.pInt(L.Result.ResultID)),a.reloadContactList(),c&&e.emailsPicsHashes())},b,this.viewID(),this.viewName(),this.viewEmail(),c?this.imageDom().src:"")},function(){var a=this.viewName(),c=this.viewEmail();return!this.viewSaving()&&(""!==a||""!==c)})}function ia(){D.call(this,"Popups","PopupsAdvancedSearch");this.fromFocus=f.observable(!1);this.from=f.observable("");this.to=f.observable("");this.subject=
f.observable("");this.text=f.observable("");this.selectedDateValue=f.observable(-1);this.hasAttachments=f.observable(!1);this.searchCommand=d.createCommand(this,function(){var a=this.buildSearchString();""!==a&&e.data().mainMessageListSearch(a);this.cancelCommand()})}function ja(){D.call(this,"Popups","PopupsAddAccount");this.email=f.observable("");this.login=f.observable("");this.password=f.observable("");this.emailError=f.observable(!1);this.loginError=f.observable(!1);this.passwordError=f.observable(!1);
this.email.subscribe(function(){this.emailError(!1)},this);this.login.subscribe(function(){this.loginError(!1)},this);this.password.subscribe(function(){this.passwordError(!1)},this);this.allowCustomLogin=f.observable(!1);this.submitRequest=f.observable(!1);this.submitError=f.observable("");this.emailFocus=f.observable(!1);this.loginFocus=f.observable(!1);this.addAccountCommand=d.createCommand(this,function(){this.emailError(""===d.trim(this.email()));this.passwordError(""===d.trim(this.password()));
if(this.emailError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().accountAdd(i.bind(function(a,b){this.submitRequest(!1);g.StorageResultType.Success===a&&b&&"AccountAdd"===b.Action?b.Result?(e.accounts(),this.cancelCommand()):b.ErrorCode&&this.submitError(d.getNotification(b.ErrorCode)):this.submitError(d.getNotification(g.Notification.UnknownError))},this),this.email(),this.login(),this.password());return!0},function(){return!this.submitRequest()});this.loginFocus.subscribe(function(a){a&&
(""===this.login()&&""!==this.email())&&this.login(this.email())},this)}function ka(){D.call(this,"Popups","PopupsLanguages");this.exp=f.observable(!1);this.languages=f.computed(function(){var a=e.data().mainLanguage();return i.map(e.data().languages(),function(b){return{key:b,selected:b===a,fullName:d.convertLangName(b)}})})}function la(){D.call(this,"Right","Login");var a=e.data();this.email=f.observable("");this.login=f.observable("");this.password=f.observable("");this.signMe=f.observable(!1);
this.logoMain=f.observable("RainLoop");this.emailError=f.observable(!1);this.loginError=f.observable(!1);this.passwordError=f.observable(!1);this.emailFocus=f.observable(!1);this.loginFocus=f.observable(!1);this.submitFocus=f.observable(!1);this.email.subscribe(function(){this.emailError(!1)},this);this.login.subscribe(function(){this.loginError(!1)},this);this.password.subscribe(function(){this.passwordError(!1)},this);this.submitRequest=f.observable(!1);this.submitError=f.observable("");this.allowCustomLogin=
a.allowCustomLogin;this.allowLanguagesOnLogin=a.allowLanguagesOnLogin;this.langRequest=f.observable(!1);this.mainLanguage=a.mainLanguage;this.bSendLanguage=!1;this.mainLanguageFullName=f.computed(function(){return d.convertLangName(this.mainLanguage())},this);this.signMeType=f.observable(g.LoginSignMeType.Unused);this.signMeType.subscribe(function(a){this.signMe(g.LoginSignMeType.DefaultOn===a)},this);this.signMeVisibility=f.computed(function(){return g.LoginSignMeType.Unused!==this.signMeType()},
this);this.submitCommand=d.createCommand(this,function(){this.emailError(""===d.trim(this.email()));this.passwordError(""===d.trim(this.password()));if(this.emailError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().login(i.bind(function(a,c){g.StorageResultType.Success===a&&c&&"Login"===c.Action?c.Result?e.loginAndLogoutReload():c.ErrorCode?(this.submitRequest(!1),this.submitError(d.getNotification(c.ErrorCode))):this.submitRequest(!1):(this.submitRequest(!1),this.submitError(d.getNotification(g.Notification.UnknownError)))},
this),this.email(),this.login(),this.password(),!!this.signMe(),this.bSendLanguage?this.mainLanguage():"");return!0},function(){return!this.submitRequest()});this.facebookLoginEnabled=f.observable(!1);this.facebookCommand=d.createCommand(this,function(){h.open(e.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");return!0},function(){return!this.submitRequest()&&this.facebookLoginEnabled()});this.googleLoginEnabled=f.observable(!1);
this.googleCommand=d.createCommand(this,function(){h.open(e.link().socialGoogle(),"Google","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");return!0},function(){return!this.submitRequest()&&this.googleLoginEnabled()});this.twitterLoginEnabled=f.observable(!1);this.twitterCommand=d.createCommand(this,function(){h.open(e.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");return!0},function(){return!this.submitRequest()&&
this.twitterLoginEnabled()});this.loginFocus.subscribe(function(a){a&&(""===this.login()&&""!==this.email())&&this.login(this.email())},this);this.socialLoginEnabled=f.computed(function(){var a=this.facebookLoginEnabled(),c=this.googleLoginEnabled(),d=this.twitterLoginEnabled();return a||c||d},this)}function T(){D.call(this,"Right","SystemDropDown");var a=e.data();this.accounts=a.accounts;this.accountEmail=a.accountEmail;this.accountsLoading=a.accountsLoading;this.allowAddAccount=e.settingsGet("AllowAdditionalAccounts");
this.loading=f.computed(function(){return this.accountsLoading()},this);this.accountClick=i.bind(this.accountClick,this)}function Sa(){T.call(this)}function Ta(){T.call(this)}function ca(){D.call(this,"Left","MailFolderList");this.folderList=e.data().folderList;this.folderListSystem=e.data().folderListSystem;this.iDropOverTimer=0;this.allowContacts=!!e.settingsGet("ContactsIsSupported")&&!!e.settingsGet("ContactsIsAllowed")}function A(){D.call(this,"Right","MailMessageList");this.sLastUid=null;this.emptySubjectValue=
"";var a=e.data();this.popupVisibility=e.popupVisibility;this.messageList=a.messageList;this.currentMessage=a.currentMessage;this.isMessageSelected=a.isMessageSelected;this.messageListSearch=a.messageListSearch;this.messageListError=a.messageListError;this.folderMenuForMove=a.folderMenuForMove;this.useCheckboxesInList=a.useCheckboxesInList;this.mainMessageListSearch=a.mainMessageListSearch;this.messageListEndFolder=a.messageListEndFolder;this.messageListChecked=a.messageListChecked;this.messageListCheckedOrSelected=
a.messageListCheckedOrSelected;this.messageListCheckedOrSelectedUidsWithSubMails=a.messageListCheckedOrSelectedUidsWithSubMails;this.messageListCompleteLoadingThrottle=a.messageListCompleteLoadingThrottle;d.initOnStartOrLangChange(function(){this.emptySubjectValue=d.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this);this.userQuota=a.userQuota;this.userUsageSize=a.userUsageSize;this.userUsageProc=a.userUsageProc;this.dragOver=f.observable(!1).extend({throttle:1});this.dragOverEnter=f.observable(!1).extend({throttle:1});
this.dragOverArea=f.observable(null);this.dragOverBodyArea=f.observable(null);this.messageListItemTemplate=f.computed(function(){return a.usePreviewPane()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"});this.messageListSearchDesc=f.computed(function(){var b=a.messageListEndSearch();return""===b?"":d.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:b})});this.messageListPagenator=f.computed(function(){var b=0,c=0,l=2,e=[],f=a.messageListPage(),g=a.messageListPageCount(),k=function(a,b,c){a=
{current:a===f,name:d.isUnd(c)?a.toString():c.toString(),custom:d.isUnd(c)?!1:!0,title:d.isUnd(c)?"":a.toString(),value:a.toString()};d.isUnd(b)||b?e.push(a):e.unshift(a)};if(1<g||0<g&&g<f){if(g<f)k(g),c=b=g;else{if(3>=f||g-2<=f)l+=2;k(f);c=b=f}for(;0<l;)if(b-=1,c+=1,0<b&&(k(b,!1),l--),g>=c)k(c,!0),l--;else if(0>=b)break;3===b?k(2,!1):3<b&&k(Math.round((b-1)/2),!1,"...");g-2===c?k(g-1,!0):g-2>c&&k(Math.round((g+c)/2),!0,"...");1<b&&k(1,!1);g>c&&k(g,!0)}return e},this);this.checkAll=f.computed({read:function(){return 0<
e.data().messageListCheckedOrSelected().length},write:function(a){a=!!a;i.each(e.data().messageList(),function(c){c.checked(a)});a||e.data().message(null)}});this.inputMessageListSearchFocus=f.observable(!1);this.sLastSearchValue="";this.inputProxyMessageListSearch=f.computed({read:this.mainMessageListSearch,write:function(a){this.sLastSearchValue=a},owner:this});this.isIncompleteChecked=f.computed(function(){var a=e.data().messageList().length,c=e.data().messageListCheckedOrSelected().length;return 0<
a&&0<c&&a>c},this);this.hasMessages=f.computed(function(){return 0<this.messageList().length},this);this.hasCheckedLines=f.computed(function(){return 0<this.messageListChecked().length},this);this.hasCheckedOrSelectedLines=f.computed(function(){return 0<this.messageListCheckedOrSelected().length},this);this.isSpamFolder=f.computed(function(){return e.data().spamFolder()===this.messageListEndFolder()},this);this.isTrashFolder=f.computed(function(){return e.data().trashFolder()===this.messageListEndFolder()},
this);this.canBeMoved=this.hasCheckedOrSelectedLines;this.clearCommand=d.createCommand(this,function(){o.showScreenPopup(Aa,[e.data().currentFolder()])});this.multyForwardCommand=d.createCommand(this,function(){o.showScreenPopup(z,[g.ComposeType.ForwardAsAttachment,e.data().messageListCheckedOrSelected()])},this.canBeMoved);this.deleteWithoutMoveCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Trash,!1)},this.canBeMoved);this.deleteCommand=d.createCommand(this,
function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Trash,!0)},this.canBeMoved);this.spamCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Spam,!0)},this.canBeMoved);this.moveCommand=d.createCommand(this,d.emptyFunction,this.canBeMoved);this.setCommand=d.createCommand(this,d.emptyFunction,this.hasCheckedLines);this.checkCommand=d.createCommand(this,d.emptyFunction,this.hasCheckedLines);this.reloadCommand=d.createCommand(this,function(){e.data().messageListCompleteLoadingThrottle()||
e.reloadMessageList(!1,!0)});this.quotaTooltip=i.bind(this.quotaTooltip,this);this.selector=new N(this.messageList,this.currentMessage,".messageListItem .actionHandle",".messageListItem.selected",".messageListItem .checkboxMessage");this.selector.on("onItemSelect",i.bind(function(b){b?(a.message(a.staticMessageList.populateByMessageListItem(b)),this.populateMessageBody(a.message())):a.message(null)},this));this.selector.on("onItemGetUid",function(a){return a?a.generateUid():""});this.selector.on("onDelete",
i.bind(function(){0<e.data().messageListCheckedOrSelected().length&&this.deleteCommand()},this))}function J(){D.call(this,"Right","MailMessageView");var a="",b=e.data(),c=this,l=function(a){return d.createCommand(c,function(){this.replyOrforward(a)},c.canBeRepliedOrForwarded)};this.oMessageScrollerDom=null;this.message=b.message;this.messageLoading=b.messageLoading;this.messageLoadingThrottle=b.messageLoadingThrottle;this.messagesBodiesDom=b.messagesBodiesDom;this.useThreads=b.useThreads;this.replySameFolder=
b.replySameFolder;this.usePreviewPane=b.usePreviewPane;this.isMessageSelected=b.isMessageSelected;this.messageActiveDom=b.messageActiveDom;this.messageError=b.messageError;this.fullScreenMode=b.messageFullScreenMode;this.showFullInfo=f.observable(!1);this.canBeRepliedOrForwarded=this.messageVisibility=f.computed(function(){return!this.messageLoadingThrottle()&&!!this.message()},this);this.closeMessage=d.createCommand(this,function(){b.message(null)});this.replyCommand=l(g.ComposeType.Reply);this.replyAllCommand=
l(g.ComposeType.ReplyAll);this.forwardCommand=l(g.ComposeType.Forward);this.forwardAsAttachmentCommand=l(g.ComposeType.ForwardAsAttachment);this.messageVisibilityCommand=d.createCommand(this,d.emptyFunction,this.messageVisibility);this.viewSubject=f.observable("");this.viewFromShort=f.observable("");this.viewToShort=f.observable("");this.viewFrom=f.observable("");this.viewTo=f.observable("");this.viewCc=f.observable("");this.viewBcc=f.observable("");this.viewDate=f.observable("");this.viewMoment=
f.observable("");this.viewLineAsCcc=f.observable("");this.viewHasImages=f.observable(!1);this.viewHasVisibleAttachments=f.observable(!1);this.viewAttachments=f.observableArray([]);this.viewIsHtml=f.observable(!1);this.viewIsRtl=f.observable(!1);this.viewViewLink=f.observable("");this.viewDownloadLink=f.observable("");this.viewUserPic=f.observable(p.DataImages.UserDotPic);this.viewUserPicVisible=f.observable(!1);this.message.subscribe(function(b){this.messageActiveDom(null);b&&(this.viewSubject(b.subject()),
this.viewFromShort(b.fromToLine(!0,!0)),this.viewToShort(b.toToLine(!0,!0)),this.viewFrom(b.fromToLine(!1)),this.viewTo(b.toToLine(!1)),this.viewCc(b.ccToLine(!1)),this.viewBcc(b.bccToLine(!1)),this.viewDate(b.fullFormatDateValue()),this.viewMoment(b.momentDate()),this.viewLineAsCcc(b.lineAsCcc()),this.viewHasImages(b.hasImages()),this.viewHasVisibleAttachments(b.hasVisibleAttachments()),this.viewAttachments(b.attachments()),this.viewIsHtml(b.isHtml()),this.viewIsRtl(b.isRtl()),this.viewViewLink(b.viewLink()),
this.viewDownloadLink(b.downloadLink()),a=e.cache().getUserPic(b.fromAsSingleEmail()),a!==this.viewUserPic()&&(this.viewUserPicVisible(!1),this.viewUserPic(p.DataImages.UserDotPic),""!==a&&(this.viewUserPicVisible(!0),this.viewUserPic(a))))},this);this.fullScreenMode.subscribe(function(a){a?U.addClass("rl-message-fullscreen"):U.removeClass("rl-message-fullscreen");d.windowResize()});this.messageLoadingThrottle.subscribe(function(a){a&&d.windowResize()});this.messageActiveDom.subscribe(function(){this.scrollMessageToTop()},
this)}function Ba(a){D.call(this,"Left","SettingsMenu");this.menu=a.menu}function Ca(){D.call(this,"Right","SettingsPane")}function Da(){var a=e.data();this.mainLanguage=a.mainLanguage;this.mainMessagesPerPage=a.mainMessagesPerPage;this.mainMessagesPerPageArray=p.Defaults.MessagesPerPageArray;this.editorDefaultType=a.editorDefaultType;this.showImages=a.showImages;this.interfaceAnimation=a.interfaceAnimation;this.useDesktopNotifications=a.useDesktopNotifications;this.threading=a.threading;this.useThreads=
a.useThreads;this.replySameFolder=a.replySameFolder;this.usePreviewPane=a.usePreviewPane;this.useCheckboxesInList=a.useCheckboxesInList;this.allowLanguagesOnSettings=a.allowLanguagesOnSettings;this.isDesktopNotificationsSupported=f.computed(function(){return g.DesktopNotifications.NotSupported!==a.desktopNotificationsPermisions()});this.isDesktopNotificationsDenied=f.computed(function(){return g.DesktopNotifications.NotSupported===a.desktopNotificationsPermisions()||g.DesktopNotifications.Denied===
a.desktopNotificationsPermisions()});this.mainLanguageFullName=f.computed(function(){return d.convertLangName(this.mainLanguage())},this);this.languageTrigger=f.observable(g.SaveSettingsStep.Idle).extend({throttle:100});this.mppTrigger=f.observable(g.SaveSettingsStep.Idle);this.isAnimationSupported=n.bAnimationSupported}function Ua(){var a=e.data();this.displayName=a.displayName;this.replyTo=a.replyTo;this.signature=a.signature;this.nameTrigger=f.observable(g.SaveSettingsStep.Idle);this.replyTrigger=
f.observable(g.SaveSettingsStep.Idle);this.signatureTrigger=f.observable(g.SaveSettingsStep.Idle)}function qa(){this.accounts=e.data().accounts;this.processText=f.computed(function(){return e.data().accountsLoading()?d.i18n("SETTINGS_ACCOUNTS/LOADING_PROCESS"):""},this);this.visibility=f.computed(function(){return""===this.processText()?"hidden":"visible"},this);this.accountForDeletion=f.observable(null).extend({falseTimeout:3E3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&
a.deleteAccess(!0)}]})}function La(){var a=e.data();this.googleEnable=a.googleEnable;this.googleActions=a.googleActions;this.googleLoggined=a.googleLoggined;this.googleUserName=a.googleUserName;this.facebookEnable=a.facebookEnable;this.facebookActions=a.facebookActions;this.facebookLoggined=a.facebookLoggined;this.facebookUserName=a.facebookUserName;this.twitterEnable=a.twitterEnable;this.twitterActions=a.twitterActions;this.twitterLoggined=a.twitterLoggined;this.twitterUserName=a.twitterUserName;
this.connectGoogle=d.createCommand(this,function(){this.googleLoggined()||e.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()});this.disconnectGoogle=d.createCommand(this,function(){e.googleDisconnect()});this.connectFacebook=d.createCommand(this,function(){this.facebookLoggined()||e.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()});this.disconnectFacebook=d.createCommand(this,function(){e.facebookDisconnect()});this.connectTwitter=
d.createCommand(this,function(){this.twitterLoggined()||e.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()});this.disconnectTwitter=d.createCommand(this,function(){e.twitterDisconnect()})}function ra(){this.changeProcess=f.observable(!1);this.passwordUpdateError=f.observable(!1);this.passwordUpdateSuccess=f.observable(!1);this.currentPassword=f.observable("");this.newPassword=f.observable("");this.currentPassword.subscribe(function(){this.passwordUpdateError(!1);
this.passwordUpdateSuccess(!1)},this);this.newPassword.subscribe(function(){this.passwordUpdateError(!1);this.passwordUpdateSuccess(!1)},this);this.saveNewPasswordCommand=d.createCommand(this,function(){this.changeProcess(!0);this.passwordUpdateError(!1);this.passwordUpdateSuccess(!1);e.remote().changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword())},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()});this.onChangePasswordResponse=
i.bind(this.onChangePasswordResponse,this)}function X(){var a=e.data();this.foldersListError=a.foldersListError;this.folderList=a.folderList;this.processText=f.computed(function(){var a=e.data(),c=a.foldersLoading(),l=a.foldersCreating(),f=a.foldersDeleting(),a=a.foldersRenaming();return l?d.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):f?d.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):a?d.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):c?d.i18n("SETTINGS_FOLDERS/LOADING_PROCESS"):""},this);this.visibility=f.computed(function(){return""===
this.processText()?"hidden":"visible"},this);this.folderForDeletion=f.observable(null).extend({falseTimeout:3E3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]});this.folderForEdit=f.observable(null).extend({toggleSubscribe:[this,function(a){a&&a.edited(!1)},function(a){a&&a.canBeEdited()&&a.edited(!0)}]});this.useImapSubscribe=!!e.settingsGet("UseImapSubscribe")}function ma(){var a=this;this.mainTheme=e.data().mainTheme;this.customThemeType=
f.observable(e.settingsGet("CustomThemeType"));this.customThemeImg=f.observable(e.settingsGet("CustomThemeImg"));this.themesObjects=f.observableArray([]);this.customThemeUploaderProgress=f.observable(!1);this.customThemeUploaderButton=f.observable(null);this.showCustomThemeConfig=f.computed(function(){return"Custom"===this.mainTheme()},this);this.showCustomThemeConfig.subscribe(function(){d.windowResize()});this.themeTrigger=f.observable(g.SaveSettingsStep.Idle).extend({throttle:100});this.oLastAjax=
null;this.iTimer=0;e.data().theme.subscribe(function(b){i.each(this.themesObjects(),function(a){a.selected(b===a.name)});var c=j("#rlThemeLink"),l=j("#rlThemeStyle"),f=c.attr("href");f||(f=l.attr("data-href"));f&&(f=f.toString().replace(/\/-\/[^\/]+\/\-\//,"/-/"+b+"/-/"),f=f.toString().replace(/\/Css\/[^\/]+\/User\//,"/Css/"+("Custom"===b&&h.__rlah?h.__rlah()||"0":"0")+"/User/"),"Json/"!==f.substring(f.length-5,f.length)&&(f+="Json/"),h.clearTimeout(a.iTimer),a.themeTrigger(g.SaveSettingsStep.Animate),
this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=j.ajax({url:f,dataType:"json"}).done(function(b){if(b&&d.isArray(b)&&2===b.length){if(c&&c[0]&&(!l||!l[0]))l=j('<style id="rlThemeStyle"></style>'),c.after(l),c.remove();l&&l[0]&&l.attr("data-href",f).attr("data-theme",b[0]).text(b[1]);a.themeTrigger(g.SaveSettingsStep.TrueResult)}}).always(function(){a.iTimer=h.setTimeout(function(){a.themeTrigger(g.SaveSettingsStep.Idle)},1E3);a.oLastAjax=null}));e.remote().saveSettings(null,
{Theme:b})},this)}function Ma(){d.initDataConstructorBySettings(this)}function V(){d.initDataConstructorBySettings(this);var a=function(a){return function(){var b=e.cache().getFolderFromCacheList(a());b&&b.type(g.FolderType.User)}},b=function(a){return function(b){(b=e.cache().getFolderFromCacheList(b))&&b.type(a)}};this.devPassword=this.devLogin=this.devEmail="";this.accountEmail=f.observable("");this.accountLogin=f.observable("");this.projectHash=f.observable("");this.threading=f.observable(!1);
this.lastFoldersHash="";this.remoteChangePassword=this.remoteSuggestions=!1;this.sentFolder=f.observable("");this.draftFolder=f.observable("");this.spamFolder=f.observable("");this.trashFolder=f.observable("");this.sentFolder.subscribe(a(this.sentFolder),this,"beforeChange");this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange");this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange");this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange");this.sentFolder.subscribe(b(g.FolderType.SentItems),
this);this.draftFolder.subscribe(b(g.FolderType.Draft),this);this.spamFolder.subscribe(b(g.FolderType.Spam),this);this.trashFolder.subscribe(b(g.FolderType.Trash),this);this.draftFolderNotEnabled=f.computed(function(){return""===this.draftFolder()||p.Values.UnuseOptionValue===this.draftFolder()},this);this.displayName=f.observable("");this.signature=f.observable("");this.replyTo=f.observable("");this.accounts=f.observableArray([]);this.accountsLoading=f.observable(!1);this.namespace="";this.folderList=
f.observableArray([]);this.foldersListError=f.observable("");this.foldersLoading=f.observable(!1);this.foldersCreating=f.observable(!1);this.foldersDeleting=f.observable(!1);this.foldersRenaming=f.observable(!1);this.currentFolder=f.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.currentFolderFullNameRaw=f.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this);this.currentFolderFullName=f.computed(function(){return this.currentFolder()?
this.currentFolder().fullName:""},this);this.currentFolderFullNameHash=f.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this);this.currentFolderName=f.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this);this.folderListSystemNames=f.computed(function(){var a=["INBOX"],b=this.folderList(),e=this.sentFolder(),f=this.draftFolder(),g=this.spamFolder(),k=this.trashFolder();d.isArray(b)&&0<b.length&&(""!==e&&p.Values.UnuseOptionValue!==
e&&a.push(e),""!==f&&p.Values.UnuseOptionValue!==f&&a.push(f),""!==g&&p.Values.UnuseOptionValue!==g&&a.push(g),""!==k&&p.Values.UnuseOptionValue!==k&&a.push(k));return a},this);this.folderListSystem=f.computed(function(){return i.compact(i.map(this.folderListSystemNames(),function(a){return e.cache().getFolderFromCacheList(a)}))},this);this.folderMenuForMove=f.computed(function(){return e.folderListOptionsBuilder(this.folderListSystem(),this.folderList(),[this.currentFolderFullNameRaw()],null,null,
null,null,function(a){return a?a.localName():""})},this);this.staticMessageList=[];this.messageList=f.observableArray([]);this.messageListCount=f.observable(0);this.messageListSearch=f.observable("");this.messageListPage=f.observable(1);this.messageListThreadFolder=f.observable("");this.messageListThreadUids=f.observableArray([]);this.messageListThreadFolder.subscribe(function(){this.messageListThreadUids([])},this);this.messageListEndSearch=f.observable("");this.messageListEndFolder=f.observable("");
this.messageListPageCount=f.computed(function(){var a=Math.ceil(this.messageListCount()/this.messagesPerPage());return 0===a?1:a},this);this.mainMessageListSearch=f.computed({read:this.messageListSearch,write:function(a){o.setHash(e.link().mailBox(this.currentFolderFullNameHash(),1,d.trim(a.toString())))},owner:this});this.messageListError=f.observable("");this.messageListLoading=f.observable(!1);this.messageListIsNotCompleted=f.observable(!1);this.messageListCompleteLoadingThrottle=f.observable(!1).extend({throttle:200});
this.messageListCompleteLoading=f.computed(function(){var a=this.messageListLoading(),b=this.messageListIsNotCompleted();return a||b},this);this.messageListCompleteLoading.subscribe(function(a){this.messageListCompleteLoadingThrottle(a)},this);this.messageList.subscribe(i.debounce(function(a){i.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500));this.staticMessageList=new m;this.message=f.observable(null);this.messageLoading=f.observable(!1);this.messageLoadingThrottle=f.observable(!1).extend({throttle:50});
this.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this);this.messageFullScreenMode=f.observable(!1);this.messageError=f.observable("");this.messagesBodiesDom=f.observable(null);this.messagesBodiesDom.subscribe(function(a){a&&!(a instanceof jQuery)&&this.messagesBodiesDom(j(a))},this);this.messageActiveDom=f.observable(null);this.isMessageSelected=f.computed(function(){return null!==this.message()},this);this.currentMessage=f.observable(null);this.message.subscribe(function(a){null===
a&&(this.currentMessage(null),this.hideMessageBodies())},this);this.messageListChecked=f.computed(function(){return i.filter(this.messageList(),function(a){return a.checked()})},this);this.messageListCheckedOrSelected=f.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return i.union(a,b?[b]:[])},this);this.messageListCheckedUids=f.computed(function(){var a=[];i.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),0<b.threadsLen()&&(0===b.parentUid()&&b.lastInCollapsedThread())&&
(a=i.union(a,b.threads())))});return a},this);this.messageListCheckedOrSelectedUidsWithSubMails=f.computed(function(){var a=[];i.each(this.messageListCheckedOrSelected(),function(b){b&&(a.push(b.uid),0<b.threadsLen()&&(0===b.parentUid()&&b.lastInCollapsedThread())&&(a=i.union(a,b.threads())))});return a},this);this.userQuota=f.observable(0);this.userUsageSize=f.observable(0);this.userUsageProc=f.computed(function(){var a=this.userQuota(),b=this.userUsageSize();return 0<a?Math.ceil(100*(b/a)):0},this);
this.useKeyboardShortcuts=f.observable(!0);this.googleActions=f.observable(!1);this.googleLoggined=f.observable(!1);this.googleUserName=f.observable("");this.facebookActions=f.observable(!1);this.facebookLoggined=f.observable(!1);this.facebookUserName=f.observable("");this.twitterActions=f.observable(!1);this.twitterLoggined=f.observable(!1);this.twitterUserName=f.observable("");this.customThemeType=f.observable(g.CustomThemeType.Light);this.purgeMessageBodyCacheThrottle=i.throttle(this.purgeMessageBodyCache,
3E4)}function fa(){this.oRequests={}}function s(){this.oRequests={};this.oRequests={}}function Y(){this.oEmailsPicsHashes={};this.oServices={}}function x(){Y.call(this);this.oFoldersCache={};this.oFoldersNamesCache={};this.oFolderHashCache={};this.oFolderUidNextCache={};this.oMessageListHashCache={};this.oMessageFlagsCache={};this.oNewMessage={};this.oRequestedMessage={}}function ga(a){M.call(this,"settings",a);this.menu=f.observableArray([]);this.oViewModelPlace=this.oCurrentSubScreen=null}function Ea(){M.call(this,
"login",[la])}function da(){M.call(this,"mailbox",[Sa,ca,A,J]);this.oLastRoute={}}function Na(){ga.call(this,[Ta,Ba,Ca]);d.initOnStartOrLangChange(function(){this.sSettingsTitle=d.i18n("TITLES/SETTINGS")},this,function(){e.setTitle(this.sSettingsTitle)})}function K(){this.oLocal=this.oLink=this.oPlugins=this.oSettings=null;this.isLocalAutocomplete=!0;this.popupVisibility=f.observable(!1);this.iframe=j('<iframe style="display:none" src="javascript:;" />').appendTo("body");Q.on("error",function(a){e&&
(a&&a.originalEvent&&a.originalEvent.message&&-1===d.inArray(a.originalEvent.message,["Uncaught Error: Error calling method on NPObject."]))&&e.remote().jsError(d.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",U.attr("class"))})}function B(){K.call(this);this.oCache=this.oRemote=this.oData=null;this.iSuggestionsLimit=d.pInt(this.settingsGet("SuggestionsLimit"));this.iSuggestionsLimit=0===this.iSuggestionsLimit?
20:this.iSuggestionsLimit;this.quotaDebounce=i.debounce(this.quota,3E4)}var p={},g={},v={},d={},y={},na={},n={},W={settings:[],"settings-removed":[],"settings-disabled":[]},o=null,Fa=h.rainloopAppData||{},Oa=h.rainloopI18N||{},U=j("html"),Q=j(h),Ga=j(h.document),oa=h.Notification&&h.Notification.requestPermission?h.Notification:null,e=null;n.minuteTick=f.observable(!0);n.fiveMinuteTick=f.observable(!0);n.langChangeTick=f.observable(!0);n.iAjaxErrorCount=0;n.iTokenErrorCount=0;n.iMessageBodyCacheCount=
0;n.bUnload=!1;n.sUserAgent=(navigator.userAgent||"").toLowerCase();n.bIsiOSDevice=-1<n.sUserAgent.indexOf("iphone")||-1<n.sUserAgent.indexOf("ipod")||-1<n.sUserAgent.indexOf("ipad");n.bIsAndroidDevice=-1<n.sUserAgent.indexOf("android");n.bMobileDevice=n.bIsiOSDevice||n.bIsAndroidDevice;n.bDisableNanoScroll=n.bMobileDevice;n.bAnimationSupported=!n.bMobileDevice&&U.hasClass("csstransitions");n.sAnimationType="";p.Defaults={};p.Values={};p.DataImages={};p.Defaults.MessagesPerPage=20;p.Defaults.MessagesPerPageArray=
[10,20,30,50,100];p.Defaults.DefaultAjaxTimeout=2E4;p.Defaults.SearchAjaxTimeout=12E4;p.Defaults.SendMessageAjaxTimeout=2E5;p.Defaults.SaveMessageAjaxTimeout=2E5;p.Values.UnuseOptionValue="__UNUSE__";p.Values.GmailFolderName="[Gmail]";p.Values.ClientSideCookieIndexName="rlcsc";p.Values.ImapDefaulPort=143;p.Values.ImapDefaulSecurePort=993;p.Values.SmtpDefaulPort=25;p.Values.SmtpDefaulSecurePort=465;p.Values.iMessageBodyCacheLimit=15;p.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=";
p.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=";g.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"};g.State={Empty:10,Login:20,Auth:30};g.StateType={Webmail:0,Admin:1};g.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,User:99};g.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"};g.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2};
g.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft"};g.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99};g.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4};g.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4};g.EventKeyCode={Backspace:8,
Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Insert:45,Delete:46,A:65,S:83};g.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3};g.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6};g.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9};g.MessagePriority={Low:5,Normal:3,High:1};g.EditorDefaultType={Html:"Html",Plain:"Plain"};g.CustomThemeType={Light:"Light",Dark:"Dark"};g.ServerSecure={None:0,SSL:1,
TLS:2};g.SearchDateType={All:-1,Days3:3,Days7:7,Month:30};g.EmailType={Defailt:0,Facebook:1,Google:2};g.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0};g.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"};g.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,CantGetMessageList:201,
CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,CantSaveMessage:301,CantSendMessage:302,InvalidRecipients:303,CantCreateFolder:400,CantRenameFolder:401,CantDeleteFolder:402,CantSubscribeFolder:403,CantUnsubscribeFolder:404,CantDeleteNonEmptyFolder:405,CantSaveSettings:501,CantSavePluginSettings:502,DomainAlreadyExists:601,CantInstallPackage:701,CantDeletePackage:702,InvalidPluginPackage:703,UnsupportedPluginPackage:704,LicensingServerIsUnavailable:710,LicensingExpired:711,LicensingBanned:712,
DemoSendMessageError:750,AccountAlreadyExists:801,MailServerError:901,UnknownNotification:999,UnknownError:999};d.trim=j.trim;d.inArray=j.inArray;d.isArray=i.isArray;d.isFunc=i.isFunction;d.isUnd=i.isUndefined;d.isNull=i.isNull;d.emptyFunction=function(){};d.isNormal=function(a){return!d.isUnd(a)&&!d.isNull(a)};d.windowResize=i.debounce(function(a){d.isUnd(a)?Q.resize():h.setTimeout(function(){Q.resize()},a)},50);d.isPosNumeric=function(a,b){return d.isNormal(a)?d.isUnd(b)||b?/^[0-9]*$/.test(a.toString()):
/^[1-9]+[0-9]*$/.test(a.toString()):!1};d.pInt=function(a){return d.isNormal(a)&&""!==a?h.parseInt(a,10):0};d.pString=function(a){return d.isNormal(a)?a+"":""};d.isNonEmptyArray=function(a){return d.isArray(a)&&0<a.length};d.exportPath=function(a,b,c){for(var l=null,a=a.split("."),c=c||h;a.length&&(l=a.shift());)!a.length&&!d.isUnd(b)?c[l]=b:c=c[l]?c[l]:c[l]={}};d.pImport=function(a,b,c){a[b]=c};d.pExport=function(a,b,c){return d.isUnd(a[b])?c:a[b]};d.encodeHtml=function(a){return d.isNormal(a)?a.toString().replace(/&/g,
"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""};d.splitPlainText=function(a,b){for(var c="",l="",e=a,f=0,g=0,b=d.isUnd(b)?100:b;e.length>b;)l=e.substring(0,b),f=l.lastIndexOf(" "),g=l.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=l.substring(0,f)+"\n",e=e.substring(f+1);return c+e};var Ha={};d.timeOutAction=function(a,b,c){d.isUnd(Ha[a])&&(Ha[a]=0);h.clearTimeout(Ha[a]);Ha[a]=h.setTimeout(b,c)};var Pa={};d.timeOutActionSecond=function(a,b,c){Pa[a]||
(Pa[a]=h.setTimeout(function(){b();Pa[a]=0},c))};var R=!1;d.audio=function(a,b){if(!1===R)if(n.bIsiOSDevice)R=null;else{var c=!1,d=!1,e=h.Audio?new h.Audio:null;e&&e.canPlayType&&e.play?((c=""!==e.canPlayType('audio/mpeg; codecs="mp3"'))||(d=""!==e.canPlayType('audio/ogg; codecs="vorbis"')),c||d?(R=e,R.preload="none",R.loop=!1,R.autoplay=!1,R.muted=!1,R.src=c?a:b):R=null):R=null}return R};d.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1};d.i18n=function(a,b,c){var l=
"",a=d.isUnd(Oa[a])?d.isUnd(c)?a:c:Oa[a];if(!d.isUnd(b)&&!d.isNull(b))for(l in b)d.hos(b,l)&&(a=a.replace("%"+l+"%",b[l]));return a};d.i18nToNode=function(a){i.defer(function(){j(".i18n",a).each(function(){var a=j(this),c="";(c=a.data("i18n-text"))?a.text(d.i18n(c)):((c=a.data("i18n-html"))&&a.html(d.i18n(c)),(c=a.data("i18n-placeholder"))&&a.attr("placeholder",d.i18n(c)))})})};d.i18nToDoc=function(){h.rainloopI18N&&(Oa=h.rainloopI18N||{},d.i18nToNode(Ga),n.langChangeTick(!n.langChangeTick()));h.rainloopI18N=
{}};d.initOnStartOrLangChange=function(a,b,c){a&&a.call(b);c?n.langChangeTick.subscribe(function(){a&&a.call(b);c.call(b)}):a&&n.langChangeTick.subscribe(a,b)};d.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)};d.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=j(document.activeElement);(a.is("input")||a.is("textarea"))&&
document.activeElement.blur()}};d.removeSelection=function(){if(h&&h.getSelection){var a=h.getSelection();a&&a.removeAllRanges&&a.removeAllRanges()}else document&&(document.selection&&document.selection.empty)&&document.selection.empty()};d.replySubjectAdd=function(a,b){var c=null,l=d.trim(b);null!==(c=(new h.RegExp("^"+a+"[\\s]?\\:(.*)$","gi")).exec(b))&&!d.isUnd(c[1])?l=a+"[2]: "+c[1]:null!==(c=(new h.RegExp("^("+a+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi")).exec(b))&&!d.isUnd(c[1])&&
!d.isUnd(c[2])&&!d.isUnd(c[3])?(d.pInt(c[2]),l=c[1]+(d.pInt(c[2])+1)+c[3]):l=a+": "+b;return l};d.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};d.friendlySize=function(a){a=d.pInt(a);return 1073741824<=a?d.roundNumber(a/1073741824,1)+"GB":1048576<=a?d.roundNumber(a/1048576,1)+"MB":1024<=a?d.roundNumber(a/1024,0)+"KB":a+"B"};d.log=function(a){h.console&&h.console.log&&h.console.log(a)};d.getNotification=function(a){a=d.pInt(a);return d.isUnd(v[a])?"":v[a]};d.initNotificationLanguage=
function(){v[g.Notification.InvalidToken]=d.i18n("NOTIFICATIONS/INVALID_TOKEN");v[g.Notification.AuthError]=d.i18n("NOTIFICATIONS/AUTH_ERROR");v[g.Notification.AccessError]=d.i18n("NOTIFICATIONS/ACCESS_ERROR");v[g.Notification.ConnectionError]=d.i18n("NOTIFICATIONS/CONNECTION_ERROR");v[g.Notification.CaptchaError]=d.i18n("NOTIFICATIONS/CAPTCHA_ERROR");v[g.Notification.SocialFacebookLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE");v[g.Notification.SocialTwitterLoginAccessDisable]=
d.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE");v[g.Notification.SocialGoogleLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE");v[g.Notification.DomainNotAllowed]=d.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED");v[g.Notification.AccountNotAllowed]=d.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED");v[g.Notification.CantGetMessageList]=d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST");v[g.Notification.CantGetMessage]=d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE");v[g.Notification.CantDeleteMessage]=
d.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE");v[g.Notification.CantMoveMessage]=d.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE");v[g.Notification.CantSaveMessage]=d.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE");v[g.Notification.CantSendMessage]=d.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE");v[g.Notification.InvalidRecipients]=d.i18n("NOTIFICATIONS/INVALID_RECIPIENTS");v[g.Notification.CantCreateFolder]=d.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER");v[g.Notification.CantRenameFolder]=d.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER");
v[g.Notification.CantDeleteFolder]=d.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER");v[g.Notification.CantDeleteNonEmptyFolder]=d.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER");v[g.Notification.CantSubscribeFolder]=d.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER");v[g.Notification.CantUnsubscribeFolder]=d.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER");v[g.Notification.CantSaveSettings]=d.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS");v[g.Notification.CantSavePluginSettings]=d.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS");
v[g.Notification.DomainAlreadyExists]=d.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS");v[g.Notification.CantInstallPackage]=d.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE");v[g.Notification.CantDeletePackage]=d.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE");v[g.Notification.InvalidPluginPackage]=d.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE");v[g.Notification.UnsupportedPluginPackage]=d.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE");v[g.Notification.LicensingServerIsUnavailable]=d.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE");
v[g.Notification.LicensingExpired]=d.i18n("NOTIFICATIONS/LICENSING_EXPIRED");v[g.Notification.LicensingBanned]=d.i18n("NOTIFICATIONS/LICENSING_BANNED");v[g.Notification.DemoSendMessageError]=d.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR");v[g.Notification.AccountAlreadyExists]=d.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS");v[g.Notification.MailServerError]=d.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR");v[g.Notification.UnknownNotification]=d.i18n("NOTIFICATIONS/UNKNOWN_ERROR");v[g.Notification.UnknownError]=
d.i18n("NOTIFICATIONS/UNKNOWN_ERROR")};d.getUploadErrorDescByCode=function(a){var b="";switch(d.pInt(a)){case g.UploadErrorCode.FileIsTooBig:b=d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case g.UploadErrorCode.FilePartiallyUploaded:b=d.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case g.UploadErrorCode.FileNoUploaded:b=d.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case g.UploadErrorCode.MissingTempFolder:b=d.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case g.UploadErrorCode.FileOnSaveingError:b=
d.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case g.UploadErrorCode.FileType:b=d.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=d.i18n("UPLOAD/ERROR_UNKNOWN")}return b};d.killCtrlAandS=function(a){if(a=a||h.event){var b=a.target||a.srcElement,c=a.keyCode||a.which;if(a.ctrlKey&&c===g.EventKeyCode.S)a.preventDefault();else if((!b||!b.tagName||!b.tagName.match(/INPUT|TEXTAREA/i))&&a.ctrlKey&&c===g.EventKeyCode.A)h.getSelection?h.getSelection().removeAllRanges():h.document.selection&&h.document.selection.clear&&
h.document.selection.clear(),a.preventDefault()}};d.createCommand=function(a,b,c){var l=b?function(){l.canExecute&&l.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments));return!1}:function(){};l.enabled=f.observable(!0);c=d.isUnd(c)?!0:c;l.canExecute=d.isFunc(c)?f.computed(function(){return l.enabled()&&c.call(a)}):f.computed(function(){return l.enabled()&&!!c});return l};d.initDataConstructorBySettings=function(a){a.editorDefaultType=f.observable(g.EditorDefaultType.Html);a.showImages=
f.observable(!1);a.interfaceAnimation=f.observable(g.InterfaceAnimation.Full);n.sAnimationType=g.InterfaceAnimation.Full;a.allowThemes=f.observable(!0);a.allowCustomLogin=f.observable(!1);a.allowLanguagesOnSettings=f.observable(!0);a.allowLanguagesOnLogin=f.observable(!0);a.desktopNotifications=f.observable(!1);a.useThreads=f.observable(!0);a.replySameFolder=f.observable(!0);a.usePreviewPane=f.observable(!0);a.useCheckboxesInList=f.observable(!0);a.interfaceAnimation.subscribe(function(a){if(n.bMobileDevice||
a===g.InterfaceAnimation.None)U.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),n.sAnimationType=g.InterfaceAnimation.None;else switch(a){case g.InterfaceAnimation.Full:U.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full");n.sAnimationType=a;break;case g.InterfaceAnimation.Normal:U.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),n.sAnimationType=a}});a.interfaceAnimation.valueHasMutated();a.desktopNotificationsPermisions=f.computed(function(){a.desktopNotifications();
var b=g.DesktopNotifications.NotSupported;if(oa&&oa.permission)switch(oa.permission.toLowerCase()){case "granted":b=g.DesktopNotifications.Allowed;break;case "denied":b=g.DesktopNotifications.Denied;break;case "default":b=g.DesktopNotifications.NotAllowed}else h.webkitNotifications&&h.webkitNotifications.checkPermission&&(b=h.webkitNotifications.checkPermission());return b});a.useDesktopNotifications=f.computed({read:function(){return a.desktopNotifications()&&g.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()},
write:function(b){b?(b=a.desktopNotificationsPermisions(),g.DesktopNotifications.Allowed===b?a.desktopNotifications(!0):g.DesktopNotifications.NotAllowed===b?oa.requestPermission(function(){a.desktopNotifications.valueHasMutated();g.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()?a.desktopNotifications()?a.desktopNotifications.valueHasMutated():a.desktopNotifications(!0):a.desktopNotifications()?a.desktopNotifications(!1):a.desktopNotifications.valueHasMutated()}):a.desktopNotifications(!1)):
a.desktopNotifications(!1)}});a.language=f.observable("");a.languages=f.observableArray([]);a.mainLanguage=f.computed({read:a.language,write:function(b){b!==a.language()?-1<d.inArray(b,a.languages())?a.language(b):0<a.languages().length&&a.language(a.languages()[0]):a.language.valueHasMutated()}});a.theme=f.observable("");a.themes=f.observableArray([]);a.mainTheme=f.computed({read:a.theme,write:function(b){if(b!==a.theme()){var c=a.themes();-1<d.inArray(b,c)?a.theme(b):0<c.length&&a.theme(c[0])}else a.theme.valueHasMutated()}});
a.allowCustomTheme=f.observable(!0);a.allowAdditionalAccounts=f.observable(!0);a.determineUserLanguage=f.observable(!1);a.messagesPerPage=f.observable(p.Defaults.MessagesPerPage);a.mainMessagesPerPage=a.messagesPerPage;a.mainMessagesPerPage=f.computed({read:a.messagesPerPage,write:function(b){-1<d.inArray(d.pInt(b),p.Defaults.MessagesPerPageArray)?b!==a.messagesPerPage()&&a.messagesPerPage(b):a.messagesPerPage.valueHasMutated()}});a.facebookEnable=f.observable(!1);a.facebookAppID=f.observable("");
a.facebookAppSecret=f.observable("");a.twitterEnable=f.observable(!1);a.twitterConsumerKey=f.observable("");a.twitterConsumerSecret=f.observable("");a.googleEnable=f.observable(!1);a.googleClientID=f.observable("");a.googleClientSecret=f.observable("");a.dropboxEnable=f.observable(!1);a.dropboxApiKey=f.observable("");a.contactsIsSupported=f.observable(!1);a.contactsIsAllowed=f.observable(!1)};d.createMomentDate=function(a){return f.computed(function(){n.minuteTick();return this.moment().fromNow()},
a)};d.createMomentShortDate=function(a){return f.computed(function(){var a="",a=ea(),c=this.moment(),l=this.momentDate();return a=4>=a.diff(c,"hours")?l:a.format("L")===c.format("L")?d.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):a.clone().subtract("days",1).format("L")===c.format("L")?d.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):a.year()===c.year()?c.format("D MMM."):c.format("LL")},a)};d.isFolderExpanded=function(a){var b=e.local().get(g.ClientSideKeyName.ExpandedFolders);return i.isArray(b)&&
-1!==i.indexOf(b,a)};d.setExpandedFolder=function(a,b){var c=e.local().get(g.ClientSideKeyName.ExpandedFolders);i.isArray(c)||(c=[]);b?(c.push(a),c=i.uniq(c)):c=i.without(c,a);e.local().set(g.ClientSideKeyName.ExpandedFolders,c)};d.initLayoutResizer=function(a,b,c,d,f,g,w,k){var d=d||300,f=f||500,g=g||f-d/2,w=w||300,h=0,q=j(a),db=j(b),r=j(c),b=e.local().get(k)||g,H=function(a,b,c){if(b||c)a=r.width(),b=b?100*(b.size.width/a):null,null===b&&c&&(b=100*(q.width()/a)),null!==b&&(q.css({width:"",height:"",
right:""+(100-b)+"%"}),db.css({width:"",height:"",left:""+b+"%"}))};b&&q.width(b);h=r.width()-w;h=f>h?h:f;q.resizable({minWidth:d,maxWidth:h,handles:"e",resize:H,stop:H});H(null,null,!0);Q.resize(i.throttle(function(b,c){c&&(c.element&&c.element[0].id&&"#"+c.element[0].id===""+a)&&(h=r.width()-w,h=f>h?h:f,q.resizable("option","maxWidth",h),c.size&&c.size.width&&e.local().set(k,c.size.width),H(null,null,!0))},400))};d.initBlockquoteSwitcher=function(a){if(a){var b=j("blockquote:not(.rl-bq-switcher)",
a).filter(function(){return 0===j(this).parent().closest("blockquote",a).length});b&&0<b.length&&b.each(function(){var a=j(this),b=a.height();if(0===b||100<b)a.addClass("rl-bq-switcher hidden-bq"),j('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>').insertBefore(a).click(function(){a.toggleClass("hidden-bq");d.windowResize()}).after("<br />").before("<br />")})}};d.removeBlockquoteSwitcher=function(a){a&&(j(a).find("blockquote.rl-bq-switcher").each(function(){j(this).removeClass("rl-bq-switcher hidden-bq")}),
j(a).find(".rlBlockquoteSwitcher").each(function(){j(this).remove()}))};d.extendAsViewModel=function(a,b){b&&(b.__name=a,y.regViewModelHook(a,b),i.extend(b.prototype,D.prototype))};d.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e};W.settings.push(a)};d.removeSettingsViewModel=function(a){W["settings-removed"].push(a)};d.disableSettingsViewModel=function(a){W["settings-disabled"].push(a)};d.convertThemeName=function(a){return d.trim(a.replace(/[^a-zA-Z]/g,
" ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))};d.convertLangName=function(a){return d.i18n("LANGS_NAMES/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)};d.fakeMd5=function(a){for(var b="",a=d.isUnd(a)?32:d.pInt(a);b.length<a;)b+="0123456789abcdefghijklmnopqrstuvwxyz".substr(h.Math.round(36*h.Math.random()),1);return b};d.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")};
d.draggeblePlace=function(){return j('<div class="draggablePlace"><span class="text"></span>&nbsp;<i class="icon-envelope icon-white"></i></div>').appendTo("#rl-hidden")};d.defautOptionsAfterRender=function(a,b){b&&!d.isUnd(b.disable)&&f.applyBindingsToNode(a,{disable:b.disable},b)};d.windowPopupKnockout=function(a,b,c,l){var e=null,f=h.open(""),g="__OpenerApplyBindingsUid"+d.fakeMd5()+"__",k=j("#"+b);h[g]=function(){if(f&&f.document.body&&k&&k[0]){var b=j(f.document.body);j("#rl-content",b).html(k.html());
j("html",f.document).addClass("external "+j("html").attr("class"));d.i18nToNode(b);F.prototype.applyExternal(a,j("#rl-content",b)[0]);h[g]=null;l(f)}};f.document.open();f.document.write('<html><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="robots" content="noindex, nofollow, noodp" /><title>'+d.encodeHtml(c)+'</title></head><body><div id="rl-content"></div></body></html>');
f.document.close();e=f.document.createElement("script");e.type="text/javascript";e.innerHTML="if(window&&window.opener&&window.opener['"+g+"']){window.opener['"+g+"']();window.opener['"+g+"']=null}";f.document.getElementsByTagName("head")[0].appendChild(e)};d.settingsSaveHelperFunction=function(a,b,c,l){c=c||null;l=d.isUnd(l)?1E3:d.pInt(l);return function(d,e,f,k,h){b.call(c,e&&e.Result?g.SaveSettingsStep.TrueResult:g.SaveSettingsStep.FalseResult);a&&a.call(c,d,e,f,k,h);i.delay(function(){b.call(c,
g.SaveSettingsStep.Idle)},l)}};d.settingsSaveHelperSimpleFunction=function(a,b){return d.settingsSaveHelperFunction(null,a,b,1E3)};d.resizeAndCrop=function(a,b,c){var d=new Image;d.onload=function(){var a=[0,0],d=document.createElement("canvas"),l=d.getContext("2d");d.width=b;d.height=b;a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width];l.fillStyle="#fff";l.fillRect(0,0,b,b);l.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,b,b);c(d.toDataURL("image/jpeg"))};
d.src=a};na={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return na.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){for(var b="",c,d,e,f,g,k,h=0,a=na._utf8_encode(a);h<a.length;)c=a.charCodeAt(h++),d=a.charCodeAt(h++),e=a.charCodeAt(h++),f=c>>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,k=e&63,isNaN(d)?g=k=64:isNaN(e)&&(k=64),b=b+this._keyStr.charAt(f)+this._keyStr.charAt(c)+this._keyStr.charAt(g)+this._keyStr.charAt(k);
return b},decode:function(a){for(var b="",c,d,e,f,g,k=0,a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)c=this._keyStr.indexOf(a.charAt(k++)),d=this._keyStr.indexOf(a.charAt(k++)),f=this._keyStr.indexOf(a.charAt(k++)),g=this._keyStr.indexOf(a.charAt(k++)),c=c<<2|d>>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,b+=String.fromCharCode(c),64!==f&&(b+=String.fromCharCode(d)),64!==g&&(b+=String.fromCharCode(e));return na._utf8_decode(b)},_utf8_encode:function(a){for(var a=a.replace(/\r\n/g,"\n"),b="",c=0,d=a.length,
e=0;c<d;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):(127<e&&2048>e?b+=String.fromCharCode(e>>6|192):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128)),b+=String.fromCharCode(e&63|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):191<d&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((d&31)<<6|e&63),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((d&15)<<12|
(e&63)<<6|f&63),c+=3);return b}};f.bindingHandlers.tooltip={init:function(a,b){if(!n.bMobileDevice){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,trigger:"hover",title:function(){return'<span class="tooltip-class '+c+'">'+d.i18n(f.utils.unwrapObservable(b()))+"</span>"}})}}};f.bindingHandlers.tooltip2={init:function(a,b){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,title:function(){return'<span class="tooltip-class '+c+
'">'+b()()+"</span>"}})}};f.bindingHandlers.popover={init:function(a,b){j(a).popover(f.utils.unwrapObservable(b()))}};f.bindingHandlers.resizecrop={init:function(a){j(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,b){b()();j(a).resizecrop({width:"100",height:"100"})}};f.bindingHandlers.onEnter={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&13===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};f.bindingHandlers.onEsc=
{init:function(a,b,c,d){j(a).on("keypress",function(c){c&&27===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};f.bindingHandlers.modal={init:function(a,b){j(a).modal({keyboard:!1,show:f.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})},update:function(a,b){var c=f.utils.unwrapObservable(b());j(a).modal(c?"show":"hide");i.delay(function(){j(a).toggleClass("popup-active",c)},1)}};f.bindingHandlers.i18nInit={init:function(a){d.i18nToNode(a)}};f.bindingHandlers.i18nUpdate=
{update:function(a,b){f.utils.unwrapObservable(b());d.i18nToNode(a)}};f.bindingHandlers.link={update:function(a,b){j(a).attr("href",f.utils.unwrapObservable(b()))}};f.bindingHandlers.title={update:function(a,b){j(a).attr("title",f.utils.unwrapObservable(b()))}};f.bindingHandlers.textF={init:function(a,b){j(a).text(f.utils.unwrapObservable(b()))}};f.bindingHandlers.initDom={init:function(a,b){b()(a)}};f.bindingHandlers.initResizeTrigger={init:function(a,b){var c=f.utils.unwrapObservable(b());j(a).css({height:c[1],
"min-height":c[1]})},update:function(a,b){var c=f.utils.unwrapObservable(b()),l=d.pInt(c[1]),e=0,e=j(a).offset().top;0<e&&(e+=d.pInt(c[2]),e=Q.height()-e,l<e&&(l=e),j(a).css({height:l,"min-height":l}))}};f.bindingHandlers.appendDom={update:function(a,b){j(a).hide().empty().append(f.utils.unwrapObservable(b())).show()}};f.bindingHandlers.draggable={init:function(a,b,c){if(!n.bMobileDevice){var l=(c=c())&&c.droppableSelector?c.droppableSelector:"",c={distance:20,handle:".dragHandle",cursorAt:{top:22,
left:3},refreshPositions:!0,scroll:!0};l&&(c.drag=function(a){j(l).each(function(){var b=null,c=null,l=j(this),c=l.offset(),b=c.top+l.height();h.clearInterval(l.data("timerScroll"));l.data("timerScroll",!1);if(a.pageX>=c.left&&a.pageX<=c.left+l.width()&&(a.pageY>=b-100&&a.pageY<=b&&(b=function(){l.scrollTop(l.scrollTop()+3);d.windowResize()},l.data("timerScroll",h.setInterval(b,10)),b()),a.pageY>=c.top&&a.pageY<=c.top+100))c=function(){l.scrollTop(l.scrollTop()-3);d.windowResize()},l.data("timerScroll",
h.setInterval(c,10)),c()})},c.stop=function(){j(l).each(function(){h.clearInterval(j(this).data("timerScroll"));j(this).data("timerScroll",!1)})});c.helper=function(a){return b()(a&&a.target?f.dataFor(a.target):null)};j(a).draggable(c).on("mousedown",function(){d.removeInFocus()})}}};f.bindingHandlers.droppable={init:function(a,b,c){if(!n.bMobileDevice){var d=b(),e=(b=c())&&b.droppableOver?b.droppableOver:null,f=b&&b.droppableOut?b.droppableOut:null,b={tolerance:"pointer",hoverClass:"droppableHover"};
d&&(b.drop=function(a,b){d(a,b)},e&&(b.over=function(a,b){e(a,b)}),f&&(b.out=function(a,b){f(a,b)}),j(a).droppable(b))}}};f.bindingHandlers.nano={init:function(a){n.bDisableNanoScroll||j(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}};f.bindingHandlers.saveTrigger={init:function(a){j(a).append('&nbsp;&nbsp;<i class="icon-spinner-2 animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>').addClass("settings-saved-trigger")},update:function(a,
b){var c=f.utils.unwrapObservable(b()),d=j(a);switch(c.toString()){case "1":d.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case "0":d.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case "-2":d.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:d.find(".animated").hide().end().find(".error,.success").removeClass("visible")}}};
f.bindingHandlers.select2={init:function(a,b){var c=0,l=null,g=new h.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),t=new h.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),w=function(){return""},k=function(a){e.getAutocomplete(a.term,a.page,function(b,c){a.callback({more:!!c,results:i.map(b,function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};j(a).addClass("ko-select2").select2({query:function(a){a&&(0===c?(k(a),c=h.setTimeout(d.emptyFunction,100)):(h.clearInterval(c),c=h.setTimeout(function(){k(a)},
100)))},formatSelection:function(a,b){var c=a&&a.c?a.c.select2Selection(b):a.text;if(null!==c)return c},formatResult:function(a,b,c,d){b=a&&a.c?a.c.select2Result(b):"";return""===b?d(a.text):b},createSearchChoice:function(a,b){return 0===b.length&&g.test(a)?{id:a,text:a}:null},formatNoMatches:w,formatSearching:function(){return d.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:w,formatSelectionTooBig:w,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,
openOnEnter:!1});f.utils.domNodeDisposal.addDisposeCallback(a,function(){j(a).select2("destroy")});j(a).on("change",function(){for(var a=j(this).select2("data"),c=0,e=a.length,f=null,g=[];c<e;c++)if((f=a[c])&&f.id)f.c||(f.c=new G,(l=t.exec(d.trim(f.id)))&&!d.isUnd(l[2])?(f.c.name=l[1],f.c.email=l[2]):f.c.email=f.id),g.push(f.c);b()(g)})},update:function(a,b){for(var c=f.utils.unwrapObservable(b()),d=0,e=c.length,g=null,w="",k=[];d<e;d++)g=c[d],w=g.toLine(!1),k.push({id:w,text:w,c:g});j(a).select2("data",
k)}};f.bindingHandlers.command={init:function(a,b,c,d){var e=j(a),g=b();if(!g||!g.enabled||!g.canExecute)throw Error("You are not using command function");e.addClass("command");f.bindingHandlers[e.is("form")?"submit":"click"].init.apply(d,arguments)},update:function(a,b){var c=!0,d=j(a),e=b(),c=e.enabled();d.toggleClass("command-not-enabled",!c);c&&(c=e.canExecute(),d.toggleClass("command-can-not-be-execute",!c));d.toggleClass("command-disabled disable disabled",!c);(d.is("input")||d.is("button"))&&
d.prop("disabled",!c)}};f.extenders.trimmer=function(a){var b=f.computed({read:a,write:function(b){a(d.trim(b.toString()))},owner:this});b(a());return b};f.extenders.reversible=function(a){var b=a();a.commit=function(){b=a()};a.reverse=function(){a(b)};a.commitedValue=function(){return b};return a};f.extenders.toggleSubscribe=function(a,b){a.subscribe(b[1],b[0],"beforeChange");a.subscribe(b[2],b[0]);return a};f.extenders.falseTimeout=function(a,b){a.iTimeout=0;a.subscribe(function(c){c&&(h.clearTimeout(a.iTimeout),
a.iTimeout=h.setTimeout(function(){a(!1);a.iTimeout=0},d.pInt(b)))});return a};f.observable.fn.validateEmail=function(){this.hasError=f.observable(!1);this.subscribe(function(a){a=d.trim(a);this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this);this.valueHasMutated();return this};f.observable.fn.validateFunc=function(a){this.hasFuncError=f.observable(!1);d.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated());return this};C.prototype.root=function(){return this.sBase};
C.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};C.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a};C.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};C.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"};C.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"};
C.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"};C.prototype.change=function(a){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+h.encodeURIComponent(a)+"/"};C.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a};C.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};C.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};C.prototype.inbox=
function(){return this.sBase+"mailbox/Inbox"};C.prototype.settings=function(a){var b=this.sBase+"settings";!d.isUnd(a)&&""!==a&&(b+="/"+a);return b};C.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};C.prototype.mailBox=function(a,b,c){var b=d.isNormal(b)?d.pInt(b):1,c=d.pString(c),e=this.sBase+"mailbox/";""!==a&&(e+=encodeURI(a));1<b&&(e=e.replace(/[\/]+$/,""),e+="/p"+
b);""!==c&&(e=e.replace(/[\/]+$/,""),e+="/"+encodeURI(c));return e};C.prototype.phpInfo=function(){return this.sServer+"Info"};C.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"};C.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"};C.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"};
C.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a};C.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"};C.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"};C.prototype.socialGoogle=
function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};C.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};C.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};y.oViewModelsHooks={};y.oSimpleHooks={};y.regViewModelHook=function(a,b){b&&(b.__hookName=a)};y.addHook=function(a,b){d.isFunc(b)&&(d.isArray(y.oSimpleHooks[a])||
(y.oSimpleHooks[a]=[]),y.oSimpleHooks[a].push(b))};y.runHook=function(a,b){d.isArray(y.oSimpleHooks[a])&&(b=b||[],i.each(y.oSimpleHooks[a],function(a){a.apply(null,b)}))};y.mainSettingsGet=function(a){return e?e.settingsGet(a):null};y.remoteRequest=function(a,b,c,d,f,g){e&&e.remote().defaultRequest(a,b,c,d,f,g)};y.settingsGet=function(a,b){var c=y.mainSettingsGet("Plugins");return(c=c&&d.isUnd(c[a])?null:c[a])?d.isUnd(c[b])?null:c[b]:null};u.prototype.initLanguage=function(a,b,c){this.oOptions.LangSwitcherConferm=
a;this.oOptions.LangSwitcherTextLabel=b;this.oOptions.LangSwitcherHtmlLabel=c};u.prototype.execCom=function(a,b,c){h.document&&(h.document.execCommand(a,b||!1,c||null),this.updateTextArea())};u.prototype.getEditorSelection=function(){var a=null;h.getSelection?a=h.getSelection():h.document.getSelection?a=h.document.getSelection():h.document.selection&&(a=h.document.selection);return a};u.prototype.getEditorRange=function(){var a=this.getEditorSelection();return!a||0===a.rangeCount?null:a.getRangeAt?
a.getRangeAt(0):a.createRange()};u.prototype.ec=function(a,b,c){this.execCom(a,b,c)};u.prototype.heading=function(a){this.ec("formatblock",!1,j.browser.msie?"Heading "+a:"h"+a)};u.prototype.insertImage=function(a){this.isHtml()&&!this.bOnlyPlain&&(this.htmlarea.focus(),this.ec("insertImage",!1,a))};u.prototype.focus=function(){this.isHtml()&&!this.bOnlyPlain?this.htmlarea.focus():this.textarea.focus()};u.prototype.setcolor=function(a,b){var c=null,c="";j.browser.msie&&9>d.pInt(j.browser.version)?
(c=this.getEditorRange())&&c.execCommand("forecolor"===a?"ForeColor":"BackColor",!1,b):(c=j.browser.msie?"forecolor"===a?"ForeColor":"BackColor":"forecolor"===a?"foreColor":"backColor",this.ec(c,!1,b))};u.prototype.isHtml=function(){return!0===this.bOnlyPlain?!1:this.textarea.is(":hidden")};u.prototype.toHtmlString=function(){return this.editor.innerHTML};u.prototype.toString=function(){return this.editor.innerText};u.prototype.updateTextArea=function(){this.textarea.val(this.toHtmlString())};u.prototype.updateHtmlArea=
function(){this.editor.innerHTML=this.textarea.val()};u.prototype.setRawText=function(a,b){b&&!this.bOnlyPlain?(this.isHtml()||(this.textarea.val(""),this.switchToHtml()),this.textarea.val(a.toString()),this.updateHtmlArea()):(this.textarea.val(a.toString()),this.updateHtmlArea(),this.switchToPlain(!1))};u.prototype.clear=function(){this.textarea.val("");this.editor.innerHTML="";this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()};u.prototype.getTextForRequest=function(){this.isHtml()&&
this.updateTextArea();return this.textarea.val()};u.prototype.getTextFromHtml=function(a){var b="",c=function(){if(arguments&&1<arguments.length){var a=d.trim(arguments[1]).replace(/__bq__start__([\s\S\n\r]*)__bq__end__/gm,c),a="\n> "+d.trim(a).replace(/\n/gm,"\n> ")+"\n>\n";return a.replace(/\n([> ]+)/gm,function(){return arguments&&1<arguments.length?"\n"+d.trim(arguments[1].replace(/[\s]/,""))+" ":""})}return""},e=function(){if(arguments&&1<arguments.length){var a=d.trim(arguments[1]);0<a.length&&
(a=a.replace(/<div[^>]*>([\s\S]*)<\/div>/gmi,e),a="\n"+d.trim(a)+"\n");return a}return""},a=d.isUnd(a)?!0:!!a,b=this.toHtmlString().replace(/[\s]+/gm," ").replace(/<br\s?\/?>/gmi,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<hr[^>]*>/gmi,"\n_______________________________\n\n").replace(/<img [^>]*>/gmi,"").replace(/<div[^>]*>([\s\S]*)<\/div>/gmi,e).replace(/<blockquote[^>]*>/gmi,"\n__bq__start__\n").replace(/<\/blockquote>/gmi,
"\n__bq__end__\n").replace(/<a [^>]*>([\s\S]*?)<\/a>/gmi,function(){return arguments&&1<arguments.length?d.trim(arguments[1]):""}).replace(/&nbsp;/gi," ").replace(/<[^>]*>/gm,"").replace(/&gt;/gi,">").replace(/&lt;/gi,"<").replace(/&amp;/gi,"&").replace(/&\w{2,6};/gi,"");return(a?d.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,c).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")};u.prototype.getHtmlFromText=function(){return d.convertPlainTextToHtml(this.textarea.val())};
u.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()};u.prototype.switchToPlain=function(a){var a=d.isUnd(a)?!0:a,b=this.getTextFromHtml(),c=i.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(b),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);!a||0===d.trim(b).length?c(!0):c(h.confirm(this.oOptions.LangSwitcherConferm))};u.prototype.switcherLinkText=
function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel};u.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar");j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!0));this.textarea.val(this.getHtmlFromText());this.updateHtmlArea();this.textarea.hide();this.htmlarea.show();this.fOnSwitch&&this.fOnSwitch(!0)};u.prototype.addButton=function(a,b){var c=this;j("<div />").addClass("editorToolbarButtom").append(j('<a tabindex="-1" href="javascript:void(0);"></a>').addClass(a)).attr("title",
b).click(function(b){d.isUnd(u.htmlFunctions[a])?h.alert(a):u.htmlFunctions[a].apply(c,[j(this),b])}).appendTo(this.toolbar)};u.htmlInitToolbar=function(){if(!this.bOnlyPlain){this.addButton("bold","Bold");this.addButton("italic","Italic");this.addButton("underline","Underline");this.addButton("strikethrough","Strikethrough");this.addButton("removeformat","removeformat");this.addButton("justifyleft","justifyleft");this.addButton("justifycenter","justifycenter");this.addButton("justifyright","justifyright");
this.addButton("horizontalrule","horizontalrule");this.addButton("orderedlist","orderedlist");this.addButton("unorderedlist","unorderedlist");this.addButton("indent","indent");this.addButton("outdent","outdent");this.addButton("forecolor","forecolor");var a=this;j("<span />").addClass("editorSwitcher").text(a.switcherLinkText(!0)).click(function(){a.switchToggle()}).appendTo(a.toolbar)}};u.htmlInitEditor=function(){this.editor=this.htmlarea[0];this.editor.innerHTML=this.textarea.val()};u.htmlAttachEditorEvents=
function(){var a=this,b=function(b){if(b=(b&&b.originalEvent?b.originalEvent:b)||h.event){b.stopPropagation();b.preventDefault();var c=null,d=null;if((b=b.files||(b.dataTransfer?b.dataTransfer.files:null))&&1===b.length&&b[0]&&b[0].type&&0===b[0].type.indexOf("image/")){var d=b[0],c=new h.FileReader,e=d;c.onload=function(b){a.insertImage(b.target.result,e.name)};c.readAsDataURL(d)}}a.htmlarea.removeClass("editorDragOver")},c=function(){a.htmlarea.removeClass("editorDragOver")},d=function(b){b.stopPropagation();
b.preventDefault();a.htmlarea.addClass("editorDragOver")},e=function(b){(b=b&&b.clipboardData?b.clipboardData:b&&b.originalEvent&&b.originalEvent.clipboardData?b.originalEvent.clipboardData:null)&&b.items&&i.each(b.items,function(b){if(b&&(b.type&&0===b.type.indexOf("image/"))&&b.getAsFile){var c=null,d=b.getAsFile();d&&(c=new h.FileReader,c.onload=function(b){a.insertImage(b.target.result,d.name)},c.readAsDataURL(d))}})};!this.bOnlyPlain&&(h.File&&h.FileReader&&h.FileList)&&(this.htmlarea.bind("dragover",
d),this.htmlarea.bind("dragleave",c),this.htmlarea.bind("drop",b),this.htmlarea.bind("paste",e))};for(var sa=u,ta=[],Va=[],Z=0,aa=0,Ia=0,Ja=0,aa="",Z=0;256>Z;Z+=85)aa=Z.toString(16),ta.push(1===aa.length?"0"+aa:aa);Ja=ta.length;for(Z=0;Z<Ja;Z++)for(aa=0;aa<Ja;aa++)for(Ia=0;Ia<Ja;Ia++)Va.push("#"+ta[Z]+""+ta[aa]+""+ta[Ia]);sa.htmlColorPickerColors=Va;var sa=u,Wa=j(h.document),Xa=!1,ua=j('<div style="position: absolute;" class="editorFontStylePicker"><div class="editorFpFonts"></div></div>'),Ya=ua.find(".editorFpFonts"),
Za=function(){};j.each("Arial;Arial Black;Courier New;Tahoma;Times New Roman;Verdana".split(";"),function(a,b){Ya.append(j('<a href="javascript:void(0);" tabindex="-1" class="editorFpFont" style="font-family: '+b+';">'+b+"</a>").click(function(){Za(b)}));Ya.append("<br />")});ua.hide();sa.htmlFontPicker=function(a,b,c){Xa||(ua.appendTo(c),Xa=!0);Za=b;Wa.unbind("click.fpNamespace");h.setTimeout(function(){Wa.one("click.fpNamespace",function(){ua.hide()})},500);b=j(a).position();ua.css("top",5+b.top+
j(a).height()+"px").css("left",b.left+"px").show()};var sa=u,$a=j(h.document),ab=!1,va=j('<div style="position: absolute;" class="editorColorPicker"><div class="editorCpColors"></div></div>'),bb=va.find(".editorCpColors"),cb=function(){};j.each(u.htmlColorPickerColors,function(a,b){bb.append('<a href="javascript:void(0);" tabindex="-1" class="editorCpColor" style="background-color: '+b+';"></a>')});va.hide();j(".editorCpColor",bb).click(function(a){var b=1,c="#000000",a=j(a.target).css("background-color"),
c=a.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==c){for(delete c[0];3>=b;++b)c[b]=d.pInt(c[b]).toString(16),1===c[b].length&&(c[b]="0"+c[b]);c="#"+c.join("")}else c=a;cb(c)});sa.htmlColorPicker=function(a,b,c){ab||(va.appendTo(c),ab=!0);c=j(a).position();cb=b;$a.unbind("click.cpNamespace");h.setTimeout(function(){$a.one("click.cpNamespace",function(){va.hide()})},100);va.css("top",5+c.top+j(a).height()+"px").css("left",c.left+"px").show()};u.htmlFunctions={bold:function(){this.ec("bold")},
italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikethrough:function(){this.ec("strikethrough")},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")},justifyleft:function(){this.ec("justifyLeft")},justifycenter:function(){this.ec("justifyCenter")},justifyright:function(){this.ec("justifyRight")},horizontalrule:function(){this.ec("insertHorizontalRule",!1,"ht")},removeformat:function(){this.ec("removeFormat")},orderedlist:function(){this.ec("insertorderedlist")},
unorderedlist:function(){this.ec("insertunorderedlist")},forecolor:function(a){u.htmlColorPicker(a,i.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){u.htmlColorPicker(a,i.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){u.htmlFontPicker(a,i.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}};N.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)};N.prototype.init=
function(a,b){this.oContentVisible=a;this.oContentScrollable=b;if(this.oContentVisible&&this.oContentScrollable){var c=this;j(this.oContentVisible).on("click",this.sItemSelector,function(a){c.actionClick(f.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=f.dataFor(this);b&&(a&&a.shiftKey?c.actionClick(b,a):(c.sLastUid=c.getItemUid(b),b.selected()?(b.checked(!1),c.selectedItem(null)):b.checked(!b.checked())))});j(h.document).on("keydown",function(a){var b=!0;if(a&&c.bUseKeyboard&&
!d.inFocus())if(-1<d.inArray(a.keyCode,[g.EventKeyCode.Up,g.EventKeyCode.Down,g.EventKeyCode.Insert,g.EventKeyCode.Home,g.EventKeyCode.End,g.EventKeyCode.PageUp,g.EventKeyCode.PageDown]))c.newSelectPosition(a.keyCode,a.shiftKey),b=!1;else if(g.EventKeyCode.Delete===a.keyCode&&!a.ctrlKey&&!a.shiftKey){if(c.oCallbacks.onDelete)c.oCallbacks.onDelete();b=!1}return b})}};N.prototype.selectByUid=function(a,b){this.useItemSelectCallback=b=d.isUnd(b)?!0:!!b;var c=i.find(this.list(),function(b){return a===
this.getItemUid(b)},this);c&&this.selectedItem(c);this.useItemSelectCallback=!0};N.prototype.useKeyboard=function(a){this.bUseKeyboard=!!a};N.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;c&&a&&(b=c(a));return b.toString()};N.prototype.newSelectPosition=function(a,b){var c=this,d=0,e=!1,f=!1,w=null,k=this.list(),j=k?k.length:0,q=this.selectedItem();if(0<j)if(q){if(q)if(g.EventKeyCode.Down===a||g.EventKeyCode.Up===a||g.EventKeyCode.Insert===a)i.each(k,function(b){if(!f)switch(a){case g.EventKeyCode.Up:q===
b?f=!0:w=b;break;case g.EventKeyCode.Down:case g.EventKeyCode.Insert:e?(w=b,f=!0):q===b&&(e=!0)}});else if(g.EventKeyCode.Home===a||g.EventKeyCode.End===a)g.EventKeyCode.Home===a?w=k[0]:g.EventKeyCode.End===a&&(w=k[k.length-1]);else if(g.EventKeyCode.PageDown===a)for(;d<j;d++){if(q===k[d]){d+=10;d=j-1<d?j-1:d;w=k[d];break}}else if(g.EventKeyCode.PageUp===a)for(d=j;0<=d;d--)if(q===k[d]){d-=10;d=0>d?0:d;w=k[d];break}}else if(g.EventKeyCode.Down===a||g.EventKeyCode.Insert===a||g.EventKeyCode.Home===
a||g.EventKeyCode.PageUp===a)w=k[0];else if(g.EventKeyCode.Up===a||g.EventKeyCode.End===a||g.EventKeyCode.PageDown===a)w=k[k.length-1];w?(q&&(b?(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)&&q.checked(!q.checked()):g.EventKeyCode.Insert===a&&q.checked(!q.checked())),this.throttleSelection=!0,this.selectedItem(w),this.throttleSelection=!0,0!==this.iSelectTimer?(h.clearTimeout(this.iSelectTimer),this.iSelectTimer=h.setTimeout(function(){c.iSelectTimer=0;c.actionClick(w)},1E3)):(this.iSelectTimer=
h.setTimeout(function(){c.iSelectTimer=0},200),this.actionClick(w)),this.scrollToSelected()):q&&(b&&(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)?q.checked(!q.checked()):g.EventKeyCode.Insert===a&&q.checked(!q.checked()))};N.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=j(this.sItemSelectedSelector,this.oContentScrollable),b=a.position(),c=this.oContentVisible.height(),a=a.outerHeight();return b&&(0>b.top||b.top+a>c)?(0>b.top?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+
b.top-20):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+b.top-c+a+20),!0):!1};N.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",k=!1,h=!1,i=[],j=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid){i=this.list();j=a.checked();d=0;for(e=i.length;d<e;d++){f=i[d];g=this.getItemUid(f);k=!1;if(g===this.sLastUid||g===c)k=!0;k&&(h=!h);(h||k)&&f.checked(j)}}this.sLastUid=""===c?"":c};N.prototype.actionClick=function(a,b){if(a){var c=
!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked())));c&&(this.selectedItem(a),this.sLastUid=d)}};N.prototype.on=function(a,b){this.oCallbacks[a]=b};xa.supported=function(){return!0};xa.prototype.set=function(a,b){var c=j.cookie(p.Values.ClientSideCookieIndexName),d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,j.cookie(p.Values.ClientSideCookieIndexName,
JSON.stringify(e),{expires:30}),d=!0}catch(f){}return d};xa.prototype.get=function(a){var b=j.cookie(p.Values.ClientSideCookieIndexName),c=null;try{c=(c=null===b?null:JSON.parse(b))&&!d.isUnd(c[a])?c[a]:null}catch(e){}return c};ya.supported=function(){return!!h.localStorage};ya.prototype.set=function(a,b){var c=h.localStorage[p.Values.ClientSideCookieIndexName]||null,d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,h.localStorage[p.Values.ClientSideCookieIndexName]=JSON.stringify(e),
d=!0}catch(f){}return d};ya.prototype.get=function(a){var b=h.localStorage[p.Values.ClientSideCookieIndexName]||null,c=null;try{c=(c=null===b?null:JSON.parse(b))&&!d.isUnd(c[a])?c[a]:null}catch(e){}return c};za.prototype.oDriver=null;za.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1};za.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null};Ra.prototype.bootstart=function(){};D.prototype.sPosition="";D.prototype.sTemplate="";D.prototype.viewModelName=
"";D.prototype.viewModelDom=null;D.prototype.viewModelTemplate=function(){return this.sTemplate};D.prototype.viewModelPosition=function(){return this.sPosition};D.prototype.cancelCommand=D.prototype.closeCommand=function(){};M.prototype.oCross=null;M.prototype.sScreenName="";M.prototype.aViewModels=[];M.prototype.viewModels=function(){return this.aViewModels};M.prototype.screenName=function(){return this.sScreenName};M.prototype.routes=function(){return null};M.prototype.__cross=function(){return this.oCross};
M.prototype.__start=function(){var a=this.routes(),b=null,c=null;d.isNonEmptyArray(a)&&(c=i.bind(this.onRoute||d.emptyFunction,this),b=Qa.create(),i.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)};F.prototype.sDefaultScreenName="";F.prototype.oScreens={};F.prototype.oBoot=null;F.prototype.oCurrentScreen=null;F.prototype.showLoading=function(){j("#rl-loading").show()};F.prototype.hideLoading=function(){j("#rl-loading").hide()};F.prototype.routeOff=function(){S.changed.active=!1};
F.prototype.routeOn=function(){S.changed.active=!0};F.prototype.setBoot=function(a){d.isNormal(a)&&(this.oBoot=a);return this};F.prototype.screen=function(a){return""!==a&&!d.isUnd(this.oScreens[a])?this.oScreens[a]:null};F.prototype.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,d.isArray(c)?c:[])};F.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var c=new a(b),l=c.viewModelPosition(),g=j("#rl-content #rl-"+l.toLowerCase()),t=null;a.__builded=!0;a.__vm=c;c.data=e.data();c.viewModelName=
a.__name;g&&1===g.length?(t=j("<div>").addClass("rl-view-model").addClass("RL-"+c.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+c.viewModelTemplate()+'"}, i18nInit: true'),t.appendTo(g),c.viewModelDom=t,a.__dom=t,"Popups"===l&&(c.cancelCommand=c.closeCommand=d.createCommand(c,function(){o.hideScreenPopup(a)})),y.runHook("view-model-pre-build",[a.__name,c,t]),f.applyBindings(c,t[0]),this.delegateRun(c,"onBuild",[t]),y.runHook("view-model-post-build",[a.__name,c,t])):d.log("Cannot find view model position: "+
l)}return a?a.__vm:null};F.prototype.applyExternal=function(a,b){a&&b&&f.applyBindings(a,b)};F.prototype.hideScreenPopup=function(a){a&&(a.__vm&&a.__dom)&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),i.defer(function(){a.__dom.find(".ko-select2").select2("close")}))};F.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),
y.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};F.prototype.screenOnRoute=function(a,b){var c=this,e=null,f=null;""===d.pString(a)&&(a=this.sDefaultScreenName);if(""!==a){e=this.screen(a);if(!e&&(e=this.screen(this.sDefaultScreenName)))b=a+"/"+b,a=this.sDefaultScreenName;e&&e.__started&&(e.__builded||(e.__builded=!0,d.isNonEmptyArray(e.viewModels())&&i.each(e.viewModels(),function(a){this.buildViewModel(a,e)},this),this.delegateRun(e,"onBuild")),i.defer(function(){if(c.oCurrentScreen){c.delegateRun(c.oCurrentScreen,
"onHide");d.isNonEmptyArray(c.oCurrentScreen.viewModels())&&i.each(c.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);c.delegateRun(a.__vm,"onHide")}})}c.oCurrentScreen=e;if(c.oCurrentScreen){c.delegateRun(c.oCurrentScreen,"onShow");y.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]);d.isNonEmptyArray(c.oCurrentScreen.viewModels())&&i.each(c.oCurrentScreen.viewModels(),function(a){if(a.__vm&&
a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);c.delegateRun(a.__vm,"onShow");y.runHook("view-model-on-show",[a.__name,a.__vm])}},c)}(f=e.__cross())&&f.parse(b)}))}};F.prototype.startScreens=function(a){i.each(a,function(a){var c=(a=new a)?a.screenName():"";a&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=a)},this);i.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),y.runHook("screen-pre-start",
[a.screenName(),a]),this.delegateRun(a,"onStart"),y.runHook("screen-post-start",[a.screenName(),a]))},this);a=Qa.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));S.initialized.add(a.parse,a);S.changed.add(a.parse,a);S.init()};F.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1):a;a="/"===a.substr(0,1)?a.substr(1):a;(d.isUnd(b)?0:b)?(S.changed.active=!1,S.setHash(a),S.changed.active=!0):(S.changed.active=!0,S.setHash(a))};F.prototype.bootstart=function(){this.oBoot&&
this.oBoot.bootstart&&this.oBoot.bootstart();return this};o=new F;G.newInstanceFromJson=function(a){var b=new G;return b.initByJson(a)?b:null};G.prototype.name="";G.prototype.email="";G.prototype.privateType=null;G.prototype.validate=function(){return""!==this.name||""!==this.email};G.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"};G.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};G.prototype.type=function(){if(null===this.privateType&&(this.email&&
"@facebook.com"===this.email.substr(-13)&&(this.privateType=g.EmailType.Facebook),null===this.privateType))this.privateType=g.EmailType.Default;return this.privateType};G.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};G.prototype.parse=function(a){var a=d.trim(a),b=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g.exec(a);b?(this.name=b[1]||"",this.email=b[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)};G.prototype.initByJson=
function(a){var b=!1;a&&"Object/Email"===a["@Object"]&&(this.name=d.trim(a.Name),this.email=d.trim(a.Email),b=""!==this.email,this.clearDuplicateName());return b};G.prototype.toLine=function(a,b){var c="";""!==this.email&&(b=d.isUnd(b)?!1:!!b,a&&""!==this.name?c=b?'<a href="mailto:'+d.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+d.encodeHtml(this.name)+"</a>":this.name:(c=this.email,""!==this.name?c=b?d.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+d.encodeHtml('"'+
this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+d.encodeHtml(c)+"</a>"+d.encodeHtml(">"):'"'+this.name+'" <'+c+">":b&&(c='<a href="mailto:'+d.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+d.encodeHtml(this.email)+"</a>")));return c};G.prototype.select2Result=function(){var a="",b=e.cache().getUserPic(this.email),a=""!==b?a+('<img class="select2-user-pic pull-left" src="'+d.encodeHtml(b)+'" />'):a+('<img class="select2-user-pic pull-left" src="'+e.link().emptyContactPic()+
'" />');g.EmailType.Facebook===this.type()?(a+=""+(0<this.name.length?this.name:this.email),a+='<i class="icon-facebook pull-right select2-icon-result" />'):a+=""+(0<this.name.length?this.email+' <span class="select2-subname">('+this.name+")</span>":this.email);return a+""};G.prototype.select2Selection=function(a){var b="";if(g.EmailType.Facebook===this.type()){if(b=0<this.name.length?this.name:this.email,""!==b)return j("<pan>").text(b).appendTo(a),a.append('<i class="icon-facebook select2-icon"></i>'),
null}else b=0<this.name.length?this.name+" ("+this.email+")":this.email;return b};pa.prototype.parse=function(a){var b=!1;a&&"Object/Contact"===a["@Object"]&&(this.idContact=d.pInt(a.IdContact),this.listName=d.pString(a.ListName),this.name=d.pString(a.Name),this.emails=d.isNonEmptyArray(a.Emails)?a.Emails:[],this.imageHash=d.pString(a.ImageHash),b=!0);return b};pa.prototype.srcAttr=function(){return""===this.imageHash?e.link().emptyContactPic():e.link().getUserPicUrlFromHash(this.imageHash)};pa.prototype.generateUid=
function(){return""+this.idContact};pa.prototype.lineAsCcc=function(){var a=[];this.deleted()&&a.push("deleted");this.selected()&&a.push("selected");this.checked()&&a.push("checked");return a.join(" ")};E.newInstanceFromJson=function(a){var b=new E;return b.initByJson(a)?b:null};E.prototype.mimeType="";E.prototype.fileName="";E.prototype.estimatedSize=0;E.prototype.friendlySize="";E.prototype.isInline=!1;E.prototype.isLinked=!1;E.prototype.cid="";E.prototype.cidWithOutTags="";E.prototype.contentLocation=
"";E.prototype.download="";E.prototype.folder="";E.prototype.uid="";E.prototype.mimeIndex="";E.prototype.initByJson=function(a){var b=!1;a&&"Object/Attachment"===a["@Object"]&&(this.mimeType=a.MimeType,this.fileName=a.FileName,this.estimatedSize=d.pInt(a.EstimatedSize),this.isInline=!!a.IsInline,this.isLinked=!!a.IsLinked,this.cid=a.CID,this.contentLocation=a.ContentLocation,this.download=a.Download,this.folder=a.Folder,this.uid=a.Uid,this.mimeIndex=a.MimeIndex,this.friendlySize=d.friendlySize(this.estimatedSize),
this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),b=!0);return b};E.prototype.isImage=function(){return-1<d.inArray(this.mimeType.toLowerCase(),["image/png","image/jpg","image/jpeg","image/gif"])};E.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)};E.prototype.linkDownload=function(){return e.link().attachmentDownload(this.download)};E.prototype.linkPreview=function(){return e.link().attachmentPreview(this.download)};E.prototype.linkPreviewAsPlain=function(){return e.link().attachmentPreviewAsPlain(this.download)};
E.prototype.generateTransferDownloadUrl=function(){var a=this.linkDownload();"http"!==a.substr(0,4)&&(a=h.location.protocol+"//"+h.location.host+h.location.pathname+a);return this.mimeType+":"+this.fileName+":"+a};E.prototype.eventDragStart=function(a,b){var c=b.originalEvent||b;a&&(c&&c.dataTransfer&&c.dataTransfer.setData)&&c.dataTransfer.setData("DownloadURL",this.generateTransferDownloadUrl());return!0};E.prototype.iconClass=function(){var a=this.mimeType.toLocaleString().split("/"),b="icon-file";
a&&a[1]&&("image"===a[0]?b="icon-image":"text"===a[0]?b="icon-file-xml":"audio"===a[0]?b="icon-music":"video"===a[0]?b="icon-film":-1<d.inArray(a[1],"zip 7z tar rar gzip bzip bzip2 x-zip x-7z x-rar x-tar x-gzip x-bzip x-bzip2 x-zip-compressed x-7z-compressed x-rar-compressed".split(" "))?b="icon-file-zip":-1<d.inArray(a[1],["pdf","x-pdf"])?b="icon-file-pdf":-1<d.inArray(a[1],["exe","x-exe","x-winexe","bat"])?b="icon-console":-1<d.inArray(a[1],"rtf msword vnd.msword vnd.openxmlformats-officedocument.wordprocessingml.document vnd.openxmlformats-officedocument.wordprocessingml.template vnd.ms-word.document.macroEnabled.12 vnd.ms-word.template.macroEnabled.12".split(" "))?
b="icon-file-word":-1<d.inArray(a[1],"excel ms-excel vnd.ms-excel vnd.openxmlformats-officedocument.spreadsheetml.sheet vnd.openxmlformats-officedocument.spreadsheetml.template vnd.ms-excel.sheet.macroEnabled.12 vnd.ms-excel.template.macroEnabled.12 vnd.ms-excel.addin.macroEnabled.12 vnd.ms-excel.sheet.binary.macroEnabled.12".split(" "))?b="icon-file-excel":-1<d.inArray(a[1],"powerpoint ms-powerpoint vnd.ms-powerpoint vnd.openxmlformats-officedocument.presentationml.presentation vnd.openxmlformats-officedocument.presentationml.template vnd.openxmlformats-officedocument.presentationml.slideshow vnd.ms-powerpoint.addin.macroEnabled.12 vnd.ms-powerpoint.presentation.macroEnabled.12 vnd.ms-powerpoint.template.macroEnabled.12 vnd.ms-powerpoint.slideshow.macroEnabled.12".split(" "))&&
(b="icon-file-powerpoint"));return b};O.prototype.id="";O.prototype.isInline=!1;O.prototype.isLinked=!1;O.prototype.CID="";O.prototype.contentLocation="";O.prototype.fromMessage=!1;O.prototype.cancel=d.emptyFunction;O.prototype.initByUploadJson=function(a){var b=!1;a&&(this.fileName(a.Name),this.size(d.isUnd(a.Size)?0:d.pInt(a.Size)),this.tempName(d.isUnd(a.TempName)?"":a.TempName),this.isInline=!1,b=!0);return b};m.newInstanceFromJson=function(a){var b=new m;return b.initByJson(a)?b:null};m.calculateFullFromatDateValue=
function(a){return ea.unix(a).format("LLL")};m.emailsToLine=function(a,b,c){var e=[],f=0,g=0;if(d.isNonEmptyArray(a)){f=0;for(g=a.length;f<g;f++)e.push(a[f].toLine(b,c))}return e.join(", ")};m.initEmailsFromJson=function(a){var b=0,c=0,e=null,f=[];if(d.isNonEmptyArray(a)){b=0;for(c=a.length;b<c;b++)(e=G.newInstanceFromJson(a[b]))&&f.push(e)}return f};m.replyHelper=function(a,b,c){if(a&&0<a.length)for(var e=0,f=a.length;e<f;e++)d.isUnd(b[a[e].email])&&(b[a[e].email]=!0,c.push(a[e]))};m.prototype.initByJson=
function(a){var b=!1;a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(d.pInt(a.Size)),this.from=m.initEmailsFromJson(a.From),this.to=m.initEmailsFromJson(a.To),this.cc=m.initEmailsFromJson(a.Cc),this.bcc=m.initEmailsFromJson(a.Bcc),this.replyTo=m.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(d.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),
this.fromEmailString(m.emailsToLine(this.from,!0)),this.toEmailsString(m.emailsToLine(this.to,!0)),this.parentUid(d.pInt(a.ParentThread)),this.threads(d.isArray(a.Threads)?a.Threads:[]),this.threadsLen(d.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0);return b};m.prototype.computeSenderEmail=function(){var a=e.data().sentFolder(),b=e.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())};
m.prototype.initUpdateByMessageJson=function(a){var b=!1,c=g.MessagePriority.Normal;a&&"Object/Message"===a["@Object"]&&(c=d.pInt(a.Priority),this.priority(-1<d.inArray(c,[g.MessagePriority.High,g.MessagePriority.Low])?c:g.MessagePriority.Normal),this.aDraftInfo=a.DraftInfo,this.sMessageId=a.MessageId,this.sInReplyTo=a.InReplyTo,this.sReferences=a.References,this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.foundedCIDs=d.isArray(a.FoundedCIDs)?a.FoundedCIDs:
[],this.attachments(this.initAttachmentsFromJson(a.Attachments)),this.computeSenderEmail(),b=!0);return b};m.prototype.initAttachmentsFromJson=function(a){var b=0,c=0,e=null,f=[];if(a&&"Collection/AttachmentCollection"===a["@Object"]&&d.isNonEmptyArray(a["@Collection"])){b=0;for(c=a["@Collection"].length;b<c;b++)if(e=E.newInstanceFromJson(a["@Collection"][b]))""!==e.cidWithOutTags&&(0<this.foundedCIDs.length&&0<=d.inArray(e.cidWithOutTags,this.foundedCIDs))&&(e.isLinked=!0),f.push(e)}return f};m.prototype.initFlagsByJson=
function(a){var b=!1;a&&"Object/Message"===a["@Object"]&&(this.unseen(!a.IsSeen),this.flagged(!!a.IsFlagged),this.answered(!!a.IsAnswered),this.forwarded(!!a.IsForwarded),b=!0);return b};m.prototype.fromToLine=function(a,b){return m.emailsToLine(this.from,a,b)};m.prototype.toToLine=function(a,b){return m.emailsToLine(this.to,a,b)};m.prototype.ccToLine=function(a,b){return m.emailsToLine(this.cc,a,b)};m.prototype.bccToLine=function(a,b){return m.emailsToLine(this.bcc,a,b)};m.prototype.lineAsCcc=function(){var a=
[];this.deleted()&&a.push("deleted");this.selected()&&a.push("selected");this.checked()&&a.push("checked");this.flagged()&&a.push("flagged");this.unseen()&&a.push("unseen");this.answered()&&a.push("answered");this.forwarded()&&a.push("forwarded");if(this.hasAttachments())switch(a.push("withAttachments"),this.attachmentsMainType()){case "image":a.push("imageOnlyAttachments");break;case "archive":a.push("archiveOnlyAttachments")}this.newForAnimation()&&a.push("new");""===this.subject()&&a.push("emptySubject");
0<this.parentUid()&&a.push("hasParentMessage");0<this.threadsLen()&&0===this.parentUid()&&a.push("hasChildrenMessage");this.hasUnseenSubMessage()&&a.push("hasUnseenSubMessage");this.hasFlaggedSubMessage()&&a.push("hasFlaggedSubMessage");return a.join(" ")};m.prototype.hasVisibleAttachments=function(){return!!i.find(this.attachments(),function(a){return!a.isLinked})};m.prototype.findAttachmentByCid=function(a){var b=null,c=this.attachments();d.isNonEmptyArray(c)&&(a=a.replace(/^<+/,"").replace(/>+$/,
""),b=i.find(c,function(b){return a===b.cidWithOutTags}));return b||null};m.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();d.isNonEmptyArray(c)&&(b=i.find(c,function(b){return a===b.contentLocation}));return b||null};m.prototype.messageId=function(){return this.sMessageId};m.prototype.inReplyTo=function(){return this.sInReplyTo};m.prototype.references=function(){return this.sReferences};m.prototype.fromAsSingleEmail=function(){return d.isArray(this.from)&&this.from[0]?
this.from[0].email:""};m.prototype.viewLink=function(){return e.link().messageViewLink(this.requestHash)};m.prototype.downloadLink=function(){return e.link().messageDownloadLink(this.requestHash)};m.prototype.replyEmails=function(a){var b=[],a=d.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a,b);return b};m.prototype.replyAllEmails=function(a){var b=[],c=[],a=d.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a,b);m.replyHelper(this.to,
a,b);m.replyHelper(this.cc,a,c);return[b,c]};m.prototype.textBodyToString=function(){return this.body?this.body.html():""};m.prototype.attachmentsToStringLine=function(){var a=i.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0<a.length?a.join(", "):""};m.prototype.getDataForWindowPopup=function(){return{popupFrom:this.fromToLine(!1),popupTo:this.toToLine(!1),popupCc:this.ccToLine(!1),popupBcc:this.bccToLine(!1),popupSubject:this.subject(),popupDate:this.fullFormatDateValue(),
popupAttachments:this.attachmentsToStringLine(),popupBody:this.textBodyToString()}};m.prototype.viewPopupMessage=function(a){d.windowPopupKnockout(this.getDataForWindowPopup(),"PopupsWindowSimpleMessage",this.subject(),function(b){b&&(b.document&&b.document.body)&&(j("img.lazy",b.document.body).each(function(a,b){var d=j(b),e=d.data("original"),f=d.attr("src");0<=a&&(e&&!f)&&d.attr("src",e)}),a&&h.setTimeout(function(){b.print()},100))})};m.prototype.printMessage=function(){this.viewPopupMessage(!0)};
m.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid};m.prototype.populateByMessageListItem=function(a){this.folderFullNameRaw=a.folderFullNameRaw;this.uid=a.uid;this.requestHash=a.requestHash;this.subject(a.subject());this.size(a.size());this.dateTimeStampInUTC(a.dateTimeStampInUTC());this.priority(a.priority());this.fromEmailString(a.fromEmailString());this.toEmailsString(a.toEmailsString());this.emails=a.emails;this.from=a.from;this.to=a.to;this.cc=a.cc;this.bcc=a.bcc;
this.replyTo=a.replyTo;this.unseen(a.unseen());this.flagged(a.flagged());this.answered(a.answered());this.forwarded(a.forwarded());this.selected(a.selected());this.checked(a.checked());this.hasAttachments(a.hasAttachments());this.attachmentsMainType(a.attachmentsMainType());this.moment(a.moment());this.body=null;this.priority(g.MessagePriority.Normal);this.aDraftInfo=[];this.sReferences=this.sInReplyTo=this.sMessageId="";this.parentUid(a.parentUid());this.threads(a.threads());this.threadsLen(a.threadsLen());
this.computeSenderEmail();return this};m.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=d.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),j("[data-x-src]",this.body).each(function(){a&&j(this).is("img")?j(this).addClass("lazy").attr("data-original",j(this).attr("data-x-src")).removeAttr("data-x-src"):j(this).attr("src",j(this).attr("data-x-src")).removeAttr("data-x-src")}),j("[data-x-style-url]",this.body).each(function(){var a=d.trim(j(this).attr("style")),
a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ";j(this).attr("style",a+j(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(j("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:j(".RL-MailMessageView .messageView .messageItem .content")[0]}),Q.resize()),d.windowResize(500))};m.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){var a=d.isUnd(a)?!1:a,b=this;this.body.data("rl-init-internal-images",
!0);j("[data-x-src-cid]",this.body).each(function(){var c=b.findAttachmentByCid(j(this).attr("data-x-src-cid"));c&&c.download&&(a&&j(this).is("img")?j(this).addClass("lazy").attr("data-original",c.linkPreview()):j(this).attr("src",c.linkPreview()))});j("[data-x-src-location]",this.body).each(function(){var c=b.findAttachmentByContentLocation(j(this).attr("data-x-src-location"));c||(c=b.findAttachmentByCid(j(this).attr("data-x-src-location")));c&&c.download&&(a&&j(this).is("img")?j(this).addClass("lazy").attr("data-original",
c.linkPreview()):j(this).attr("src",c.linkPreview()))});j("[data-x-style-cid]",this.body).each(function(){var a="",c="",e=b.findAttachmentByCid(j(this).attr("data-x-style-cid"));e&&e.linkPreview&&(c=j(this).attr("data-x-style-cid-name"),""!==c&&(a=d.trim(j(this).attr("style")),a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",j(this).attr("style",a+c+": url('"+e.linkPreview()+"')")))});if(a){var c=j("img.lazy",b.body),e=j(".RL-MailMessageView .messageView .messageItem .content")[0];i.delay(function(){c.addClass("lazy-inited").lazyload({threshold:400,
effect:"fadeIn",skip_invisible:!1,container:e})},300)}d.windowResize(500)}};I.newInstanceFromJson=function(a){var b=new I;return b.initByJson(a)?b.initComputed():null};I.prototype.initComputed=function(){this.hasSubScribedSubfolders=f.computed(function(){return!!i.find(this.subFolders(),function(a){return a.subScribed()})},this);this.visible=f.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this);this.isSystemFolder=f.computed(function(){return g.FolderType.User!==
this.type()},this);this.hidden=f.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this);this.selectableForFolderList=f.computed(function(){return!this.isSystemFolder()&&this.selectable},this);this.messageCountAll=f.computed({read:this.privateMessageCountAll,write:function(a){d.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this});this.messageCountUnread=
f.computed({read:this.privateMessageCountUnread,write:function(a){d.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this});this.printableUnreadCount=f.computed(function(){var a=this.messageCountAll(),b=this.messageCountUnread(),c=this.type();return 0<b&&(g.FolderType.Inbox===c||g.FolderType.Spam===c)?""+b:0<a&&g.FolderType.Draft===c?""+a:""},this);this.canBeDeleted=f.computed(function(){return!this.isSystemFolder()&&0===this.subFolders().length&&
"INBOX"!==this.fullNameRaw},this);this.canBeSubScribed=f.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this);this.visible.subscribe(function(){d.timeOutAction("folder-list-folder-visibility-change",function(){Q.trigger("folder-list-folder-visibility-change")},100)});this.localName=f.computed(function(){n.langChangeTick();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case g.FolderType.Inbox:b=d.i18n("FOLDER_LIST/INBOX_NAME");break;
case g.FolderType.SentItems:b=d.i18n("FOLDER_LIST/SENT_NAME");break;case g.FolderType.Draft:b=d.i18n("FOLDER_LIST/DRAFTS_NAME");break;case g.FolderType.Spam:b=d.i18n("FOLDER_LIST/SPAM_NAME");break;case g.FolderType.Trash:b=d.i18n("FOLDER_LIST/TRASH_NAME")}return b},this);this.manageFolderSystemName=f.computed(function(){n.langChangeTick();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case g.FolderType.Inbox:a="("+d.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case g.FolderType.SentItems:a=
"("+d.i18n("FOLDER_LIST/SENT_NAME")+")";break;case g.FolderType.Draft:a="("+d.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case g.FolderType.Spam:a="("+d.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case g.FolderType.Trash:a="("+d.i18n("FOLDER_LIST/TRASH_NAME")+")"}if(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())a="";return a},this);this.collapsed=f.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this});return this};I.prototype.fullName=
"";I.prototype.fullNameRaw="";I.prototype.fullNameHash="";I.prototype.delimiter="";I.prototype.namespace="";I.prototype.deep=0;I.prototype.isNamespaceFolder=!1;I.prototype.isGmailFolder=!1;I.prototype.isUnpaddigFolder=!1;I.prototype.collapsedCss=function(){return this.hasSubScribedSubfolders()?this.collapsed()?"icon-arrow-right-3 e-collapsed-sign":"icon-arrow-down-3 e-collapsed-sign":"icon-none e-collapsed-sign"};I.prototype.initByJson=function(a){var b=!1;a&&"Object/Folder"===a["@Object"]&&(this.name(a.Name),
this.delimiter=a.Delimiter,this.fullName=a.FullName,this.fullNameRaw=a.FullNameRaw,this.fullNameHash=a.FullNameHash,this.deep=a.FullNameRaw.split(this.delimiter).length-1,this.selectable=!!a.IsSelectable,this.existen=!!a.IsExisten,this.subScribed(!!a.IsSubscribed),this.type("INBOX"===this.fullNameRaw?g.FolderType.Inbox:g.FolderType.User),b=!0);return b};I.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")};Ka.prototype.email="";Ka.prototype.changeAccountLink=
function(){return e.link().change(this.email)};d.extendAsViewModel("PopupsFolderClearViewModel",Aa);Aa.prototype.clearPopup=function(){this.clearingProcess(!1);this.selectedFolder(null)};Aa.prototype.onShow=function(a){this.clearPopup();a&&this.selectedFolder(a)};d.extendAsViewModel("PopupsFolderCreateViewModel",ha);ha.prototype.sNoParentText="";ha.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(d.trim(a))};ha.prototype.clearPopup=function(){this.folderName("");this.selectedParentValue("");
this.focusTrigger(!1)};ha.prototype.onShow=function(){this.clearPopup();this.focusTrigger(!0)};d.extendAsViewModel("PopupsFolderSystemViewModel",ba);ba.prototype.sChooseOnText="";ba.prototype.sUnuseText="";ba.prototype.onShow=function(a){var b="",a=d.isUnd(a)?g.SetSystemFoldersNotification.None:a;switch(a){case g.SetSystemFoldersNotification.Sent:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case g.SetSystemFoldersNotification.Draft:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");
break;case g.SetSystemFoldersNotification.Spam:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case g.SetSystemFoldersNotification.Trash:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)};d.extendAsViewModel("PopupsComposeViewModel",z);z.prototype.formattedFrom=function(){var a=e.data().displayName(),b=e.data().accountEmail();return""===a?b:a+" ("+b+")"};z.prototype.sendMessageResponse=function(a,b){var c=!1;this.sending(!1);g.StorageResultType.Success===a&&(b&&b.Result)&&
(c=!0,this.modalVisibility()&&o.delegateRun(this,"closeCommand"));this.modalVisibility()&&!c&&(b&&g.Notification.CantSaveMessage===b.ErrorCode?(this.sendSuccessButSaveError(!0),h.alert(d.trim(d.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),h.alert(d.getNotification(b.ErrorCode?b.ErrorCode:g.Notification.CantSendMessage))))};z.prototype.saveMessageResponse=function(a,b){var c=!1,f=null;this.saving(!1);if(g.StorageResultType.Success===a&&(b&&b.Result)&&(b.Result.NewFolder&&b.Result.NewUid)&&
(this.bFromDraft&&(f=e.data().message())&&(this.draftFolder()===f.folderFullNameRaw&&this.draftUid()===f.uid)&&e.data().message(null),this.draftFolder(b.Result.NewFolder),this.draftUid(b.Result.NewUid),this.draftID(b.Result.NewID),this.modalVisibility()))this.savedTime(h.Math.round((new h.Date).getTime()/1E3)),this.savedOrSendingText(0<this.savedTime()?d.i18n("COMPOSE/SAVED_TIME",{TIME:ea.unix(this.savedTime()-1).format("LT")}):""),c=!0,this.bFromDraft&&e.cache().setFolderHash(this.draftFolder(),
"");!this.modalVisibility()&&!c&&(this.savedError(!0),this.savedOrSendingText(d.getNotification(g.Notification.CantSaveMessage)))};z.prototype.onHide=function(){o.routeOn()};z.prototype.onShow=function(a,b,c){o.routeOff();var f=this,L="",t="",h="",k="",n="",q=null,k=q="",m=[],L={},k=e.data().accountEmail(),r=[],r=t=null,m=!1,a=a||g.ComposeType.Empty;(b=b||null)&&d.isNormal(b)&&(r=d.isArray(b)&&1===b.length?b[0]:!d.isArray(b)?b:null);null!==k&&(L[k]=!0);this.reset();d.isNonEmptyArray(c)&&this.to(c);
if(""!==a&&r){k=r.fullFormatDateValue();n=r.subject();t=r.aDraftInfo;q=j(r.body).clone();d.removeBlockquoteSwitcher(q);q=q.html();switch(a){case g.ComposeType.Reply:this.to(r.replyEmails(L));this.subject(d.replySubjectAdd("Re",n));this.prepearMessageAttachments(r,a);this.aDraftInfo=["reply",r.uid,r.folderFullNameRaw];this.sInReplyTo=r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+r.sReferences);m=!0;break;case g.ComposeType.ReplyAll:m=r.replyAllEmails(L);this.to(m[0]);this.cc(m[1]);this.subject(d.replySubjectAdd("Re",
n));this.prepearMessageAttachments(r,a);this.aDraftInfo=["reply",r.uid,r.folderFullNameRaw];this.sInReplyTo=r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+r.references());m=!0;break;case g.ComposeType.Forward:this.subject(d.replySubjectAdd("Fwd",n));this.prepearMessageAttachments(r,a);this.aDraftInfo=["forward",r.uid,r.folderFullNameRaw];this.sInReplyTo=r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+r.sReferences);break;case g.ComposeType.ForwardAsAttachment:this.subject(d.replySubjectAdd("Fwd",
n));this.prepearMessageAttachments(r,a);this.aDraftInfo=["forward",r.uid,r.folderFullNameRaw];this.sInReplyTo=r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+r.sReferences);break;case g.ComposeType.Draft:this.to(r.to),this.cc(r.cc),this.bcc(r.bcc),this.bFromDraft=!0,this.draftFolder(r.folderFullNameRaw),this.draftUid(r.uid),this.draftID(r.messageId()),this.subject(n),this.prepearMessageAttachments(r,a),this.aDraftInfo=d.isNonEmptyArray(t)&&3===t.length?t:null,this.sInReplyTo=r.sInReplyTo,
this.sReferences=r.sReferences}if(this.oEditor){switch(a){case g.ComposeType.Reply:case g.ComposeType.ReplyAll:L=r.fromToLine(!1,!0);k=d.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:k,EMAIL:L});q="<br /><br />"+k+":<blockquote><br />"+q+"</blockquote>";break;case g.ComposeType.Forward:L=r.fromToLine(!1,!0);t=r.toToLine(!1,!0);h=r.ccToLine(!1,!0);q="<br /><br /><br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+L+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+
": "+t+(0<h.length?"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+h:"")+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+d.encodeHtml(k)+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+d.encodeHtml(n)+"<br /><br />"+q;break;case g.ComposeType.ForwardAsAttachment:q=""}this.oEditor.setRawText(q,r.isHtml)}}else this.oEditor&&g.ComposeType.Empty===a?this.oEditor.setRawText("<br />"+d.convertPlainTextToHtml(e.data().signature()),g.EditorDefaultType.Html===e.data().editorDefaultType()):
d.isNonEmptyArray(b)&&i.each(b,function(a){f.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload();d.isNonEmptyArray(r)&&e.remote().messageUploadAttachments(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!f.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=f.getAttachmentById(b.Result[d]))&&c.tempName(d)}else f.setMessageAttachmentFailedDowbloadText()},r);m&&this.oEditor&&this.oEditor.focus();this.triggerForResize()};z.prototype.onBuild=
function(){this.initEditor();this.initUploader();var a=this,b=null;Q.on("keydown",function(b){var d=!0;b&&(a.modalVisibility()&&e.data().useKeyboardShortcuts())&&(b.ctrlKey&&g.EventKeyCode.S===b.keyCode?(a.saveCommand(),d=!1):b.ctrlKey&&g.EventKeyCode.Enter===b.keyCode&&(a.sendCommand(),d=!1));return d});Q.on("resize",function(){a.triggerForResize()});this.dropboxEnabled()&&(b=document.createElement("script"),b.type="text/javascript",b.src="https://www.dropbox.com/static/api/1/dropins.js",j(b).attr("id",
"dropboxjs").attr("data-app-key",e.settingsGet("DropboxApiKey")),document.body.appendChild(b))};z.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;c<d;c++)if(b[c]&&a===b[c].id)return b[c];return null};z.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new u(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||
a.removeLinkedAttachments()}});this.oEditor.initLanguage(d.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),d.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),d.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}};z.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=d.pInt(e.settingsGet("AttachmentLimit")),c=new wa({action:e.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace(),
onDragEnter:i.bind(function(){this.dragAndDropOver(!0)},this),onDragLeave:i.bind(function(){this.dragAndDropOver(!1)},this),onBodyDragEnter:i.bind(function(){this.dragAndDropVisible(!0)},this),onBodyDragLeave:i.bind(function(){this.dragAndDropVisible(!1)},this),onProgress:i.bind(function(b,c,e){var f=null;d.isUnd(a[b])?(f=this.getAttachmentById(b))&&(a[b]=f):f=a[b];f&&f.progress(" - "+Math.floor(100*(c/e))+"%")},this),onSelect:i.bind(function(a,e){this.dragAndDropOver(!1);var f=this,g=d.isUnd(e.FileName)?
"":e.FileName.toString(),k=d.isNormal(e.Size)?d.pInt(e.Size):null,g=new O(a,g,k);g.cancel=function(){f.attachments.remove(function(b){return b&&b.id===a});c&&c.cancel(a)};this.attachments.push(g);return 0<k&&0<b&&b<k?(g.error(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:i.bind(function(b){var c=null;d.isUnd(a[b])?(c=this.getAttachmentById(b))&&(a[b]=c):c=a[b];c&&(c.waiting(!1),c.uploading(!0))},this),onComplete:i.bind(function(b,c,e){var f="",g=null,h=null,i=this.getAttachmentById(b),
h=c&&e&&e.Result&&e.Result.Attachment?e.Result.Attachment:null,g=e&&e.Result&&e.Result.ErrorCode?e.Result.ErrorCode:null;null!==g?f=d.getUploadErrorDescByCode(g):h||(f=d.i18n("UPLOAD/ERROR_UNKNOWN"));i&&(""!==f&&0<f.length?i.waiting(!1).uploading(!1).error(f):h&&(i.waiting(!1).uploading(!1),i.initByUploadJson(h)),d.isUnd(a[b])&&delete a[b])},this)});c?this.addAttachmentEnabled(!0).dragAndDropEnabled(c.isDragAndDropSupported()):this.addAttachmentEnabled(!1).dragAndDropEnabled(!1)}};z.prototype.prepearAttachmentsForSendOrSave=
function(){var a={};i.each(this.attachmentsInReady(),function(b){b&&(""!==b.tempName()&&b.enabled())&&(a[b.tempName()]=[b.fileName(),b.isInline?"1":"0",b.CID,b.contentLocation])});return a};z.prototype.addMessageAsAttachment=function(a){if(a){var b=this,c=null,c=a.subject(),c=".eml"===c.substr(-4).toLowerCase()?c:c+".eml",c=new O(a.requestHash,c,a.size());c.fromMessage=!0;var d=a.requestHash;c.cancel=function(){b.attachments.remove(function(a){return a&&a.id===d})};c.waiting(!1).uploading(!0);this.attachments.push(c)}};
z.prototype.addDropboxAttachment=function(a){var b=this,c=d.pInt(e.settingsGet("AttachmentLimit")),f=null,h=a.bytes,f=new O(a.link,a.name,h);f.fromMessage=!1;var t=a.link;f.cancel=function(){b.attachments.remove(function(a){return a&&a.id===t})};f.waiting(!1).uploading(!0);this.attachments.push(f);if(0<h&&0<c&&c<h)return f.uploading(!1),f.error(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1;e.remote().composeUploadExternals(function(a,b){var c=!1;f.uploading(!1);g.StorageResultType.Success===a&&(b&&b.Result)&&
b.Result[f.id]&&(c=!0,f.tempName(b.Result[f.id]));c||f.error(d.getUploadErrorDescByCode(g.UploadErrorCode.FileNoUploaded))},[a.link]);return!0};z.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,e=d.isNonEmptyArray(a.attachments())?a.attachments():[],f=0,h=e.length,i=null,k=null,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(g.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f<h;f++)k=e[f],i=new O(k.download,
k.fileName,k.estimatedSize,k.isInline,k.isLinked,k.cid,k.contentLocation),i.fromMessage=!0,i.cancel=j(k.download),i.waiting(!1).uploading(!0),this.attachments.push(i)}};z.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})};z.prototype.setMessageAttachmentFailedDowbloadText=function(){i.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(d.getUploadErrorDescByCode(g.UploadErrorCode.FileNoUploaded))},this)};z.prototype.isEmptyForm=
function(a){a=(a=d.isUnd(a)?!0:!!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&&a&&""===this.oEditor.getTextForRequest()};z.prototype.reset=function(){this.to([]);this.cc([]);this.bcc([]);this.subject("");this.aDraftInfo=null;this.sInReplyTo="";this.bFromDraft=!1;this.sReferences="";this.bReloadFolder=!1;this.sendError(!1);this.sendSuccessButSaveError(!1);this.savedError(!1);
this.savedTime(0);this.savedOrSendingText("");this.emptyToError(!1);this.showCcAndBcc(!1);this.attachments([]);this.dragAndDropOver(!1);this.dragAndDropVisible(!1);this.draftFolder("");this.draftUid("");this.draftID("");this.sending(!1);this.saving(!1);this.oEditor&&this.oEditor.clear()};z.prototype.getAttachmentsDownloadsForUpload=function(){return i.map(i.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})};z.prototype.triggerForResize=function(){this.resizer(!this.resizer())};
d.extendAsViewModel("PopupsContactsViewModel",P);P.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contactsCheckedOrSelected();0<d.length&&(i.each(d,function(b){c&&c.idContact===b.idContact&&(c=null,a.currentContact(null));b.deleted(!0)}),i.delay(function(){i.each(d,function(a){b.remove(a)})},500))};P.prototype.deleteSelectedContacts=function(){0<this.contactsCheckedOrSelected().length&&(e.remote().contactsDelete(i.bind(this.deleteResponse,
this),this.contactsCheckedOrSelectedUids()),this.removeCheckedOrSelectedContactsFromList())};P.prototype.deleteResponse=function(a,b){500<(g.StorageResultType.Success===a&&b&&b.Time?d.pInt(b.Time):0)?this.reloadContactList():i.delay(function(a){return function(){a.reloadContactList()}}(this),500)};P.prototype.populateViewContact=function(a){this.imageTrigger(!1);this.emptySelection(!1);a?(this.viewID(a.idContact),this.viewName(a.name),this.viewEmail(a.emails[0]||""),this.viewImageUrl(a.srcAttr())):
(this.viewID(""),this.viewName(""),this.viewEmail(""),this.viewImageUrl(e.link().emptyContactPic()))};P.prototype.reloadContactList=function(){var a=this;this.contacts.loading(!0);e.remote().contacts(function(b,c){var e=[];g.StorageResultType.Success===b&&(c&&c.Result&&c.Result.List)&&d.isNonEmptyArray(c.Result.List)&&(e=i.map(c.Result.List,function(a){var b=new pa;return b.parse(a)?b:null}),e=i.compact(e));a.contacts(e);a.viewClearSearch(""!==a.search());a.contacts.loading(!1);""!==a.viewID()&&(!a.currentContact()&&
a.contacts.setSelectedByUid)&&a.contacts.setSelectedByUid(""+a.viewID())},this.search())};P.prototype.onBuild=function(a){this.initUploader();this.oContentVisible=j(".b-list-content",a);this.oContentScrollable=j(".content",this.oContentVisible);this.selector.init(this.oContentVisible,this.oContentScrollable);this.viewImageUrl.valueHasMutated();f.computed(function(){var a=this.modalVisibility(),c=e.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&c)},this).extend({notify:"always"})};P.prototype.initUploader=
function(){var a=this,b=null;h.File&&(h.FileReader&&this.imageUploader())&&(b=new wa({queueSize:1,multipleSizeLimit:1,clickElement:this.imageUploader(),disableDragAndDrop:!0,disableMultiple:!0,onSelect:function(b,e){if(e&&e.File&&e.File.type){var f=null,g=e.File;e.File.type.match(/image.*/)?(f=new h.FileReader,f.onload=function(b){b&&(b.target&&b.target.result)&&d.resizeAndCrop(b.target.result,150,function(b){a.viewImageUrl(b);a.imageTrigger(!0)})},f.readAsDataURL(g)):h.alert("this file is not an image.")}return!1}}));
return b};P.prototype.onShow=function(){o.routeOff();this.reloadContactList()};P.prototype.onHide=function(){o.routeOn();this.currentContact(null);this.emptySelection(!0);this.search("");i.each(this.contacts(),function(a){a.checked(!1)})};d.extendAsViewModel("PopupsAdvancedSearchViewModel",ia);ia.prototype.buildSearchStringValue=function(a){-1<a.indexOf(" ")&&(a='"'+a+'"');return a};ia.prototype.buildSearchString=function(){var a=[],b=d.trim(this.from()),c=d.trim(this.to()),e=d.trim(this.subject()),
f=d.trim(this.text());b&&""!==b&&a.push("from:"+this.buildSearchStringValue(b));c&&""!==c&&a.push("to:"+this.buildSearchStringValue(c));e&&""!==e&&a.push("subject:"+this.buildSearchStringValue(e));this.hasAttachments()&&a.push("has:attachments");-1<this.selectedDateValue()&&a.push("date:"+ea().subtract("days",this.selectedDateValue()).format("YYYY.MM.DD")+"/");f&&""!==f&&a.push("text:"+this.buildSearchStringValue(f));return d.trim(a.join(" "))};ia.prototype.clearPopup=function(){this.from("");this.to("");
this.subject("");this.text("");this.selectedDateValue(-1);this.hasAttachments(!1);this.fromFocus(!0)};ia.prototype.onShow=function(){this.clearPopup();this.fromFocus(!0)};d.extendAsViewModel("PopupsAddAccountViewModel",ja);ja.prototype.clearPopup=function(){this.email("");this.login("");this.password("");this.emailError(!1);this.loginError(!1);this.passwordError(!1);this.submitRequest(!1);this.submitError("")};ja.prototype.onShow=function(){this.clearPopup();this.emailFocus(!0)};ja.prototype.onBuild=
function(){this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"))};d.extendAsViewModel("PopupsLanguagesViewModel",ka);ka.prototype.onShow=function(){this.exp(!0)};ka.prototype.onHide=function(){this.exp(!1)};ka.prototype.changeLanguage=function(a){e.data().mainLanguage(a);this.cancelCommand()};d.extendAsViewModel("LoginViewModel",la);la.prototype.onShow=function(){o.routeOff();i.delay(i.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0);e.settingsGet("UserLanguage")&&
j.cookie("rllang",e.data().language(),{expires:30})},this),100)};la.prototype.onHide=function(){this.submitFocus(!1);this.emailFocus(!1)};la.prototype.onBuild=function(){var a=this,b=e.settingsGet("JsHash"),c=function(b){b=d.pInt(b);0===b?(a.submitRequest(!0),e.loginAndLogoutReload()):a.submitError(d.getNotification(b))};this.facebookLoginEnabled(!!e.settingsGet("AllowFacebookSocial"));this.twitterLoginEnabled(!!e.settingsGet("AllowTwitterSocial"));this.googleLoginEnabled(!!e.settingsGet("AllowGoogleSocial"));
switch((e.settingsGet("SignMe")||"unused").toLowerCase()){case g.LoginSignMeTypeAsString.DefaultOff:this.signMeType(g.LoginSignMeType.DefaultOff);break;case g.LoginSignMeTypeAsString.DefaultOn:this.signMeType(g.LoginSignMeType.DefaultOn);break;default:case g.LoginSignMeTypeAsString.Unused:this.signMeType(g.LoginSignMeType.Unused)}this.email(e.data().devEmail);this.login(e.data().devLogin);this.password(e.data().devPassword);this.googleLoginEnabled()&&(h["rl_"+b+"_google_login_service"]=c);this.facebookLoginEnabled()&&
(h["rl_"+b+"_facebook_login_service"]=c);this.twitterLoginEnabled()&&(h["rl_"+b+"_twitter_login_service"]=c);i.delay(function(){e.data().language.subscribe(function(b){a.langRequest(!0);j.ajax({url:e.link().langLink(b),dataType:"script",cache:!0}).done(function(){a.bSendLanguage=!0;d.i18nToDoc();j.cookie("rllang",e.data().language(),{expires:30})}).always(function(){a.langRequest(!1)})})},50)};la.prototype.selectLanguage=function(){o.showScreenPopup(ka)};i.extend(T.prototype,D.prototype);T.prototype.accountClick=
function(a,b){if(a&&b&&!d.isUnd(b.which)&&1===b.which){var c=this;this.accountsLoading(!0);i.delay(function(){c.accountsLoading(!1)},1E3)}return!0};T.prototype.emailTitle=function(){return e.data().accountEmail()};T.prototype.settingsClick=function(){o.setHash(e.link().settings())};T.prototype.addAccountClick=function(){this.allowAddAccount&&o.showScreenPopup(ja)};T.prototype.logoutClick=function(){e.remote().logout(function(){h.__rlah_clear&&h.__rlah_clear();e.loginAndLogoutReload(!0,e.settingsGet("ParentEmail")&&
0<e.settingsGet("ParentEmail").length)})};i.extend(Sa.prototype,T.prototype);i.extend(Ta.prototype,T.prototype);d.extendAsViewModel("MailBoxFolderListViewModel",ca);ca.prototype.onBuild=function(a){a.on("click",".b-folders .e-item .e-link .e-collapsed-sign",function(a){var c=f.dataFor(this),e=!1;c&&a&&(e=c.collapsed(),d.setExpandedFolder(c.fullNameHash,e),c.collapsed(!e),a.preventDefault(),a.stopPropagation())}).on("click",".b-folders .e-item .e-link.selectable",function(a){a.preventDefault();if(a=
f.dataFor(this))e.data().usePreviewPane()||e.data().message(null),a.fullNameRaw===e.data().currentFolderFullNameRaw()&&e.cache().setFolderHash(a.fullNameRaw,""),o.setHash(e.link().mailBox(a.fullNameHash))})};ca.prototype.messagesDropOver=function(a){h.clearTimeout(this.iDropOverTimer);a&&a.collapsed()&&(this.iDropOverTimer=h.setTimeout(function(){a.collapsed(!1);d.setExpandedFolder(a.fullNameHash,!0);d.windowResize()},500))};ca.prototype.messagesDropOut=function(){h.clearTimeout(this.iDropOverTimer)};
ca.prototype.messagesDrop=function(a,b){if(a&&b&&b.helper){var c=b.helper.data("rl-folder"),e=b.helper.data("rl-uids");A&&(A.__vm&&d.isNormal(c)&&d.isArray(e))&&A.__vm.moveMessagesToFolder(c,e,a.fullNameRaw)}};ca.prototype.composeClick=function(){o.showScreenPopup(z)};ca.prototype.contactsClick=function(){this.allowContacts&&o.showScreenPopup(P)};d.extendAsViewModel("MailBoxMessageListViewModel",A);A.prototype.emptySubjectValue="";A.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue);
this.inputMessageListSearchFocus(!1)};A.prototype.cancelSearch=function(){this.mainMessageListSearch("");this.inputMessageListSearchFocus(!1)};A.prototype.removeMessagesFromList=function(a,b,c,f){var c=d.isNormal(c)?c:"",f=d.isUnd(f)?!1:!!f,g=0,h=e.data(),j=e.cache().getFolderFromCacheList(a),k=""===c?null:e.cache().getFolderFromCacheList(c||""),n=h.currentFolderFullNameRaw(),q=h.message(),m=n===a?i.filter(h.messageList(),function(a){return a&&-1<d.inArray(a.uid,b)}):[];f||i.each(m,function(a){a&&
a.unseen()&&g++});j&&!f&&(j.messageCountAll(0<=j.messageCountAll()-b.length?j.messageCountAll()-b.length:0),0<g&&j.messageCountUnread(0<=j.messageCountUnread()-g?j.messageCountUnread()-g:0));k&&!f&&(k.messageCountAll(k.messageCountAll()+b.length),0<g&&k.messageCountUnread(k.messageCountUnread()+g));0<m.length&&(i.each(m,function(a){if(q&&q.requestHash===a.requestHash){q=null;h.message(null)}a.deleted(true)}),i.delay(function(){i.each(m,function(a){h.messageList.remove(a)})},400),f||(e.data().messageListIsNotCompleted(!0),
e.cache().setFolderHash(a,""),d.isNormal(c)&&e.cache().setFolderHash(c||"","")))};A.prototype.removeCheckedOrSelectedMessagesFromList=function(a){this.removeMessagesFromList(e.data().currentFolderFullNameRaw(),i.map(e.data().messageListCheckedOrSelected(),function(a){return a.uid}),a)};A.prototype.moveOrDeleteResponse=function(a,b){g.StorageResultType.Success===a&&e.data().currentFolder()&&(b&&d.isArray(b.Result)&&2===b.Result.length?e.cache().setFolderHash(b.Result[0],b.Result[1]):(b&&g.Notification.CantMoveMessage===
b.ErrorCode&&h.alert(d.getNotification(g.Notification.CantMoveMessage)),e.cache().setFolderHash(e.data().currentFolderFullNameRaw(),"")),e.reloadMessageList(),e.quotaDebounce())};A.prototype.moveMessagesToFolder=function(a,b,c){if(a!==c&&d.isArray(b)&&0<b.length){var f=e.cache().getFolderFromCacheList(a),g=e.cache().getFolderFromCacheList(c);if(f&&g)return e.remote().messagesMove(i.bind(this.moveOrDeleteResponse,this),f.fullNameRaw,g.fullNameRaw,b),g.actionBlink(!0),this.removeMessagesFromList(a,
b,c),!0}return!1};A.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()?this.moveMessagesToFolder(e.data().currentFolderFullNameRaw(),e.data().messageListCheckedOrSelectedUidsWithSubMails(),a):!1};A.prototype.deleteSelectedMessageFromCurrentFolder=function(a,b){if(this.canBeMoved()){var b=d.isUnd(b)?!0:!!b,c=e.cache().getFolderFromCacheList(g.FolderType.Spam===a?e.data().spamFolder():e.data().trashFolder());!c&&b?o.showScreenPopup(ba,[g.FolderType.Spam===a?g.SetSystemFoldersNotification.Spam:
g.SetSystemFoldersNotification.Trash]):!b||c&&(p.Values.UnuseOptionValue===c.fullNameRaw||e.data().currentFolderFullNameRaw()===c.fullNameRaw)?(e.remote().messagesDelete(i.bind(this.moveOrDeleteResponse,this),e.data().currentFolderFullNameRaw(),e.data().messageListCheckedOrSelectedUidsWithSubMails()),this.removeCheckedOrSelectedMessagesFromList()):c&&(e.remote().messagesMove(i.bind(this.moveOrDeleteResponse,this),e.data().currentFolderFullNameRaw(),c.fullNameRaw,e.data().messageListCheckedOrSelectedUidsWithSubMails()),
c.actionBlink(!0),this.removeCheckedOrSelectedMessagesFromList(c.fullNameRaw))}};A.prototype.dragAndDronHelper=function(a){a&&a.checked(!0);a=d.draggeblePlace();a.data("rl-folder",e.data().currentFolderFullNameRaw());a.data("rl-uids",e.data().messageListCheckedOrSelectedUidsWithSubMails());a.find(".text").text(e.data().messageListCheckedOrSelectedUidsWithSubMails().length);return a};A.prototype.onMessageResponse=function(a,b,c){var f=e.data();f.messageLoading(!1);g.StorageResultType.Success===a&&
b&&b.Result?f.setMessage(b,c):g.StorageResultType.Unload===a?(f.message(null),f.messageError("")):g.StorageResultType.Abort!==a&&(f.message(null),f.messageError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.getNotification(g.Notification.UnknownError)))};A.prototype.populateMessageBody=function(a){a&&(e.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?e.data().messageLoading(!0):d.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))};A.prototype.setAction=
function(a,b,c){var f=[],h=null,t=e.cache(),j=0;d.isUnd(c)&&(c=e.data().messageListChecked());f=i.map(c,function(a){return a.uid});if(""!==a&&0<f.length){switch(b){case g.MessageSetAction.SetSeen:i.each(c,function(a){a.unseen()&&j++;a.unseen(!1);t.storeMessageFlagsToCache(a)});(h=t.getFolderFromCacheList(a))&&h.messageCountUnread(h.messageCountUnread()-j);e.remote().messageSetSeen(d.emptyFunction,a,f,!0);break;case g.MessageSetAction.UnsetSeen:i.each(c,function(a){a.unseen()&&j++;a.unseen(!0);t.storeMessageFlagsToCache(a)});
(h=t.getFolderFromCacheList(a))&&h.messageCountUnread(h.messageCountUnread()-j+f.length);e.remote().messageSetSeen(d.emptyFunction,a,f,!1);break;case g.MessageSetAction.SetFlag:i.each(c,function(a){a.flagged(!0);t.storeMessageFlagsToCache(a)});e.remote().messageSetFlagged(d.emptyFunction,a,f,!0);break;case g.MessageSetAction.UnsetFlag:i.each(c,function(a){a.flagged(!1);t.storeMessageFlagsToCache(a)}),e.remote().messageSetFlagged(d.emptyFunction,a,f,!1)}e.reloadFlagsCurrentMessageListAndMessageFromCache()}};
A.prototype.setActionForAll=function(a,b){var c=null,f=e.data().messageList(),h=e.cache();if(""!==a&&(c=h.getFolderFromCacheList(a))){switch(b){case g.MessageSetAction.SetSeen:if(c=h.getFolderFromCacheList(a))i.each(f,function(a){a.unseen(!1)}),c.messageCountUnread(0),h.clearMessageFlagsFromCacheByFolder(a);e.remote().messageSetSeenToAll(d.emptyFunction,a,!0);break;case g.MessageSetAction.UnsetSeen:if(c=h.getFolderFromCacheList(a))i.each(f,function(a){a.unseen(!0)}),c.messageCountUnread(c.messageCountAll()),
h.clearMessageFlagsFromCacheByFolder(a);e.remote().messageSetSeenToAll(d.emptyFunction,a,!1)}e.reloadFlagsCurrentMessageListAndMessageFromCache()}};A.prototype.listSetSeen=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetSeen,e.data().messageListCheckedOrSelected())};A.prototype.listSetAllSeen=function(){this.setActionForAll(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetSeen)};A.prototype.listUnsetSeen=function(){this.setAction(e.data().currentFolderFullNameRaw(),
g.MessageSetAction.UnsetSeen,e.data().messageListCheckedOrSelected())};A.prototype.listSetFlags=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetFlag,e.data().messageListCheckedOrSelected())};A.prototype.listUnsetFlags=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.UnsetFlag,e.data().messageListCheckedOrSelected())};A.prototype.onBuild=function(a){var b=this,c=e.data();this.oContentVisible=j(".b-content",a);this.oContentScrollable=
j(".content",this.oContentVisible);this.oContentVisible.on("click",".fullThreadHandle",function(){var a=[],b=f.dataFor(this);b&&!b.lastInCollapsedThreadLoading()&&(e.data().messageListThreadFolder(b.folderFullNameRaw),a=e.data().messageListThreadUids(),b.lastInCollapsedThread()?a.push(0<b.parentUid()?b.parentUid():b.uid):a=i.without(a,0<b.parentUid()?b.parentUid():b.uid),e.data().messageListThreadUids(i.uniq(a)),b.lastInCollapsedThreadLoading(!0),b.lastInCollapsedThread(!b.lastInCollapsedThread()),
e.reloadMessageList());return!1});this.selector.init(this.oContentVisible,this.oContentScrollable);Ga.on("keydown",function(a){var f=!0,h=a?a.keyCode:0;if(a&&b.viewModelVisibility()&&c.useKeyboardShortcuts()&&!e.popupVisibility()&&!c.messageFullScreenMode()&&!d.inFocus()&&(c.usePreviewPane()||!c.message()&&(g.EventKeyCode.Delete===h||g.EventKeyCode.A===h))&&a.ctrlKey&&g.EventKeyCode.A===h)b.checkAll(!(b.checkAll()&&!b.isIncompleteChecked())),f=!1;return f});a.on("click",".pagenator .page",function(){var a=
f.dataFor(this);a&&o.setHash(e.link().mailBox(c.currentFolderFullNameHash(),a.value,c.messageListSearch()))}).on("click",".messageList .checkboxCkeckAll",function(){b.checkAll(!b.checkAll())}).on("click",".messageList .messageListItem .flagParent",function(){var a=f.dataFor(this),e=c.messageListCheckedOrSelected(),h=[];a&&(0<e.length&&(h=i.map(e,function(a){return a.uid})),0<h.length&&-1<d.inArray(a.uid,h)?b.setAction(a.folderFullNameRaw,a.flagged()?g.MessageSetAction.UnsetFlag:g.MessageSetAction.SetFlag,
e):b.setAction(a.folderFullNameRaw,a.flagged()?g.MessageSetAction.UnsetFlag:g.MessageSetAction.SetFlag,[a]))});f.computed(function(){var a=e.data(),b=this.viewModelVisibility(),c=e.popupVisibility(),d=a.useKeyboardShortcuts(),a=a.messageFullScreenMode();this.selector.useKeyboard(b&&d&&!a&&!c)},this).extend({notify:"always"});this.initUploaderForAppend()};A.prototype.composeClick=function(){o.showScreenPopup(z)};A.prototype.advancedSearchClick=function(){o.showScreenPopup(ia)};A.prototype.quotaTooltip=
function(){return d.i18n("MESSAGE_LIST/QUOTA_SIZE",{SIZE:d.friendlySize(this.userUsageSize()),PROC:this.userUsageProc(),LIMIT:d.friendlySize(this.userQuota())})};A.prototype.initUploaderForAppend=function(){return!e.settingsGet("AllowAppendMessage")||!this.dragOverArea()?!1:!!new wa({action:e.link().append(),name:"AppendFile",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,hidden:{Folder:function(){return e.data().currentFolderFullNameRaw()}},dragAndDropElement:this.dragOverArea(),dragAndDropBodyElement:this.dragOverBodyArea(),
onDragEnter:i.bind(function(){this.dragOverEnter(true)},this),onDragLeave:i.bind(function(){this.dragOverEnter(false)},this),onBodyDragEnter:i.bind(function(){this.dragOver(true)},this),onBodyDragLeave:i.bind(function(){this.dragOver(false)},this),onSelect:i.bind(function(a,b){if(a&&b&&"message/rfc822"===b.Type){e.data().messageListLoading(true);return true}return false}),onComplete:i.bind(function(){e.reloadMessageList(true,true)},this)})};d.extendAsViewModel("MailBoxMessageViewViewModel",J);J.prototype.scrollToTop=
function(){var a=j(".messageItem.nano .content",this.viewModelDom);a&&a[0]?a.scrollTop(0):j(".messageItem",this.viewModelDom).scrollTop(0);d.windowResize()};J.prototype.fullScreen=function(){this.fullScreenMode(!0);d.windowResize()};J.prototype.unFullScreen=function(){this.fullScreenMode(!1);d.windowResize()};J.prototype.toggleFullScreen=function(){d.removeSelection();this.fullScreenMode(!this.fullScreenMode());d.windowResize()};J.prototype.replyOrforward=function(a){o.showScreenPopup(z,[a,e.data().message()])};
J.prototype.onBuild=function(a){var b=this,c=e.data();Ga.on("keydown",function(a){var e=!0,a=a?a.keyCode:0;if(0<a&&(g.EventKeyCode.Backspace===a||g.EventKeyCode.Esc===a)&&b.viewModelVisibility()&&c.useKeyboardShortcuts()&&!d.inFocus()&&c.message())b.fullScreenMode(!1),c.usePreviewPane()||c.message(null),e=!1;return e});j(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",preload:[1,1],gallery:{enabled:!0},callbacks:{open:function(){c.useKeyboardShortcuts(!1)},
close:function(){c.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:300});a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=f.dataFor(this);a&&a.download&&e.download(a.linkDownload())});this.oMessageScrollerDom=(this.oMessageScrollerDom=a.find(".messageItem .content"))&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null};J.prototype.isDraftFolder=function(){return e.data().message()&&
e.data().draftFolder()===e.data().message().folderFullNameRaw};J.prototype.isSentFolder=function(){return e.data().message()&&e.data().sentFolder()===e.data().message().folderFullNameRaw};J.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()};J.prototype.composeClick=function(){o.showScreenPopup(z)};J.prototype.editMessage=function(){e.data().message()&&o.showScreenPopup(z,[g.ComposeType.Draft,e.data().message()])};J.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&
this.oMessageScrollerDom.scrollTop(0)};J.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)};d.extendAsViewModel("SettingsMenuViewModel",Ba);Ba.prototype.link=function(a){return e.link().settings(a)};Ba.prototype.backToMailBoxClick=function(){o.setHash(e.link().inbox())};d.extendAsViewModel("SettingsPaneViewModel",Ca);Ca.prototype.onShow=function(){e.data().message(null)};Ca.prototype.backToMailBoxClick=function(){o.setHash(e.link().inbox())};d.addSettingsViewModel(Da,
"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0);Da.prototype.onBuild=function(){var a=this;i.delay(function(){var b=e.data(),c=d.settingsSaveHelperSimpleFunction(a.mppTrigger,a);b.language.subscribe(function(b){a.languageTrigger(g.SaveSettingsStep.Animate);j.ajax({url:e.link().langLink(b),dataType:"script",cache:!0}).done(function(){d.i18nToDoc();a.languageTrigger(g.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(g.SaveSettingsStep.FalseResult)}).always(function(){i.delay(function(){a.languageTrigger(g.SaveSettingsStep.Idle)},
1E3)});e.remote().saveSettings(d.emptyFunction,{Language:b})});b.editorDefaultType.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{EditorDefaultType:a})});b.messagesPerPage.subscribe(function(a){e.remote().saveSettings(c,{MPP:a})});b.showImages.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{ShowImages:a?"1":"0"})});b.interfaceAnimation.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{InterfaceAnimation:a})});b.useDesktopNotifications.subscribe(function(a){d.timeOutAction("SaveDesktopNotifications",
function(){e.remote().saveSettings(d.emptyFunction,{DesktopNotifications:a?"1":"0"})},3E3)});b.replySameFolder.subscribe(function(a){d.timeOutAction("SaveReplySameFolder",function(){e.remote().saveSettings(d.emptyFunction,{ReplySameFolder:a?"1":"0"})},3E3)});b.useThreads.subscribe(function(a){b.messageList([]);e.remote().saveSettings(d.emptyFunction,{UseThreads:a?"1":"0"})});b.usePreviewPane.subscribe(function(a){b.messageList([]);e.remote().saveSettings(d.emptyFunction,{UsePreviewPane:a?"1":"0"})});
b.useCheckboxesInList.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)};Da.prototype.onShow=function(){e.data().desktopNotifications.valueHasMutated()};Da.prototype.selectLanguage=function(){o.showScreenPopup(ka)};d.addSettingsViewModel(Ua,"SettingsPersonal","SETTINGS_LABELS/LABEL_PERSONAL_NAME","personal");Ua.prototype.onBuild=function(){var a=this;i.delay(function(){var b=e.data(),c=d.settingsSaveHelperSimpleFunction(a.nameTrigger,a),f=d.settingsSaveHelperSimpleFunction(a.replyTrigger,
a),g=d.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){e.remote().saveSettings(c,{DisplayName:a})});b.replyTo.subscribe(function(a){e.remote().saveSettings(f,{ReplyTo:a})});b.signature.subscribe(function(a){e.remote().saveSettings(g,{Signature:a})})},50)};d.addSettingsViewModel(qa,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts");qa.prototype.addNewAccount=function(){o.showScreenPopup(ja)};qa.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);
var b=function(b){return a===b};a&&(e.data().accounts.remove(b),e.remote().accountDelete(function(){e.accounts()},a.email))}};d.addSettingsViewModel(La,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social");d.addSettingsViewModel(ra,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password");ra.prototype.onHide=function(){this.changeProcess(!1);this.currentPassword("");this.newPassword("")};ra.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1);
g.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)};d.addSettingsViewModel(X,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders");X.prototype.folderEditOnEnter=function(a){var b=a?d.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(e.local().set(g.ClientSideKeyName.FoldersLashHash,""),e.data().foldersRenaming(!0),e.remote().folderRename(function(a,b){e.data().foldersRenaming(!1);if(g.StorageResultType.Success!==
a||!b||!b.Result)e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"));e.folders(!1)},a.fullNameRaw,b),e.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b));a.edited(!1)};X.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)};X.prototype.onShow=function(){e.data().foldersListError("")};X.prototype.createFolder=function(){o.showScreenPopup(ha)};X.prototype.systemFolder=function(){o.showScreenPopup(ba)};X.prototype.deleteFolder=
function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){if(a===c)return!0;c.subFolders.remove(b);return!1};a&&(e.local().set(g.ClientSideKeyName.FoldersLashHash,""),e.data().folderList.remove(b),e.data().foldersDeleting(!0),e.remote().folderDelete(function(a,b){e.data().foldersDeleting(!1);if(g.StorageResultType.Success!==a||!b||!b.Result)e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"));
e.folders(!1)},a.fullNameRaw),e.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0<a.privateMessageCountAll()&&e.data().foldersListError(d.getNotification(g.Notification.CantDeleteNonEmptyFolder))};X.prototype.subscribeFolder=function(a){e.local().set(g.ClientSideKeyName.FoldersLashHash,"");e.remote().folderSetSubscribe(d.emptyFunction,a.fullNameRaw,!0);a.subScribed(!0)};X.prototype.unSubscribeFolder=function(a){e.local().set(g.ClientSideKeyName.FoldersLashHash,"");e.remote().folderSetSubscribe(d.emptyFunction,
a.fullNameRaw,!1);a.subScribed(!1)};d.addSettingsViewModel(ma,"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes");ma.prototype.removeCustomThemeImg=function(){this.customThemeImg("")};ma.prototype.onBuild=function(){var a=this,b=e.data().theme();this.themesObjects(i.map(e.data().themes(),function(a){return{name:a,nameDisplay:d.convertThemeName(a),selected:f.observable(a===b),themePreviewSrc:e.link().themePreviewLink(a)}}));i.delay(function(){a.customThemeType.subscribe(function(a){e.remote().saveSettings(function(){e.data().theme.valueHasMutated()},
{CustomThemeType:a})});a.customThemeImg.subscribe(function(a){e.remote().saveSettings(function(){e.data().theme.valueHasMutated()},{CustomThemeImg:a})})},50);this.initCustomThemeUploader()};ma.prototype.initCustomThemeUploader=function(){return this.customThemeUploaderButton()?!!new wa({action:e.link().uploadBackground(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,clickElement:this.customThemeUploaderButton(),onSelect:i.bind(function(a,b){var c=d.isUnd(b.FileName)?
"":b.FileName.toString(),c=c.substring(c.length-4,c.length),e=d.isNormal(b.Size)?d.pInt(b.Size):null;return-1===d.inArray(c,["jpeg",".jpg",".png"])?(h.alert(d.i18n("SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR")),!1):1048576<e?(h.alert(d.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:i.bind(function(){this.customThemeUploaderProgress(!0)},this),onComplete:i.bind(function(a,b,c){!b||!c||!c.Result?h.alert(c&&c.ErrorCode?d.getUploadErrorDescByCode(c.ErrorCode):d.getUploadErrorDescByCode(g.UploadErrorCode.Unknown)):
this.customThemeImg(c.Result);this.customThemeUploaderProgress(!1)},this)}):!1};Ma.prototype.populateDataOnStart=function(){var a=e.settingsGet("Languages"),b=e.settingsGet("Themes");d.isArray(a)&&this.languages(a);d.isArray(b)&&this.themes(b);this.mainLanguage(e.settingsGet("Language"));this.mainTheme(e.settingsGet("Theme"));this.allowCustomTheme(!!e.settingsGet("AllowCustomTheme"));this.allowAdditionalAccounts(!!e.settingsGet("AllowAdditionalAccounts"));this.determineUserLanguage(!!e.settingsGet("DetermineUserLanguage"));
this.allowThemes(!!e.settingsGet("AllowThemes"));this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"));this.allowLanguagesOnLogin(!!e.settingsGet("AllowLanguagesOnLogin"));this.allowLanguagesOnSettings(!!e.settingsGet("AllowLanguagesOnSettings"));this.editorDefaultType(e.settingsGet("EditorDefaultType"));this.showImages(!!e.settingsGet("ShowImages"));this.interfaceAnimation(e.settingsGet("InterfaceAnimation"));this.mainMessagesPerPage(e.settingsGet("MPP"));this.desktopNotifications(!!e.settingsGet("DesktopNotifications"));
this.useThreads(!!e.settingsGet("UseThreads"));this.replySameFolder(!!e.settingsGet("ReplySameFolder"));this.usePreviewPane(!!e.settingsGet("UsePreviewPane"));this.useCheckboxesInList(!!e.settingsGet("UseCheckboxesInList"));this.facebookEnable(!!e.settingsGet("AllowFacebookSocial"));this.facebookAppID(e.settingsGet("FacebookAppID"));this.facebookAppSecret(e.settingsGet("FacebookAppSecret"));this.twitterEnable(!!e.settingsGet("AllowTwitterSocial"));this.twitterConsumerKey(e.settingsGet("TwitterConsumerKey"));
this.twitterConsumerSecret(e.settingsGet("TwitterConsumerSecret"));this.googleEnable(!!e.settingsGet("AllowGoogleSocial"));this.googleClientID(e.settingsGet("GoogleClientID"));this.googleClientSecret(e.settingsGet("GoogleClientSecret"));this.dropboxEnable(!!e.settingsGet("AllowDropboxSocial"));this.dropboxApiKey(e.settingsGet("DropboxApiKey"));this.contactsIsSupported(!!e.settingsGet("ContactsIsSupported"));this.contactsIsAllowed(!!e.settingsGet("ContactsIsAllowed"))};i.extend(V.prototype,Ma.prototype);
V.prototype.purgeMessageBodyCache=function(){var a=0,b=null,c=n.iMessageBodyCacheCount-p.Values.iMessageBodyCacheLimit;if(0<c&&(b=this.messagesBodiesDom()))b.find(".rl-cache-class").each(function(){var b=j(this);c>b.data("rl-cache-count")&&(b.addClass("rl-cache-purge"),a++)}),0<a&&i.delay(function(){b.find(".rl-cache-purge").remove()},300)};V.prototype.populateDataOnStart=function(){Ma.prototype.populateDataOnStart.call(this);this.accountEmail(e.settingsGet("Email"));this.accountLogin(e.settingsGet("Login"));
this.projectHash(e.settingsGet("ProjectHash"));this.displayName(e.settingsGet("DisplayName"));this.replyTo(e.settingsGet("ReplyTo"));this.signature(e.settingsGet("Signature"));this.lastFoldersHash=e.local().get(g.ClientSideKeyName.FoldersLashHash)||"";this.remoteSuggestions=!!e.settingsGet("RemoteSuggestions");this.remoteChangePassword=!!e.settingsGet("RemoteChangePassword");this.devEmail=e.settingsGet("DevEmail");this.devLogin=e.settingsGet("DevLogin");this.devPassword=e.settingsGet("DevPassword")};
V.prototype.initUidNextAndNewMessages=function(a,b,c){if("INBOX"===a&&d.isNormal(b)&&""!==b){if(d.isArray(c)&&0<c.length){var f=e.cache(),g=0,j=c.length,w=function(a,b,c){var d=null;if(oa&&e.data().useDesktopNotifications()&&(d=new oa(b,{body:c,icon:a})))d.show&&d.show(),h.setTimeout(function(a){return function(){a.cancel?a.cancel():a.close&&a.close()}}(d),7E3)};i.each(c,function(b){f.addNewMessageCache(a,b.Uid)});if(3<j)w(e.link().notificationMailIcon(),e.data().accountEmail(),d.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",
{COUNT:j}));else for(;g<j;g++)w(e.link().notificationMailIcon(),m.emailsToLine(m.initEmailsFromJson(c[g].From),!1),c[g].Subject)}e.cache().setFolderUidNext(a,b)}};V.prototype.folderResponseParseRec=function(a,b,c){for(var f=0,g=0,h=null,i=null,j="",h=[],m=[],c=!!c,f=0,g=b.length;f<g;f++)if(h=b[f]){j=h.FullNameRaw;i=e.cache().getFolderFromCacheList(j);if(!i&&(i=I.newInstanceFromJson(h)))if(e.cache().setFolderToCacheList(j,i),e.cache().setFolderFullNameRaw(i.fullNameHash,j),i.isGmailFolder=p.Values.GmailFolderName.toLowerCase()===
j.toLowerCase(),""!==a&&a===i.fullNameRaw+i.delimiter&&(i.isNamespaceFolder=!0),i.isNamespaceFolder||i.isGmailFolder)i.isUnpaddigFolder=!0;i&&(i.collapsed(!d.isFolderExpanded(i.fullNameHash)),!c&&h.Extended&&(h.Extended.Hash&&e.cache().setFolderHash(i.fullNameRaw,h.Extended.Hash),d.isNormal(h.Extended.MessageCount)&&i.messageCountAll(h.Extended.MessageCount),d.isNormal(h.Extended.MessageUnseenCount)&&i.messageCountUnread(h.Extended.MessageUnseenCount)),(h=h.SubFolders)&&("Collection/FolderCollection"===
h["@Object"]&&h["@Collection"]&&d.isArray(h["@Collection"]))&&i.subFolders(this.folderResponseParseRec(a,h["@Collection"],c)),m.push(i))}return m};V.prototype.setFolders=function(a,b){var c=[],f=!1,h=e.data(),i=0===h.folderList().length,j=function(a){return""===a||p.Values.UnuseOptionValue===a||null!==e.cache().getFolderFromCacheList(a)?a:""};a&&(a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&d.isArray(a.Result["@Collection"]))&&(d.isUnd(a.Result.Namespace)||
(h.namespace=a.Result.Namespace),this.threading(!!e.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),c=this.folderResponseParseRec(h.namespace,a.Result["@Collection"],!!b),h.folderList(c),a.Result.SystemFolders&&""===""+e.settingsGet("SentFolder")+e.settingsGet("DraftFolder")+e.settingsGet("SpamFolder")+e.settingsGet("TrashFolder")&&(e.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),e.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),e.settingsSet("SpamFolder",a.Result.SystemFolders[4]||
null),e.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),f=!0),h.sentFolder(j(e.settingsGet("SentFolder"))),h.draftFolder(j(e.settingsGet("DraftFolder"))),h.spamFolder(j(e.settingsGet("SpamFolder"))),h.trashFolder(j(e.settingsGet("TrashFolder"))),f&&e.remote().saveSystemFolders(d.emptyFunction,{SentFolder:h.sentFolder(),DraftFolder:h.draftFolder(),SpamFolder:h.spamFolder(),TrashFolder:h.trashFolder()}),b||e.local().set(g.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash),i&&b&&e.folders(!1))};
V.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()};V.prototype.setMessage=function(a,b){var c=!1,f=!1,g=!1,h=null,f=null,c="",i=this.messagesBodiesDom(),k=this.message();if(a&&k&&a.Result&&"Object/Message"===a.Result["@Object"]&&k.folderFullNameRaw===a.Result.Folder&&k.uid===a.Result.Uid){this.messageError("");k.initUpdateByMessageJson(a.Result);e.cache().addRequestedMessage(k.folderFullNameRaw,k.uid);b||k.initFlagsByJson(a.Result);if(i=i&&i[0]?
i:null)c="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),f=i.find("#"+c),!f||!f[0]?(f=!!a.Result.HasExternals,g=!!a.Result.HasInternals,h=j('<div id="'+c+'" />').hide().addClass("rl-cache-class"),h.data("rl-cache-count",++n.iMessageBodyCacheCount),d.isNormal(a.Result.Html)&&""!==a.Result.Html?(c=!0,h.html(a.Result.Html.toString()).addClass("b-text-part html")):d.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(c=!1,h.html(a.Result.Plain.toString()).addClass("b-text-part plain")):c=!1,a.Result.Rtl&&
(h.data("rl-is-rtl",!0),h.addClass("rtl-text-part")),i.append(h),h.data("rl-is-html",c),h.data("rl-has-images",f),k.isRtl(!!h.data("rl-is-rtl")),k.isHtml(!!h.data("rl-is-html")),k.hasImages(!!h.data("rl-has-images")),k.body=h,g&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()):(f.data("rl-cache-count",++n.iMessageBodyCacheCount),k.isRtl(!!f.data("rl-is-rtl")),k.isHtml(!!f.data("rl-is-html")),k.hasImages(!!f.data("rl-has-images")),
k.body=f),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),h&&d.initBlockquoteSwitcher(h);e.cache().initMessageFlagsFromCache(k);k.unseen()&&e.setMessageSeen(k);d.windowResize()}};V.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&d.isArray(a.Result["@Collection"])){var c=e.data(),f=e.cache(),h=null,i=0,j=0,k=0,n=0,q=[],o=c.staticMessageList,r=null,H=null,p=null,s=0,u=!1,k=d.pInt(a.Result.MessageResultCount),
n=d.pInt(a.Result.Offset);d.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(h=a.Result.LastCollapsedThreadUids);if((p=e.cache().getFolderFromCacheList(d.isNormal(a.Result.Folder)?a.Result.Folder:""))&&!b)e.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),d.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),d.isNormal(a.Result.MessageUnseenCount)&&(d.pInt(p.messageCountUnread())!==d.pInt(a.Result.MessageUnseenCount)&&(u=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),
this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages);u&&p&&e.cache().clearMessageFlagsFromCacheByFolder(p.fullNameRaw);i=0;for(j=a.Result["@Collection"].length;i<j;i++)if((r=a.Result["@Collection"][i])&&"Object/Message"===r["@Object"]){H=o[i];if(!H||!H.initByJson(r))H=m.newInstanceFromJson(r);H&&(f.hasNewMessageAndRemoveFromCache(H.folderFullNameRaw,H.uid)&&5>=s&&(s++,H.newForAnimation(!0)),H.deleted(!1),b?e.cache().initMessageFlagsFromCache(H):e.cache().storeMessageFlagsToCache(H),
H.lastInCollapsedThread(h&&-1<d.inArray(d.pInt(H.uid),h)?!0:!1),q.push(H))}c.messageListCount(k);c.messageListSearch(d.isNormal(a.Result.Search)?a.Result.Search:"");c.messageListEndSearch(d.isNormal(a.Result.Search)?a.Result.Search:"");c.messageListEndFolder(d.isNormal(a.Result.Folder)?a.Result.Folder:"");c.messageListPage(Math.ceil(n/c.messagesPerPage()+1));c.messageList(q);c.messageListIsNotCompleted(!1);(H=c.message())&&c.messageList.setSelectedByUid&&c.messageList.setSelectedByUid(H.generateUid());
o.length<q.length&&(c.staticMessageList=q);f.clearNewMessageCache();p&&(b||u||e.data().useThreads())&&e.folderInformation(p.fullNameRaw,q)}else e.data().messageListCount(0),e.data().messageList([]),e.data().messageListError(d.getNotification(a&&a.ErrorCode?a.ErrorCode:g.Notification.CantGetMessageList))};fa.prototype.oRequests={};fa.prototype.defaultResponse=function(a,b,c,f,j,t){var w=function(){g.StorageResultType.Success!==c&&n.bUnload&&(c=g.StorageResultType.Unload);if(g.StorageResultType.Success===
c&&f&&!f.Result){if(f&&-1<d.inArray(f.ErrorCode,[g.Notification.AuthError,g.Notification.AccessError,g.Notification.ConnectionError,g.Notification.DomainNotAllowed,g.Notification.AccountNotAllowed,g.Notification.MailServerError,g.Notification.UnknownNotification,g.Notification.UnknownError])&&n.iAjaxErrorCount++,f&&g.Notification.InvalidToken===f.ErrorCode&&n.iTokenErrorCount++,10<n.iTokenErrorCount&&e.loginAndLogoutReload(!0),f.Logout||7<n.iAjaxErrorCount)h.__rlah_clear&&h.__rlah_clear(),e.loginAndLogoutReload(!0)}else g.StorageResultType.Success===
c&&(f&&f.Result)&&(n.iAjaxErrorCount=0,n.iTokenErrorCount=0);a&&(y.runHook("ajax-default-response",[b,g.StorageResultType.Success===c?f:null,c,j,t]),a(c,g.StorageResultType.Success===c?f:null,j,b,t))};switch(c){case "success":c=g.StorageResultType.Success;break;case "abort":c=g.StorageResultType.Abort;break;default:c=g.StorageResultType.Error}g.StorageResultType.Error===c?i.delay(w,300):w()};fa.prototype.ajaxRequest=function(a,b,c,f,g){var t=this,w=""===f,k=(new h.Date).getTime(),m=null,q="",b=b||
{},c=d.isNormal(c)?c:2E4,f=d.isUnd(f)?"":d.pString(f),g=d.isArray(g)?g:[];(q=b.Action||"")&&0<g.length&&i.each(g,function(a){t.oRequests[a]&&(t.oRequests[a].__aborted=!0,t.oRequests[a].abort&&t.oRequests[a].abort(),t.oRequests[a]=null)});w&&(b.XToken=e.settingsGet("Token"));m=j.ajax({type:w?"POST":"GET",url:e.link().ajax(f),async:!0,dataType:"json",data:w?b:{},headers:{},timeout:c,global:!0});m.always(function(c,e){var f=!1;c&&c.Time&&(f=d.pInt(c.Time)>(new h.Date).getTime()-k);q&&t.oRequests[q]&&
(t.oRequests[q].__aborted&&(e="abort"),t.oRequests[q]=null);t.defaultResponse(a,q,e,c,f,b)});q&&(0<g.length&&-1<d.inArray(q,g))&&(this.oRequests[q]&&(this.oRequests[q].__aborted=!0,this.oRequests[q].abort&&this.oRequests[q].abort(),this.oRequests[q]=null),this.oRequests[q]=m);return m};fa.prototype.defaultRequest=function(a,b,c,e,f,g){c=c||{};c.Action=b;f=d.pString(f);y.runHook("ajax-default-request",[b,c,f]);this.ajaxRequest(a,c,d.isUnd(e)?p.Defaults.DefaultAjaxTimeout:d.pInt(e),f,g)};fa.prototype.noop=
function(a){this.defaultRequest(a,"Noop")};fa.prototype.jsError=function(a,b,c,d,e,f){this.defaultRequest(a,"JsError",{Message:b,FileName:c,LineNo:d,Location:e,HtmlCapa:f})};i.extend(s.prototype,fa.prototype);s.prototype.folders=function(a,b){var c=e.data().lastFoldersHash;(b=d.isUnd(b)?!1:!!b)&&""!==c?this.defaultRequest(a,"Folders",{},null,"Folders/"+e.data().projectHash()+"-"+c,["Folders"]):this.defaultRequest(a,"Folders",{},null,"",["Folders"])};s.prototype.login=function(a,b,c,d,e,f){this.defaultRequest(a,
"Login",{Email:b,Login:c,Password:d,Language:f||"",SignMe:e?"1":"0"})};s.prototype.accountAdd=function(a,b,c,d){this.defaultRequest(a,"AccountAdd",{Email:b,Login:c,Password:d})};s.prototype.accountDelete=function(a,b){this.defaultRequest(a,"AccountDelete",{EmailToDelete:b})};s.prototype.accounts=function(a){this.defaultRequest(a,"Accounts")};s.prototype.messageList=function(a,b,c,f,g,h){var b=d.pString(b),i=e.data(),j=e.cache().getFolderHash(b),h=d.isUnd(h)?!1:!!h,c=d.isUnd(c)?0:d.pInt(c),f=d.isUnd(c)?
20:d.pInt(f),g=d.pString(g);""!==j?this.defaultRequest(a,"MessageList",{},""===g?p.Defaults.DefaultAjaxTimeout:p.Defaults.SearchAjaxTimeout,"MessageList/"+na.urlsafe_encode([b,c,f,g,i.projectHash(),j,"INBOX"===b?e.cache().getFolderUidNext(b):"",i.threading()&&i.useThreads()?"1":"0",i.threading()&&b===i.messageListThreadFolder()?i.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),h?[]:["MessageList"]):this.defaultRequest(a,"MessageList",{Folder:b,Offset:c,Limit:f,Search:g,UidNext:"INBOX"===
b?e.cache().getFolderUidNext(b):"",UseThreads:e.data().threading()&&e.data().useThreads()?"1":"0",ExpandedThreadUid:i.threading()&&b===i.messageListThreadFolder()?i.messageListThreadUids().join(","):""},""===g?p.Defaults.DefaultAjaxTimeout:p.Defaults.SearchAjaxTimeout,"",h?[]:["MessageList"])};s.prototype.messageUploadAttachments=function(a,b){this.defaultRequest(a,"MessageUploadAttachments",{Attachments:b},999E3)};s.prototype.message=function(a,b,c){b=d.pString(b);c=d.pInt(c);return e.cache().getFolderFromCacheList(b)&&
0<c?(this.defaultRequest(a,"Message",{},null,"Message/"+na.urlsafe_encode([b,c,e.data().projectHash(),e.data().threading()&&e.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1};s.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999E3)};s.prototype.folderInformation=function(a,b,c){var f=!0,g=e.cache(),h=[];d.isArray(c)&&0<c.length&&(f=!1,i.each(c,function(a){g.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid)||
h.push(a.uid);0<a.threads().length&&i.each(a.threads(),function(b){g.getMessageFlagsFromCache(a.folderFullNameRaw,b)||h.push(b)})}),0<h.length&&(f=!0));f?this.defaultRequest(a,"FolderInformation",{Folder:b,FlagsUids:d.isArray(h)?h.join(","):"",UidNext:"INBOX"===b?e.cache().getFolderUidNext(b):""}):e.data().useThreads()&&e.reloadFlagsCurrentMessageListAndMessageFromCache()};s.prototype.logout=function(a){this.defaultRequest(a,"Logout")};s.prototype.messageSetFlagged=function(a,b,c,d){this.defaultRequest(a,
"MessageSetFlagged",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})};s.prototype.messageSetSeen=function(a,b,c,d){this.defaultRequest(a,"MessageSetSeen",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})};s.prototype.messageSetSeenToAll=function(a,b,c){this.defaultRequest(a,"MessageSetSeenToAll",{Folder:b,SetAction:c?"1":"0"})};s.prototype.saveMessage=function(a,b,c,d,e,f,g,h,i,j,m,n,o,s,u){this.defaultRequest(a,"SaveMessage",{MessageFolder:b,MessageUid:c,MessageID:d,DraftFolder:e,To:f,Cc:g,Bcc:h,
Subject:i,TextIsHtml:j?"1":"0",Text:m,DraftInfo:o,InReplyTo:s,References:u,Attachments:n},p.Defaults.SaveMessageAjaxTimeout)};s.prototype.sendMessage=function(a,b,c,d,e,f,g,h,i,j,m,n,o,s,u){this.defaultRequest(a,"SendMessage",{MessageFolder:b,MessageUid:c,MessageID:d,SentFolder:e,To:f,Cc:g,Bcc:h,Subject:i,TextIsHtml:j?"1":"0",Text:m,DraftInfo:o,InReplyTo:s,References:u,Attachments:n},p.Defaults.SendMessageAjaxTimeout)};s.prototype.saveSystemFolders=function(a,b){this.defaultRequest(a,"SystemFoldersUpdate",
b)};s.prototype.saveSettings=function(a,b){this.defaultRequest(a,"SettingsUpdate",b)};s.prototype.changePassword=function(a,b,c){this.defaultRequest(a,"ChangePassword",{PrevPassword:b,NewPassword:c})};s.prototype.folderCreate=function(a,b,c){this.defaultRequest(a,"FolderCreate",{Folder:b,Parent:c},null,"",["Folders"])};s.prototype.folderDelete=function(a,b){this.defaultRequest(a,"FolderDelete",{Folder:b},null,"",["Folders"])};s.prototype.folderRename=function(a,b,c){this.defaultRequest(a,"FolderRename",
{Folder:b,NewFolderName:c},null,"",["Folders"])};s.prototype.folderClear=function(a,b){this.defaultRequest(a,"FolderClear",{Folder:b})};s.prototype.folderSetSubscribe=function(a,b,c){this.defaultRequest(a,"FolderSubscribe",{Folder:b,Subscribe:c?"1":"0"})};s.prototype.messagesMove=function(a,b,c,d){this.defaultRequest(a,"MessageMove",{FromFolder:b,ToFolder:c,Uids:d.join(",")},null,"",["MessageList","Message"])};s.prototype.messagesDelete=function(a,b,c){this.defaultRequest(a,"MessageDelete",{Folder:b,
Uids:c.join(",")},null,"",["MessageList","Message"])};s.prototype.appDelayStart=function(a){this.defaultRequest(a,"AppDelayStart")};s.prototype.quota=function(a){this.defaultRequest(a,"Quota")};s.prototype.contacts=function(a,b){this.defaultRequest(a,"Contacts",{Search:b},null,"",["Contacts"])};s.prototype.contactSave=function(a,b,c,e,f,g){c=d.trim(c);this.defaultRequest(a,"ContactSave",{RequestUid:b,Uid:c,Name:e,Email:f,ImageData:g})};s.prototype.contactsDelete=function(a,b){this.defaultRequest(a,
"ContactsDelete",{Uids:b.join(",")})};s.prototype.suggestions=function(a,b,c){this.defaultRequest(a,"Suggestions",{Query:b,Page:c},null,"",["Suggestions"])};s.prototype.servicesPics=function(a){this.defaultRequest(a,"ServicesPics")};s.prototype.emailsPicsHashes=function(a){this.defaultRequest(a,"EmailsPicsHashes")};s.prototype.facebookUser=function(a){this.defaultRequest(a,"SocialFacebookUserInformation")};s.prototype.facebookDisconnect=function(a){this.defaultRequest(a,"SocialFacebookDisconnect")};
s.prototype.twitterUser=function(a){this.defaultRequest(a,"SocialTwitterUserInformation")};s.prototype.twitterDisconnect=function(a){this.defaultRequest(a,"SocialTwitterDisconnect")};s.prototype.googleUser=function(a){this.defaultRequest(a,"SocialGoogleUserInformation")};s.prototype.googleDisconnect=function(a){this.defaultRequest(a,"SocialGoogleDisconnect")};s.prototype.socialUsers=function(a){this.defaultRequest(a,"SocialUsers")};Y.prototype.oEmailsPicsHashes={};Y.prototype.oServices={};Y.prototype.clear=
function(){this.oServices={};this.oEmailsPicsHashes={}};Y.prototype.getUserPic=function(a){var b="",b="",b=a.toLowerCase(),c=d.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];""===c?(b=b.substr(a.indexOf("@")+1),b=""!==b&&this.oServices[b]?this.oServices[b]:""):b=e.link().getUserPicUrlFromHash(c);return b};Y.prototype.setServicesData=function(a){this.oServices=a};Y.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a};i.extend(x.prototype,Y.prototype);x.prototype.oFoldersCache=
{};x.prototype.oFoldersNamesCache={};x.prototype.oFolderHashCache={};x.prototype.oFolderUidNextCache={};x.prototype.oMessageListHashCache={};x.prototype.oMessageFlagsCache={};x.prototype.oBodies={};x.prototype.oNewMessage={};x.prototype.oRequestedMessage={};x.prototype.clear=function(){Y.prototype.clear.call(this);this.oFoldersCache={};this.oFoldersNamesCache={};this.oFolderHashCache={};this.oFolderUidNextCache={};this.oMessageListHashCache={};this.oMessageFlagsCache={};this.oBodies={}};x.prototype.getMessageKey=
function(a,b){return a+"#"+b};x.prototype.addRequestedMessage=function(a,b){this.oRequestedMessage[this.getMessageKey(a,b)]=!0};x.prototype.hasRequestedMessage=function(a,b){return!0===this.oRequestedMessage[this.getMessageKey(a,b)]};x.prototype.addNewMessageCache=function(a,b){this.oNewMessage[this.getMessageKey(a,b)]=!0};x.prototype.hasNewMessageAndRemoveFromCache=function(a,b){return this.oNewMessage[this.getMessageKey(a,b)]?(this.oNewMessage[this.getMessageKey(a,b)]=null,!0):!1};x.prototype.clearNewMessageCache=
function(){this.oNewMessage={}};x.prototype.getFolderFullNameRaw=function(a){return""!==a&&this.oFoldersNamesCache[a]?this.oFoldersNamesCache[a]:""};x.prototype.setFolderFullNameRaw=function(a,b){this.oFoldersNamesCache[a]=b};x.prototype.getFolderHash=function(a){return""!==a&&this.oFolderHashCache[a]?this.oFolderHashCache[a]:""};x.prototype.setFolderHash=function(a,b){this.oFolderHashCache[a]=b};x.prototype.getFolderUidNext=function(a){return""!==a&&this.oFolderUidNextCache[a]?this.oFolderUidNextCache[a]:
""};x.prototype.setFolderUidNext=function(a,b){this.oFolderUidNextCache[a]=b};x.prototype.getFolderFromCacheList=function(a){return""!==a&&this.oFoldersCache[a]?this.oFoldersCache[a]:null};x.prototype.setFolderToCacheList=function(a,b){this.oFoldersCache[a]=b};x.prototype.removeFolderFromCacheList=function(a){this.setFolderToCacheList(a,null)};x.prototype.getMessageFlagsFromCache=function(a,b){return this.oMessageFlagsCache[a]&&this.oMessageFlagsCache[a][b]?this.oMessageFlagsCache[a][b]:null};x.prototype.setMessageFlagsToCache=
function(a,b,c){this.oMessageFlagsCache[a]||(this.oMessageFlagsCache[a]={});this.oMessageFlagsCache[a][b]=c};x.prototype.clearMessageFlagsFromCacheByFolder=function(a){this.oMessageFlagsCache[a]={}};x.prototype.initMessageFlagsFromCache=function(a){if(a){var b=this,c=this.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid),e=null,f=null;c&&4===c.length&&(a.unseen(c[0]),a.flagged(c[1]),a.answered(c[2]),a.forwarded(c[3]));0<a.threads().length&&(e=i.find(a.threads(),function(c){return(c=b.getMessageFlagsFromCache(a.folderFullNameRaw,
c))&&4===c.length&&!!c[0]}),f=i.find(a.threads(),function(c){return(c=b.getMessageFlagsFromCache(a.folderFullNameRaw,c))&&4===c.length&&!!c[1]}),a.hasUnseenSubMessage(e&&0<d.pInt(e)),a.hasFlaggedSubMessage(f&&0<d.pInt(f)))}};x.prototype.storeMessageFlagsToCache=function(a){a&&this.setMessageFlagsToCache(a.folderFullNameRaw,a.uid,[a.unseen(),a.flagged(),a.answered(),a.forwarded()])};x.prototype.storeMessageFlagsToCacheByFolderAndUid=function(a,b,c){d.isArray(c)&&4===c.length&&this.setMessageFlagsToCache(a,
b,c)};i.extend(ga.prototype,M.prototype);ga.prototype.onRoute=function(a){var b=this,c=null,g=null,h=null,t=null;if(g=i.find(W.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}))i.find(W["settings-removed"],function(a){return a&&a===g})&&(g=null),g&&i.find(W["settings-disabled"],function(a){return a&&a===g})&&(g=null);g&&(g.__builded&&g.__vm?c=g.__vm:(h=this.oViewModelPlace)&&1===h.length?(c=new g,t=j("<div></div>").addClass("rl-settings-view-model").hide().attr("data-bind",
'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),t.appendTo(h),c.data=e.data(),c.viewModelDom=t,c.viewModelDom.addClass("rl-animation-margin"),c.__rlSettingsData=g.__rlSettingsData,g.__dom=t,g.__builded=!0,g.__vm=c,f.applyBindings(c,t[0]),o.delegateRun(c,"onBuild",[t])):d.log("Cannot find sub settings view model position: SettingsSubScreen"),c&&i.defer(function(){if(b.oCurrentSubScreen){o.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide();b.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin")}b.oCurrentSubScreen=
c;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();o.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),function(a){a.selected(c&&c.__rlSettingsData&&a.route===c.__rlSettingsData.Route)});j("#rl-content .b-settings .b-content .content").scrollTop(0);b.oCurrentSubScreen.viewModelDom.removeClass("rl-animation-margin")}d.windowResize()}))};ga.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(o.delegateRun(this.oCurrentSubScreen,"onHide"),
this.oCurrentSubScreen.viewModelDom.hide(),this.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin"))};ga.prototype.onBuild=function(){i.each(W.settings,function(a){a&&(a.__rlSettingsData&&!i.find(W["settings-removed"],function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:f.observable(!1),disabled:!!i.find(W["settings-disabled"],function(b){return b&&b===a})})},this);this.oViewModelPlace=j("#rl-content #rl-settings-subscreen")};
ga.prototype.routes=function(){var a=i.find(W.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,e){e.subname=d.isUnd(e.subname)?b:d.pString(e.subname);return[e.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(Ea.prototype,M.prototype);Ea.prototype.onShow=function(){e.setTitle(d.i18n("TITLES/LOGIN"))};i.extend(da.prototype,M.prototype);da.prototype.oLastRoute={};da.prototype.onShow=
function(){var a=e.data().accountEmail();e.setTitle((""===a?"":a+" - ")+d.i18n("TITLES/MAILBOX"))};da.prototype.onRoute=function(a,b,c){var d=e.data(),a=e.cache().getFolderFullNameRaw(a);if(a=e.cache().getFolderFromCacheList(a))d.currentFolder(a).messageListPage(b).messageListSearch(c),!d.usePreviewPane()&&d.message()&&d.message(null),e.reloadMessageList()};da.prototype.onStart=function(){var a=e.data(),b=function(){d.windowResize()};e.settingsGet("AllowAdditionalAccounts")&&e.accounts();i.delay(function(){e.quota()},
5E3);i.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&e.folderInformation("INBOX")},1E3);i.delay(function(){var b=e.data().spamFolder();b!==a.currentFolderFullNameRaw()&&e.folderInformation(b)},1500);i.delay(function(){var b=e.data().draftFolder();b!==a.currentFolderFullNameRaw()&&e.folderInformation(b)},2E3);i.delay(function(){e.remote().appDelayStart(d.emptyFunction)},35E3);h.setInterval(function(){e.folderInformation("INBOX")},12E4);h.setInterval(function(){e.quota()},3E5);U.toggleClass("rl-no-preview-pane",
!a.usePreviewPane());a.folderList.subscribe(b);a.messageList.subscribe(b);a.message.subscribe(b);a.usePreviewPane.subscribe(function(a){U.toggleClass("rl-no-preview-pane",!a)})};da.prototype.onBuild=function(){n.bMobileDevice||i.defer(function(){d.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",350,900,350,350,g.ClientSideKeyName.MailBoxListSize)})};da.prototype.routes=function(){var a=function(a,c){c[0]=d.pString(c[0]);c[1]=d.pInt(c[1]);c[1]=0>=c[1]?1:c[1];c[2]=d.pString(c[2]);
""===a&&(c[0]="Inbox",c[1]=1);return[decodeURI(c[0]),c[1],decodeURI(c[2])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:function(a,c){c[0]=d.pString(c[0]);c[1]=d.pString(c[1]);""===a&&(c[0]="Inbox");return[decodeURI(c[0]),1,decodeURI(c[1])]}}],[/^([^\/]*)$/,{normalize_:a}]]};i.extend(Na.prototype,ga.prototype);Na.prototype.onShow=function(){e.setTitle(this.sSettingsTitle)};i.extend(K.prototype,
Ra.prototype);K.prototype.oSettings=null;K.prototype.oLink=null;K.prototype.download=function(a){var b=null,c=null;if((b=navigator.userAgent.toLowerCase())&&(-1<b.indexOf("chrome")||-1<b.indexOf("chrome")))if(b=document.createElement("a"),b.href=a,document.createEvent&&(c=document.createEvent("MouseEvents"))&&c.initEvent&&b.dispatchEvent)return c.initEvent("click",!0,!0),b.dispatchEvent(c),!0;n.bMobileDevice?(h.open(a,"_self"),h.focus()):this.iframe.attr("src",a);return!0};K.prototype.link=function(){null===
this.oLink&&(this.oLink=new C);return this.oLink};K.prototype.local=function(){null===this.oLocal&&(this.oLocal=new za);return this.oLocal};K.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=d.isNormal(Fa)?Fa:{});return d.isUnd(this.oSettings[a])?null:this.oSettings[a]};K.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=d.isNormal(Fa)?Fa:{});this.oSettings[a]=b};K.prototype.setTitle=function(a){a=(0<a.length?a+" - ":"")+this.settingsGet("Title")||
"";a!==h.document.title&&(h.document.title=a)};K.prototype.loginAndLogoutReload=function(a,b){var c=d.pString(this.settingsGet("CustomLogoutLink")),f=!!this.settingsGet("InIframe"),a=d.isUnd(a)?!1:!!a,b=d.isUnd(b)?!1:!!b;a&&(b&&h.close)&&h.close();a&&""!==c&&h.location.href!==c?i.defer(function(){f&&h.parent?h.parent.location.href=c:h.location.href=c}):(o.routeOff(),o.setHash(e.link().root(),!0),o.routeOff(),i.defer(function(){f&&h.parent?h.parent.location.reload():h.location.reload()}))};K.prototype.getAutocomplete=
function(a,b,c){c([],a)};K.prototype.bootstart=function(){d.initOnStartOrLangChange(function(){d.initNotificationLanguage()},null);i.delay(function(){d.windowResize()},1E3)};i.extend(B.prototype,K.prototype);B.prototype.oData=null;B.prototype.oRemote=null;B.prototype.oCache=null;B.prototype.data=function(){null===this.oData&&(this.oData=new V);return this.oData};B.prototype.remote=function(){null===this.oRemote&&(this.oRemote=new s);return this.oRemote};B.prototype.cache=function(){null===this.oCache&&
(this.oCache=new x);return this.oCache};B.prototype.reloadFlagsCurrentMessageListAndMessageFromCache=function(){var a=e.cache();i.each(e.data().messageList(),function(b){a.initMessageFlagsFromCache(b)});a.initMessageFlagsFromCache(e.data().message())};B.prototype.reloadMessageList=function(a,b){var c=e.data(),f=(c.messageListPage()-1)*c.messagesPerPage();(d.isUnd(b)?0:b)&&e.cache().setFolderHash(c.currentFolderFullNameRaw(),"");if(d.isUnd(a)?0:a)c.messageListPage(1),f=0;c.messageListLoading(!0);e.remote().messageList(function(a,
b,e){g.StorageResultType.Success===a&&b&&b.Result?(c.messageListError(""),c.messageListLoading(!1),c.setMessageList(b,e)):g.StorageResultType.Unload===a?(c.messageListError(""),c.messageListLoading(!1)):g.StorageResultType.Abort!==a&&(c.messageList([]),c.messageListLoading(!1),c.messageListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST")))},c.currentFolderFullNameRaw(),f,c.messagesPerPage(),c.messageListSearch())};B.prototype.recacheInboxMessageList=
function(){e.remote().messageList(d.emptyFunction,"INBOX",0,e.data().messagesPerPage(),"",!0)};B.prototype.folders=function(a,b){this.data().foldersLoading(!0);this.remote().folders(i.bind(function(a,d,f){e.data().foldersLoading(!1);g.StorageResultType.Success===a?(this.data().setFolders(d,f),b&&b(!0)):b&&b(!1)},this),a)};B.prototype.accounts=function(){e.data().accountsLoading(!0);e.remote().accounts(function(a,b){e.data().accountsLoading(!1);if(g.StorageResultType.Success===a&&d.isArray(b.Result)){var c=
e.settingsGet("ParentEmail"),c=""===c?e.data().accountEmail():c;e.data().accounts(i.map(b.Result,function(a){return new Ka(a,a!==c)}))}})};B.prototype.quota=function(){this.remote().quota(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result&&d.isArray(b.Result)&&2===b.Result.length&&d.isPosNumeric(b.Result[0],!0)&&d.isPosNumeric(b.Result[1],!0))&&(e.data().userQuota(1024*d.pInt(b.Result[1])),e.data().userUsageSize(1024*d.pInt(b.Result[0])))})};B.prototype.folderInformation=function(a,b){this.remote().folderInformation(function(a,
b){if(g.StorageResultType.Success===a&&b&&b.Result&&b.Result.Hash&&b.Result.Folder){var f=e.cache().getFolderHash(b.Result.Folder),h=e.cache().getFolderFromCacheList(b.Result.Folder),i=!1,j="",m=[],m=!1,n=null;if(h){b.Result.Hash&&e.cache().setFolderHash(b.Result.Folder,b.Result.Hash);d.isNormal(b.Result.MessageCount)&&h.messageCountAll(b.Result.MessageCount);d.isNormal(b.Result.MessageUnseenCount)&&(d.pInt(h.messageCountUnread())!==d.pInt(b.Result.MessageUnseenCount)&&(m=!0),h.messageCountUnread(b.Result.MessageUnseenCount));
m&&e.cache().clearMessageFlagsFromCacheByFolder(h.fullNameRaw);if(b.Result.Flags){for(j in b.Result.Flags)b.Result.Flags.hasOwnProperty(j)&&(i=!0,n=b.Result.Flags[j],e.cache().storeMessageFlagsToCacheByFolderAndUid(h.fullNameRaw,j.toString(),[!n.IsSeen,!!n.IsFlagged,!!n.IsAnswered,!!n.IsForwarded]));i&&e.reloadFlagsCurrentMessageListAndMessageFromCache()}e.data().initUidNextAndNewMessages(h.fullNameRaw,b.Result.UidNext,b.Result.NewMessages);b.Result.Hash!==f||""===f?h.fullNameRaw===e.data().currentFolderFullNameRaw()?
e.reloadMessageList():"INBOX"===h.fullNameRaw&&e.recacheInboxMessageList():m&&h.fullNameRaw===e.data().currentFolderFullNameRaw()&&(m=e.data().messageList(),d.isNonEmptyArray(m)&&e.folderInformation(h.fullNameRaw,m))}}},a,b)};B.prototype.setMessageSeen=function(a){if(a.unseen()){a.unseen(!1);var b=e.cache().getFolderFromCacheList(a.folderFullNameRaw);b&&b.messageCountUnread(0<=b.messageCountUnread()-1?b.messageCountUnread()-1:0);e.cache().storeMessageFlagsToCache(a);e.reloadFlagsCurrentMessageListAndMessageFromCache()}e.remote().messageSetSeen(d.emptyFunction,
a.folderFullNameRaw,[a.uid],!0)};B.prototype.googleConnect=function(){h.open(e.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")};B.prototype.twitterConnect=function(){h.open(e.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")};B.prototype.facebookConnect=function(){h.open(e.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")};
B.prototype.socialUsers=function(a){var b=e.data();a&&(b.googleActions(!0),b.facebookActions(!0),b.twitterActions(!0));e.remote().socialUsers(function(a,d){if(g.StorageResultType.Success===a&&d&&d.Result){b.googleUserName(d.Result.Google||"");b.facebookUserName(d.Result.Facebook||"");b.twitterUserName(d.Result.Twitter||"")}else{b.googleUserName("");b.facebookUserName("");b.twitterUserName("")}b.googleLoggined(""!==b.googleUserName());b.facebookLoggined(""!==b.facebookUserName());b.twitterLoggined(""!==
b.twitterUserName());b.googleActions(false);b.facebookActions(false);b.twitterActions(false)})};B.prototype.googleDisconnect=function(){e.data().googleActions(!0);e.remote().googleDisconnect(function(){e.socialUsers()})};B.prototype.facebookDisconnect=function(){e.data().facebookActions(!0);e.remote().facebookDisconnect(function(){e.socialUsers()})};B.prototype.twitterDisconnect=function(){e.data().twitterActions(!0);e.remote().twitterDisconnect(function(){e.socialUsers()})};B.prototype.folderListOptionsBuilder=
function(a,b,c,f,i,j,m,k,n,q){var p=0,r=0,o=null,s=[],n=!d.isNormal(n)?0<a.length:n,q=d.isUnd(q)?!1:!!q,i=!d.isNormal(i)?0:i,j=d.isNormal(j)?j:null,m=d.isNormal(m)?m:null,k=d.isNormal(k)?k:null;d.isArray(c)||(c=[]);d.isArray(f)||(f=[]);p=0;for(r=f.length;p<r;p++)s.push({id:f[p][0],name:f[p][1],disable:!1});p=0;for(r=a.length;p<r;p++)if(o=a[p],m?m.call(null,o):1)s.push({id:o.fullNameRaw,system:!0,name:k?k.call(null,o):o.name(),disable:!o.selectable||-1<d.inArray(o.fullNameRaw,c)||(j?j.call(null,o):
!1)});p=0;for(r=b.length;p<r;p++){o=b[p];if(!o.isGmailFolder&&(o.subScribed()||!o.existen))if(m?m.call(null,o):1)if(g.FolderType.User===o.type()||!n||!o.isNamespaceFolder&&0<o.subFolders().length)s.push({id:o.fullNameRaw,system:!1,name:(new h.Array(o.deep+1-i)).join("\u00a0\u00a0\u00a0")+(k?k.call(null,o):o.name()),disable:!o.selectable||-1<d.inArray(o.fullNameRaw,c)||g.FolderType.User!==o.type()||(j?j.call(null,o):!1)});o.subScribed()&&0<o.subFolders().length&&(s=s.concat(e.folderListOptionsBuilder([],
o.subFolders(),c,[],o.isUnpaddigFolder?i+1:i,j,m,k,n,q)))}return s};B.prototype.getAutocomplete=function(a,b,c){var f=[];e.remote().suggestions(function(a,b){g.StorageResultType.Success===a&&b&&b.Result&&d.isArray(b.Result.List)?(f=i.map(b.Result.List,function(a){return a&&a[0]?new G(a[0],a[1]):null}),c(i.compact(f),!!b.Result.More)):g.StorageResultType.Abort!==a&&c([],!1)},a,b)};B.prototype.emailsPicsHashes=function(){e.remote().emailsPicsHashes(function(a,b){g.StorageResultType.Success===a&&(b&&
b.Result)&&e.cache().setEmailsPicsHashesData(b.Result)})};B.prototype.bootstart=function(){K.prototype.bootstart.call(this);e.data().populateDataOnStart();var a="",b=this.settingsGet("JsHash"),c=this.settingsGet("AllowGoogleSocial"),f=this.settingsGet("AllowFacebookSocial"),m=this.settingsGet("AllowTwitterSocial");!this.settingsGet("RemoteChangePassword")&&ra&&d.removeSettingsViewModel(ra);!this.settingsGet("AllowAdditionalAccounts")&&qa&&d.removeSettingsViewModel(qa);!c&&(!f&&!m&&La)&&d.removeSettingsViewModel(La);
!this.settingsGet("AllowThemes")&&ma&&d.removeSettingsViewModel(ma);d.initOnStartOrLangChange(function(){j.extend(!0,j.magnificPopup.defaults,{tClose:d.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:d.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:d.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:d.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:d.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:d.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:d.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this);h.SimplePace&&(h.SimplePace.set(70),
h.SimplePace.sleep());this.settingsGet("Auth")?(this.setTitle(d.i18n("TITLES/LOADING")),this.folders(!0,i.bind(function(a){o.hideLoading();if(a){o.startScreens([da,Na]);Ga.on("mousedown","#rl-center a",function(a){if(a&&3!==a.which){var a=null,b=j(this).attr("href");if(b&&"mailto:"===b.toString().toLowerCase().substr(0,7)){a=new G;a.parse(h.decodeURI(b.toString().substr(7)));if(a&&a.email){o.showScreenPopup(z,[g.ComposeType.Empty,null,[a]]);return false}}}return true});(c||f||m)&&e.socialUsers(true);
i.delay(function(){e.emailsPicsHashes();e.remote().servicesPics(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result)&&e.cache().setServicesData(b.Result)})},1E3);y.runHook("rl-start-user-screens")}else{o.startScreens([Ea]);y.runHook("rl-start-login-screens")}h.SimplePace&&h.SimplePace.set(100);n.bMobileDevice||i.defer(function(){d.initLayoutResizer("#rl-top-resizer-left","#rl-top-resizer-right","#rl-center",120,300,200,600,g.ClientSideKeyName.FolderListSize)})},this))):(a=d.pString(this.settingsGet("CustomLoginLink")))?
(o.routeOff(),o.setHash(e.link().root(),!0),o.routeOff(),i.defer(function(){h.location.href=a})):(o.hideLoading(),o.startScreens([Ea]),y.runHook("rl-start-login-screens"),h.SimplePace&&h.SimplePace.set(100));c&&(h["rl_"+b+"_google_service"]=function(){e.data().googleActions(true);e.socialUsers()});f&&(h["rl_"+b+"_facebook_service"]=function(){e.data().facebookActions(true);e.socialUsers()});m&&(h["rl_"+b+"_twitter_service"]=function(){e.data().twitterActions(true);e.socialUsers()});y.runHook("rl-start-screens")};
e=new B;U.addClass(n.bMobileDevice?"mobile":"no-mobile");Q.keydown(d.killCtrlAandS).keyup(d.killCtrlAandS);Q.unload(function(){n.bUnload=!0});h.rl=h.rl||{};h.rl.addHook=y.addHook;h.rl.settingsGet=y.mainSettingsGet;h.rl.remoteRequest=y.remoteRequest;h.rl.pluginSettingsGet=y.settingsGet;h.rl.addSettingsViewModel=d.addSettingsViewModel;h.rl.createCommand=d.createCommand;h.rl.EmailModel=G;h.rl.Enums=g;h.__RLBOOT=function(a){j(function(){h.rainloopTEMPLATES&&h.rainloopTEMPLATES[0]?(j("#rl-templates").html(h.rainloopTEMPLATES[0]),
h.setInterval(function(){n.minuteTick(!n.minuteTick())},6E4),h.setInterval(function(){n.fiveMinuteTick(!n.fiveMinuteTick())},3E5),i.delay(function(){h.rainloopAppData={};h.rainloopI18N={};h.rainloopTEMPLATES={};o.setBoot(e).bootstart()},50)):a(!1);h.__RLBOOT=null})};h.SimplePace&&h.SimplePace.add(10)})(window,jQuery,ko,crossroads,hasher,moment,Jua,_);