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