mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
9 lines
No EOL
246 KiB
JavaScript
9 lines
No EOL
246 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,i){"use strict";function j(){this.sBase="#/",this.sCdnStaticDomain=Mb.settingsGet("CdnStaticDomain"),this.sVersion=Mb.settingsGet("Version"),this.sSpecSuffix=Mb.settingsGet("AuthAccountHash")||"0",this.sServer=(Mb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function k(a,c,d,e){var f=this;f.editor=null,f.iBlurTimer=0,f.fOnBlur=c||null,f.fOnReady=d||null,f.fOnModeChange=e||null,f.$element=b(a),f.init()}function l(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();Ab.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),Ab.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1<Ab.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 m(){}function n(){}function o(){}function p(){var a=[n,m],b=h.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function q(){}function r(a,b){this.bDisabeCloseOnEsc=!1,this.sPosition=Ab.pString(a),this.sTemplate=Ab.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function s(a,b){this.sScreenName=a,this.aViewModels=Ab.isArray(b)?b:[]}function t(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null}function u(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function v(){this.idContact=0,this.idContactStr="",this.display="",this.properties=[],this.readOnly=!1,this.scopeType=yb.ContactScopeType.Default,this.checked=c.observable(!1),this.selected=c.observable(!1),this.deleted=c.observable(!1),this.shared=c.observable(!1)}function w(a,b,d,e){this.type=c.observable(Ab.isUnd(a)?yb.ContactPropertyType.Unknown:a),this.focused=c.observable(Ab.isUnd(d)?!1:!!d),this.value=c.observable(Ab.pString(b)),this.placeholder=c.observable(e||""),this.placeholderValue=c.computed(function(){var a=this.placeholder();return a?Ab.i18n(a):""},this)}function x(){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 y(a,b,d,e,f,g,h){this.id=a,this.isInline=Ab.isUnd(e)?!1:!!e,this.isLinked=Ab.isUnd(f)?!1:!!f,this.CID=Ab.isUnd(g)?"":g,this.contentLocation=Ab.isUnd(h)?"":h,this.fromMessage=!1,this.fileName=c.observable(b),this.size=c.observable(Ab.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?"":Ab.friendlySize(this.size())},this)}function z(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject=c.observable(""),this.size=c.observable(0),this.dateTimeStampInUTC=c.observable(0),this.priority=c.observable(yb.MessagePriority.Normal),this.fromEmailString=c.observable(""),this.toEmailsString=c.observable(""),this.senderEmailsString=c.observable(""),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.isReadReceipt=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-text"}return a},this),this.fullFormatDateValue=c.computed(function(){return z.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.fullFormatDateValue=c.computed(function(){return z.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.momentDate=Ab.createMomentDate(this),this.momentShortDate=Ab.createMomentShortDate(this),this.dateTimeStampInUTC.subscribe(function(a){var b=f().unix();this.moment(f.unix(a>b?b:a))},this),this.body=null,this.plainRaw="",this.isRtl=c.observable(!1),this.isHtml=c.observable(!1),this.hasImages=c.observable(!1),this.attachments=c.observableArray([]),this.isPgpSigned=c.observable(!1),this.isPgpEncrypted=c.observable(!1),this.pgpSignedVerifyStatus=c.observable(yb.SignedVerifyStatus.None),this.pgpSignedVerifyUser=c.observable(""),this.priority=c.observable(yb.MessagePriority.Normal),this.readReceipt=c.observable(""),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 A(){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.interval=0,this.type=c.observable(yb.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.privateMessageCountAll=c.observable(0),this.privateMessageCountUnread=c.observable(0),this.collapsedPrivate=c.observable(!0)}function B(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function C(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 D(a,b,d,e,f,g,h){this.index=a,this.id=d,this.guid=b,this.user=e,this.email=f,this.armor=h,this.isPrivate=!!g,this.deleteAccess=c.observable(!1)}function E(){r.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 Ab.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=Ab.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Mb.data().message(null),Mb.data().messageList([]),this.clearingProcess(!0),Mb.cache().setFolderHash(b.fullNameRaw,""),Mb.remote().folderClear(function(b,c){a.clearingProcess(!1),yb.StorageResultType.Success===b&&c&&c.Result?(Mb.reloadMessageList(!0),a.cancelCommand()):a.clearingError(c&&c.ErrorCode?Ab.getNotification(c.ErrorCode):Ab.getNotification(yb.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),t.constructorEnd(this)}function F(){r.call(this,"Popups","PopupsFolderCreate"),Ab.initOnStartOrLangChange(function(){this.sNoParentText=Ab.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(xb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Mb.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)}),Mb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=Ab.createCommand(this,function(){var a=Mb.data(),b=this.selectedParentValue();""===b&&1<a.namespace.length&&(b=a.namespace.substr(0,a.namespace.length-1)),a.foldersCreating(!0),Mb.remote().folderCreate(function(a,b){Mb.data().foldersCreating(!1),yb.StorageResultType.Success===a&&b&&b.Result?Mb.folders():Mb.data().foldersListError(b&&b.ErrorCode?Ab.getNotification(b.ErrorCode):Ab.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"))},this.folderName(),b),this.cancelCommand()},function(){return this.simpleFolderNameValidation(this.folderName())}),this.defautOptionsAfterRender=Ab.defautOptionsAfterRender,t.constructorEnd(this)}function G(){r.call(this,"Popups","PopupsFolderSystem"),Ab.initOnStartOrLangChange(function(){this.sChooseOnText=Ab.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE"),this.sUnuseText=Ab.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME")},this),this.notification=c.observable(""),this.folderSelectList=c.computed(function(){return Mb.folderListOptionsBuilder([],Mb.data().folderList(),Mb.data().folderListSystemNames(),[["",this.sChooseOnText],[xb.Values.UnuseOptionValue,this.sUnuseText]])},this);var a=Mb.data(),b=this,d=null,e=null;this.sentFolder=a.sentFolder,this.draftFolder=a.draftFolder,this.spamFolder=a.spamFolder,this.trashFolder=a.trashFolder,this.archiveFolder=a.archiveFolder,d=h.debounce(function(){Mb.settingsSet("SentFolder",b.sentFolder()),Mb.settingsSet("DraftFolder",b.draftFolder()),Mb.settingsSet("SpamFolder",b.spamFolder()),Mb.settingsSet("TrashFolder",b.trashFolder()),Mb.settingsSet("ArchiveFolder",b.archiveFolder()),Mb.remote().saveSystemFolders(Ab.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder(),ArchiveFolder:b.archiveFolder(),NullFolder:"NullFolder"})},1e3),e=function(){Mb.settingsSet("SentFolder",b.sentFolder()),Mb.settingsSet("DraftFolder",b.draftFolder()),Mb.settingsSet("SpamFolder",b.spamFolder()),Mb.settingsSet("TrashFolder",b.trashFolder()),Mb.settingsSet("ArchiveFolder",b.archiveFolder()),d()},this.sentFolder.subscribe(e),this.draftFolder.subscribe(e),this.spamFolder.subscribe(e),this.trashFolder.subscribe(e),this.archiveFolder.subscribe(e),this.defautOptionsAfterRender=Ab.defautOptionsAfterRender,t.constructorEnd(this)}function H(){r.call(this,"Popups","PopupsCompose"),this.oEditor=null,this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bAllowIdentities=Mb.settingsGet("AllowIdentities"),this.bAllowCtrlS=!!Mb.settingsGet("AllowCtrlSOnCompose");var b=this,d=Mb.data(),e=function(a){!1===b.showCcAndBcc()&&0<a.length&&b.showCcAndBcc(!0)};this.allowOpenPGP=d.allowOpenPGP,this.resizer=c.observable(!1).extend({throttle:50}),this.to=c.observable(""),this.to.focusTrigger=c.observable(!1),this.cc=c.observable(""),this.bcc=c.observable(""),this.replyTo=c.observable(""),this.subject=c.observable(""),this.isHtml=c.observable(!1),this.requestReadReceipt=c.observable(!1),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(e,this),this.bcc.subscribe(e,this),this.draftFolder=c.observable(""),this.draftUid=c.observable(""),this.sending=c.observable(!1),this.saving=c.observable(!1),this.attachments=c.observableArray([]),this.attachmentsInProcess=this.attachments.filter(function(a){return a&&""===a.tempName()}),this.attachmentsInReady=this.attachments.filter(function(a){return a&&""!==a.tempName()}),this.attachments.subscribe(function(){this.triggerForResize()},this),this.isDraftFolderMessage=c.computed(function(){return""!==this.draftFolder()&&""!==this.draftUid()},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.composeEditorArea=c.observable(null),this.identities=Mb.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!==Mb.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.editorResizeThrottle=h.throttle(h.bind(this.editorResize,this),100),this.resizer.subscribe(function(){this.editorResizeThrottle()},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=Ab.createCommand(this,function(){Mb.deleteMessagesFromFolderWithoutCheck(this.draftFolder(),[this.draftUid()]),Fb.hideScreenPopup(H)},function(){return this.isDraftFolderMessage()}),this.sendMessageResponse=h.bind(this.sendMessageResponse,this),this.saveMessageResponse=h.bind(this.saveMessageResponse,this),this.sendCommand=Ab.createCommand(this,function(){var a=Ab.trim(this.to()),b=Mb.data().sentFolder(),c=[];0===a.length?this.emptyToError(!0):(Mb.data().replySameFolder()&&Ab.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&Ab.isNormal(this.aDraftInfo[2])&&0<this.aDraftInfo[2].length&&(b=this.aDraftInfo[2]),""===b?Fb.showScreenPopup(G,[yb.SetSystemFoldersNotification.Sent]):(this.sendError(!1),this.sending(!0),Ab.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&(c=Mb.cache().getMessageFlagsFromCache(this.aDraftInfo[2],this.aDraftInfo[1]),c&&("forward"===this.aDraftInfo[0]?c[3]=!0:c[2]=!0,Mb.cache().setMessageFlagsToCache(this.aDraftInfo[2],this.aDraftInfo[1],c),Mb.reloadFlagsCurrentMessageListAndMessageFromCache(),Mb.cache().setFolderHash(this.aDraftInfo[2],""))),b=xb.Values.UnuseOptionValue===b?"":b,Mb.cache().setFolderHash(this.draftFolder(),""),Mb.cache().setFolderHash(b,""),Mb.remote().sendMessage(this.sendMessageResponse,this.draftFolder(),this.draftUid(),b,this.currentIdentityResultEmail(),a,this.cc(),this.bcc(),this.subject(),this.oEditor?this.oEditor.isHtml():!1,this.oEditor?this.oEditor.getData():"",this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences,this.requestReadReceipt())))},this.canBeSendedOrSaved),this.saveCommand=Ab.createCommand(this,function(){Mb.data().draftFolderNotEnabled()?Fb.showScreenPopup(G,[yb.SetSystemFoldersNotification.Draft]):(this.savedError(!1),this.saving(!0),Mb.cache().setFolderHash(Mb.data().draftFolder(),""),Mb.remote().saveMessage(this.saveMessageResponse,this.draftFolder(),this.draftUid(),Mb.data().draftFolder(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc(),this.subject(),this.oEditor?this.oEditor.isHtml():!1,this.oEditor?this.oEditor.getData():"",this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences))},this.canBeSendedOrSaved),Mb.sub("interval.1m",function(){!this.modalVisibility()||Mb.data().draftFolderNotEnabled()||this.isEmptyForm(!1)||this.saving()||this.sending()||this.savedError()||this.saveCommand()},this),this.showCcAndBcc.subscribe(function(){this.triggerForResize()},this),this.dropboxEnabled=c.observable(Mb.settingsGet("DropboxApiKey")?!0:!1),this.dropboxCommand=Ab.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.driveEnabled=c.observable(!1),this.driveCommand=Ab.createCommand(this,function(){return!0},function(){return this.driveEnabled()}),this.bDisabeCloseOnEsc=!0,t.constructorEnd(this)}function I(){r.call(this,"Popups","PopupsContacts");var a=this,b=yb.ContactPropertyType,d=[b.FirstName,b.LastName],e=[b.EmailPersonal,b.EmailBussines,b.EmailOther],f=[b.PhonePersonal,b.PhoneBussines,b.PhoneOther,b.MobilePersonal,b.MobileBussines,b.MobileOther,b.FaxPesonal,b.FaxBussines,b.FaxOther],g=[b.Facebook,b.Skype,b.GitHub],i=function(b){b&&0<b.length&&a.viewProperties.removeAll(b)};this.search=c.observable(""),this.contactsCount=c.observable(0),this.contacts=c.observableArray([]),this.contacts.loading=c.observable(!1).extend({throttle:200}),this.contacts.importing=c.observable(!1).extend({throttle:200}),this.currentContact=c.observable(null),this.importUploaderButton=c.observable(null),this.contactsSharingIsAllowed=!!Mb.settingsGet("ContactsSharingIsAllowed"),this.contactsPage=c.observable(1),this.contactsPageCount=c.computed(function(){var a=Math.ceil(this.contactsCount()/xb.Defaults.ContactsPerPage);return 0>=a?1:a},this),this.contactsPagenator=c.computed(Ab.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewIDStr=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewScopeType=c.observable(yb.ContactScopeType.Default),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(yb.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1<Ab.inArray(a.type(),d)}),this.viewPropertiesEmails=this.viewProperties.filter(function(a){return-1<Ab.inArray(a.type(),e)}),this.shareIcon=c.computed(function(){return yb.ContactScopeType.ShareAll===this.viewScopeType()?"icon-earth":"icon-share"},this),this.shareToNone=c.computed(function(){return yb.ContactScopeType.ShareAll!==this.viewScopeType()},this),this.shareToAll=c.computed(function(){return yb.ContactScopeType.ShareAll===this.viewScopeType()},this),this.viewHasNonEmptyRequaredProperties=c.computed(function(){var a=this.viewPropertiesNames(),b=this.viewPropertiesEmails(),c=function(a){return""!==Ab.trim(a.value())};return!(!h.find(a,c)&&!h.find(b,c))},this),this.viewPropertiesPhones=this.viewProperties.filter(function(a){return-1<Ab.inArray(a.type(),f)}),this.viewPropertiesOther=this.viewProperties.filter(function(a){return-1<Ab.inArray(a.type(),g)}),this.viewPropertiesEmailsNonEmpty=this.viewPropertiesNames.filter(function(a){return""!==Ab.trim(a.value())}),this.viewPropertiesEmailsEmptyAndOnFocused=this.viewPropertiesEmails.filter(function(a){var b=a.focused();return""===Ab.trim(a.value())&&!b}),this.viewPropertiesPhonesEmptyAndOnFocused=this.viewPropertiesPhones.filter(function(a){var b=a.focused();return""===Ab.trim(a.value())&&!b}),this.viewPropertiesEmailsEmptyAndOnFocused.subscribe(function(a){i(a)}),this.viewPropertiesPhonesEmptyAndOnFocused.subscribe(function(a){i(a)}),this.viewSaving=c.observable(!1),this.useCheckboxesInList=Mb.data().useCheckboxesInList,this.search.subscribe(function(){this.reloadContactList()},this),this.contacts.subscribe(function(){Ab.windowResize()},this),this.viewProperties.subscribe(function(){Ab.windowResize()},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.selector=new l(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=Ab.createCommand(this,function(){this.populateViewContact(null),this.currentContact(null)}),this.deleteCommand=Ab.createCommand(this,function(){this.deleteSelectedContacts(),this.emptySelection(!0)},function(){return 0<this.contactsCheckedOrSelected().length}),this.newMessageCommand=Ab.createCommand(this,function(){var a=this.contactsCheckedOrSelected(),b=[];Ab.isNonEmptyArray(a)&&(b=h.map(a,function(a){if(a){var b=a.getNameAndEmailHelper(),c=b?new u(b[0],b[1]):null;if(c&&c.validate())return c}return null}),b=h.compact(b)),Ab.isNonEmptyArray(b)&&(Fb.hideScreenPopup(I),Fb.showScreenPopup(H,[yb.ComposeType.Empty,null,b]))},function(){return 0<this.contactsCheckedOrSelected().length}),this.clearCommand=Ab.createCommand(this,function(){this.search("")}),this.saveCommand=Ab.createCommand(this,function(){this.viewSaving(!0),this.viewSaveTrigger(yb.SaveSettingsStep.Animate);var b=Ab.fakeMd5(),c=[];h.each(this.viewProperties(),function(a){a.type()&&""!==Ab.trim(a.value())&&c.push([a.type(),a.value()])}),Mb.remote().contactSave(function(c,d){var e=!1;a.viewSaving(!1),yb.StorageResultType.Success===c&&d&&d.Result&&d.Result.RequestUid===b&&0<Ab.pInt(d.Result.ResultID)&&(""===a.viewID()&&a.viewID(Ab.pInt(d.Result.ResultID)),""===a.viewIDStr()&&a.viewIDStr(Ab.pString(d.Result.ResultIDStr)),a.reloadContactList(),e=!0),h.delay(function(){a.viewSaveTrigger(e?yb.SaveSettingsStep.TrueResult:yb.SaveSettingsStep.FalseResult)},300),e&&(a.watchDirty(!1),h.delay(function(){a.viewSaveTrigger(yb.SaveSettingsStep.Idle)},1e3))},b,this.viewID(),this.viewIDStr(),this.viewScopeType(),c)},function(){var a=this.viewHasNonEmptyRequaredProperties(),b=this.viewReadOnly();return!this.viewSaving()&&a&&!b}),this.bDropPageAfterDelete=!1,this.watchDirty=c.observable(!1),this.watchHash=c.observable(!1),this.viewHash=c.computed(function(){return""+a.viewScopeType()+" - "+h.map(a.viewProperties(),function(a){return a.value()}).join("")}),this.viewHash.subscribe(function(){!this.watchHash()||this.viewReadOnly()||this.watchDirty()||this.watchDirty(!0)},this),t.constructorEnd(this)}function J(){r.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.starred=c.observable(!1),this.unseen=c.observable(!1),this.searchCommand=Ab.createCommand(this,function(){var a=this.buildSearchString();""!==a&&Mb.data().mainMessageListSearch(a),this.cancelCommand()}),t.constructorEnd(this)}function K(){r.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=Ab.createCommand(this,function(){return this.emailError(""===Ab.trim(this.email())),this.passwordError(""===Ab.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),Mb.remote().accountAdd(h.bind(function(a,b){this.submitRequest(!1),yb.StorageResultType.Success===a&&b&&"AccountAdd"===b.Action?b.Result?(Mb.accountsAndIdentities(),this.cancelCommand()):b.ErrorCode&&this.submitError(Ab.getNotification(b.ErrorCode)):this.submitError(Ab.getNotification(yb.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),t.constructorEnd(this)}function L(){r.call(this,"Popups","PopupsAddOpenPgpKey"),this.key=c.observable(""),this.key.error=c.observable(!1),this.key.focus=c.observable(!1),this.key.subscribe(function(){this.key.error(!1)},this),this.addOpenPgpKeyCommand=Ab.createCommand(this,function(){var a=Ab.trim(this.key()),b=Mb.data().openpgpKeyring;return this.key.error(""===a),!b||this.key.error()?!1:(b.importKey(a),b.store(),Mb.reloadOpenPgpKeys(),Ab.delegateRun(this,"cancelCommand"),!0)}),t.constructorEnd(this)}function M(){r.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=c.observable(""),this.keyDom=c.observable(null),t.constructorEnd(this)}function N(){r.call(this,"Popups","PopupsGenerateNewOpenPgpKey"),this.email=c.observable(""),this.email.focus=c.observable(""),this.email.error=c.observable(!1),this.name=c.observable(""),this.password=c.observable(""),this.keyBitLength=c.observable(2048),this.submitRequest=c.observable(!1),this.email.subscribe(function(){this.email.error(!1)},this),this.generateOpenPgpKeyCommand=Ab.createCommand(this,function(){var b=this,c="",d=null,e=Mb.data().openpgpKeyring;return this.email.error(""===Ab.trim(this.email())),!e||this.email.error()?!1:(c=this.email(),""!==this.name()&&(c=this.name()+" <"+c+">"),this.submitRequest(!0),h.delay(function(){d=a.openpgp.generateKeyPair(1,Ab.pInt(b.keyBitLength()),c,Ab.trim(b.password())),d&&d.privateKeyArmored&&(e.importKey(d.privateKeyArmored),e.importKey(d.publicKeyArmored),e.store(),Mb.reloadOpenPgpKeys(),Ab.delegateRun(b,"cancelCommand")),b.submitRequest(!1)},100),!0)}),t.constructorEnd(this)}function O(){r.call(this,"Popups","PopupsComposeOpenPgp"),this.notification=c.observable(""),this.sign=c.observable(!0),this.encrypt=c.observable(!0),this.password=c.observable(""),this.password.focus=c.observable(!0),this.from=c.observable(""),this.to=c.observableArray([]),this.text=c.observable(""),this.resultCallback=null,this.submitRequest=c.observable(!1),this.doCommand=Ab.createCommand(this,function(){var b=this,c=!0,d=Mb.data(),e=null,f=[];this.submitRequest(!0),c&&this.sign()&&""===this.from()&&(this.notification("Please specify FROM email address"),c=!1),c&&this.sign()&&(e=d.findPrivateKeyByEmail(this.from(),this.password()),e||(this.notification('No private key found for "'+this.from()+'" email'),c=!1)),c&&this.encrypt()&&0===this.to().length&&(this.notification("Please specify at least one recipient"),c=!1),c&&this.encrypt()&&(f=[],h.each(this.to(),function(a){var e=d.findPublicKeysByEmail(a);0===e.length&&c&&(b.notification('No public key found for "'+a+'" email'),c=!1),f=f.concat(e)}),!c||0!==f.length&&this.to().length===f.length||(c=!1)),h.delay(function(){if(b.resultCallback&&c)try{e&&0===f.length?b.resultCallback(a.openpgp.signClearMessage([e],b.text())):e&&0<f.length?b.resultCallback(a.openpgp.signAndEncryptMessage(f,e,b.text())):!e&&0<f.length&&b.resultCallback(a.openpgp.encryptMessage(f,b.text()))}catch(d){b.notification("OpenPGP error: "+d),c=!1}c&&b.cancelCommand(),b.submitRequest(!1)},10)},function(){return!this.submitRequest()&&(this.sign()||this.encrypt())}),t.constructorEnd(this)}function P(){r.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=Ab.createCommand(this,function(){return this.email.hasError()||this.email.hasError(""===Ab.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),Mb.remote().identityUpdate(h.bind(function(a,b){this.submitRequest(!1),yb.StorageResultType.Success===a&&b?b.Result?(Mb.accountsAndIdentities(),this.cancelCommand()):b.ErrorCode&&this.submitError(Ab.getNotification(b.ErrorCode)):this.submitError(Ab.getNotification(yb.Notification.UnknownError))},this),this.id,this.email(),this.name(),this.replyTo(),this.bcc()),!0)},function(){return!this.submitRequest()}),this.label=c.computed(function(){return Ab.i18n("POPUPS_IDENTITIES/"+(this.edit()?"TITLE_UPDATE_IDENTITY":"TITLE_ADD_IDENTITY"))},this),this.button=c.computed(function(){return Ab.i18n("POPUPS_IDENTITIES/"+(this.edit()?"BUTTON_UPDATE_IDENTITY":"BUTTON_ADD_IDENTITY"))},this),t.constructorEnd(this)}function Q(){r.call(this,"Popups","PopupsLanguages"),this.exp=c.observable(!1),this.languages=c.computed(function(){return h.map(Mb.data().languages(),function(a){return{key:a,selected:c.observable(!1),fullName:Ab.convertLangName(a)}})}),Mb.data().mainLanguage.subscribe(function(){this.resetMainLanguage()},this),t.constructorEnd(this)}function R(){r.call(this,"Popups","PopupsTwoFactorTest");var a=this;this.code=c.observable(""),this.code.focused=c.observable(!1),this.code.status=c.observable(null),this.testing=c.observable(!1),this.testCode=Ab.createCommand(this,function(){this.testing(!0),Mb.remote().testTwoFactor(function(b,c){a.testing(!1),a.code.status(yb.StorageResultType.Success===b&&c&&c.Result?!0:!1)},this.code())},function(){return""!==this.code()&&!this.testing()}),t.constructorEnd(this)}function S(){r.call(this,"Popups","PopupsAsk"),this.askDesc=c.observable(""),this.yesButton=c.observable(""),this.noButton=c.observable(""),this.yesFocus=c.observable(!1),this.noFocus=c.observable(!1),this.fYesAction=null,this.fNoAction=null,this.bDisabeCloseOnEsc=!0,t.constructorEnd(this)}function T(){r.call(this,"Center","Login");var b=Mb.data();this.email=c.observable(""),this.login=c.observable(""),this.password=c.observable(""),this.signMe=c.observable(!1),this.additionalCode=c.observable(""),this.additionalCode.error=c.observable(!1),this.additionalCode.focused=c.observable(!1),this.additionalCode.visibility=c.observable(!1),this.logoImg=Ab.trim(Mb.settingsGet("LoginLogo")),this.loginDescription=Ab.trim(Mb.settingsGet("LoginDescription")),this.logoCss=Ab.trim(Mb.settingsGet("LoginCss")),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.additionalCode(""),this.additionalCode.visibility(!1)
|
||
},this),this.login.subscribe(function(){this.loginError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.additionalCode.subscribe(function(){this.additionalCode.error(!1)},this),this.additionalCode.visibility.subscribe(function(){this.additionalCode.error(!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 Ab.convertLangName(this.mainLanguage())},this),this.signMeType=c.observable(yb.LoginSignMeType.Unused),this.signMeType.subscribe(function(a){this.signMe(yb.LoginSignMeType.DefaultOn===a)},this),this.signMeVisibility=c.computed(function(){return yb.LoginSignMeType.Unused!==this.signMeType()},this),this.submitCommand=Ab.createCommand(this,function(){return this.emailError(""===Ab.trim(this.email())),this.passwordError(""===Ab.trim(this.password())),this.additionalCode.visibility()&&this.additionalCode.error(""===Ab.trim(this.additionalCode())),this.emailError()||this.passwordError()||this.additionalCode.error()?!1:(this.submitRequest(!0),Mb.remote().login(h.bind(function(a,b){yb.StorageResultType.Success===a&&b&&"Login"===b.Action?b.Result?b.TwoFactorAuth?(this.additionalCode(""),this.additionalCode.visibility(!0),this.additionalCode.focused(!0),this.submitRequest(!1)):Mb.loginAndLogoutReload():b.ErrorCode?(this.submitRequest(!1),this.submitError(Ab.getNotification(b.ErrorCode)),""===this.submitError()&&this.submitError(Ab.getNotification(yb.Notification.UnknownError))):this.submitRequest(!1):(this.submitRequest(!1),this.submitError(Ab.getNotification(yb.Notification.UnknownError)))},this),this.email(),this.login(),this.password(),!!this.signMe(),this.bSendLanguage?this.mainLanguage():"",this.additionalCode.visibility()?this.additionalCode():""),!0)},function(){return!this.submitRequest()}),this.facebookLoginEnabled=c.observable(!1),this.facebookCommand=Ab.createCommand(this,function(){return a.open(Mb.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=Ab.createCommand(this,function(){return a.open(Mb.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=Ab.createCommand(this,function(){return a.open(Mb.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),t.constructorEnd(this)}function U(){r.call(this,"Right","SystemDropDown");var a=Mb.data();this.accounts=a.accounts,this.accountEmail=a.accountEmail,this.accountsLoading=a.accountsLoading,this.allowAddAccount=Mb.settingsGet("AllowAdditionalAccounts"),this.loading=c.computed(function(){return this.accountsLoading()},this),this.accountClick=h.bind(this.accountClick,this)}function V(){U.call(this),t.constructorEnd(this)}function W(){U.call(this),t.constructorEnd(this)}function X(){r.call(this,"Left","MailFolderList"),this.folderList=Mb.data().folderList,this.folderListSystem=Mb.data().folderListSystem,this.foldersChanging=Mb.data().foldersChanging,this.iDropOverTimer=0,this.allowContacts=!!Mb.settingsGet("ContactsIsAllowed"),t.constructorEnd(this)}function Y(){r.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="";var a=Mb.data();this.popupVisibility=Mb.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,Ab.initOnStartOrLangChange(function(){this.emptySubjectValue=Ab.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 yb.Layout.NoPreview!==a.layout()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=c.computed(function(){var b=a.messageListEndSearch();return""===b?"":Ab.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:b})}),this.messageListPagenator=c.computed(Ab.computedPagenatorHelper(a.messageListPage,a.messageListPageCount)),this.checkAll=c.computed({read:function(){return 0<Mb.data().messageListCheckedOrSelected().length},write:function(a){a=!!a,h.each(Mb.data().messageList(),function(b){b.checked(a)}),a||Mb.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=Mb.data().messageList().length,b=Mb.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 a.spamFolder()===this.messageListEndFolder()&&""!==a.spamFolder()},this),this.isSpamDisabled=c.computed(function(){return xb.Values.UnuseOptionValue===a.spamFolder()},this),this.isTrashFolder=c.computed(function(){return a.trashFolder()===this.messageListEndFolder()&&""!==a.trashFolder()},this),this.isArchiveFolder=c.computed(function(){return a.archiveFolder()===this.messageListEndFolder()&&""!==a.archiveFolder()},this),this.isArchiveDisabled=c.computed(function(){return xb.Values.UnuseOptionValue===Mb.data().archiveFolder()},this),this.canBeMoved=this.hasCheckedOrSelectedLines,this.clearCommand=Ab.createCommand(this,function(){Fb.showScreenPopup(E,[Mb.data().currentFolder()])}),this.multyForwardCommand=Ab.createCommand(this,function(){Fb.showScreenPopup(H,[yb.ComposeType.ForwardAsAttachment,Mb.data().messageListCheckedOrSelected()])},this.canBeMoved),this.deleteWithoutMoveCommand=Ab.createCommand(this,function(){Mb.deleteMessagesFromFolder(yb.FolderType.Trash,Mb.data().currentFolderFullNameRaw(),Mb.data().messageListCheckedOrSelectedUidsWithSubMails(),!1)},this.canBeMoved),this.deleteCommand=Ab.createCommand(this,function(){Mb.deleteMessagesFromFolder(yb.FolderType.Trash,Mb.data().currentFolderFullNameRaw(),Mb.data().messageListCheckedOrSelectedUidsWithSubMails(),!0)},this.canBeMoved),this.archiveCommand=Ab.createCommand(this,function(){Mb.deleteMessagesFromFolder(yb.FolderType.Archive,Mb.data().currentFolderFullNameRaw(),Mb.data().messageListCheckedOrSelectedUidsWithSubMails(),!0)},this.canBeMoved),this.spamCommand=Ab.createCommand(this,function(){Mb.deleteMessagesFromFolder(yb.FolderType.Spam,Mb.data().currentFolderFullNameRaw(),Mb.data().messageListCheckedOrSelectedUidsWithSubMails(),!0)},this.canBeMoved),this.moveCommand=Ab.createCommand(this,Ab.emptyFunction,this.canBeMoved),this.setCommand=Ab.createCommand(this,Ab.emptyFunction,this.hasCheckedLines),this.checkCommand=Ab.createCommand(this,Ab.emptyFunction,this.hasCheckedLines),this.reloadCommand=Ab.createCommand(this,function(){Mb.data().messageListCompleteLoadingThrottle()||Mb.reloadMessageList(!1,!0)}),this.quotaTooltip=h.bind(this.quotaTooltip,this),this.selector=new l(this.messageList,this.currentMessage,".messageListItem .actionHandle",".messageListItem.selected",".messageListItem .checkboxMessage"),this.selector.on("onItemSelect",h.bind(function(b){b?(yb.Layout.NoPreview===a.layout()&&Fb.setHash(Mb.link().messagePreview(),!0),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<Mb.data().messageListCheckedOrSelected().length&&this.deleteCommand()},this)),Mb.sub("mailbox.message-list.selector.go-down",function(){this.selector.goDown()},this).sub("mailbox.message-list.selector.go-up",function(){this.selector.goUp()},this),t.constructorEnd(this)}function Z(){r.call(this,"Right","MailMessageView");var a="",b=Mb.data(),d=this,e=function(a){return Ab.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.layout=b.layout,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=Ab.createCommand(this,function(){yb.Layout.NoPreview===b.layout()?Mb.historyBack():b.message(null)}),this.replyCommand=e(yb.ComposeType.Reply),this.replyAllCommand=e(yb.ComposeType.ReplyAll),this.forwardCommand=e(yb.ComposeType.Forward),this.forwardAsAttachmentCommand=e(yb.ComposeType.ForwardAsAttachment),this.editAsNewCommand=e(yb.ComposeType.EditAsNew),this.messageVisibilityCommand=Ab.createCommand(this,Ab.emptyFunction,this.messageVisibility),this.messageEditCommand=Ab.createCommand(this,function(){this.editMessage()},this.messageVisibility),this.deleteCommand=Ab.createCommand(this,function(){this.message()&&Mb.deleteMessagesFromFolder(yb.FolderType.Trash,this.message().folderFullNameRaw,[this.message().uid],!0)},this.messageVisibility),this.archiveCommand=Ab.createCommand(this,function(){this.message()&&Mb.deleteMessagesFromFolder(yb.FolderType.Archive,this.message().folderFullNameRaw,[this.message().uid],!0)},this.messageVisibility),this.spamCommand=Ab.createCommand(this,function(){this.message()&&Mb.deleteMessagesFromFolder(yb.FolderType.Spam,this.message().folderFullNameRaw,[this.message().uid],!0)},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.viewViewLink=c.observable(""),this.viewDownloadLink=c.observable(""),this.viewUserPic=c.observable(xb.DataImages.UserDotPic),this.viewUserPicVisible=c.observable(!1),this.viewPgpPassword=c.observable(""),this.viewPgpSignedVerifyStatus=c.computed(function(){return this.message()?this.message().pgpSignedVerifyStatus():yb.SignedVerifyStatus.None},this),this.viewPgpSignedVerifyUser=c.computed(function(){return this.message()?this.message().pgpSignedVerifyUser():""},this),this.message.subscribe(function(b){this.messageActiveDom(null),this.viewPgpPassword(""),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.viewViewLink(b.viewLink()),this.viewDownloadLink(b.downloadLink()),a=Mb.cache().getUserPic(b.fromAsSingleEmail()),a!==this.viewUserPic()&&(this.viewUserPicVisible(!1),this.viewUserPic(xb.DataImages.UserDotPic),""!==a&&(this.viewUserPicVisible(!0),this.viewUserPic(a))))},this),this.fullScreenMode.subscribe(function(a){a?Ib.addClass("rl-message-fullscreen"):Ib.removeClass("rl-message-fullscreen"),Ab.windowResize()}),this.messageLoadingThrottle.subscribe(function(a){a&&Ab.windowResize()}),this.messageActiveDom.subscribe(function(){this.scrollMessageToTop()},this),this.goUpCommand=Ab.createCommand(this,function(){Mb.pub("mailbox.message-list.selector.go-up")}),this.goDownCommand=Ab.createCommand(this,function(){Mb.pub("mailbox.message-list.selector.go-down")}),t.constructorEnd(this)}function $(a){r.call(this,"Left","SettingsMenu"),this.menu=a.menu,t.constructorEnd(this)}function _(){r.call(this,"Right","SettingsPane"),t.constructorEnd(this)}function ab(){var a=Mb.data();this.mainLanguage=a.mainLanguage,this.mainMessagesPerPage=a.mainMessagesPerPage,this.mainMessagesPerPageArray=xb.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.layout=a.layout,this.usePreviewPane=a.usePreviewPane,this.useCheckboxesInList=a.useCheckboxesInList,this.allowLanguagesOnSettings=a.allowLanguagesOnSettings,this.isDesktopNotificationsSupported=c.computed(function(){return yb.DesktopNotifications.NotSupported!==a.desktopNotificationsPermisions()}),this.isDesktopNotificationsDenied=c.computed(function(){return yb.DesktopNotifications.NotSupported===a.desktopNotificationsPermisions()||yb.DesktopNotifications.Denied===a.desktopNotificationsPermisions()}),this.mainLanguageFullName=c.computed(function(){return Ab.convertLangName(this.mainLanguage())},this),this.languageTrigger=c.observable(yb.SaveSettingsStep.Idle).extend({throttle:100}),this.mppTrigger=c.observable(yb.SaveSettingsStep.Idle),this.isAnimationSupported=Db.bAnimationSupported}function bb(){var a=Mb.data();this.contactsAutosave=a.contactsAutosave,this.showPassword=c.observable(!1),this.allowContactsSync=!!Mb.settingsGet("ContactsSyncIsAllowed"),this.contactsSyncServer=Mb.settingsGet("ContactsSyncServer"),this.contactsSyncUser=Mb.settingsGet("ContactsSyncUser"),this.contactsSyncPass=Mb.settingsGet("ContactsSyncPassword"),this.contactsSyncPabUrl=Mb.settingsGet("ContactsSyncPabUrl")}function cb(){var a=Mb.data();this.accounts=a.accounts,this.processText=c.computed(function(){return a.accountsLoading()?Ab.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 db(){var a=Mb.data();this.editor=null,this.displayName=a.displayName,this.signature=a.signature,this.signatureToAll=a.signatureToAll,this.replyTo=a.replyTo,this.signatureDom=c.observable(null),this.displayNameTrigger=c.observable(yb.SaveSettingsStep.Idle),this.replyTrigger=c.observable(yb.SaveSettingsStep.Idle),this.signatureTrigger=c.observable(yb.SaveSettingsStep.Idle)}function eb(){var a=Mb.data();this.editor=null,this.displayName=a.displayName,this.signature=a.signature,this.signatureToAll=a.signatureToAll,this.replyTo=a.replyTo,this.signatureDom=c.observable(null),this.displayNameTrigger=c.observable(yb.SaveSettingsStep.Idle),this.replyTrigger=c.observable(yb.SaveSettingsStep.Idle),this.signatureTrigger=c.observable(yb.SaveSettingsStep.Idle),this.identities=a.identities,this.processText=c.computed(function(){return a.identitiesLoading()?Ab.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 fb(){this.processing=c.observable(!1),this.clearing=c.observable(!1),this.viewUser=c.observable(""),this.viewEnable=c.observable(!1),this.viewEnable.subs=!0,this.twoFactorStatus=c.observable(!1),this.viewSecret=c.observable(""),this.viewBackupCodes=c.observable(""),this.viewUrl=c.observable(""),this.bFirst=!0,this.viewTwoFactorStatus=c.computed(function(){return Db.langChangeTrigger(),Ab.i18n(this.twoFactorStatus()?"SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC":"SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC")},this),this.onResult=h.bind(this.onResult,this)}function gb(){var a=Mb.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=Ab.createCommand(this,function(){this.googleLoggined()||Mb.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=Ab.createCommand(this,function(){Mb.googleDisconnect()}),this.connectFacebook=Ab.createCommand(this,function(){this.facebookLoggined()||Mb.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=Ab.createCommand(this,function(){Mb.facebookDisconnect()}),this.connectTwitter=Ab.createCommand(this,function(){this.twitterLoggined()||Mb.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=Ab.createCommand(this,function(){Mb.twitterDisconnect()})}function hb(){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=Ab.createCommand(this,function(){this.changeProcess(!0),this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),Mb.remote().changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword())},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()}),this.onChangePasswordResponse=h.bind(this.onChangePasswordResponse,this)}function ib(){var a=Mb.data();this.foldersListError=a.foldersListError,this.folderList=a.folderList,this.processText=c.computed(function(){var a=Mb.data(),b=a.foldersLoading(),c=a.foldersCreating(),d=a.foldersDeleting(),e=a.foldersRenaming();return c?Ab.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):d?Ab.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):e?Ab.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):b?Ab.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=!!Mb.settingsGet("UseImapSubscribe")}function jb(){var d=this,e=Mb.data();this.mainTheme=e.mainTheme,this.customThemeType=c.observable(Mb.settingsGet("CustomThemeType")),this.customThemeImg=c.observable(Mb.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(){Ab.windowResize()}),this.themeTrigger=c.observable(yb.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,Mb.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(yb.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=b.ajax({url:g,dataType:"json"}).done(function(a){a&&Ab.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]),f&&f[0]&&f[0].styleSheet&&!Ab.isUnd(f[0].styleSheet.cssText)?f[0].styleSheet.cssText=a[1]:f.text(a[1])),d.themeTrigger(yb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(yb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Mb.remote().saveSettings(null,{Theme:c})},this)}function kb(){this.openpgpkeys=Mb.data().openpgpkeys,this.openpgpkeysPublic=Mb.data().openpgpkeysPublic,this.openpgpkeysPrivate=Mb.data().openpgpkeysPrivate,this.openPgpKeyForDeletion=c.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]})}function lb(){Ab.initDataConstructorBySettings(this)}function mb(){lb.call(this);var a=function(a){return function(){var b=Mb.cache().getFolderFromCacheList(a());b&&b.type(yb.FolderType.User)}},d=function(a){return function(b){var c=Mb.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.archiveFolder=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.archiveFolder.subscribe(a(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(d(yb.FolderType.SentItems),this),this.draftFolder.subscribe(d(yb.FolderType.Draft),this),this.spamFolder.subscribe(d(yb.FolderType.Spam),this),this.trashFolder.subscribe(d(yb.FolderType.Trash),this),this.archiveFolder.subscribe(d(yb.FolderType.Archive),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||xb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),this.enableTwoFactor=c.observable(!1),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.foldersChanging=c.computed(function(){var a=this.foldersLoading(),b=this.foldersCreating(),c=this.foldersDeleting(),d=this.foldersRenaming();return a||b||c||d},this),this.foldersInboxUnreadCount=c.observable(0),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(),g=this.archiveFolder();return Ab.isArray(b)&&0<b.length&&(""!==c&&xb.Values.UnuseOptionValue!==c&&a.push(c),""!==d&&xb.Values.UnuseOptionValue!==d&&a.push(d),""!==e&&xb.Values.UnuseOptionValue!==e&&a.push(e),""!==f&&xb.Values.UnuseOptionValue!==f&&a.push(f),""!==g&&xb.Values.UnuseOptionValue!==g&&a.push(g)),a},this),this.folderListSystem=c.computed(function(){return h.compact(h.map(this.folderListSystemNames(),function(a){return Mb.cache().getFolderFromCacheList(a)}))},this),this.folderMenuForMove=c.computed(function(){return Mb.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){Fb.setHash(Mb.link().mailBox(this.currentFolderFullNameHash(),1,Ab.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 z,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.allowOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=c.computed(function(){return h.filter(this.openpgpkeys(),function(a){return!(!a||a.isPrivate)})},this),this.openpgpkeysPrivate=c.computed(function(){return h.filter(this.openpgpkeys(),function(a){return!(!a||!a.isPrivate)})},this),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(yb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function nb(){this.oRequests={}}function ob(){nb.call(this),this.oRequests={}}function pb(){this.oEmailsPicsHashes={},this.oServices={}}function qb(){pb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function rb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function sb(){s.call(this,"login",[T])}function tb(){s.call(this,"mailbox",[V,X,Y,Z]),this.oLastRoute={}}function ub(){rb.call(this,[W,$,_]),Ab.initOnStartOrLangChange(function(){this.sSettingsTitle=Ab.i18n("TITLES/SETTINGS")},this,function(){Mb.setTitle(this.sSettingsTitle)})}function vb(){q.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=c.observableArray([]),this.popupVisibility=c.computed(function(){return 0<this.popupVisibilityNames().length},this),this.iframe=b('<iframe style="display:none" src="javascript:;" />').appendTo("body"),Jb.on("error",function(a){Mb&&a&&a.originalEvent&&a.originalEvent.message&&-1===Ab.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Mb.remote().jsError(Ab.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Ib.attr("class"),Ab.microtime()-Db.now)})}function wb(){vb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),a.setInterval(function(){Mb.pub("interval.30s")
|
||
},3e4),a.setInterval(function(){Mb.pub("interval.1m")},6e4),a.setInterval(function(){Mb.pub("interval.2m")},12e4),a.setInterval(function(){Mb.pub("interval.3m")},18e4),a.setInterval(function(){Mb.pub("interval.5m")},3e5),a.setInterval(function(){Mb.pub("interval.10m")},6e5),b.wakeUp(function(){Mb.remote().jsVersion(function(b,c){yb.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Mb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Mb.settingsGet("Version"))},{},36e5)}var xb={},yb={},zb={},Ab={},Bb={},Cb={},Db={},Eb={settings:[],"settings-removed":[],"settings-disabled":[]},Fb=null,Gb=a.rainloopAppData||{},Hb=a.rainloopI18N||{},Ib=b("html"),Jb=b(a),Kb=b(a.document),Lb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Mb=null,Nb=b("<div></div>");Db.now=(new Date).getTime(),Db.momentTrigger=c.observable(!0),Db.langChangeTrigger=c.observable(!0),Db.iAjaxErrorCount=0,Db.iTokenErrorCount=0,Db.iMessageBodyCacheCount=0,Db.bUnload=!1,Db.sUserAgent=(navigator.userAgent||"").toLowerCase(),Db.bIsiOSDevice=-1<Db.sUserAgent.indexOf("iphone")||-1<Db.sUserAgent.indexOf("ipod")||-1<Db.sUserAgent.indexOf("ipad"),Db.bIsAndroidDevice=-1<Db.sUserAgent.indexOf("android"),Db.bMobileDevice=Db.bIsiOSDevice||Db.bIsAndroidDevice,Db.bDisableNanoScroll=Db.bMobileDevice,Db.bAllowPdfPreview=!Db.bMobileDevice,Db.bAnimationSupported=!Db.bMobileDevice&&Ib.hasClass("csstransitions"),Db.sAnimationType="",Db.oHtmlEditorDefaultConfig={title:!1,stylesSet:!1,customConfig:"",contentsCss:"",toolbarGroups:[{name:"spec"},{name:"styles"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"colors"},{name:"paragraph",groups:["list","indent","blocks","align"]},{name:"links"},{name:"insert"},{name:"others"}],removePlugins:"contextmenu",removeButtons:"Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll",removeDialogTabs:"link:advanced;link:target;image:advanced",extraPlugins:"plain",allowedContent:!0,autoParagraph:!1,enterMode:a.CKEDITOR.ENTER_BR,shiftEnterMode:a.CKEDITOR.ENTER_BR,font_defaultLabel:"Arial",fontSize_defaultLabel:"13",fontSize_sizes:"10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px"},Db.oHtmlEditorLangsMap={de:"de",es:"es",fr:"fr",hu:"hu",is:"is",it:"it",ko:"ko","ko-kr":"ko",lv:"lv",nl:"nl",no:"no",pl:"pl",pt:"pt","pt-pt":"pt","pt-br":"pt-br",ru:"ru",ro:"ro",zh:"zh","zh-cn":"zh-cn"},Db.bAllowPdfPreview&&navigator&&navigator.mimeTypes&&(Db.bAllowPdfPreview=!!h.find(navigator.mimeTypes,function(a){return a&&"application/pdf"===a.type})),xb.Defaults={},xb.Values={},xb.DataImages={},xb.Defaults.MessagesPerPage=20,xb.Defaults.ContactsPerPage=20,xb.Defaults.MessagesPerPageArray=[10,20,30,50,100],xb.Defaults.DefaultAjaxTimeout=2e4,xb.Defaults.SearchAjaxTimeout=12e4,xb.Defaults.SendMessageAjaxTimeout=2e5,xb.Defaults.SaveMessageAjaxTimeout=2e5,xb.Values.UnuseOptionValue="__UNUSE__",xb.Values.GmailFolderName="[Gmail]",xb.Values.ClientSideCookieIndexName="rlcsc",xb.Values.ImapDefaulPort=143,xb.Values.ImapDefaulSecurePort=993,xb.Values.SmtpDefaulPort=25,xb.Values.SmtpDefaulSecurePort=465,xb.Values.MessageBodyCacheLimit=15,xb.Values.AjaxErrorLimit=7,xb.Values.TokenErrorLimit=10,xb.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",xb.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",yb.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},yb.State={Empty:10,Login:20,Auth:30},yb.StateType={Webmail:0,Admin:1},yb.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,Archive:15,User:99},yb.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},yb.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},yb.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},yb.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},yb.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4,Archive:5},yb.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},yb.EventKeyCode={Backspace:8,Tab:9,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},yb.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},yb.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},yb.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},yb.MessagePriority={Low:5,Normal:3,High:1},yb.EditorDefaultType={Html:"Html",Plain:"Plain"},yb.CustomThemeType={Light:"Light",Dark:"Dark"},yb.ServerSecure={None:0,SSL:1,TLS:2},yb.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},yb.EmailType={Defailt:0,Facebook:1,Google:2},yb.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},yb.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},yb.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},yb.ContactScopeType={Default:0,ShareAll:2},yb.SignedVerifyStatus={UnknownPublicKeys:-4,UnknownPrivateKey:-3,Unverified:-2,Error:-1,None:0,Success:1},yb.ContactPropertyType={Unknown:0,FullName:10,FirstName:15,LastName:16,MiddleName:16,Nick:18,NamePrefix:20,NameSuffix:21,EmailPersonal:30,EmailBussines:31,PhonePersonal:50,PhoneBussines:51,MobilePersonal:60,MobileBussines:61,FaxPesonal:70,FaxBussines:71,Facebook:90,Skype:91,GitHub:92,Note:110,Custom:250},yb.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,AccountTwoFactorAuthRequired:120,AccountTwoFactorAuthError:121,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,CantCopyMessage:205,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,ClientViewError:902,UnknownNotification:999,UnknownError:999},Ab.trim=b.trim,Ab.inArray=b.inArray,Ab.isArray=h.isArray,Ab.isFunc=h.isFunction,Ab.isUnd=h.isUndefined,Ab.isNull=h.isNull,Ab.emptyFunction=function(){},Ab.isNormal=function(a){return!Ab.isUnd(a)&&!Ab.isNull(a)},Ab.windowResize=h.debounce(function(b){Ab.isUnd(b)?Jb.resize():a.setTimeout(function(){Jb.resize()},b)},50),Ab.isPosNumeric=function(a,b){return Ab.isNormal(a)?(Ab.isUnd(b)?0:!b)?/^[1-9]+[0-9]*$/.test(a.toString()):/^[0-9]*$/.test(a.toString()):!1},Ab.pInt=function(b){return Ab.isNormal(b)&&""!==b?a.parseInt(b,10):0},Ab.pString=function(a){return Ab.isNormal(a)?""+a:""},Ab.isNonEmptyArray=function(a){return Ab.isArray(a)&&0<a.length},Ab.exportPath=function(b,c,d){for(var e=null,f=b.split("."),g=d||a;f.length&&(e=f.shift());)f.length||Ab.isUnd(c)?g=g[e]?g[e]:g[e]={}:g[e]=c},Ab.pImport=function(a,b,c){a[b]=c},Ab.pExport=function(a,b,c){return Ab.isUnd(a[b])?c:a[b]},Ab.encodeHtml=function(a){return Ab.isNormal(a)?a.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},Ab.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=Ab.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},Ab.timeOutAction=function(){var b={};return function(c,d,e){Ab.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),Ab.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),Ab.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Db.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}}(),Ab.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},Ab.i18n=function(a,b,c){var d="",e=Ab.isUnd(Hb[a])?Ab.isUnd(c)?a:c:Hb[a];if(!Ab.isUnd(b)&&!Ab.isNull(b))for(d in b)Ab.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},Ab.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(Ab.i18n(c)):(c=a.data("i18n-html"),c&&a.html(Ab.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",Ab.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",Ab.i18n(c)))})})},Ab.i18nToDoc=function(){a.rainloopI18N&&(Hb=a.rainloopI18N||{},Ab.i18nToNode(Kb),Db.langChangeTrigger(!Db.langChangeTrigger())),a.rainloopI18N={}},Ab.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Db.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Db.langChangeTrigger.subscribe(a,b)},Ab.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)},Ab.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},Ab.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()},Ab.replySubjectAdd=function(b,c,d){var e=null,f=Ab.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||Ab.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||Ab.isUnd(e[1])||Ab.isUnd(e[2])||Ab.isUnd(e[3])?b+": "+c:e[1]+(Ab.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(Ab.isUnd(d)?!0:d)?Ab.fixLongSubject(f):f},Ab.fixLongSubject=function(a){var b=0,c=null;a=Ab.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||Ab.isUnd(c[0]))&&(c=null),c&&(b=0,b+=Ab.isUnd(c[2])?1:0+Ab.pInt(c[2]),b+=Ab.isUnd(c[4])?1:0+Ab.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},Ab.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Ab.friendlySize=function(a){return a=Ab.pInt(a),a>=1073741824?Ab.roundNumber(a/1073741824,1)+"GB":a>=1048576?Ab.roundNumber(a/1048576,1)+"MB":a>=1024?Ab.roundNumber(a/1024,0)+"KB":a+"B"},Ab.log=function(b){a.console&&a.console.log&&a.console.log(b)},Ab.getNotification=function(a,b){return a=Ab.pInt(a),yb.Notification.ClientViewError===a&&b?b:Ab.isUnd(zb[a])?"":zb[a]},Ab.initNotificationLanguage=function(){zb[yb.Notification.InvalidToken]=Ab.i18n("NOTIFICATIONS/INVALID_TOKEN"),zb[yb.Notification.AuthError]=Ab.i18n("NOTIFICATIONS/AUTH_ERROR"),zb[yb.Notification.AccessError]=Ab.i18n("NOTIFICATIONS/ACCESS_ERROR"),zb[yb.Notification.ConnectionError]=Ab.i18n("NOTIFICATIONS/CONNECTION_ERROR"),zb[yb.Notification.CaptchaError]=Ab.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),zb[yb.Notification.SocialFacebookLoginAccessDisable]=Ab.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),zb[yb.Notification.SocialTwitterLoginAccessDisable]=Ab.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),zb[yb.Notification.SocialGoogleLoginAccessDisable]=Ab.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),zb[yb.Notification.DomainNotAllowed]=Ab.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),zb[yb.Notification.AccountNotAllowed]=Ab.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),zb[yb.Notification.AccountTwoFactorAuthRequired]=Ab.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),zb[yb.Notification.AccountTwoFactorAuthError]=Ab.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),zb[yb.Notification.CantGetMessageList]=Ab.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),zb[yb.Notification.CantGetMessage]=Ab.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),zb[yb.Notification.CantDeleteMessage]=Ab.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),zb[yb.Notification.CantMoveMessage]=Ab.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),zb[yb.Notification.CantCopyMessage]=Ab.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),zb[yb.Notification.CantSaveMessage]=Ab.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),zb[yb.Notification.CantSendMessage]=Ab.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),zb[yb.Notification.InvalidRecipients]=Ab.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),zb[yb.Notification.CantCreateFolder]=Ab.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),zb[yb.Notification.CantRenameFolder]=Ab.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),zb[yb.Notification.CantDeleteFolder]=Ab.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),zb[yb.Notification.CantDeleteNonEmptyFolder]=Ab.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),zb[yb.Notification.CantSubscribeFolder]=Ab.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),zb[yb.Notification.CantUnsubscribeFolder]=Ab.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),zb[yb.Notification.CantSaveSettings]=Ab.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),zb[yb.Notification.CantSavePluginSettings]=Ab.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),zb[yb.Notification.DomainAlreadyExists]=Ab.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),zb[yb.Notification.CantInstallPackage]=Ab.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),zb[yb.Notification.CantDeletePackage]=Ab.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),zb[yb.Notification.InvalidPluginPackage]=Ab.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),zb[yb.Notification.UnsupportedPluginPackage]=Ab.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),zb[yb.Notification.LicensingServerIsUnavailable]=Ab.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),zb[yb.Notification.LicensingExpired]=Ab.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),zb[yb.Notification.LicensingBanned]=Ab.i18n("NOTIFICATIONS/LICENSING_BANNED"),zb[yb.Notification.DemoSendMessageError]=Ab.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),zb[yb.Notification.AccountAlreadyExists]=Ab.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),zb[yb.Notification.MailServerError]=Ab.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),zb[yb.Notification.UnknownNotification]=Ab.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),zb[yb.Notification.UnknownError]=Ab.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Ab.getUploadErrorDescByCode=function(a){var b="";switch(Ab.pInt(a)){case yb.UploadErrorCode.FileIsTooBig:b=Ab.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case yb.UploadErrorCode.FilePartiallyUploaded:b=Ab.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case yb.UploadErrorCode.FileNoUploaded:b=Ab.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case yb.UploadErrorCode.MissingTempFolder:b=Ab.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case yb.UploadErrorCode.FileOnSaveingError:b=Ab.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case yb.UploadErrorCode.FileType:b=Ab.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=Ab.i18n("UPLOAD/ERROR_UNKNOWN")}return b},Ab.delegateRun=function(a,b,c,d){a&&a[b]&&(d=Ab.pInt(d),0>=d?a[b].apply(a,Ab.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,Ab.isArray(c)?c:[])},d))},Ab.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===yb.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===yb.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},Ab.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=Ab.isUnd(d)?!0:d,e.canExecute=c.computed(Ab.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},Ab.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(yb.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(yb.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Db.sAnimationType=yb.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(yb.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return yb.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Db.bMobileDevice||a===yb.InterfaceAnimation.None)Ib.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Db.sAnimationType=yb.InterfaceAnimation.None;else switch(a){case yb.InterfaceAnimation.Full:Ib.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Db.sAnimationType=a;break;case yb.InterfaceAnimation.Normal:Ib.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Db.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=yb.DesktopNotifications.NotSupported;if(Lb&&Lb.permission)switch(Lb.permission.toLowerCase()){case"granted":c=yb.DesktopNotifications.Allowed;break;case"denied":c=yb.DesktopNotifications.Denied;break;case"default":c=yb.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&yb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();yb.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):yb.DesktopNotifications.NotAllowed===c?Lb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),yb.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<Ab.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<Ab.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(xb.Defaults.MessagesPerPage),b.mainMessagesPerPage=b.messagesPerPage,b.mainMessagesPerPage=c.computed({read:b.messagesPerPage,write:function(a){-1<Ab.inArray(Ab.pInt(a),xb.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.contactsIsAllowed=c.observable(!1)},Ab.createMomentDate=function(a){return Ab.isUnd(a.moment)&&(a.moment=c.observable(f())),c.computed(function(){return Db.momentTrigger(),this.moment().fromNow()},a)},Ab.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")?Ab.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?Ab.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},Ab.isFolderExpanded=function(a){var b=Mb.local().get(yb.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},Ab.setExpandedFolder=function(a,b){var c=Mb.local().get(yb.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Mb.local().set(yb.ClientSideKeyName.ExpandedFolders,c)},Ab.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Mb.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Mb.local().set(d,b.size.width),f.css({left:""+b.size.width+"px"}))};null!==g&&(e.css({width:""+g+"px"}),f.css({left:""+g+"px"})),e.resizable({helper:"ui-resizable-helper",minWidth:120,maxWidth:400,handles:"e",stop:h})},Ab.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"),Ab.windowResize()}).after("<br />").before("<br />"))})}},Ab.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()}))},Ab.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,Bb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},Ab.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Eb.settings.push(a)},Ab.removeSettingsViewModel=function(a){Eb["settings-removed"].push(a)},Ab.disableSettingsViewModel=function(a){Eb["settings-disabled"].push(a)},Ab.convertThemeName=function(a){return Ab.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Ab.quoteName=function(a){return a.replace(/["]/g,'\\"')},Ab.microtime=function(){return(new Date).getTime()},Ab.convertLangName=function(a,b){return Ab.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},Ab.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=Ab.isUnd(a)?32:Ab.pInt(a);b.length<a;)b+=c.substr(Math.round(Math.random()*c.length),1);return b},Ab.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\r/g,"").replace(/\n/g,"<br />")},Ab.draggeblePlace=function(){return b('<div class="draggablePlace"><span class="text"></span> <i class="icon-mail icon-white"></i></div>').appendTo("#rl-hidden")},Ab.defautOptionsAfterRender=function(a,b){b&&!Ab.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},Ab.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+Ab.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")),Ab.i18nToNode(d),t.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>'+Ab.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)},Ab.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=Ab.isUnd(d)?1e3:Ab.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?yb.SaveSettingsStep.TrueResult:yb.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,yb.SaveSettingsStep.Idle)},d)}},Ab.settingsSaveHelperSimpleFunction=function(a,b){return Ab.settingsSaveHelperFunction(null,a,b,1e3)},Ab.htmlToPlain=function(a){var c="",d="> ",e=function(){if(arguments&&1<arguments.length){var a=b.trim(arguments[1]).replace(/__bq__start__(.|[\s\S\n\r]*)__bq__end__/gm,e);return a="\n"+d+b.trim(a).replace(/\n/gm,"\n"+d)+"\n>\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1<arguments.length?"\n"+b.trim(arguments[1].replace(/[\s]/,""))+" ":""})}return""},f=function(){if(arguments&&1<arguments.length){var a=b.trim(arguments[1]);return 0<a.length&&(a=a.replace(/<div[^>]*>(.|[\s\S\r\n]*)<\/div>/gim,f),a="\n"+b.trim(a)+"\n"),a}return""},g=function(){return arguments&&1<arguments.length?""+arguments[1]+arguments[2].replace(/</g,"<").replace(/>/g,">"):""},h=function(){if(arguments&&1<arguments.length){var a=b.trim(arguments[1]);return a}return""};return c=a.replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,g).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\r\n]*)<\/div>/gim,f).replace(/<blockquote[^>]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/<a [^>]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Ab.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\r/g,"").replace(/\n/g,"<br />")},Ab.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},Ab.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:Ab.isUnd(c)?a.toString():c.toString(),custom:Ab.isUnd(c)?!1:!0,title:Ab.isUnd(c)?"":a.toString(),value:a.toString()};(Ab.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},Ab.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},Cb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Cb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Cb._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 Cb._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(!Db.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+'">'+Ab.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.csstext={init:function(a,d){a&&a.styleSheet&&!Ab.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!Ab.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Db.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){Ab.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Ab.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Ab.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=Ab.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Ab.pInt(e[2]),g=Jb.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(!Db.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),Ab.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),Ab.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null,!!a.shiftKey)},b(d).draggable(k).on("mousedown",function(){Ab.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Db.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){Db.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' <i class="icon-spinner 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.emailsTags={init:function(a,c){var d=b(a),e=c();d.inputosaurus({parseOnBlur:!0,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Mb.getAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=Ab.trim(a),c=null;return""!==b?(c=new u,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(){d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(Ab.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},Ab.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Ab.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=Ab.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Ab.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},j.prototype.root=function(){return this.sBase},j.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},j.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},j.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},j.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},j.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},j.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},j.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},j.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},j.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},j.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},j.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},j.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},j.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},j.prototype.settings=function(a){var b=this.sBase+"settings";return Ab.isUnd(a)||""===a||(b+="/"+a),b},j.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},j.prototype.mailBox=function(a,b,c){b=Ab.isNormal(b)?Ab.pInt(b):1,c=Ab.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},j.prototype.phpInfo=function(){return this.sServer+"Info"},j.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},j.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},j.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},j.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},j.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},j.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},j.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.js"},j.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},j.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},j.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Bb.oViewModelsHooks={},Bb.oSimpleHooks={},Bb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Bb.addHook=function(a,b){Ab.isFunc(b)&&(Ab.isArray(Bb.oSimpleHooks[a])||(Bb.oSimpleHooks[a]=[]),Bb.oSimpleHooks[a].push(b))},Bb.runHook=function(a,b){Ab.isArray(Bb.oSimpleHooks[a])&&(b=b||[],h.each(Bb.oSimpleHooks[a],function(a){a.apply(null,b)}))},Bb.mainSettingsGet=function(a){return Mb?Mb.settingsGet(a):null},Bb.remoteRequest=function(a,b,c,d,e,f){Mb&&Mb.remote().defaultRequest(a,b,c,d,e,f)},Bb.settingsGet=function(a,b){var c=Bb.mainSettingsGet("Plugins");return c=c&&Ab.isUnd(c[a])?null:c[a],c?Ab.isUnd(c[b])?null:c[b]:null},k.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},k.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},k.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},k.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},k.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},k.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},k.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},k.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},k.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},k.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Db.oHtmlEditorDefaultConfig,d=Mb.settingsGet("Language"),e=!!Mb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Db.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},k.prototype.focus=function(){this.editor&&this.editor.focus()},k.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},k.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},k.prototype.clear=function(a){this.setHtml("",a)},l.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},l.prototype.goDown=function(){this.newSelectPosition(yb.EventKeyCode.Down,!1)},l.prototype.goUp=function(){this.newSelectPosition(yb.EventKeyCode.Up,!1)},l.prototype.init=function(d,e){if(this.oContentVisible=d,this.oContentScrollable=e,this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){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&&!Ab.inFocus()&&(-1<Ab.inArray(a.keyCode,[yb.EventKeyCode.Up,yb.EventKeyCode.Down,yb.EventKeyCode.Insert,yb.EventKeyCode.Home,yb.EventKeyCode.End,yb.EventKeyCode.PageUp,yb.EventKeyCode.PageDown])?(f.newSelectPosition(a.keyCode,a.shiftKey),b=!1):yb.EventKeyCode.Delete!==a.keyCode||a.ctrlKey||a.shiftKey||(f.oCallbacks.onDelete&&f.oCallbacks.onDelete(),b=!1)),b})}},l.prototype.selectByUid=function(a,b){b=Ab.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},l.prototype.useKeyboard=function(a){this.bUseKeyboard=!!a},l.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},l.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(yb.EventKeyCode.Down===b||yb.EventKeyCode.Up===b||yb.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case yb.EventKeyCode.Up:m===a?i=!0:j=a;break;case yb.EventKeyCode.Down:case yb.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(yb.EventKeyCode.Home===b||yb.EventKeyCode.End===b)yb.EventKeyCode.Home===b?j=k[0]:yb.EventKeyCode.End===b&&(j=k[k.length-1]);else if(yb.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(yb.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 yb.EventKeyCode.Down===b||yb.EventKeyCode.Insert===b||yb.EventKeyCode.Home===b||yb.EventKeyCode.PageUp===b?j=k[0]:(yb.EventKeyCode.Up===b||yb.EventKeyCode.End===b||yb.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(yb.EventKeyCode.Up===b||yb.EventKeyCode.Down===b)&&m.checked(!m.checked()):yb.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||yb.EventKeyCode.Up!==b&&yb.EventKeyCode.Down!==b?yb.EventKeyCode.Insert===b&&m.checked(!m.checked()):m.checked(!m.checked()))},l.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)?(this.oContentScrollable.scrollTop(d.top<0?this.oContentScrollable.scrollTop()+d.top-a:this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},l.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},l.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)}},l.prototype.on=function(a,b){this.oCallbacks[a]=b},m.supported=function(){return!0},m.prototype.set=function(a,c){var d=b.cookie(xb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(xb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},m.prototype.get=function(a){var c=b.cookie(xb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Ab.isUnd(d[a])?d[a]:null}catch(e){}return d},n.supported=function(){return!!a.localStorage},n.prototype.set=function(b,c){var d=a.localStorage[xb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[xb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},n.prototype.get=function(b){var c=a.localStorage[xb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Ab.isUnd(d[b])?d[b]:null}catch(e){}return d},o.prototype.item="armoredRainLoopKeys",o.prototype.load=function(){var b=0,c=0,d=[],e=JSON.parse(a.localStorage.getItem(this.item));if(e&&0<e.length)for(c=e.length;c>b;b++)d.push(a.openpgp.key.readArmored(e[b]).keys[0]);return d},o.prototype.store=function(b){for(var c=0,d=b.length,e=[];d>c;c++)e.push(b[c].armor());a.localStorage.setItem(this.item,JSON.stringify(e))},p.prototype.oDriver=null,p.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},p.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},q.prototype.bootstart=function(){},r.prototype.sPosition="",r.prototype.sTemplate="",r.prototype.viewModelName="",r.prototype.viewModelDom=null,r.prototype.viewModelTemplate=function(){return this.sTemplate},r.prototype.viewModelPosition=function(){return this.sPosition},r.prototype.cancelCommand=r.prototype.closeCommand=function(){},r.prototype.registerPopupEscapeKey=function(){var a=this;Jb.on("keydown",function(b){return b&&yb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()?(Ab.delegateRun(a,"cancelCommand"),!1):!0})},s.prototype.oCross=null,s.prototype.sScreenName="",s.prototype.aViewModels=[],s.prototype.viewModels=function(){return this.aViewModels},s.prototype.screenName=function(){return this.sScreenName},s.prototype.routes=function(){return null},s.prototype.__cross=function(){return this.oCross},s.prototype.__start=function(){var a=this.routes(),b=null,c=null;Ab.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Ab.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},t.constructorEnd=function(a){Ab.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},t.prototype.sDefaultScreenName="",t.prototype.oScreens={},t.prototype.oBoot=null,t.prototype.oCurrentScreen=null,t.prototype.hideLoading=function(){b("#rl-loading").hide()},t.prototype.routeOff=function(){e.changed.active=!1},t.prototype.routeOn=function(){e.changed.active=!0},t.prototype.setBoot=function(a){return Ab.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Ab.isUnd(this.oScreens[a])?null:this.oScreens[a]},t.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=Mb.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=Ab.createCommand(e,function(){Fb.hideScreenPopup(a)})),Bb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),Ab.delegateRun(e,"onBuild",[h]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),Bb.runHook("view-model-post-build",[a.__name,e,h])):Ab.log("Cannot find view model position: "+f)}return a?a.__vm:null},t.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},t.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Ab.delegateRun(a.__vm,"onHide"),Mb.popupVisibilityNames.remove(a.__name),Bb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),Ab.delegateRun(a.__vm,"onShow",b||[]),Mb.popupVisibilityNames.push(a.__name),Bb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),Ab.delegateRun(a.__vm,"onFocus",[],500)))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Ab.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,Ab.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Ab.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Ab.delegateRun(c.oCurrentScreen,"onHide"),Ab.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),Ab.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Ab.delegateRun(c.oCurrentScreen,"onShow"),Bb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Ab.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),Ab.delegateRun(a.__vm,"onShow"),Ab.delegateRun(a.__vm,"onFocus",[],200),Bb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},t.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),h.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),h.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),Bb.runHook("screen-pre-start",[a.screenName(),a]),Ab.delegateRun(a,"onStart"),Bb.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),h.delay(function(){Ib.removeClass("rl-started-trigger").addClass("rl-started")},50)},t.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=Ab.isUnd(c)?!1:!!c,(Ab.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)},t.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},Fb=new t,u.newInstanceFromJson=function(a){var b=new u;return b.initByJson(a)?b:null},u.prototype.name="",u.prototype.email="",u.prototype.privateType=null,u.prototype.clear=function(){this.email="",this.name="",this.privateType=null},u.prototype.validate=function(){return""!==this.name||""!==this.email},u.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},u.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},u.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=yb.EmailType.Facebook),null===this.privateType&&(this.privateType=yb.EmailType.Default)),this.privateType},u.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},u.prototype.parse=function(a){this.clear(),a=Ab.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)},u.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=Ab.trim(a.Name),this.email=Ab.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Ab.isUnd(b)?!1:!!b,c=Ab.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'<a href="mailto:'+Ab.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+Ab.encodeHtml(this.name)+"</a>":c?Ab.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Ab.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+Ab.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+Ab.encodeHtml(d)+"</a>"+Ab.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Ab.encodeHtml(d))):b&&(d='<a href="mailto:'+Ab.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+Ab.encodeHtml(this.email)+"</a>"))),d},u.prototype.mailsoParse=function(a){if(a=Ab.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m<a.length;){switch(a.substr(m,1)){case'"':g||h||i?h||i||(l=m,d=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,g=!1):(g=!0,k=m);break;case"<":g||h||i||(m>0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=Ab.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Ab.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Ab.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},u.prototype.inputoTagLine=function(){return 0<this.name.length?this.name+" ("+this.email+")":this.email},v.prototype.getNameAndEmailHelper=function(){var a="",b="";return Ab.isNonEmptyArray(this.properties)&&h.each(this.properties,function(c){c&&(""===a&&yb.ContactPropertyType.FullName===c[0]?a=c[1]:""===b&&-1<Ab.inArray(c[0],[yb.ContactPropertyType.EmailPersonal,yb.ContactPropertyType.EmailBussines,yb.ContactPropertyType.EmailOther])&&(b=c[1]))},this),""===b?null:[b,a]},v.prototype.parse=function(a){var b=!1;return a&&"Object/Contact"===a["@Object"]&&(this.idContact=Ab.pInt(a.IdContact),this.idContactStr=Ab.pString(a.IdContactStr),this.display=Ab.pString(a.Display),this.readOnly=!!a.ReadOnly,this.scopeType=Ab.pInt(a.ScopeType),Ab.isNonEmptyArray(a.Properties)&&h.each(a.Properties,function(a){a&&a.Type&&Ab.isNormal(a.Value)&&this.properties.push([Ab.pInt(a.Type),Ab.pString(a.Value)])},this),this.shared(yb.ContactScopeType.ShareAll===this.scopeType),b=!0),b},v.prototype.srcAttr=function(){return Mb.link().emptyContactPic()},v.prototype.generateUid=function(){return""+this.idContact},v.prototype.lineAsCcc=function(){var a=[];return this.deleted()&&a.push("deleted"),this.selected()&&a.push("selected"),this.checked()&&a.push("checked"),this.shared()&&a.push("shared"),a.join(" ")},x.newInstanceFromJson=function(a){var b=new x;return b.initByJson(a)?b:null},x.prototype.mimeType="",x.prototype.fileName="",x.prototype.estimatedSize=0,x.prototype.friendlySize="",x.prototype.isInline=!1,x.prototype.isLinked=!1,x.prototype.cid="",x.prototype.cidWithOutTags="",x.prototype.contentLocation="",x.prototype.download="",x.prototype.folder="",x.prototype.uid="",x.prototype.mimeIndex="",x.prototype.initByJson=function(a){var b=!1;return a&&"Object/Attachment"===a["@Object"]&&(this.mimeType=(a.MimeType||"").toLowerCase(),this.fileName=a.FileName,this.estimatedSize=Ab.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=Ab.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),b=!0),b},x.prototype.isImage=function(){return-1<Ab.inArray(this.mimeType.toLowerCase(),["image/png","image/jpg","image/jpeg","image/gif"])},x.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)&&-1===Ab.inArray(this.mimeType,["text/html"])},x.prototype.isPdf=function(){return Db.bAllowPdfPreview&&"application/pdf"===this.mimeType},x.prototype.linkDownload=function(){return Mb.link().attachmentDownload(this.download)},x.prototype.linkPreview=function(){return Mb.link().attachmentPreview(this.download)},x.prototype.linkPreviewAsPlain=function(){return Mb.link().attachmentPreviewAsPlain(this.download)},x.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},x.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},x.prototype.iconClass=function(){var a=this.mimeType.toLocaleString().split("/"),b="icon-file";return a&&a[1]&&("image"===a[0]?b="icon-file-image":"text"===a[0]?b="icon-file-text":"audio"===a[0]?b="icon-file-music":"video"===a[0]?b="icon-file-movie":-1<Ab.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<Ab.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-text":-1<Ab.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<Ab.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-chart-graph")),b},y.prototype.id="",y.prototype.isInline=!1,y.prototype.isLinked=!1,y.prototype.CID="",y.prototype.contentLocation="",y.prototype.fromMessage=!1,y.prototype.cancel=Ab.emptyFunction,y.prototype.initByUploadJson=function(a){var b=!1;return a&&(this.fileName(a.Name),this.size(Ab.isUnd(a.Size)?0:Ab.pInt(a.Size)),this.tempName(Ab.isUnd(a.TempName)?"":a.TempName),this.isInline=!1,b=!0),b},z.newInstanceFromJson=function(a){var b=new z;return b.initByJson(a)?b:null},z.calculateFullFromatDateValue=function(a){return f.unix(a).format("LLL")},z.emailsToLine=function(a,b,c){var d=[],e=0,f=0;if(Ab.isNonEmptyArray(a))for(e=0,f=a.length;f>e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},z.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(Ab.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=u.newInstanceFromJson(a[b]),d&&e.push(d);return e},z.replyHelper=function(a,b,c){if(a&&0<a.length)for(var d=0,e=a.length;e>d;d++)Ab.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},z.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(yb.MessagePriority.Normal),this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isRtl(!1),this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(yb.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)
|
||
},z.prototype.computeSenderEmail=function(){var a=Mb.data().sentFolder(),b=Mb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},z.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.hash=a.Hash,this.requestHash=a.RequestHash,this.size(Ab.pInt(a.Size)),this.from=z.initEmailsFromJson(a.From),this.to=z.initEmailsFromJson(a.To),this.cc=z.initEmailsFromJson(a.Cc),this.bcc=z.initEmailsFromJson(a.Bcc),this.replyTo=z.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(Ab.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(z.emailsToLine(this.from,!0)),this.toEmailsString(z.emailsToLine(this.to,!0)),this.parentUid(Ab.pInt(a.ParentThread)),this.threads(Ab.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Ab.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},z.prototype.initUpdateByMessageJson=function(a){var b=!1,c=yb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Ab.pInt(a.Priority),this.priority(-1<Ab.inArray(c,[yb.MessagePriority.High,yb.MessagePriority.Low])?c:yb.MessagePriority.Normal),this.aDraftInfo=a.DraftInfo,this.sMessageId=a.MessageId,this.sInReplyTo=a.InReplyTo,this.sReferences=a.References,Mb.data().allowOpenPGP()&&(this.isPgpSigned(!!a.PgpSigned),this.isPgpEncrypted(!!a.PgpEncrypted)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.foundedCIDs=Ab.isArray(a.FoundedCIDs)?a.FoundedCIDs:[],this.attachments(this.initAttachmentsFromJson(a.Attachments)),this.readReceipt(a.ReadReceipt||""),this.computeSenderEmail(),b=!0),b},z.prototype.initAttachmentsFromJson=function(a){var b=0,c=0,d=null,e=[];if(a&&"Collection/AttachmentCollection"===a["@Object"]&&Ab.isNonEmptyArray(a["@Collection"]))for(b=0,c=a["@Collection"].length;c>b;b++)d=x.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0<this.foundedCIDs.length&&0<=Ab.inArray(d.cidWithOutTags,this.foundedCIDs)&&(d.isLinked=!0),e.push(d));return e},z.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),this.isReadReceipt(!!a.IsReadReceipt),b=!0),b},z.prototype.fromToLine=function(a,b){return z.emailsToLine(this.from,a,b)},z.prototype.toToLine=function(a,b){return z.emailsToLine(this.to,a,b)},z.prototype.ccToLine=function(a,b){return z.emailsToLine(this.cc,a,b)},z.prototype.bccToLine=function(a,b){return z.emailsToLine(this.bcc,a,b)},z.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(" ")},z.prototype.hasVisibleAttachments=function(){return!!h.find(this.attachments(),function(a){return!a.isLinked})},z.prototype.findAttachmentByCid=function(a){var b=null,c=this.attachments();return Ab.isNonEmptyArray(c)&&(a=a.replace(/^<+/,"").replace(/>+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},z.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return Ab.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},z.prototype.messageId=function(){return this.sMessageId},z.prototype.inReplyTo=function(){return this.sInReplyTo},z.prototype.references=function(){return this.sReferences},z.prototype.fromAsSingleEmail=function(){return Ab.isArray(this.from)&&this.from[0]?this.from[0].email:""},z.prototype.viewLink=function(){return Mb.link().messageViewLink(this.requestHash)},z.prototype.downloadLink=function(){return Mb.link().messageDownloadLink(this.requestHash)},z.prototype.replyEmails=function(a){var b=[],c=Ab.isUnd(a)?{}:a;return z.replyHelper(this.replyTo,c,b),0===b.length&&z.replyHelper(this.from,c,b),b},z.prototype.replyAllEmails=function(a){var b=[],c=[],d=Ab.isUnd(a)?{}:a;return z.replyHelper(this.replyTo,d,b),0===b.length&&z.replyHelper(this.from,d,b),z.replyHelper(this.to,d,b),z.replyHelper(this.cc,d,c),[b,c]},z.prototype.textBodyToString=function(){return this.body?this.body.html():""},z.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0<a.length?a.join(", "):""},z.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()}},z.prototype.viewPopupMessage=function(c){Ab.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))})},z.prototype.printMessage=function(){this.viewPopupMessage(!0)},z.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},z.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.hash=a.hash,this.requestHash=a.requestHash,this.subject(a.subject()),this.size(a.size()),this.dateTimeStampInUTC(a.dateTimeStampInUTC()),this.priority(a.priority()),this.fromEmailString(a.fromEmailString()),this.toEmailsString(a.toEmailsString()),this.emails=a.emails,this.from=a.from,this.to=a.to,this.cc=a.cc,this.bcc=a.bcc,this.replyTo=a.replyTo,this.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),this.isReadReceipt(a.isReadReceipt()),this.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(yb.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},z.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=Ab.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=Ab.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]}),Jb.resize()),Ab.windowResize(500))},z.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),a=Ab.isUnd(a)?!1:a;var c=this;b("[data-x-src-cid]",this.body).each(function(){var d=c.findAttachmentByCid(b(this).attr("data-x-src-cid"));d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-src-location]",this.body).each(function(){var d=c.findAttachmentByContentLocation(b(this).attr("data-x-src-location"));d||(d=c.findAttachmentByCid(b(this).attr("data-x-src-location"))),d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-style-cid]",this.body).each(function(){var a="",d="",e=c.findAttachmentByCid(b(this).attr("data-x-style-cid"));e&&e.linkPreview&&(d=b(this).attr("data-x-style-cid-name"),""!==d&&(a=Ab.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]),Ab.windowResize(500)}},z.prototype.storeDataToDom=function(){this.body&&(this.body.data("rl-is-rtl",!!this.isRtl()),this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw),Mb.data().allowOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser())))},z.prototype.storePgpVerifyDataToDom=function(){this.body&&Mb.data().allowOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},z.prototype.fetchDataToDom=function(){this.body&&(this.isRtl(!!this.body.data("rl-is-rtl")),this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=Ab.pString(this.body.data("rl-plain-raw")),Mb.data().allowOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},z.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var c=[],d=null,e=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",f=Mb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?yb.SignedVerifyStatus.Unverified:yb.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0<c.length&&(g=h.find(c,function(a){return a&&a.keyid&&a.valid}),g&&(i=Mb.data().findPublicKeyByHex(g.keyid.toHex()),i&&(j=d.getText(),this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Success),this.pgpSignedVerifyUser(i.user),j=Nb.empty().append(b('<pre class="b-plain-openpgp signed verified"></pre>').text(j)).html(),Nb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},z.prototype.decryptPgpEncryptedMessage=function(c){if(this.isPgpEncrypted()){var d=[],e=null,f=null,g=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",i=Mb.data().findPublicKeysByEmail(g),j=Mb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0<d.length&&(k=h.find(d,function(a){return a&&a.keyid&&a.valid}),k&&(l=Mb.data().findPublicKeyByHex(k.keyid.toHex()),l&&(this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Success),this.pgpSignedVerifyUser(l.user)))),m=f.getText(),m=Nb.empty().append(b('<pre class="b-plain-openpgp signed verified"></pre>').text(m)).html(),Nb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},z.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.newInstanceFromJson=function(a){var b=new A;return b.initByJson(a)?b.initComputed():null},A.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.canBeEdited=c.computed(function(){return yb.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=c.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this),this.isSystemFolder=c.computed(function(){return yb.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){Ab.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Ab.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=c.computed(function(){var a=this.messageCountAll(),b=this.messageCountUnread(),c=this.type();if(yb.FolderType.Inbox===c&&Mb.data().foldersInboxUnreadCount(b),a>0){if(yb.FolderType.Draft===c)return""+a;if(b>0&&yb.FolderType.Trash!==c&&yb.FolderType.Archive!==c&&yb.FolderType.SentItems!==c)return""+b}return""},this),this.canBeDeleted=c.computed(function(){var a=this.isSystemFolder();return!a&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=c.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){Ab.timeOutAction("folder-list-folder-visibility-change",function(){Jb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Db.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case yb.FolderType.Inbox:b=Ab.i18n("FOLDER_LIST/INBOX_NAME");break;case yb.FolderType.SentItems:b=Ab.i18n("FOLDER_LIST/SENT_NAME");break;case yb.FolderType.Draft:b=Ab.i18n("FOLDER_LIST/DRAFTS_NAME");break;case yb.FolderType.Spam:b=Ab.i18n("FOLDER_LIST/SPAM_NAME");break;case yb.FolderType.Trash:b=Ab.i18n("FOLDER_LIST/TRASH_NAME");break;case yb.FolderType.Archive:b=Ab.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Db.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case yb.FolderType.Inbox:a="("+Ab.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case yb.FolderType.SentItems:a="("+Ab.i18n("FOLDER_LIST/SENT_NAME")+")";break;case yb.FolderType.Draft:a="("+Ab.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case yb.FolderType.Spam:a="("+Ab.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case yb.FolderType.Trash:a="("+Ab.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case yb.FolderType.Archive:a="("+Ab.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this.hasUnreadMessages=c.computed(function(){return 0<this.messageCountUnread()},this),this.hasSubScribedUnreadMessagesSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.hasUnreadMessages()||a.hasSubScribedUnreadMessagesSubfolders()})},this),this},A.prototype.fullName="",A.prototype.fullNameRaw="",A.prototype.fullNameHash="",A.prototype.delimiter="",A.prototype.namespace="",A.prototype.deep=0,A.prototype.interval=0,A.prototype.isNamespaceFolder=!1,A.prototype.isGmailFolder=!1,A.prototype.isUnpaddigFolder=!1,A.prototype.collapsedCss=function(){return this.hasSubScribedSubfolders()?this.collapsed()?"icon-right-mini e-collapsed-sign":"icon-down-mini e-collapsed-sign":"icon-none e-collapsed-sign"},A.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?yb.FolderType.Inbox:yb.FolderType.User),b=!0),b},A.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},B.prototype.email="",B.prototype.changeAccountLink=function(){return Mb.link().change(this.email)},C.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},C.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},C.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+Ab.quoteName(a)+'" <'+this.email()+">"},D.prototype.index=0,D.prototype.id="",D.prototype.guid="",D.prototype.user="",D.prototype.email="",D.prototype.armor="",D.prototype.isPrivate=!1,Ab.extendAsViewModel("PopupsFolderClearViewModel",E),E.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},E.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Ab.extendAsViewModel("PopupsFolderCreateViewModel",F),F.prototype.sNoParentText="",F.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Ab.trim(a))},F.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},F.prototype.onShow=function(){this.clearPopup()},F.prototype.onFocus=function(){this.folderName.focused(!0)},Ab.extendAsViewModel("PopupsFolderSystemViewModel",G),G.prototype.sChooseOnText="",G.prototype.sUnuseText="",G.prototype.onShow=function(a){var b="";switch(a=Ab.isUnd(a)?yb.SetSystemFoldersNotification.None:a){case yb.SetSystemFoldersNotification.Sent:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case yb.SetSystemFoldersNotification.Draft:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case yb.SetSystemFoldersNotification.Spam:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case yb.SetSystemFoldersNotification.Trash:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case yb.SetSystemFoldersNotification.Archive:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Ab.extendAsViewModel("PopupsComposeViewModel",H),H.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Fb.showScreenPopup(O,[function(b){a.editor(function(a){a.setPlain(b)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},H.prototype.reloadDraftFolder=function(){var a=Mb.data().draftFolder();""!==a&&(Mb.cache().setFolderHash(a,""),Mb.data().currentFolderFullNameRaw()===a?Mb.reloadMessageList(!0):Mb.folderInformation(a))},H.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};if(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Mb.data().accountEmail()]=Mb.data().accountEmail(),b)switch(a){case yb.ComposeType.Empty:d=Mb.data().accountEmail();break;case yb.ComposeType.Reply:case yb.ComposeType.ReplyAll:case yb.ComposeType.Forward:case yb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case yb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Mb.data().accountEmail();return d},H.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},H.prototype.formattedFrom=function(a){var b=Mb.data().displayName(),c=Mb.data().accountEmail();return""===b?c:(Ab.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Ab.quoteName(b)+'" <'+c+">"},H.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),yb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Ab.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&yb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Ab.trim(Ab.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Ab.getNotification(c&&c.ErrorCode?c.ErrorCode:yb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Ab.getNotification(yb.Notification.CantSendMessage)))),this.reloadDraftFolder()},H.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),yb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Mb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Mb.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0<this.savedTime()?Ab.i18n("COMPOSE/SAVED_TIME",{TIME:f.unix(this.savedTime()-1).format("LT")}):""),d=!0,this.bFromDraft&&Mb.cache().setFolderHash(this.draftFolder(),""))),this.modalVisibility()||d||(this.savedError(!0),this.savedOrSendingText(Ab.getNotification(yb.Notification.CantSaveMessage))),this.reloadDraftFolder()},H.prototype.onHide=function(){this.reset(),Fb.routeOn()},H.prototype.convertSignature=function(a,b){if(""!==a){var c=!1;":HTML:"===a.substr(0,6)&&(c=!0,a=a.substr(6)),a=a.replace(/[\r]/,""),b=Ab.pString(b),a=""!==b?a.replace(/{{FROM}}/,b):a.replace(/{{IF:FROM}}[\s\S]+{{\/IF:FROM}}[\n]?/gm,""),a=a.replace(/{{FROM}}[\n]?/,"").replace(/{{IF:FROM}}[\n]?/,"").replace(/{{\/IF:FROM}}[\n]?/,""),c||(a=Ab.convertPlainTextToHtml(a))}return a},H.prototype.editor=function(a){if(a){var b=this;!this.oEditor&&this.composeEditorArea()?h.delay(function(){b.oEditor=new k(b.composeEditorArea(),null,function(){a(b.oEditor)},function(a){b.isHtml(!!a)})},300):this.oEditor&&a(this.oEditor)}},H.prototype.onShow=function(a,c,d){Fb.routeOff();var e=this,f="",g="",i="",j="",k="",l=null,m="",n="",o=[],p={},q=Mb.data().accountEmail(),r=Mb.data().signature(),s=Mb.data().signatureToAll(),t=[],u=null,v=null,w=a||yb.ComposeType.Empty,x=function(a,b){for(var c=0,d=a.length,e=[];d>c;c++)e.push(a[c].toLine(!!b));return e.join(", ")};if(c=c||null,c&&Ab.isNormal(c)&&(v=Ab.isArray(c)&&1===c.length?c[0]:Ab.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Ab.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Ab.removeBlockquoteSwitcher(l),m=l.html(),w){case yb.ComposeType.Empty:break;case yb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Ab.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.sReferences);break;case yb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Ab.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.references());break;case yb.ComposeType.Forward:this.subject(Ab.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.sReferences);break;case yb.ComposeType.ForwardAsAttachment:this.subject(Ab.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.sReferences);break;case yb.ComposeType.Draft:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.bFromDraft=!0,this.draftFolder(v.folderFullNameRaw),this.draftUid(v.uid),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Ab.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case yb.ComposeType.EditAsNew:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Ab.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case yb.ComposeType.Reply:case yb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Ab.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="<br /><br />"+n+":<blockquote><p>"+m+"</p></blockquote>";break;case yb.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m="<br /><br /><br />"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"<br />"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"<br />"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0<i.length?"<br />"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"<br />"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Ab.encodeHtml(j)+"<br />"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Ab.encodeHtml(k)+"<br /><br />"+m;break;case yb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&yb.ComposeType.EditAsNew!==w&&yb.ComposeType.Draft!==w&&(m=this.convertSignature(r,x(v.from,!0))+"<br />"+m),this.editor(function(a){a.setHtml(m,!1),v.isHtml()||a.modeToggle(!1)})}else yb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),yb.EditorDefaultType.Html!==Mb.data().editorDefaultType()&&a.modeToggle(!1)})):Ab.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Ab.isNonEmptyArray(t)&&Mb.remote().messageUploadAttachments(function(a,b){if(yb.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},t),this.triggerForResize()},H.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},H.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},H.prototype.tryToClosePopup=function(){var a=this;Fb.showScreenPopup(S,[Ab.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Ab.delegateRun(a,"closeCommand")}])},H.prototype.onBuild=function(){this.initUploader();var a=this,c=null;Jb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Mb.data().useKeyboardShortcuts()&&(a.bAllowCtrlS&&b.ctrlKey&&!b.shiftKey&&!b.altKey&&yb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):!b.ctrlKey||b.shiftKey||b.altKey||yb.EventKeyCode.Enter!==b.keyCode?yb.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1):(a.sendCommand(),c=!1)),c}),Jb.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",Mb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},H.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},H.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=Ab.pInt(Mb.settingsGet("AttachmentLimit")),c=new g({action:Mb.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});c?(c.on("onDragEnter",h.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",h.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",h.bind(function(b,c,d){var e=null;Ab.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this)).on("onSelect",h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=Ab.isUnd(d.FileName)?"":d.FileName.toString(),g=Ab.isNormal(d.Size)?Ab.pInt(d.Size):null,h=new y(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(Ab.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Ab.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this)).on("onComplete",h.bind(function(b,c,d){var e="",f=null,g=null,h=this.getAttachmentById(b);g=c&&d&&d.Result&&d.Result.Attachment?d.Result.Attachment:null,f=d&&d.Result&&d.Result.ErrorCode?d.Result.ErrorCode:null,null!==f?e=Ab.getUploadErrorDescByCode(f):g||(e=Ab.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)),Ab.isUnd(a[b])&&delete a[b])},this)),this.addAttachmentEnabled(!0).dragAndDropEnabled(c.isDragAndDropSupported())):this.addAttachmentEnabled(!1).dragAndDropEnabled(!1)}},H.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},H.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 y(a.requestHash,d,a.size()),c.fromMessage=!0,c.cancel=e(a.requestHash),c.waiting(!1).uploading(!0),this.attachments.push(c)}},H.prototype.addDropboxAttachment=function(a){var b=this,c=function(a){return function(){b.attachments.remove(function(b){return b&&b.id===a})}},d=Ab.pInt(Mb.settingsGet("AttachmentLimit")),e=null,f=a.bytes;return e=new y(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(Ab.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Mb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),yb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Ab.getUploadErrorDescByCode(yb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},H.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Ab.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(yb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case yb.ComposeType.Reply:case yb.ComposeType.ReplyAll:i=h.isLinked;break;case yb.ComposeType.Forward:case yb.ComposeType.Draft:case yb.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new y(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))}}},H.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},H.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(Ab.getUploadErrorDescByCode(yb.UploadErrorCode.FileNoUploaded))
|
||
},this)},H.prototype.isEmptyForm=function(a){a=Ab.isUnd(a)?!0:!!a;var b=a?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&b&&(!this.oEditor||""===this.oEditor.getData())},H.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},H.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},H.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Ab.extendAsViewModel("PopupsContactsViewModel",I),I.prototype.setShareToNone=function(){this.viewScopeType(yb.ContactScopeType.Default)},I.prototype.setShareToAll=function(){this.viewScopeType(yb.ContactScopeType.ShareAll)},I.prototype.addNewProperty=function(a){var b=new w(a,"");b.focused(!0),this.viewProperties.push(b)},I.prototype.addNewEmail=function(){this.addNewProperty(yb.ContactPropertyType.EmailPersonal)},I.prototype.addNewPhone=function(){this.addNewProperty(yb.ContactPropertyType.MobilePersonal)},I.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Mb.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});b&&b.on("onStart",h.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",h.bind(function(b,c,d){this.contacts.importing(!1),this.reloadContactList(),b&&c&&d&&d.Result||a.alert(Ab.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},I.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contacts().length,e=this.contactsCheckedOrSelected();0<e.length&&(h.each(e,function(b){c&&c.idContact===b.idContact&&(c=null,a.currentContact(null)),b.deleted(!0),d--}),0>=d&&(this.bDropPageAfterDelete=!0),h.delay(function(){h.each(e,function(a){b.remove(a)})},500))},I.prototype.deleteSelectedContacts=function(){0<this.contactsCheckedOrSelected().length&&(Mb.remote().contactsDelete(h.bind(this.deleteResponse,this),this.contactsCheckedOrSelectedUids()),this.removeCheckedOrSelectedContactsFromList())},I.prototype.deleteResponse=function(a,b){500<(yb.StorageResultType.Success===a&&b&&b.Time?Ab.pInt(b.Time):0)?this.reloadContactList(this.bDropPageAfterDelete):h.delay(function(a){return function(){a.reloadContactList(a.bDropPageAfterDelete)}}(this),500)},I.prototype.removeProperty=function(a){this.viewProperties.remove(a)},I.prototype.populateViewContact=function(a){var b="",c="",d="",e="",f=[];this.watchHash(!1),this.emptySelection(!1),this.viewReadOnly(!1),this.viewScopeType(yb.ContactScopeType.Default),a&&(b=a.idContact,c=a.idContactStr,Ab.isNonEmptyArray(a.properties)&&h.each(a.properties,function(a){a&&a[0]&&(yb.ContactPropertyType.LastName===a[0]?d=a[1]:yb.ContactPropertyType.FirstName===a[0]?e=a[1]:-1===Ab.inArray(a[0],[yb.ContactPropertyType.FullName])&&f.push(new w(a[0],a[1])))}),this.viewReadOnly(!!a.readOnly),this.viewScopeType(a.scopeType)),f.unshift(new w(yb.ContactPropertyType.LastName,d,!a,"CONTACTS/PLACEHOLDER_ENTER_LAST_NAME")),f.unshift(new w(yb.ContactPropertyType.FirstName,e,!1,"CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME")),this.viewID(b),this.viewIDStr(c),this.viewProperties([]),this.viewProperties(f),this.watchDirty(!1),this.watchHash(!0)},I.prototype.reloadContactList=function(a){var b=this,c=(this.contactsPage()-1)*xb.Defaults.ContactsPerPage;this.bDropPageAfterDelete=!1,(Ab.isUnd(a)?1:!a)||(this.contactsPage(1),c=0),this.contacts.loading(!0),Mb.remote().contacts(function(a,c){var d=0,e=[];yb.StorageResultType.Success===a&&c&&c.Result&&c.Result.List&&Ab.isNonEmptyArray(c.Result.List)&&(e=h.map(c.Result.List,function(a){var c=new v;return c.parse(a,b.contactsSharingIsAllowed)?c:null}),e=h.compact(e),d=Ab.pInt(c.Result.Count),d=d>0?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,xb.Defaults.ContactsPerPage,this.search())},I.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Mb.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Ab.pInt(a.value)),d.reloadContactList())}),this.initUploader()},I.prototype.onShow=function(){Fb.routeOff(),this.reloadContactList(!0)},I.prototype.onHide=function(){Fb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},Ab.extendAsViewModel("PopupsAdvancedSearchViewModel",J),J.prototype.buildSearchStringValue=function(a){return-1<a.indexOf(" ")&&(a='"'+a+'"'),a},J.prototype.buildSearchString=function(){var a=[],b=Ab.trim(this.from()),c=Ab.trim(this.to()),d=Ab.trim(this.subject()),e=Ab.trim(this.text()),g=[];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()&&g.push("attachments"),this.unseen()&&g.push("unseen"),this.starred()&&g.push("flag"),0<g.length&&a.push("has:"+g.join(",")),-1<this.selectedDateValue()&&a.push("date:"+f().subtract("days",this.selectedDateValue()).format("YYYY.MM.DD")+"/"),e&&""!==e&&a.push("text:"+this.buildSearchStringValue(e)),Ab.trim(a.join(" "))},J.prototype.clearPopup=function(){this.from(""),this.to(""),this.subject(""),this.text(""),this.selectedDateValue(-1),this.hasAttachments(!1),this.starred(!1),this.unseen(!1),this.fromFocus(!0)},J.prototype.onShow=function(){this.clearPopup()},J.prototype.onFocus=function(){this.fromFocus(!0)},Ab.extendAsViewModel("PopupsAddAccountViewModel",K),K.prototype.clearPopup=function(){this.email(""),this.login(""),this.password(""),this.emailError(!1),this.loginError(!1),this.passwordError(!1),this.submitRequest(!1),this.submitError("")},K.prototype.onShow=function(){this.clearPopup()},K.prototype.onFocus=function(){this.emailFocus(!0)},K.prototype.onBuild=function(){this.allowCustomLogin(!!Mb.settingsGet("AllowCustomLogin"))},Ab.extendAsViewModel("PopupsAddOpenPgpKeyViewModel",L),L.prototype.clearPopup=function(){this.key(""),this.key.error(!1)},L.prototype.onShow=function(){this.clearPopup()},L.prototype.onFocus=function(){this.key.focus(!0)},Ab.extendAsViewModel("PopupsViewOpenPgpKeyViewModel",M),M.prototype.clearPopup=function(){this.key("")},M.prototype.selectKey=function(){var a=this.keyDom();a&&Ab.selectElement(a)},M.prototype.onShow=function(a){this.clearPopup(),a&&this.key(a.armor)},Ab.extendAsViewModel("PopupsGenerateNewOpenPgpKeyViewModel",N),N.prototype.clearPopup=function(){this.name(""),this.password(""),this.email(""),this.email.error(!1),this.keyBitLength(2048)},N.prototype.onShow=function(){this.clearPopup()},N.prototype.onFocus=function(){this.email.focus(!0)},Ab.extendAsViewModel("PopupsComposeOpenPgpViewModel",O),O.prototype.clearPopup=function(){this.notification(""),this.password(""),this.password.focus(!1),this.from(""),this.to([]),this.text(""),this.submitRequest(!1),this.resultCallback=null},O.prototype.onHide=function(){this.clearPopup()},O.prototype.onShow=function(a,b,c,d,e,f){this.clearPopup();var g=new u,i="",j=[];this.resultCallback=a,g.clear(),g.mailsoParse(c),""!==g.email&&(i=g.email),""!==d&&j.push(d),""!==e&&j.push(e),""!==f&&j.push(f),j=j.join(", ").split(","),j=h.compact(h.map(j,function(a){return g.clear(),g.mailsoParse(Ab.trim(a)),""===g.email?!1:g.email})),this.from(i),this.to(j),this.text(b)},Ab.extendAsViewModel("PopupsIdentityViewModel",P),P.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("")},P.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===Mb.data().accountEmail()))},P.prototype.onFocus=function(){this.owner()||this.email.focused(!0)},Ab.extendAsViewModel("PopupsLanguagesViewModel",Q),Q.prototype.languageEnName=function(a){return Ab.convertLangName(a,!0)},Q.prototype.resetMainLanguage=function(){var a=Mb.data().mainLanguage();h.each(this.languages(),function(b){b.selected(b.key===a)})},Q.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},Q.prototype.onHide=function(){this.exp(!1)},Q.prototype.changeLanguage=function(a){Mb.data().mainLanguage(a),this.cancelCommand()},Ab.extendAsViewModel("PopupsTwoFactorTestViewModel",R),R.prototype.clearPopup=function(){this.code(""),this.code.focused(!1),this.code.status(null),this.testing(!1)},R.prototype.onShow=function(){this.clearPopup()},R.prototype.onFocus=function(){this.code.focused(!0)},Ab.extendAsViewModel("PopupsAskViewModel",S),S.prototype.clearPopup=function(){this.askDesc(""),this.yesButton(Ab.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton(Ab.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},S.prototype.yesClick=function(){Ab.isFunc(this.fYesAction)&&this.fYesAction.call(null),this.cancelCommand()},S.prototype.noClick=function(){Ab.isFunc(this.fNoAction)&&this.fNoAction.call(null),this.cancelCommand()},S.prototype.onShow=function(a,b,c,d,e){this.clearPopup(),this.fYesAction=b||null,this.fNoAction=c||null,this.askDesc(a||""),d&&this.yesButton(d),d&&this.yesButton(e)},S.prototype.onFocus=function(){this.yesFocus(!0)},S.prototype.onHide=function(){},S.prototype.onBuild=function(){var a=this;Jb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&(yb.EventKeyCode.Tab===b.keyCode||yb.EventKeyCode.Right===b.keyCode||yb.EventKeyCode.Left===b.keyCode)&&(a.yesFocus()?a.noFocus(!0):a.yesFocus(!0),c=!1),c})},Ab.extendAsViewModel("LoginViewModel",T),T.prototype.onShow=function(){Fb.routeOff(),h.delay(h.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0),Mb.settingsGet("UserLanguage")&&b.cookie("rllang",Mb.data().language(),{expires:30})},this),100)},T.prototype.onHide=function(){this.submitFocus(!1),this.emailFocus(!1)},T.prototype.onBuild=function(){var c=this,d=Mb.settingsGet("JsHash"),e=function(a){a=Ab.pInt(a),0===a?(c.submitRequest(!0),Mb.loginAndLogoutReload()):c.submitError(Ab.getNotification(a))};switch(this.facebookLoginEnabled(!!Mb.settingsGet("AllowFacebookSocial")),this.twitterLoginEnabled(!!Mb.settingsGet("AllowTwitterSocial")),this.googleLoginEnabled(!!Mb.settingsGet("AllowGoogleSocial")),(Mb.settingsGet("SignMe")||"unused").toLowerCase()){case yb.LoginSignMeTypeAsString.DefaultOff:this.signMeType(yb.LoginSignMeType.DefaultOff);break;case yb.LoginSignMeTypeAsString.DefaultOn:this.signMeType(yb.LoginSignMeType.DefaultOn);break;default:case yb.LoginSignMeTypeAsString.Unused:this.signMeType(yb.LoginSignMeType.Unused)}this.email(Mb.data().devEmail),this.login(Mb.data().devLogin),this.password(Mb.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(){Mb.data().language.subscribe(function(a){c.langRequest(!0),b.ajax({url:Mb.link().langLink(a),dataType:"script",cache:!0}).done(function(){c.bSendLanguage=!0,Ab.i18nToDoc(),b.cookie("rllang",Mb.data().language(),{expires:30})}).always(function(){c.langRequest(!1)})})},50)},T.prototype.selectLanguage=function(){Fb.showScreenPopup(Q)},h.extend(U.prototype,r.prototype),U.prototype.accountClick=function(a,b){if(a&&b&&!Ab.isUnd(b.which)&&1===b.which){var c=this;this.accountsLoading(!0),h.delay(function(){c.accountsLoading(!1)},1e3)}return!0},U.prototype.emailTitle=function(){return Mb.data().accountEmail()},U.prototype.settingsClick=function(){Fb.setHash(Mb.link().settings())},U.prototype.addAccountClick=function(){this.allowAddAccount&&Fb.showScreenPopup(K)},U.prototype.logoutClick=function(){Mb.remote().logout(function(){a.__rlah_clear&&a.__rlah_clear(),Mb.loginAndLogoutReload(!0,Mb.settingsGet("ParentEmail")&&0<Mb.settingsGet("ParentEmail").length)})},Ab.extendAsViewModel("MailBoxSystemDropDownViewModel",V,U),Ab.extendAsViewModel("SettingsSystemDropDownViewModel",W,U),Ab.extendAsViewModel("MailBoxFolderListViewModel",X),X.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(),Ab.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=Mb.data(),d=c.dataFor(this);d&&(yb.Layout.NoPreview===b.layout()&&b.message(null),d.fullNameRaw===b.currentFolderFullNameRaw()&&Mb.cache().setFolderHash(d.fullNameRaw,""),Fb.setHash(Mb.link().mailBox(d.fullNameHash)))})},X.prototype.messagesDropOver=function(b){a.clearTimeout(this.iDropOverTimer),b&&b.collapsed()&&(this.iDropOverTimer=a.setTimeout(function(){b.collapsed(!1),Ab.setExpandedFolder(b.fullNameHash,!0),Ab.windowResize()},500))},X.prototype.messagesDropOut=function(){a.clearTimeout(this.iDropOverTimer)},X.prototype.messagesDrop=function(a,b){if(a&&b&&b.helper){var c=b.helper.data("rl-folder"),d="1"===b.helper.data("rl-copy"),e=b.helper.data("rl-uids");Ab.isNormal(c)&&""!==c&&Ab.isArray(e)&&Mb.moveMessagesToFolder(c,e,a.fullNameRaw,d)}},X.prototype.composeClick=function(){Fb.showScreenPopup(H)},X.prototype.createFolder=function(){Fb.showScreenPopup(F)},X.prototype.configureFolders=function(){Fb.setHash(Mb.link().settings("folders"))},X.prototype.contactsClick=function(){this.allowContacts&&Fb.showScreenPopup(I)},Ab.extendAsViewModel("MailBoxMessageListViewModel",Y),Y.prototype.emptySubjectValue="",Y.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue),this.inputMessageListSearchFocus(!1)},Y.prototype.printableMessageCountForDeletion=function(){var a=this.messageListCheckedOrSelectedUidsWithSubMails().length;return a>1?" ("+(100>a?a:"99+")+")":""},Y.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},Y.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Mb.moveMessagesToFolder(Mb.data().currentFolderFullNameRaw(),Mb.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},Y.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=Ab.draggeblePlace();return c.data("rl-folder",Mb.data().currentFolderFullNameRaw()),c.data("rl-uids",Mb.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Mb.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},Y.prototype.onMessageResponse=function(a,b,c){var d=Mb.data();d.hideMessageBodies(),d.messageLoading(!1),yb.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):yb.StorageResultType.Unload===a?(d.message(null),d.messageError("")):yb.StorageResultType.Abort!==a&&(d.message(null),d.messageError(Ab.getNotification(b&&b.ErrorCode?b.ErrorCode:yb.Notification.UnknownError)))},Y.prototype.populateMessageBody=function(a){a&&(Mb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Mb.data().messageLoading(!0):Ab.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},Y.prototype.setAction=function(a,b,c){var d=[],e=null,f=Mb.cache(),g=0;if(Ab.isUnd(c)&&(c=Mb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0<d.length){switch(b){case yb.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),Mb.remote().messageSetSeen(Ab.emptyFunction,a,d,!0);break;case yb.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),Mb.remote().messageSetSeen(Ab.emptyFunction,a,d,!1);break;case yb.MessageSetAction.SetFlag:h.each(c,function(a){a.flagged(!0),f.storeMessageFlagsToCache(a)}),Mb.remote().messageSetFlagged(Ab.emptyFunction,a,d,!0);break;case yb.MessageSetAction.UnsetFlag:h.each(c,function(a){a.flagged(!1),f.storeMessageFlagsToCache(a)}),Mb.remote().messageSetFlagged(Ab.emptyFunction,a,d,!1)}Mb.reloadFlagsCurrentMessageListAndMessageFromCache()}},Y.prototype.setActionForAll=function(a,b){var c=null,d=Mb.data().messageList(),e=Mb.cache();if(""!==a&&(c=e.getFolderFromCacheList(a))){switch(b){case yb.MessageSetAction.SetSeen:c=e.getFolderFromCacheList(a),c&&(h.each(d,function(a){a.unseen(!1)}),c.messageCountUnread(0),e.clearMessageFlagsFromCacheByFolder(a)),Mb.remote().messageSetSeenToAll(Ab.emptyFunction,a,!0);break;case yb.MessageSetAction.UnsetSeen:c=e.getFolderFromCacheList(a),c&&(h.each(d,function(a){a.unseen(!0)}),c.messageCountUnread(c.messageCountAll()),e.clearMessageFlagsFromCacheByFolder(a)),Mb.remote().messageSetSeenToAll(Ab.emptyFunction,a,!1)}Mb.reloadFlagsCurrentMessageListAndMessageFromCache()}},Y.prototype.listSetSeen=function(){this.setAction(Mb.data().currentFolderFullNameRaw(),yb.MessageSetAction.SetSeen,Mb.data().messageListCheckedOrSelected())},Y.prototype.listSetAllSeen=function(){this.setActionForAll(Mb.data().currentFolderFullNameRaw(),yb.MessageSetAction.SetSeen)},Y.prototype.listUnsetSeen=function(){this.setAction(Mb.data().currentFolderFullNameRaw(),yb.MessageSetAction.UnsetSeen,Mb.data().messageListCheckedOrSelected())},Y.prototype.listSetFlags=function(){this.setAction(Mb.data().currentFolderFullNameRaw(),yb.MessageSetAction.SetFlag,Mb.data().messageListCheckedOrSelected())},Y.prototype.listUnsetFlags=function(){this.setAction(Mb.data().currentFolderFullNameRaw(),yb.MessageSetAction.UnsetFlag,Mb.data().messageListCheckedOrSelected())},Y.prototype.onBuild=function(a){var d=this,e=Mb.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()&&(Mb.data().messageListThreadFolder(b.folderFullNameRaw),a=Mb.data().messageListThreadUids(),b.lastInCollapsedThread()?a.push(0<b.parentUid()?b.parentUid():b.uid):a=h.without(a,0<b.parentUid()?b.parentUid():b.uid),Mb.data().messageListThreadUids(h.uniq(a)),b.lastInCollapsedThreadLoading(!0),b.lastInCollapsedThread(!b.lastInCollapsedThread()),Mb.reloadMessageList()),!1}),this.selector.init(this.oContentVisible,this.oContentScrollable),Kb.on("keydown",function(a){var b=!0,c=a?a.keyCode:0;return a&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!Mb.popupVisibility()&&!e.messageFullScreenMode()&&!Ab.inFocus()&&(yb.Layout.NoPreview===e.layout()&&(e.message()||yb.EventKeyCode.Delete!==c&&yb.EventKeyCode.A!==c)||a.ctrlKey&&yb.EventKeyCode.A===c&&(d.checkAll(!(d.checkAll()&&!d.isIncompleteChecked())),b=!1)),b}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&Fb.setHash(Mb.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<Ab.inArray(a.uid,f)?d.setAction(a.folderFullNameRaw,a.flagged()?yb.MessageSetAction.UnsetFlag:yb.MessageSetAction.SetFlag,b):d.setAction(a.folderFullNameRaw,a.flagged()?yb.MessageSetAction.UnsetFlag:yb.MessageSetAction.SetFlag,[a]))}),c.computed(function(){var a=Mb.data(),b=this.viewModelVisibility(),c=Mb.popupVisibility(),d=a.useKeyboardShortcuts(),e=a.messageFullScreenMode();this.selector.useKeyboard(b&&d&&!e&&!c)},this).extend({notify:"always"}),this.initUploaderForAppend(),!Db.bMobileDevice&&Mb.settingsGet("AllowPrefetch")&&i&&(i.setIdleDuration(10),i.idle(function(){d.prefetchNextTick()}))},Y.prototype.prefetchNextTick=function(){if(!this.bPrefetch&&!i.now()&&this.viewModelVisibility()){var a=this,b=Mb.cache(),c=h.find(this.messageList(),function(a){return a&&!b.hasRequestedMessage(a.folderFullNameRaw,a.uid)});c&&(this.bPrefetch=!0,Mb.cache().addRequestedMessage(c.folderFullNameRaw,c.uid),Mb.remote().message(function(b,c){var d=!(yb.StorageResultType.Success!==b||!c||!c.Result);h.delay(function(){a.bPrefetch=!1,d&&a.prefetchNextTick()},1e3)},c.folderFullNameRaw,c.uid))}},Y.prototype.composeClick=function(){Fb.showScreenPopup(H)},Y.prototype.advancedSearchClick=function(){Fb.showScreenPopup(J)},Y.prototype.quotaTooltip=function(){return Ab.i18n("MESSAGE_LIST/QUOTA_SIZE",{SIZE:Ab.friendlySize(this.userUsageSize()),PROC:this.userUsageProc(),LIMIT:Ab.friendlySize(this.userQuota())})},Y.prototype.initUploaderForAppend=function(){if(!Mb.settingsGet("AllowAppendMessage")||!this.dragOverArea())return!1;var a=new g({action:Mb.link().append(),name:"AppendFile",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,hidden:{Folder:function(){return Mb.data().currentFolderFullNameRaw()}},dragAndDropElement:this.dragOverArea(),dragAndDropBodyElement:this.dragOverBodyArea()});return a.on("onDragEnter",h.bind(function(){this.dragOverEnter(!0)},this)).on("onDragLeave",h.bind(function(){this.dragOverEnter(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragOver(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragOver(!1)},this)).on("onSelect",h.bind(function(a,b){return a&&b&&"message/rfc822"===b.Type?(Mb.data().messageListLoading(!0),!0):!1},this)).on("onComplete",h.bind(function(){Mb.reloadMessageList(!0,!0)},this)),!!a},Ab.extendAsViewModel("MailBoxMessageViewViewModel",Z),Z.prototype.isPgpActionVisible=function(){return yb.SignedVerifyStatus.Success!==this.viewPgpSignedVerifyStatus()},Z.prototype.isPgpStatusVerifyVisible=function(){return yb.SignedVerifyStatus.None!==this.viewPgpSignedVerifyStatus()},Z.prototype.isPgpStatusVerifySuccess=function(){return yb.SignedVerifyStatus.Success===this.viewPgpSignedVerifyStatus()},Z.prototype.pgpStatusVerifyMessage=function(){var a="";switch(this.viewPgpSignedVerifyStatus()){case yb.SignedVerifyStatus.UnknownPublicKeys:a="No public keys found";break;case yb.SignedVerifyStatus.UnknownPrivateKey:a="No private key found";break;case yb.SignedVerifyStatus.Unverified:a="Unverified signature";break;case yb.SignedVerifyStatus.Error:a="OpenPGP decryption error";break;case yb.SignedVerifyStatus.Success:a="Good signature from "+this.viewPgpSignedVerifyUser()}return a},Z.prototype.scrollToTop=function(){var a=b(".messageItem.nano .content",this.viewModelDom);a&&a[0]?a.scrollTop(0):b(".messageItem",this.viewModelDom).scrollTop(0),Ab.windowResize()},Z.prototype.fullScreen=function(){this.fullScreenMode(!0),Ab.windowResize()},Z.prototype.unFullScreen=function(){this.fullScreenMode(!1),Ab.windowResize()},Z.prototype.toggleFullScreen=function(){Ab.removeSelection(),this.fullScreenMode(!this.fullScreenMode()),Ab.windowResize()},Z.prototype.replyOrforward=function(a){Fb.showScreenPopup(H,[a,Mb.data().message()])},Z.prototype.onBuild=function(a){var d=this,e=Mb.data();Kb.on("keydown",function(a){var b=!0,c=a?a.keyCode:0;return c>0&&yb.EventKeyCode.Esc===c&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!Ab.inFocus()&&e.message()&&(d.fullScreenMode(!1),yb.Layout.NoPreview===e.layout()&&Mb.historyBack(),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("mousedown","a",function(a){return!(a&&3!==a.which&&Mb.mailToHelper(b(this).attr("href")))}).on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Mb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},Z.prototype.isDraftFolder=function(){return Mb.data().message()&&Mb.data().draftFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isSentFolder=function(){return Mb.data().message()&&Mb.data().sentFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isSpamFolder=function(){return Mb.data().message()&&Mb.data().spamFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isSpamDisabled=function(){return Mb.data().message()&&Mb.data().spamFolder()===xb.Values.UnuseOptionValue},Z.prototype.isArchiveFolder=function(){return Mb.data().message()&&Mb.data().archiveFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isArchiveDisabled=function(){return Mb.data().message()&&Mb.data().archiveFolder()===xb.Values.UnuseOptionValue},Z.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},Z.prototype.composeClick=function(){Fb.showScreenPopup(H)},Z.prototype.editMessage=function(){Mb.data().message()&&Fb.showScreenPopup(H,[yb.ComposeType.Draft,Mb.data().message()])},Z.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},Z.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},Z.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},Z.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage(this.viewPgpPassword())},Z.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Mb.remote().sendReadReceiptMessage(Ab.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),Ab.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),Ab.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":a.readReceipt()})),a.isReadReceipt(!0),Mb.cache().storeMessageFlagsToCache(a),Mb.reloadFlagsCurrentMessageListAndMessageFromCache())},Ab.extendAsViewModel("SettingsMenuViewModel",$),$.prototype.link=function(a){return Mb.link().settings(a)},$.prototype.backToMailBoxClick=function(){Fb.setHash(Mb.link().inbox())},Ab.extendAsViewModel("SettingsPaneViewModel",_),_.prototype.onShow=function(){Mb.data().message(null)},_.prototype.backToMailBoxClick=function(){Fb.setHash(Mb.link().inbox())},Ab.addSettingsViewModel(ab,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),ab.prototype.toggleLayout=function(){this.layout(yb.Layout.NoPreview===this.layout()?yb.Layout.SidePreview:yb.Layout.NoPreview)},ab.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Mb.data(),d=Ab.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(yb.SaveSettingsStep.Animate),b.ajax({url:Mb.link().langLink(c),dataType:"script",cache:!0}).done(function(){Ab.i18nToDoc(),a.languageTrigger(yb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(yb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(yb.SaveSettingsStep.Idle)},1e3)}),Mb.remote().saveSettings(Ab.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Mb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){Ab.timeOutAction("SaveDesktopNotifications",function(){Mb.remote().saveSettings(Ab.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){Ab.timeOutAction("SaveReplySameFolder",function(){Mb.remote().saveSettings(Ab.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Mb.remote().saveSettings(Ab.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Mb.remote().saveSettings(Ab.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},ab.prototype.onShow=function(){Mb.data().desktopNotifications.valueHasMutated()},ab.prototype.selectLanguage=function(){Fb.showScreenPopup(Q)},Ab.addSettingsViewModel(bb,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),bb.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},bb.prototype.onBuild=function(){Mb.data().contactsAutosave.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{ContactsAutosave:a?"1":"0"})})},bb.prototype.onShow=function(){this.showPassword(!1)},Ab.addSettingsViewModel(cb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),cb.prototype.addNewAccount=function(){Fb.showScreenPopup(K)},cb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Mb.remote().accountDelete(function(b,c){yb.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Fb.routeOff(),Fb.setHash(Mb.link().root(),!0),Fb.routeOff(),h.defer(function(){a.location.reload()})):Mb.accountsAndIdentities()},b.email))}},Ab.addSettingsViewModel(db,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),db.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Mb.data().signature();this.editor=new k(a.signatureDom(),function(){Mb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},db.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Mb.data(),c=Ab.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=Ab.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=Ab.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Mb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Mb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Mb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Mb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Ab.addSettingsViewModel(eb,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),eb.prototype.addNewIdentity=function(){Fb.showScreenPopup(P)},eb.prototype.editIdentity=function(a){Fb.showScreenPopup(P,[a])},eb.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Mb.remote().identityDelete(function(){Mb.accountsAndIdentities()},a.id))}},eb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Mb.data().signature();this.editor=new k(a.signatureDom(),function(){Mb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())
|
||
},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},eb.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=Mb.data(),c=Ab.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=Ab.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=Ab.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Mb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Mb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Mb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Mb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Ab.addSettingsViewModel(fb,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),fb.prototype.createTwoFactor=function(){this.processing(!0),Mb.remote().createTwoFactor(this.onResult)},fb.prototype.enableTwoFactor=function(){this.processing(!0),Mb.remote().enableTwoFactor(this.onResult,this.viewEnable())},fb.prototype.testTwoFactor=function(){Fb.showScreenPopup(R)},fb.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),Mb.remote().clearTwoFactor(this.onResult)},fb.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},fb.prototype.onResult=function(a,b){if(this.processing(!1),this.clearing(!1),yb.StorageResultType.Success===a&&b&&b.Result?(this.viewUser(Ab.pString(b.Result.User)),this.viewEnable(!!b.Result.Enable),this.twoFactorStatus(!!b.Result.IsSet),this.viewSecret(Ab.pString(b.Result.Secret)),this.viewBackupCodes(Ab.pString(b.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Ab.pString(b.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var c=this;this.viewEnable.subscribe(function(a){this.viewEnable.subs&&Mb.remote().enableTwoFactor(function(a,b){yb.StorageResultType.Success===a&&b&&b.Result||(c.viewEnable.subs=!1,c.viewEnable(!1),c.viewEnable.subs=!0)},a)},this)}},fb.prototype.onBuild=function(){this.processing(!0),Mb.remote().getTwoFactor(this.onResult)},Ab.addSettingsViewModel(gb,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Ab.addSettingsViewModel(hb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),hb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},hb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),yb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},Ab.addSettingsViewModel(ib,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),ib.prototype.folderEditOnEnter=function(a){var b=a?Ab.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,""),Mb.data().foldersRenaming(!0),Mb.remote().folderRename(function(a,b){Mb.data().foldersRenaming(!1),yb.StorageResultType.Success===a&&b&&b.Result||Mb.data().foldersListError(b&&b.ErrorCode?Ab.getNotification(b.ErrorCode):Ab.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Mb.folders()},a.fullNameRaw,b),Mb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},ib.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},ib.prototype.onShow=function(){Mb.data().foldersListError("")},ib.prototype.createFolder=function(){Fb.showScreenPopup(F)},ib.prototype.systemFolder=function(){Fb.showScreenPopup(G)},ib.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&&(Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,""),Mb.data().folderList.remove(b),Mb.data().foldersDeleting(!0),Mb.remote().folderDelete(function(a,b){Mb.data().foldersDeleting(!1),yb.StorageResultType.Success===a&&b&&b.Result||Mb.data().foldersListError(b&&b.ErrorCode?Ab.getNotification(b.ErrorCode):Ab.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Mb.folders()},a.fullNameRaw),Mb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0<a.privateMessageCountAll()&&Mb.data().foldersListError(Ab.getNotification(yb.Notification.CantDeleteNonEmptyFolder))},ib.prototype.subscribeFolder=function(a){Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,""),Mb.remote().folderSetSubscribe(Ab.emptyFunction,a.fullNameRaw,!0),a.subScribed(!0)},ib.prototype.unSubscribeFolder=function(a){Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,""),Mb.remote().folderSetSubscribe(Ab.emptyFunction,a.fullNameRaw,!1),a.subScribed(!1)},Ab.addSettingsViewModel(jb,"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes"),jb.prototype.removeCustomThemeImg=function(){this.customThemeImg("")},jb.prototype.onBuild=function(){var a=this,b=Mb.data().theme();this.themesObjects(h.map(Mb.data().themes(),function(a){return{name:a,nameDisplay:Ab.convertThemeName(a),selected:c.observable(a===b),themePreviewSrc:Mb.link().themePreviewLink(a)}})),h.delay(function(){a.customThemeType.subscribe(function(a){Mb.remote().saveSettings(function(){Mb.data().theme.valueHasMutated()},{CustomThemeType:a})}),a.customThemeImg.subscribe(function(a){Mb.remote().saveSettings(function(){Mb.data().theme.valueHasMutated()},{CustomThemeImg:a})})},50),this.initCustomThemeUploader()},jb.prototype.initCustomThemeUploader=function(){if(this.customThemeUploaderButton()){var b=new g({action:Mb.link().uploadBackground(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,clickElement:this.customThemeUploaderButton()});return b.on("onSelect",h.bind(function(b,c){var d=Ab.isUnd(c.FileName)?"":c.FileName.toString(),e=d.substring(d.length-4,d.length),f=Ab.isNormal(c.Size)?Ab.pInt(c.Size):null;return-1===Ab.inArray(e,["jpeg",".jpg",".png"])?(a.alert(Ab.i18n("SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR")),!1):f>1048576?(a.alert(Ab.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(){this.customThemeUploaderProgress(!0)},this)).on("onComplete",h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(Ab.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:yb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},Ab.addSettingsViewModel(kb,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),kb.prototype.addOpenPgpKey=function(){Fb.showScreenPopup(L)},kb.prototype.generateOpenPgpKey=function(){Fb.showScreenPopup(N)},kb.prototype.viewOpenPgpKey=function(a){a&&Fb.showScreenPopup(M,[a])},kb.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Mb.data().openpgpKeyring,d=function(b){return a===b};a&&c&&(this.openpgpkeys.remove(d),h.each(c.keys,function(c,d){-1===b&&c&&c.primaryKey&&a.guid===c.primaryKey.getFingerprint()&&a.isPrivate===c.isPrivate()&&(b=d)}),b>=0&&c.removeKey(b),c.store(),Mb.reloadOpenPgpKeys())}},lb.prototype.populateDataOnStart=function(){var a=Ab.pInt(Mb.settingsGet("Layout")),b=Mb.settingsGet("Languages"),c=Mb.settingsGet("Themes");Ab.isArray(b)&&this.languages(b),Ab.isArray(c)&&this.themes(c),this.mainLanguage(Mb.settingsGet("Language")),this.mainTheme(Mb.settingsGet("Theme")),this.allowCustomTheme(!!Mb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Mb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Mb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Mb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Mb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Mb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Mb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Mb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Mb.settingsGet("EditorDefaultType")),this.showImages(!!Mb.settingsGet("ShowImages")),this.contactsAutosave(!!Mb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Mb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Mb.settingsGet("MPP")),this.desktopNotifications(!!Mb.settingsGet("DesktopNotifications")),this.useThreads(!!Mb.settingsGet("UseThreads")),this.replySameFolder(!!Mb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Mb.settingsGet("UseCheckboxesInList")),this.layout(yb.Layout.SidePreview),-1<Ab.inArray(a,[yb.Layout.NoPreview,yb.Layout.SidePreview,yb.Layout.BottomPreview])&&this.layout(a),this.facebookEnable(!!Mb.settingsGet("AllowFacebookSocial")),this.facebookAppID(Mb.settingsGet("FacebookAppID")),this.facebookAppSecret(Mb.settingsGet("FacebookAppSecret")),this.twitterEnable(!!Mb.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(Mb.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(Mb.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!Mb.settingsGet("AllowGoogleSocial")),this.googleClientID(Mb.settingsGet("GoogleClientID")),this.googleClientSecret(Mb.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!Mb.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(Mb.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!Mb.settingsGet("ContactsIsAllowed"))},h.extend(mb.prototype,lb.prototype),mb.prototype.purgeMessageBodyCache=function(){var a=0,c=null,d=Db.iMessageBodyCacheCount-xb.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)))},mb.prototype.populateDataOnStart=function(){lb.prototype.populateDataOnStart.call(this),this.accountEmail(Mb.settingsGet("Email")),this.accountIncLogin(Mb.settingsGet("IncLogin")),this.accountOutLogin(Mb.settingsGet("OutLogin")),this.projectHash(Mb.settingsGet("ProjectHash")),this.displayName(Mb.settingsGet("DisplayName")),this.replyTo(Mb.settingsGet("ReplyTo")),this.signature(Mb.settingsGet("Signature")),this.signatureToAll(!!Mb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Mb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Mb.local().get(yb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Mb.settingsGet("RemoteSuggestions"),this.devEmail=Mb.settingsGet("DevEmail"),this.devLogin=Mb.settingsGet("DevLogin"),this.devPassword=Mb.settingsGet("DevPassword")},mb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Ab.isNormal(c)&&""!==c){if(Ab.isArray(d)&&0<d.length){var e=Mb.cache(),f=0,g=d.length,i=function(b,c,d){var e=null;Lb&&Mb.data().useDesktopNotifications()&&(e=new Lb(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(Mb.link().notificationMailIcon(),Mb.data().accountEmail(),Ab.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Mb.link().notificationMailIcon(),z.emailsToLine(z.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Mb.cache().setFolderUidNext(b,c)}},mb.prototype.folderResponseParseRec=function(a,b){var c=0,d=0,e=null,f=null,g="",h=[],i=[];for(c=0,d=b.length;d>c;c++)e=b[c],e&&(g=e.FullNameRaw,f=Mb.cache().getFolderFromCacheList(g),f||(f=A.newInstanceFromJson(e),f&&(Mb.cache().setFolderToCacheList(g,f),Mb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=xb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!Ab.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Mb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Ab.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Ab.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Ab.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},mb.prototype.setFolders=function(a){var b=[],c=!1,d=Mb.data(),e=function(a){return""===a||xb.Values.UnuseOptionValue===a||null!==Mb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Ab.isArray(a.Result["@Collection"])&&(Ab.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Mb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Mb.settingsGet("SentFolder")+Mb.settingsGet("DraftFolder")+Mb.settingsGet("SpamFolder")+Mb.settingsGet("TrashFolder")+Mb.settingsGet("ArchiveFolder")+Mb.settingsGet("NullFolder")&&(Mb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Mb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Mb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Mb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Mb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Mb.settingsGet("SentFolder"))),d.draftFolder(e(Mb.settingsGet("DraftFolder"))),d.spamFolder(e(Mb.settingsGet("SpamFolder"))),d.trashFolder(e(Mb.settingsGet("TrashFolder"))),d.archiveFolder(e(Mb.settingsGet("ArchiveFolder"))),c&&Mb.remote().saveSystemFolders(Ab.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},mb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},mb.prototype.getNextFolderNames=function(a){a=Ab.isUnd(a)?!1:!!a;var b=[],c=10,d=f().unix(),e=d-300,g=[],i=function(b){h.each(b,function(b){b&&"INBOX"!==b.fullNameRaw&&b.selectable&&b.existen&&e>b.interval&&(!a||b.subScribed())&&g.push([b.interval,b.fullNameRaw]),b&&0<b.subFolders().length&&i(b.subFolders())})};return i(this.folderList()),g.sort(function(a,b){return a[0]<b[0]?-1:a[0]>b[0]?1:0}),h.find(g,function(a){var e=Mb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},mb.prototype.removeMessagesFromList=function(a,b,c,d){c=Ab.isNormal(c)?c:"",d=Ab.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Ab.pInt(a)});var e=0,f=Mb.data(),g=Mb.cache(),i=Mb.cache().getFolderFromCacheList(a),j=""===c?null:g.getFolderFromCacheList(c||""),k=f.currentFolderFullNameRaw(),l=f.message(),m=k===a?h.filter(f.messageList(),function(a){return a&&-1<Ab.inArray(Ab.pInt(a.uid),b)}):[];h.each(m,function(a){a&&a.unseen()&&e++}),i&&!d&&(i.messageCountAll(0<=i.messageCountAll()-b.length?i.messageCountAll()-b.length:0),e>0&&i.messageCountUnread(0<=i.messageCountUnread()-e?i.messageCountUnread()-e:0)),j&&(j.messageCountAll(j.messageCountAll()+b.length),e>0&&j.messageCountUnread(j.messageCountUnread()+e),j.actionBlink(!0)),0<m.length&&(d?h.each(m,function(a){a.checked(!1)}):(f.messageListIsNotCompleted(!0),h.each(m,function(a){l&&l.requestHash===a.requestHash&&(l=null,f.message(null)),a.deleted(!0)}),h.delay(function(){h.each(m,function(a){f.messageList.remove(a)})},400))),""!==a&&g.setFolderHash(a,""),""!==c&&g.setFolderHash(c,"")},mb.prototype.setMessage=function(a,c){var d=!1,e=!1,f=!1,g=null,h=null,i="",j="",k=!1,l=!1,m=this.messagesBodiesDom(),n=this.message();a&&n&&a.Result&&"Object/Message"===a.Result["@Object"]&&n.folderFullNameRaw===a.Result.Folder&&n.uid===a.Result.Uid&&(this.messageError(""),n.initUpdateByMessageJson(a.Result),Mb.cache().addRequestedMessage(n.folderFullNameRaw,n.uid),c||n.initFlagsByJson(a.Result),m=m&&m[0]?m:null,m&&(i="rl-mgs-"+n.hash.replace(/[^a-zA-Z0-9]/g,""),h=m.find("#"+i),h&&h[0]?(n.body=h,n.body&&(n.body.data("rl-cache-count",++Db.iMessageBodyCacheCount),n.fetchDataToDom())):(e=!!a.Result.HasExternals,f=!!a.Result.HasInternals,g=b('<div id="'+i+'" />').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Db.iMessageBodyCacheCount),Ab.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Ab.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Mb.data().allowOpenPGP()&&Ab.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Ab.pString(a.Result.PlainRaw),l=/---BEGIN PGP MESSAGE---/.test(n.plainRaw),l||(k=/-----BEGIN PGP SIGNED MESSAGE-----/.test(n.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(n.plainRaw)),Nb.empty(),k&&n.isPgpSigned()?j=Nb.append(b('<pre class="b-plain-openpgp signed"></pre>').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Nb.append(b('<pre class="b-plain-openpgp encrypted"></pre>').text(n.plainRaw)).html()),Nb.empty(),n.isPgpSigned(k),n.isPgpEncrypted(l)),g.html(j).addClass("b-text-part plain")):d=!1,n.isHtml(!!d),n.hasImages(!!e),n.pgpSignedVerifyStatus(yb.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(this.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),n.storeDataToDom(),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Ab.initBlockquoteSwitcher(g)),Mb.cache().initMessageFlagsFromCache(n),n.unseen()&&Mb.setMessageSeen(n),Ab.windowResize())},mb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Ab.isArray(a.Result["@Collection"])){var c=Mb.data(),d=Mb.cache(),e=null,g=0,h=0,i=0,j=0,k=[],l=f().unix(),m=c.staticMessageList,n=null,o=null,p=null,q=0,r=!1;for(i=Ab.pInt(a.Result.MessageResultCount),j=Ab.pInt(a.Result.Offset),Ab.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Mb.cache().getFolderFromCacheList(Ab.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Mb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Ab.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Ab.isNormal(a.Result.MessageUnseenCount)&&(Ab.pInt(p.messageCountUnread())!==Ab.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Mb.cache().clearMessageFlagsFromCacheByFolder(p.fullNameRaw),g=0,h=a.Result["@Collection"].length;h>g;g++)n=a.Result["@Collection"][g],n&&"Object/Message"===n["@Object"]&&(o=m[g],o&&o.initByJson(n)||(o=z.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Mb.cache().initMessageFlagsFromCache(o):Mb.cache().storeMessageFlagsToCache(o),o.lastInCollapsedThread(e&&-1<Ab.inArray(Ab.pInt(o.uid),e)?!0:!1),k.push(o)));c.messageListCount(i),c.messageListSearch(Ab.isNormal(a.Result.Search)?a.Result.Search:""),c.messageListEndSearch(Ab.isNormal(a.Result.Search)?a.Result.Search:""),c.messageListEndFolder(Ab.isNormal(a.Result.Folder)?a.Result.Folder:""),c.messageListPage(Math.ceil(j/c.messagesPerPage()+1)),c.messageList(k),c.messageListIsNotCompleted(!1),o=c.message(),o&&c.messageList.setSelectedByUid&&c.messageList.setSelectedByUid(o.generateUid()),m.length<k.length&&(c.staticMessageList=k),d.clearNewMessageCache(),p&&(b||r||Mb.data().useThreads())&&Mb.folderInformation(p.fullNameRaw,k)}else Mb.data().messageListCount(0),Mb.data().messageList([]),Mb.data().messageListError(Ab.getNotification(a&&a.ErrorCode?a.ErrorCode:yb.Notification.CantGetMessageList))},mb.prototype.findPublicKeyByHex=function(a){return h.find(this.openpgpkeysPublic(),function(b){return b&&a===b.id})},mb.prototype.findPublicKeysByEmail=function(b){return h.compact(h.map(this.openpgpkeysPublic(),function(c){var d=null;if(c&&b===c.email)try{if(d=a.openpgp.key.readArmored(c.armor),d&&!d.err&&d.keys&&d.keys[0])return d.keys[0]}catch(e){}return null}))},mb.prototype.findPrivateKeyByEmail=function(b,c){var d=null,e=h.find(this.openpgpkeysPrivate(),function(a){return a&&b===a.email});if(e)try{d=a.openpgp.key.readArmored(e.armor),d&&!d.err&&d.keys&&d.keys[0]?(d=d.keys[0],d.decrypt(Ab.pString(c))):d=null}catch(f){d=null}return d},mb.prototype.findSelfPrivateKey=function(a){return this.findPrivateKeyByEmail(this.accountEmail(),a)},nb.prototype.oRequests={},nb.prototype.defaultResponse=function(b,c,d,e,f,g){var i=function(){yb.StorageResultType.Success!==d&&Db.bUnload&&(d=yb.StorageResultType.Unload),yb.StorageResultType.Success===d&&e&&!e.Result?(e&&-1<Ab.inArray(e.ErrorCode,[yb.Notification.AuthError,yb.Notification.AccessError,yb.Notification.ConnectionError,yb.Notification.DomainNotAllowed,yb.Notification.AccountNotAllowed,yb.Notification.MailServerError,yb.Notification.UnknownNotification,yb.Notification.UnknownError])&&Db.iAjaxErrorCount++,e&&yb.Notification.InvalidToken===e.ErrorCode&&Db.iTokenErrorCount++,xb.Values.TokenErrorLimit<Db.iTokenErrorCount&&Mb.loginAndLogoutReload(!0),(e.Logout||xb.Values.AjaxErrorLimit<Db.iAjaxErrorCount)&&(a.__rlah_clear&&a.__rlah_clear(),Mb.loginAndLogoutReload(!0))):yb.StorageResultType.Success===d&&e&&e.Result&&(Db.iAjaxErrorCount=0,Db.iTokenErrorCount=0),b&&(Bb.runHook("ajax-default-response",[c,yb.StorageResultType.Success===d?e:null,d,f,g]),b(d,yb.StorageResultType.Success===d?e:null,f,c,g))};switch(d){case"success":d=yb.StorageResultType.Success;break;case"abort":d=yb.StorageResultType.Abort;break;default:d=yb.StorageResultType.Error}yb.StorageResultType.Error===d?h.delay(i,300):i()},nb.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=Ab.isNormal(e)?e:2e4,f=Ab.isUnd(f)?"":Ab.pString(f),g=Ab.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=Mb.settingsGet("Token")),m=b.ajax({type:j?"POST":"GET",url:Mb.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=Ab.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<Ab.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},nb.prototype.defaultRequest=function(a,b,c,d,e,f){c=c||{},c.Action=b,e=Ab.pString(e),Bb.runHook("ajax-default-request",[b,c,e]),this.ajaxRequest(a,c,Ab.isUnd(d)?xb.Defaults.DefaultAjaxTimeout:Ab.pInt(d),e,f)},nb.prototype.noop=function(a){this.defaultRequest(a,"Noop")},nb.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})},nb.prototype.jsInfo=function(a,b,c,d){this.defaultRequest(a,"JsInfo",{Type:b,Data:c,IsError:(Ab.isUnd(d)?1:!d)?"0":"1"})},nb.prototype.jsVersion=function(a,b){this.defaultRequest(a,"Version",{Version:b})},h.extend(ob.prototype,nb.prototype),ob.prototype.folders=function(a){this.defaultRequest(a,"Folders",{SentFolder:Mb.settingsGet("SentFolder"),DraftFolder:Mb.settingsGet("DraftFolder"),SpamFolder:Mb.settingsGet("SpamFolder"),TrashFolder:Mb.settingsGet("TrashFolder"),ArchiveFolder:Mb.settingsGet("ArchiveFolder")},null,"",["Folders"])},ob.prototype.login=function(a,b,c,d,e,f,g){this.defaultRequest(a,"Login",{Email:b,Login:c,Password:d,Language:f||"",AdditionalCode:g||"",SignMe:e?"1":"0"})},ob.prototype.getTwoFactor=function(a){this.defaultRequest(a,"GetTwoFactorInfo")},ob.prototype.createTwoFactor=function(a){this.defaultRequest(a,"CreateTwoFactorSecret")},ob.prototype.clearTwoFactor=function(a){this.defaultRequest(a,"ClearTwoFactorInfo")},ob.prototype.testTwoFactor=function(a,b){this.defaultRequest(a,"TestTwoFactorInfo",{Code:b})},ob.prototype.enableTwoFactor=function(a,b){this.defaultRequest(a,"EnableTwoFactor",{Enable:b?"1":"0"})},ob.prototype.clearTwoFactorInfo=function(a){this.defaultRequest(a,"ClearTwoFactorInfo")},ob.prototype.accountAdd=function(a,b,c,d){this.defaultRequest(a,"AccountAdd",{Email:b,Login:c,Password:d})},ob.prototype.accountDelete=function(a,b){this.defaultRequest(a,"AccountDelete",{EmailToDelete:b})},ob.prototype.identityUpdate=function(a,b,c,d,e,f){this.defaultRequest(a,"IdentityUpdate",{Id:b,Email:c,Name:d,ReplyTo:e,Bcc:f})},ob.prototype.identityDelete=function(a,b){this.defaultRequest(a,"IdentityDelete",{IdToDelete:b})},ob.prototype.accountsAndIdentities=function(a){this.defaultRequest(a,"AccountsAndIdentities")},ob.prototype.messageList=function(a,b,c,d,e,f){b=Ab.pString(b);var g=Mb.data(),h=Mb.cache().getFolderHash(b);f=Ab.isUnd(f)?!1:!!f,c=Ab.isUnd(c)?0:Ab.pInt(c),d=Ab.isUnd(c)?20:Ab.pInt(d),e=Ab.pString(e),""===h||""!==e&&-1!==e.indexOf("has:")?this.defaultRequest(a,"MessageList",{Folder:b,Offset:c,Limit:d,Search:e,UidNext:"INBOX"===b?Mb.cache().getFolderUidNext(b):"",UseThreads:Mb.data().threading()&&Mb.data().useThreads()?"1":"0",ExpandedThreadUid:g.threading()&&b===g.messageListThreadFolder()?g.messageListThreadUids().join(","):""},""===e?xb.Defaults.DefaultAjaxTimeout:xb.Defaults.SearchAjaxTimeout,"",f?[]:["MessageList"]):this.defaultRequest(a,"MessageList",{},""===e?xb.Defaults.DefaultAjaxTimeout:xb.Defaults.SearchAjaxTimeout,"MessageList/"+Cb.urlsafe_encode([b,c,d,e,g.projectHash(),h,"INBOX"===b?Mb.cache().getFolderUidNext(b):"",g.threading()&&g.useThreads()?"1":"0",g.threading()&&b===g.messageListThreadFolder()?g.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),f?[]:["MessageList"])},ob.prototype.messageUploadAttachments=function(a,b){this.defaultRequest(a,"MessageUploadAttachments",{Attachments:b},999e3)},ob.prototype.message=function(a,b,c){return b=Ab.pString(b),c=Ab.pInt(c),Mb.cache().getFolderFromCacheList(b)&&c>0?(this.defaultRequest(a,"Message",{},null,"Message/"+Cb.urlsafe_encode([b,c,Mb.data().projectHash(),Mb.data().threading()&&Mb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},ob.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},ob.prototype.folderInformation=function(a,b,c){var d=!0,e=Mb.cache(),f=[];Ab.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:Ab.isArray(f)?f.join(","):"",UidNext:"INBOX"===b?Mb.cache().getFolderUidNext(b):""}):Mb.data().useThreads()&&Mb.reloadFlagsCurrentMessageListAndMessageFromCache()},ob.prototype.folderInformationMultiply=function(a,b){this.defaultRequest(a,"FolderInformationMultiply",{Folders:b})},ob.prototype.logout=function(a){this.defaultRequest(a,"Logout")},ob.prototype.messageSetFlagged=function(a,b,c,d){this.defaultRequest(a,"MessageSetFlagged",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})},ob.prototype.messageSetSeen=function(a,b,c,d){this.defaultRequest(a,"MessageSetSeen",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})},ob.prototype.messageSetSeenToAll=function(a,b,c){this.defaultRequest(a,"MessageSetSeenToAll",{Folder:b,SetAction:c?"1":"0"})},ob.prototype.saveMessage=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){this.defaultRequest(a,"SaveMessage",{MessageFolder:b,MessageUid:c,DraftFolder:d,From:e,To:f,Cc:g,Bcc:h,Subject:i,TextIsHtml:j?"1":"0",Text:k,DraftInfo:m,InReplyTo:n,References:o,Attachments:l},xb.Defaults.SaveMessageAjaxTimeout)},ob.prototype.sendReadReceiptMessage=function(a,b,c,d,e,f){this.defaultRequest(a,"SendReadReceiptMessage",{MessageFolder:b,MessageUid:c,ReadReceipt:d,Subject:e,Text:f})},ob.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,SentFolder:d,From:e,To:f,Cc:g,Bcc:h,Subject:i,TextIsHtml:j?"1":"0",Text:k,DraftInfo:m,InReplyTo:n,References:o,ReadReceiptRequest:p?"1":"0",Attachments:l},xb.Defaults.SendMessageAjaxTimeout)},ob.prototype.saveSystemFolders=function(a,b){this.defaultRequest(a,"SystemFoldersUpdate",b)},ob.prototype.saveSettings=function(a,b){this.defaultRequest(a,"SettingsUpdate",b)},ob.prototype.changePassword=function(a,b,c){this.defaultRequest(a,"ChangePassword",{PrevPassword:b,NewPassword:c})},ob.prototype.folderCreate=function(a,b,c){this.defaultRequest(a,"FolderCreate",{Folder:b,Parent:c},null,"",["Folders"])},ob.prototype.folderDelete=function(a,b){this.defaultRequest(a,"FolderDelete",{Folder:b},null,"",["Folders"])},ob.prototype.folderRename=function(a,b,c){this.defaultRequest(a,"FolderRename",{Folder:b,NewFolderName:c},null,"",["Folders"])},ob.prototype.folderClear=function(a,b){this.defaultRequest(a,"FolderClear",{Folder:b})},ob.prototype.folderSetSubscribe=function(a,b,c){this.defaultRequest(a,"FolderSubscribe",{Folder:b,Subscribe:c?"1":"0"})},ob.prototype.messagesMove=function(a,b,c,d){this.defaultRequest(a,"MessageMove",{FromFolder:b,ToFolder:c,Uids:d.join(",")},null,"",["MessageList","Message"])},ob.prototype.messagesCopy=function(a,b,c,d){this.defaultRequest(a,"MessageCopy",{FromFolder:b,ToFolder:c,Uids:d.join(",")})},ob.prototype.messagesDelete=function(a,b,c){this.defaultRequest(a,"MessageDelete",{Folder:b,Uids:c.join(",")},null,"",["MessageList","Message"])},ob.prototype.appDelayStart=function(a){this.defaultRequest(a,"AppDelayStart")},ob.prototype.quota=function(a){this.defaultRequest(a,"Quota")},ob.prototype.contacts=function(a,b,c,d){this.defaultRequest(a,"Contacts",{Offset:b,Limit:c,Search:d},null,"",["Contacts"])},ob.prototype.contactSave=function(a,b,c,d,e,f){this.defaultRequest(a,"ContactSave",{RequestUid:b,Uid:Ab.trim(c),UidStr:Ab.trim(d),ScopeType:e,Properties:f})},ob.prototype.contactsDelete=function(a,b){this.defaultRequest(a,"ContactsDelete",{Uids:b.join(",")})},ob.prototype.suggestions=function(a,b,c){this.defaultRequest(a,"Suggestions",{Query:b,Page:c},null,"",["Suggestions"])},ob.prototype.servicesPics=function(a){this.defaultRequest(a,"ServicesPics")},ob.prototype.emailsPicsHashes=function(a){this.defaultRequest(a,"EmailsPicsHashes")},ob.prototype.facebookUser=function(a){this.defaultRequest(a,"SocialFacebookUserInformation")},ob.prototype.facebookDisconnect=function(a){this.defaultRequest(a,"SocialFacebookDisconnect")},ob.prototype.twitterUser=function(a){this.defaultRequest(a,"SocialTwitterUserInformation")},ob.prototype.twitterDisconnect=function(a){this.defaultRequest(a,"SocialTwitterDisconnect")},ob.prototype.googleUser=function(a){this.defaultRequest(a,"SocialGoogleUserInformation")},ob.prototype.googleDisconnect=function(a){this.defaultRequest(a,"SocialGoogleDisconnect")},ob.prototype.socialUsers=function(a){this.defaultRequest(a,"SocialUsers")},pb.prototype.oEmailsPicsHashes={},pb.prototype.oServices={},pb.prototype.clear=function(){this.oServices={},this.oEmailsPicsHashes={}},pb.prototype.getUserPic=function(a){var b="",c="",d=a.toLowerCase(),e=Ab.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];return""===e?(c=d.substr(a.indexOf("@")+1),b=""!==c&&this.oServices[c]?this.oServices[c]:""):b=Mb.link().getUserPicUrlFromHash(e),b},pb.prototype.setServicesData=function(a){this.oServices=a},pb.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a},h.extend(qb.prototype,pb.prototype),qb.prototype.oFoldersCache={},qb.prototype.oFoldersNamesCache={},qb.prototype.oFolderHashCache={},qb.prototype.oFolderUidNextCache={},qb.prototype.oMessageListHashCache={},qb.prototype.oMessageFlagsCache={},qb.prototype.oBodies={},qb.prototype.oNewMessage={},qb.prototype.oRequestedMessage={},qb.prototype.clear=function(){pb.prototype.clear.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oBodies={}
|
||
},qb.prototype.getMessageKey=function(a,b){return a+"#"+b},qb.prototype.addRequestedMessage=function(a,b){this.oRequestedMessage[this.getMessageKey(a,b)]=!0},qb.prototype.hasRequestedMessage=function(a,b){return!0===this.oRequestedMessage[this.getMessageKey(a,b)]},qb.prototype.addNewMessageCache=function(a,b){this.oNewMessage[this.getMessageKey(a,b)]=!0},qb.prototype.hasNewMessageAndRemoveFromCache=function(a,b){return this.oNewMessage[this.getMessageKey(a,b)]?(this.oNewMessage[this.getMessageKey(a,b)]=null,!0):!1},qb.prototype.clearNewMessageCache=function(){this.oNewMessage={}},qb.prototype.getFolderFullNameRaw=function(a){return""!==a&&this.oFoldersNamesCache[a]?this.oFoldersNamesCache[a]:""},qb.prototype.setFolderFullNameRaw=function(a,b){this.oFoldersNamesCache[a]=b},qb.prototype.getFolderHash=function(a){return""!==a&&this.oFolderHashCache[a]?this.oFolderHashCache[a]:""},qb.prototype.setFolderHash=function(a,b){this.oFolderHashCache[a]=b},qb.prototype.getFolderUidNext=function(a){return""!==a&&this.oFolderUidNextCache[a]?this.oFolderUidNextCache[a]:""},qb.prototype.setFolderUidNext=function(a,b){this.oFolderUidNextCache[a]=b},qb.prototype.getFolderFromCacheList=function(a){return""!==a&&this.oFoldersCache[a]?this.oFoldersCache[a]:null},qb.prototype.setFolderToCacheList=function(a,b){this.oFoldersCache[a]=b},qb.prototype.removeFolderFromCacheList=function(a){this.setFolderToCacheList(a,null)},qb.prototype.getMessageFlagsFromCache=function(a,b){return this.oMessageFlagsCache[a]&&this.oMessageFlagsCache[a][b]?this.oMessageFlagsCache[a][b]:null},qb.prototype.setMessageFlagsToCache=function(a,b,c){this.oMessageFlagsCache[a]||(this.oMessageFlagsCache[a]={}),this.oMessageFlagsCache[a][b]=c},qb.prototype.clearMessageFlagsFromCacheByFolder=function(a){this.oMessageFlagsCache[a]={}},qb.prototype.initMessageFlagsFromCache=function(a){if(a){var b=this,c=this.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid),d=null,e=null;c&&0<c.length&&(a.unseen(!!c[0]),a.flagged(!!c[1]),a.answered(!!c[2]),a.forwarded(!!c[3]),a.isReadReceipt(!!c[4])),0<a.threads().length&&(d=h.find(a.threads(),function(c){var d=b.getMessageFlagsFromCache(a.folderFullNameRaw,c);return d&&0<d.length&&!!d[0]}),e=h.find(a.threads(),function(c){var d=b.getMessageFlagsFromCache(a.folderFullNameRaw,c);return d&&0<d.length&&!!d[1]}),a.hasUnseenSubMessage(d&&0<Ab.pInt(d)),a.hasFlaggedSubMessage(e&&0<Ab.pInt(e)))}},qb.prototype.storeMessageFlagsToCache=function(a){a&&this.setMessageFlagsToCache(a.folderFullNameRaw,a.uid,[a.unseen(),a.flagged(),a.answered(),a.forwarded(),a.isReadReceipt()])},qb.prototype.storeMessageFlagsToCacheByFolderAndUid=function(a,b,c){Ab.isArray(c)&&0<c.length&&this.setMessageFlagsToCache(a,b,c)},h.extend(rb.prototype,s.prototype),rb.prototype.onRoute=function(a){var d=this,e=null,f=null,g=null,i=null;f=h.find(Eb.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}),f&&(h.find(Eb["settings-removed"],function(a){return a&&a===f})&&(f=null),f&&h.find(Eb["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=Mb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),Ab.delegateRun(e,"onBuild",[i])):Ab.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Ab.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Ab.delegateRun(d.oCurrentSubScreen,"onShow"),Ab.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),h.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),Ab.windowResize()})):Fb.setHash(Mb.link().settings(),!1,!0)},rb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Ab.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},rb.prototype.onBuild=function(){h.each(Eb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Eb["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(Eb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},rb.prototype.routes=function(){var a=h.find(Eb.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=Ab.isUnd(c.subname)?b:Ab.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(sb.prototype,s.prototype),sb.prototype.onShow=function(){Mb.setTitle("")},h.extend(tb.prototype,s.prototype),tb.prototype.oLastRoute={},tb.prototype.setNewTitle=function(){var a=Mb.data().accountEmail(),b=Mb.data().foldersInboxUnreadCount();Mb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Ab.i18n("TITLES/MAILBOX"))},tb.prototype.onShow=function(){this.setNewTitle()},tb.prototype.onRoute=function(a,b,c,d){if(Ab.isUnd(d)?1:!d){var e=Mb.data(),f=Mb.cache().getFolderFullNameRaw(a),g=Mb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),yb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Mb.reloadMessageList())}else yb.Layout.NoPreview!==Mb.data().layout()||Mb.data().message()||Mb.historyBack()},tb.prototype.onStart=function(){var a=Mb.data(),b=function(){Ab.windowResize()};(Mb.settingsGet("AllowAdditionalAccounts")||Mb.settingsGet("AllowIdentities"))&&Mb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Mb.folderInformation("INBOX")},1e3),h.delay(function(){Mb.quota()},5e3),h.delay(function(){Mb.remote().appDelayStart(Ab.emptyFunction)},35e3),Ib.toggleClass("rl-no-preview-pane",yb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Ib.toggleClass("rl-no-preview-pane",yb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},tb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Ab.pString(b[0]),b[1]=Ab.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Ab.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2]),!1]},c=function(a,b){return b[0]=Ab.pString(b[0]),b[1]=Ab.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:c}],[/^message-preview$/,{normalize_:a}],[/^([^\/]*)$/,{normalize_:b}]]},h.extend(ub.prototype,rb.prototype),ub.prototype.onShow=function(){Mb.setTitle(this.sSettingsTitle)},h.extend(vb.prototype,q.prototype),vb.prototype.oSettings=null,vb.prototype.oPlugins=null,vb.prototype.oLocal=null,vb.prototype.oLink=null,vb.prototype.oSubs={},vb.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):(Db.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},vb.prototype.link=function(){return null===this.oLink&&(this.oLink=new j),this.oLink},vb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},vb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Ab.isNormal(Gb)?Gb:{}),Ab.isUnd(this.oSettings[a])?null:this.oSettings[a]},vb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Ab.isNormal(Gb)?Gb:{}),this.oSettings[a]=b},vb.prototype.setTitle=function(b){b=(Ab.isNormal(b)&&0<b.length?b+" - ":"")+Mb.settingsGet("Title")||"",a.document.title="_",a.document.title=b},vb.prototype.loginAndLogoutReload=function(b,c){var d=Ab.pString(Mb.settingsGet("CustomLogoutLink")),e=!!Mb.settingsGet("InIframe");b=Ab.isUnd(b)?!1:!!b,c=Ab.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):(Fb.routeOff(),Fb.setHash(Mb.link().root(),!0),Fb.routeOff(),h.delay(function(){e&&a.parent?a.parent.location.reload():a.location.reload()},100))},vb.prototype.historyBack=function(){a.history.back()},vb.prototype.getAutocomplete=function(a,b){b([],a)},vb.prototype.sub=function(a,b,c){return Ab.isUnd(this.oSubs[a])&&(this.oSubs[a]=[]),this.oSubs[a].push([b,c]),this},vb.prototype.pub=function(a,b){return Bb.runHook("rl-pub",[a,b]),Ab.isUnd(this.oSubs[a])||h.each(this.oSubs[a],function(a){a[0]&&a[0].apply(a[1]||null,b||[])}),this},vb.prototype.bootstart=function(){Ab.initOnStartOrLangChange(function(){Ab.initNotificationLanguage()},null),h.delay(function(){Ab.windowResize()},1e3),ssm.addState({id:"mobile",maxWidth:767,onEnter:function(){Ib.addClass("ssm-state-mobile")},onLeave:function(){Ib.removeClass("ssm-state-mobile")}}),ssm.addState({id:"tablet",minWidth:768,maxWidth:999,onEnter:function(){Ib.addClass("ssm-state-tablet")},onLeave:function(){Ib.removeClass("ssm-state-tablet")}}),ssm.addState({id:"desktop",minWidth:1e3,maxWidth:1400,onEnter:function(){Ib.addClass("ssm-state-desktop")},onLeave:function(){Ib.removeClass("ssm-state-desktop")}}),ssm.addState({id:"desktop-large",minWidth:1400,onEnter:function(){Ib.addClass("ssm-state-desktop-large")},onLeave:function(){Ib.removeClass("ssm-state-desktop-large")}}),ssm.ready()},h.extend(wb.prototype,vb.prototype),wb.prototype.oData=null,wb.prototype.oRemote=null,wb.prototype.oCache=null,wb.prototype.data=function(){return null===this.oData&&(this.oData=new mb),this.oData},wb.prototype.remote=function(){return null===this.oRemote&&(this.oRemote=new ob),this.oRemote},wb.prototype.cache=function(){return null===this.oCache&&(this.oCache=new qb),this.oCache},wb.prototype.reloadFlagsCurrentMessageListAndMessageFromCache=function(){var a=Mb.cache();h.each(Mb.data().messageList(),function(b){a.initMessageFlagsFromCache(b)}),a.initMessageFlagsFromCache(Mb.data().message())},wb.prototype.reloadMessageList=function(a,b){var c=Mb.data(),d=(c.messageListPage()-1)*c.messagesPerPage();(Ab.isUnd(b)?1:!b)||Mb.cache().setFolderHash(c.currentFolderFullNameRaw(),""),(Ab.isUnd(a)?1:!a)||(c.messageListPage(1),d=0),c.messageListLoading(!0),Mb.remote().messageList(function(a,b,d){yb.StorageResultType.Success===a&&b&&b.Result?(c.messageListError(""),c.messageListLoading(!1),c.setMessageList(b,d)):yb.StorageResultType.Unload===a?(c.messageListError(""),c.messageListLoading(!1)):yb.StorageResultType.Abort!==a&&(c.messageList([]),c.messageListLoading(!1),c.messageListError(b&&b.ErrorCode?Ab.getNotification(b.ErrorCode):Ab.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST")))},c.currentFolderFullNameRaw(),d,c.messagesPerPage(),c.messageListSearch())},wb.prototype.recacheInboxMessageList=function(){Mb.remote().messageList(Ab.emptyFunction,"INBOX",0,Mb.data().messagesPerPage(),"",!0)},wb.prototype.moveOrDeleteResponseHelper=function(b,c){yb.StorageResultType.Success===b&&Mb.data().currentFolder()&&(c&&Ab.isArray(c.Result)&&2===c.Result.length?Mb.cache().setFolderHash(c.Result[0],c.Result[1]):(Mb.cache().setFolderHash(Mb.data().currentFolderFullNameRaw(),""),c&&-1<Ab.inArray(c.ErrorCode,[yb.Notification.CantMoveMessage,yb.Notification.CantCopyMessage])&&a.alert(Ab.getNotification(c.ErrorCode))),Mb.reloadMessageList(0===Mb.data().messageList().length),Mb.quotaDebounce())},wb.prototype.deleteMessagesFromFolderWithoutCheck=function(a,b){Mb.remote().messagesDelete(this.moveOrDeleteResponseHelper,a,b),Mb.data().removeMessagesFromList(a,b)},wb.prototype.deleteMessagesFromFolder=function(a,b,c,d){var e=this,f=Mb.data(),g=Mb.cache(),h=null,i=null;switch(a){case yb.FolderType.Spam:h=g.getFolderFromCacheList(f.spamFolder()),i=yb.SetSystemFoldersNotification.Spam;break;case yb.FolderType.Trash:h=g.getFolderFromCacheList(f.trashFolder()),i=yb.SetSystemFoldersNotification.Trash;break;case yb.FolderType.Archive:h=g.getFolderFromCacheList(f.archiveFolder()),i=yb.SetSystemFoldersNotification.Archive}d=Ab.isUnd(d)?!0:!!d,d&&(yb.FolderType.Spam===a&&xb.Values.UnuseOptionValue===f.spamFolder()||yb.FolderType.Trash===a&&xb.Values.UnuseOptionValue===f.trashFolder()||yb.FolderType.Archive===a&&xb.Values.UnuseOptionValue===f.archiveFolder())&&(d=!1),!h&&d?Fb.showScreenPopup(G,[i]):d&&(yb.FolderType.Trash!==a||b!==f.spamFolder()&&b!==f.trashFolder())?h&&(Mb.remote().messagesMove(this.moveOrDeleteResponseHelper,b,h.fullNameRaw,c),f.removeMessagesFromList(b,c,h.fullNameRaw)):Fb.showScreenPopup(S,[Ab.i18n("POPUPS_ASK/DESC_WANT_DELETE_MESSAGES"),function(){Mb.remote().messagesDelete(e.moveOrDeleteResponseHelper,b,c),f.removeMessagesFromList(b,c)}])},wb.prototype.moveMessagesToFolder=function(a,b,c,d){if(a!==c&&Ab.isArray(b)&&0<b.length){var e=Mb.cache().getFolderFromCacheList(a),f=Mb.cache().getFolderFromCacheList(c);if(e&&f)return d=Ab.isUnd(d)?!1:!!d,Mb.remote()[d?"messagesCopy":"messagesMove"](this.moveOrDeleteResponseHelper,e.fullNameRaw,f.fullNameRaw,b),Mb.data().removeMessagesFromList(e.fullNameRaw,b,f.fullNameRaw,d),!0}return!1},wb.prototype.folders=function(a){this.data().foldersLoading(!0),this.remote().folders(h.bind(function(b,c){Mb.data().foldersLoading(!1),yb.StorageResultType.Success===b?(this.data().setFolders(c),a&&a(!0)):a&&a(!1)},this))},wb.prototype.reloadOpenPgpKeys=function(){if(Mb.data().allowOpenPGP()){var a=[],b=new u,c=Mb.data().openpgpKeyring,d=c?c.keys:[];h.each(d,function(c,d){if(c&&c.primaryKey){var e=c.getPrimaryUser(),f=e&&e.user?e.user.userId.userid:c.users&&c.users[0]?c.users[0].userId.userid:"";b.clear(),b.mailsoParse(f),b.validate()&&a.push(new D(d,c.primaryKey.getFingerprint(),c.primaryKey.getKeyId().toHex().toLowerCase(),f,b.email,c.isPrivate(),c.armor()))}}),Mb.data().openpgpkeys(a)}},wb.prototype.accountsAndIdentities=function(){var a=Mb.data();a.accountsLoading(!0),a.identitiesLoading(!0),Mb.remote().accountsAndIdentities(function(b,c){if(a.accountsLoading(!1),a.identitiesLoading(!1),yb.StorageResultType.Success===b&&c.Result){var d=Mb.settingsGet("ParentEmail"),e=a.accountEmail();d=""===d?e:d,Ab.isArray(c.Result.Accounts)&&a.accounts(h.map(c.Result.Accounts,function(a){return new B(a,a!==d)})),Ab.isArray(c.Result.Identities)&&a.identities(h.map(c.Result.Identities,function(a){var b=Ab.pString(a.Id),c=Ab.pString(a.Email),d=new C(b,c,b!==e);return d.name(Ab.pString(a.Name)),d.replyTo(Ab.pString(a.ReplyTo)),d.bcc(Ab.pString(a.Bcc)),d}))}})},wb.prototype.quota=function(){this.remote().quota(function(a,b){yb.StorageResultType.Success===a&&b&&b.Result&&Ab.isArray(b.Result)&&2===b.Result.length&&Ab.isPosNumeric(b.Result[0],!0)&&Ab.isPosNumeric(b.Result[1],!0)&&(Mb.data().userQuota(1024*Ab.pInt(b.Result[1])),Mb.data().userUsageSize(1024*Ab.pInt(b.Result[0])))})},wb.prototype.folderInformation=function(a,b){""!==Ab.trim(a)&&this.remote().folderInformation(function(a,b){if(yb.StorageResultType.Success===a&&b&&b.Result&&b.Result.Hash&&b.Result.Folder){var c=f().unix(),d=Mb.cache().getFolderHash(b.Result.Folder),e=Mb.cache().getFolderFromCacheList(b.Result.Folder),g=!1,h="",i=[],j=!1,k=null;if(e){if(e.interval=c,b.Result.Hash&&Mb.cache().setFolderHash(b.Result.Folder,b.Result.Hash),Ab.isNormal(b.Result.MessageCount)&&e.messageCountAll(b.Result.MessageCount),Ab.isNormal(b.Result.MessageUnseenCount)&&(Ab.pInt(e.messageCountUnread())!==Ab.pInt(b.Result.MessageUnseenCount)&&(j=!0),e.messageCountUnread(b.Result.MessageUnseenCount)),j&&Mb.cache().clearMessageFlagsFromCacheByFolder(e.fullNameRaw),b.Result.Flags){for(h in b.Result.Flags)b.Result.Flags.hasOwnProperty(h)&&(g=!0,k=b.Result.Flags[h],Mb.cache().storeMessageFlagsToCacheByFolderAndUid(e.fullNameRaw,h.toString(),[!k.IsSeen,!!k.IsFlagged,!!k.IsAnswered,!!k.IsForwarded,!!k.IsReadReceipt]));g&&Mb.reloadFlagsCurrentMessageListAndMessageFromCache()}Mb.data().initUidNextAndNewMessages(e.fullNameRaw,b.Result.UidNext,b.Result.NewMessages),b.Result.Hash!==d||""===d?e.fullNameRaw===Mb.data().currentFolderFullNameRaw()?Mb.reloadMessageList():"INBOX"===e.fullNameRaw&&Mb.recacheInboxMessageList():j&&e.fullNameRaw===Mb.data().currentFolderFullNameRaw()&&(i=Mb.data().messageList(),Ab.isNonEmptyArray(i)&&Mb.folderInformation(e.fullNameRaw,i))}}},a,b)},wb.prototype.folderInformationMultiply=function(a){a=Ab.isUnd(a)?!1:!!a;var b=f().unix(),c=Mb.data().getNextFolderNames(a);Ab.isNonEmptyArray(c)&&this.remote().folderInformationMultiply(function(c,d){yb.StorageResultType.Success===c&&d&&d.Result&&d.Result.List&&Ab.isNonEmptyArray(d.Result.List)&&(h.each(d.Result.List,function(a){var c=[],d=Mb.cache().getFolderHash(a.Folder),e=Mb.cache().getFolderFromCacheList(a.Folder),f=!1;e&&(e.interval=b,a.Hash&&Mb.cache().setFolderHash(a.Folder,a.Hash),Ab.isNormal(a.MessageCount)&&e.messageCountAll(a.MessageCount),Ab.isNormal(a.MessageUnseenCount)&&(Ab.pInt(e.messageCountUnread())!==Ab.pInt(a.MessageUnseenCount)&&(f=!0),e.messageCountUnread(a.MessageUnseenCount)),f&&Mb.cache().clearMessageFlagsFromCacheByFolder(e.fullNameRaw),a.Hash!==d||""===d?e.fullNameRaw===Mb.data().currentFolderFullNameRaw()&&Mb.reloadMessageList():f&&e.fullNameRaw===Mb.data().currentFolderFullNameRaw()&&(c=Mb.data().messageList(),Ab.isNonEmptyArray(c)&&Mb.folderInformation(e.fullNameRaw,c)))}),a&&Mb.folderInformationMultiply(!0))},c)},wb.prototype.setMessageSeen=function(a){if(a.unseen()){a.unseen(!1);var b=Mb.cache().getFolderFromCacheList(a.folderFullNameRaw);b&&b.messageCountUnread(0<=b.messageCountUnread()-1?b.messageCountUnread()-1:0),Mb.cache().storeMessageFlagsToCache(a),Mb.reloadFlagsCurrentMessageListAndMessageFromCache()}Mb.remote().messageSetSeen(Ab.emptyFunction,a.folderFullNameRaw,[a.uid],!0)},wb.prototype.googleConnect=function(){a.open(Mb.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")},wb.prototype.twitterConnect=function(){a.open(Mb.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")},wb.prototype.facebookConnect=function(){a.open(Mb.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")},wb.prototype.socialUsers=function(a){var b=Mb.data();a&&(b.googleActions(!0),b.facebookActions(!0),b.twitterActions(!0)),Mb.remote().socialUsers(function(a,c){yb.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)})},wb.prototype.googleDisconnect=function(){Mb.data().googleActions(!0),Mb.remote().googleDisconnect(function(){Mb.socialUsers()})},wb.prototype.facebookDisconnect=function(){Mb.data().facebookActions(!0),Mb.remote().facebookDisconnect(function(){Mb.socialUsers()})},wb.prototype.twitterDisconnect=function(){Mb.data().twitterActions(!0),Mb.remote().twitterDisconnect(function(){Mb.socialUsers()})},wb.prototype.folderListOptionsBuilder=function(b,c,d,e,f,g,h,i,j,k){var l=0,m=0,n=null,o=" ",p=[];for(j=Ab.isNormal(j)?j:0<b.length,k=Ab.isUnd(k)?!1:!!k,f=Ab.isNormal(f)?f:0,g=Ab.isNormal(g)?g:null,h=Ab.isNormal(h)?h:null,i=Ab.isNormal(i)?i:null,Ab.isArray(d)||(d=[]),Ab.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<Ab.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)&&(yb.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<Ab.inArray(n.fullNameRaw,d)||yb.FolderType.User!==n.type()||(g?g.call(null,n):!1)}),n.subScribed()&&0<n.subFolders().length&&(p=p.concat(Mb.folderListOptionsBuilder([],n.subFolders(),d,[],n.isUnpaddigFolder?f+1:f,g,h,i,j,k)));return p},wb.prototype.getAutocomplete=function(a,b){var c=[];Mb.remote().suggestions(function(a,d){yb.StorageResultType.Success===a&&d&&Ab.isArray(d.Result)?(c=h.map(d.Result,function(a){return a&&a[0]?new u(a[0],a[1]):null}),b(h.compact(c))):yb.StorageResultType.Abort!==a&&b([])},a)},wb.prototype.emailsPicsHashes=function(){Mb.remote().emailsPicsHashes(function(a,b){yb.StorageResultType.Success===a&&b&&b.Result&&Mb.cache().setEmailsPicsHashesData(b.Result)})},wb.prototype.mailToHelper=function(b){if(b&&"mailto:"===b.toString().toLowerCase().substr(0,7)){var c=null;if(c=new u,c.parse(a.decodeURI(b.toString().substr(7).replace(/\?.+$/,""))),c&&c.email)return Fb.showScreenPopup(H,[yb.ComposeType.Empty,null,[c]]),!0}return!1},wb.prototype.bootstart=function(){Mb.pub("rl.bootstart"),vb.prototype.bootstart.call(this),Mb.data().populateDataOnStart();var c="",d=Mb.settingsGet("JsHash"),e=Mb.settingsGet("AllowGoogleSocial"),f=Mb.settingsGet("AllowFacebookSocial"),g=Mb.settingsGet("AllowTwitterSocial");Mb.settingsGet("ChangePasswordIsAllowed")||Ab.removeSettingsViewModel(hb),Mb.settingsGet("ContactsIsAllowed")||Ab.removeSettingsViewModel(bb),Mb.settingsGet("AllowAdditionalAccounts")||Ab.removeSettingsViewModel(cb),Ab.removeSettingsViewModel(Mb.settingsGet("AllowIdentities")?db:eb),Mb.settingsGet("OpenPGP")||Ab.removeSettingsViewModel(kb),Mb.settingsGet("AllowTwoFactorAuth")||Ab.removeSettingsViewModel(fb),e||f||g||Ab.removeSettingsViewModel(gb),Mb.settingsGet("AllowThemes")||Ab.removeSettingsViewModel(jb),Ab.initOnStartOrLangChange(function(){b.extend(!0,b.magnificPopup.defaults,{tClose:Ab.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:Ab.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:Ab.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:Ab.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:Ab.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:Ab.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:Ab.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this),a.SimplePace&&(a.SimplePace.set(70),a.SimplePace.sleep()),Mb.settingsGet("Auth")?(this.setTitle(Ab.i18n("TITLES/LOADING")),this.folders(h.bind(function(c){Fb.hideLoading(),c?(a.crypto&&a.crypto.getRandomValues&&Mb.settingsGet("OpenPGP")?b.ajax({url:Mb.link().openPgpJs(),dataType:"script",cache:!0,success:function(){a.openpgp&&(Mb.data().openpgpKeyring=new a.openpgp.Keyring(new o),Mb.data().allowOpenPGP(!0),Mb.pub("openpgp.init"),Mb.reloadOpenPgpKeys())}}):Mb.data().allowOpenPGP(!1),Fb.startScreens([tb,ub]),(e||f||g)&&Mb.socialUsers(!0),Mb.sub("interval.2m",function(){Mb.folderInformation("INBOX")}),Mb.sub("interval.2m",function(){var a=Mb.data().currentFolderFullNameRaw();"INBOX"!==a&&Mb.folderInformation(a)}),Mb.sub("interval.3m",function(){Mb.folderInformationMultiply()}),Mb.sub("interval.5m",function(){Mb.quota()}),h.delay(function(){Mb.folderInformationMultiply(!0)},500),h.delay(function(){Mb.emailsPicsHashes(),Mb.remote().servicesPics(function(a,b){yb.StorageResultType.Success===a&&b&&b.Result&&Mb.cache().setServicesData(b.Result)})},2e3),Bb.runHook("rl-start-user-screens"),Mb.pub("rl.bootstart-user-screens")):(Fb.startScreens([sb]),Bb.runHook("rl-start-login-screens"),Mb.pub("rl.bootstart-login-screens")),a.SimplePace&&a.SimplePace.set(100),Db.bMobileDevice||h.defer(function(){Ab.initLayoutResizer("#rl-left","#rl-right",yb.ClientSideKeyName.FolderListSize)})},this))):(c=Ab.pString(Mb.settingsGet("CustomLoginLink")),c?(Fb.routeOff(),Fb.setHash(Mb.link().root(),!0),Fb.routeOff(),h.defer(function(){a.location.href=c})):(Fb.hideLoading(),Fb.startScreens([sb]),Bb.runHook("rl-start-login-screens"),Mb.pub("rl.bootstart-login-screens"),a.SimplePace&&a.SimplePace.set(100))),e&&(a["rl_"+d+"_google_service"]=function(){Mb.data().googleActions(!0),Mb.socialUsers()}),f&&(a["rl_"+d+"_facebook_service"]=function(){Mb.data().facebookActions(!0),Mb.socialUsers()}),g&&(a["rl_"+d+"_twitter_service"]=function(){Mb.data().twitterActions(!0),Mb.socialUsers()}),Mb.sub("interval.1m",function(){Db.momentTrigger(!Db.momentTrigger())}),Bb.runHook("rl-start-screens"),Mb.pub("rl.bootstart-end")},Mb=new wb,Ib.addClass(Db.bMobileDevice?"mobile":"no-mobile"),Jb.keydown(Ab.killCtrlAandS).keyup(Ab.killCtrlAandS),Jb.unload(function(){Db.bUnload=!0}),a.rl=a.rl||{},a.rl.addHook=Bb.addHook,a.rl.settingsGet=Bb.mainSettingsGet,a.rl.remoteRequest=Bb.remoteRequest,a.rl.pluginSettingsGet=Bb.settingsGet,a.rl.addSettingsViewModel=Ab.addSettingsViewModel,a.rl.createCommand=Ab.createCommand,a.rl.EmailModel=u,a.rl.Enums=yb,a.__RLBOOT=function(c){b(function(){a.rainloopTEMPLATES&&a.rainloopTEMPLATES[0]?(b("#rl-templates").html(a.rainloopTEMPLATES[0]),h.delay(function(){a.rainloopAppData={},a.rainloopI18N={},a.rainloopTEMPLATES={},Fb.setBoot(Mb).bootstart(),Ib.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):c(!1),a.__RLBOOT=null})},a.SimplePace&&a.SimplePace.add(10)}(window,jQuery,ko,crossroads,hasher,moment,Jua,_,ifvisible); |