snappymail/rainloop/v/0.0.0/static/js/app.min.js
RainLoop Team 8768b343a5 html editor optimizations (fixed #84)
disable blockquote button (unstable work)
2014-02-14 19:53:52 +04:00

9 lines
No EOL
228 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! 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=Eb.settingsGet("CdnStaticDomain"),this.sVersion=Eb.settingsGet("Version"),this.sSpecSuffix=Eb.settingsGet("AuthAccountHash")||"0",this.sServer=(Eb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function k(a,c,d){var e=this;e.editor=null,e.iBlurTimer=0,e.fOnBlur=c||null,e.fOnReady=d||null,e.$element=b(a),e.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();sb.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),sb.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1<sb.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(){var a=[n,m],b=h.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function p(){}function q(a,b){this.sPosition=sb.pString(a),this.sTemplate=sb.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function r(a,b){this.sScreenName=a,this.aViewModels=sb.isArray(b)?b:[]}function s(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null,this.popupVisibility=c.observable(!1),this.popupVisibility.subscribe(function(a){Eb&&Eb.popupVisibility(a)})}function t(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function u(){this.idContact=0,this.idContactStr="",this.display="",this.properties=[],this.readOnly=!1,this.scopeType=qb.ContactScopeType.Default,this.checked=c.observable(!1),this.selected=c.observable(!1),this.deleted=c.observable(!1),this.shared=c.observable(!1)}function v(a,b,d,e){this.type=c.observable(sb.isUnd(a)?qb.ContactPropertyType.Unknown:a),this.focused=c.observable(sb.isUnd(d)?!1:!!d),this.value=c.observable(sb.pString(b)),this.placeholder=c.observable(e||""),this.placeholderValue=c.computed(function(){var a=this.placeholder();return a?sb.i18n(a):""},this)}function w(){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 x(a,b,d,e,f,g,h){this.id=a,this.isInline=sb.isUnd(e)?!1:!!e,this.isLinked=sb.isUnd(f)?!1:!!f,this.CID=sb.isUnd(g)?"":g,this.contentLocation=sb.isUnd(h)?"":h,this.fromMessage=!1,this.fileName=c.observable(b),this.size=c.observable(sb.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?"":sb.friendlySize(this.size())},this)}function y(){this.folderFullNameRaw="",this.uid="",this.requestHash="",this.subject=c.observable(""),this.size=c.observable(0),this.dateTimeStampInUTC=c.observable(0),this.priority=c.observable(qb.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 y.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.fullFormatDateValue=c.computed(function(){return y.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.momentDate=sb.createMomentDate(this),this.momentShortDate=sb.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.pgpSignature=c.observable(""),this.priority=c.observable(qb.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 z(){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(qb.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 A(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function B(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 C(){q.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 sb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=sb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Eb.data().message(null),Eb.data().messageList([]),this.clearingProcess(!0),Eb.cache().setFolderHash(b.fullNameRaw,""),Eb.remote().folderClear(function(b,c){a.clearingProcess(!1),qb.StorageResultType.Success===b&&c&&c.Result?(Eb.reloadMessageList(!0),a.cancelCommand()):c&&c.ErrorCode?a.clearingError(sb.getNotification(c.ErrorCode)):a.clearingError(sb.getNotification(qb.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),s.constructorEnd(this)}function D(){q.call(this,"Popups","PopupsFolderCreate"),sb.initOnStartOrLangChange(function(){this.sNoParentText=sb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(pb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Eb.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)}),Eb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=sb.createCommand(this,function(){var a=Eb.data(),b=this.selectedParentValue();""===b&&1<a.namespace.length&&(b=a.namespace.substr(0,a.namespace.length-1)),a.foldersCreating(!0),Eb.remote().folderCreate(function(a,b){Eb.data().foldersCreating(!1),qb.StorageResultType.Success===a&&b&&b.Result?Eb.folders():Eb.data().foldersListError(b&&b.ErrorCode?sb.getNotification(b.ErrorCode):sb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"))},this.folderName(),b),this.cancelCommand()},function(){return this.simpleFolderNameValidation(this.folderName())}),this.defautOptionsAfterRender=sb.defautOptionsAfterRender,s.constructorEnd(this)}function E(){q.call(this,"Popups","PopupsFolderSystem"),sb.initOnStartOrLangChange(function(){this.sChooseOnText=sb.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE"),this.sUnuseText=sb.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME")},this),this.notification=c.observable(""),this.folderSelectList=c.computed(function(){return Eb.folderListOptionsBuilder([],Eb.data().folderList(),Eb.data().folderListSystemNames(),[["",this.sChooseOnText],[pb.Values.UnuseOptionValue,this.sUnuseText]])},this);var a=Eb.data(),b=this,d=null,e=null;this.sentFolder=a.sentFolder,this.draftFolder=a.draftFolder,this.spamFolder=a.spamFolder,this.trashFolder=a.trashFolder,d=h.debounce(function(){Eb.settingsSet("SentFolder",b.sentFolder()),Eb.settingsSet("DraftFolder",b.draftFolder()),Eb.settingsSet("SpamFolder",b.spamFolder()),Eb.settingsSet("TrashFolder",b.trashFolder()),Eb.remote().saveSystemFolders(sb.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder(),NullFolder:"NullFolder"})},1e3),e=function(){Eb.settingsSet("SentFolder",b.sentFolder()),Eb.settingsSet("DraftFolder",b.draftFolder()),Eb.settingsSet("SpamFolder",b.spamFolder()),Eb.settingsSet("TrashFolder",b.trashFolder()),d()},this.sentFolder.subscribe(e),this.draftFolder.subscribe(e),this.spamFolder.subscribe(e),this.trashFolder.subscribe(e),this.defautOptionsAfterRender=sb.defautOptionsAfterRender,s.constructorEnd(this)}function F(){q.call(this,"Popups","PopupsCompose"),this.oEditor=null,this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bReloadFolder=!1,this.bAllowIdentities=Eb.settingsGet("AllowIdentities");var b=this,d=Eb.data(),e=function(a){!1===this.showCcAndBcc()&&0<a.length&&this.showCcAndBcc(!0)};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.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=Eb.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!==Eb.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=sb.createCommand(this,function(){var a=null,b=this.draftFolder(),c=this.draftUid();this.bFromDraft&&(a=Eb.data().message(),a&&b===a.folderFullNameRaw&&c===a.uid&&Eb.data().message(null)),Eb.data().currentFolderFullNameRaw()===this.draftFolder()&&h.each(Eb.data().messageList(),function(a){a&&b===a.folderFullNameRaw&&c===a.uid&&a.deleted(!0)}),Eb.data().messageListIsNotCompleted(!0),Eb.remote().messagesDelete(function(){Eb.cache().setFolderHash(b,""),Eb.reloadMessageList()},this.draftFolder(),[this.draftUid()]),this.bReloadFolder=!1,xb.hideScreenPopup(F)},function(){return this.isDraftFolderMessage()}),this.sendMessageResponse=h.bind(this.sendMessageResponse,this),this.saveMessageResponse=h.bind(this.saveMessageResponse,this),this.sendCommand=sb.createCommand(this,function(){var a=sb.trim(this.to()),b=Eb.data().sentFolder(),c=[];0===a.length?this.emptyToError(!0):(Eb.data().replySameFolder()&&sb.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&sb.isNormal(this.aDraftInfo[2])&&0<this.aDraftInfo[2].length&&(b=this.aDraftInfo[2]),""===b?xb.showScreenPopup(E,[qb.SetSystemFoldersNotification.Sent]):(this.sendError(!1),this.sending(!0),this.bReloadFolder=!0,sb.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&(c=Eb.cache().getMessageFlagsFromCache(this.aDraftInfo[2],this.aDraftInfo[1]),c&&("forward"===this.aDraftInfo[0]?c[3]=!0:c[2]=!0,Eb.cache().setMessageFlagsToCache(this.aDraftInfo[2],this.aDraftInfo[1],c),Eb.reloadFlagsCurrentMessageListAndMessageFromCache())),b=pb.Values.UnuseOptionValue===b?"":b,Eb.cache().setFolderHash(this.draftFolder(),""),Eb.cache().setFolderHash(b,""),Eb.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=sb.createCommand(this,function(){Eb.data().draftFolderNotEnabled()?xb.showScreenPopup(E,[qb.SetSystemFoldersNotification.Draft]):(this.savedError(!1),this.saving(!0),this.bReloadFolder=!0,Eb.cache().setFolderHash(Eb.data().draftFolder(),""),Eb.remote().saveMessage(this.saveMessageResponse,this.draftFolder(),this.draftUid(),Eb.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),Eb.sub("interval.1m",function(){!this.modalVisibility()||Eb.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(Eb.settingsGet("DropboxApiKey")?!0:!1),this.dropboxCommand=sb.createCommand(this,function(){return a.Dropbox&&a.Dropbox.choose({success:function(a){a&&a[0]&&a[0].link&&b.addDropboxAttachment(a[0])},linkType:"direct",multiselect:!1}),!0},function(){return this.dropboxEnabled()}),this.modalVisibility.subscribe(function(a){!a&&this.bReloadFolder&&(this.bReloadFolder=!1,Eb.reloadMessageList())},this),this.driveEnabled=c.observable(!1),this.driveCommand=sb.createCommand(this,function(){return!0},function(){return this.driveEnabled()}),s.constructorEnd(this)}function G(){q.call(this,"Popups","PopupsContacts");var a=this,b=qb.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=!!Eb.settingsGet("ContactsSharingIsAllowed"),this.contactsPage=c.observable(1),this.contactsPageCount=c.computed(function(){var a=Math.ceil(this.contactsCount()/pb.Defaults.ContactsPerPage);return 0>=a?1:a},this),this.contactsPagenator=c.computed(sb.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(qb.ContactScopeType.Default),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(qb.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1<sb.inArray(a.type(),d)}),this.viewPropertiesEmails=this.viewProperties.filter(function(a){return-1<sb.inArray(a.type(),e)}),this.shareIcon=c.computed(function(){return qb.ContactScopeType.ShareAll===this.viewScopeType()?"icon-earth":"icon-share"},this),this.shareToNone=c.computed(function(){return qb.ContactScopeType.ShareAll!==this.viewScopeType()},this),this.shareToAll=c.computed(function(){return qb.ContactScopeType.ShareAll===this.viewScopeType()},this),this.viewHasNonEmptyRequaredProperties=c.computed(function(){var a=this.viewPropertiesNames(),b=this.viewPropertiesEmails(),c=function(a){return""!==sb.trim(a.value())};return!(!h.find(a,c)&&!h.find(b,c))},this),this.viewPropertiesPhones=this.viewProperties.filter(function(a){return-1<sb.inArray(a.type(),f)}),this.viewPropertiesOther=this.viewProperties.filter(function(a){return-1<sb.inArray(a.type(),g)}),this.viewPropertiesEmailsNonEmpty=this.viewPropertiesNames.filter(function(a){return""!==sb.trim(a.value())}),this.viewPropertiesEmailsEmptyAndOnFocused=this.viewPropertiesEmails.filter(function(a){var b=a.focused();return""===sb.trim(a.value())&&!b}),this.viewPropertiesPhonesEmptyAndOnFocused=this.viewPropertiesPhones.filter(function(a){var b=a.focused();return""===sb.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=Eb.data().useCheckboxesInList,this.search.subscribe(function(){this.reloadContactList()},this),this.contacts.subscribe(function(){sb.windowResize()},this),this.viewProperties.subscribe(function(){sb.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=sb.createCommand(this,function(){this.populateViewContact(null),this.currentContact(null)}),this.deleteCommand=sb.createCommand(this,function(){this.deleteSelectedContacts(),this.emptySelection(!0)},function(){return 0<this.contactsCheckedOrSelected().length}),this.newMessageCommand=sb.createCommand(this,function(){var a=this.contactsCheckedOrSelected(),b=[];sb.isNonEmptyArray(a)&&(b=h.map(a,function(a){if(a){var b=a.getNameAndEmailHelper(),c=b?new t(b[0],b[1]):null;if(c&&c.validate())return c}return null}),b=h.compact(b)),sb.isNonEmptyArray(b)&&(xb.hideScreenPopup(G),xb.showScreenPopup(F,[qb.ComposeType.Empty,null,b]))},function(){return 0<this.contactsCheckedOrSelected().length}),this.clearCommand=sb.createCommand(this,function(){this.search("")}),this.saveCommand=sb.createCommand(this,function(){this.viewSaving(!0),this.viewSaveTrigger(qb.SaveSettingsStep.Animate);var b=sb.fakeMd5(),c=[];h.each(this.viewProperties(),function(a){a.type()&&""!==sb.trim(a.value())&&c.push([a.type(),a.value()])}),Eb.remote().contactSave(function(c,d){var e=!1;a.viewSaving(!1),qb.StorageResultType.Success===c&&d&&d.Result&&d.Result.RequestUid===b&&0<sb.pInt(d.Result.ResultID)&&(""===a.viewID()&&a.viewID(sb.pInt(d.Result.ResultID)),""===a.viewIDStr()&&a.viewIDStr(sb.pString(d.Result.ResultIDStr)),a.reloadContactList(),e=!0),h.delay(function(){a.viewSaveTrigger(e?qb.SaveSettingsStep.TrueResult:qb.SaveSettingsStep.FalseResult)},300),e&&(a.watchDirty(!1),h.delay(function(){a.viewSaveTrigger(qb.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),s.constructorEnd(this)}function H(){q.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=sb.createCommand(this,function(){var a=this.buildSearchString();""!==a&&Eb.data().mainMessageListSearch(a),this.cancelCommand()}),s.constructorEnd(this)}function I(){q.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=sb.createCommand(this,function(){return this.emailError(""===sb.trim(this.email())),this.passwordError(""===sb.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),Eb.remote().accountAdd(h.bind(function(a,b){this.submitRequest(!1),qb.StorageResultType.Success===a&&b&&"AccountAdd"===b.Action?b.Result?(Eb.accountsAndIdentities(),this.cancelCommand()):b.ErrorCode&&this.submitError(sb.getNotification(b.ErrorCode)):this.submitError(sb.getNotification(qb.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),s.constructorEnd(this)}function J(){q.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=sb.createCommand(this,function(){return this.email.hasError()||this.email.hasError(""===sb.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),Eb.remote().identityUpdate(h.bind(function(a,b){this.submitRequest(!1),qb.StorageResultType.Success===a&&b?b.Result?(Eb.accountsAndIdentities(),this.cancelCommand()):b.ErrorCode&&this.submitError(sb.getNotification(b.ErrorCode)):this.submitError(sb.getNotification(qb.Notification.UnknownError))},this),this.id,this.email(),this.name(),this.replyTo(),this.bcc()),!0)},function(){return!this.submitRequest()}),this.label=c.computed(function(){return sb.i18n("POPUPS_IDENTITIES/"+(this.edit()?"TITLE_UPDATE_IDENTITY":"TITLE_ADD_IDENTITY"))},this),this.button=c.computed(function(){return sb.i18n("POPUPS_IDENTITIES/"+(this.edit()?"BUTTON_UPDATE_IDENTITY":"BUTTON_ADD_IDENTITY"))},this),s.constructorEnd(this)}function K(){q.call(this,"Popups","PopupsLanguages"),this.exp=c.observable(!1),this.languages=c.computed(function(){return h.map(Eb.data().languages(),function(a){return{key:a,selected:c.observable(!1),fullName:sb.convertLangName(a)}})}),Eb.data().mainLanguage.subscribe(function(){this.resetMainLanguage()},this),s.constructorEnd(this)}function L(){q.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,s.constructorEnd(this)}function M(){q.call(this,"Popups","PopupsPgpKey"),this.key=c.observable(""),this.passphrase=c.observable(""),this.bPrivate=null,this.fCallback=null,this.sendPgp=sb.createCommand(this,function(){var a=sb.trim(this.key());this.fCallback&&a&&this.fCallback(this.passphrase(),a),this.cancelCommand()}),s.constructorEnd(this)}function N(){q.call(this,"Center","Login");var b=Eb.data();this.email=c.observable(""),this.login=c.observable(""),this.password=c.observable(""),this.signMe=c.observable(!1),this.logoImg=sb.trim(Eb.settingsGet("LoginLogo")),this.loginDescription=sb.trim(Eb.settingsGet("LoginDescription")),this.logoCss=sb.trim(Eb.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),this.login.subscribe(function(){this.loginError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=c.observable(!1),this.submitError=c.observable(""),this.allowCustomLogin=b.allowCustomLogin,this.allowLanguagesOnLogin=b.allowLanguagesOnLogin,this.langRequest=c.observable(!1),this.mainLanguage=b.mainLanguage,this.bSendLanguage=!1,this.mainLanguageFullName=c.computed(function(){return sb.convertLangName(this.mainLanguage())},this),this.signMeType=c.observable(qb.LoginSignMeType.Unused),this.signMeType.subscribe(function(a){this.signMe(qb.LoginSignMeType.DefaultOn===a)},this),this.signMeVisibility=c.computed(function(){return qb.LoginSignMeType.Unused!==this.signMeType()},this),this.submitCommand=sb.createCommand(this,function(){return this.emailError(""===sb.trim(this.email())),this.passwordError(""===sb.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),Eb.remote().login(h.bind(function(a,b){qb.StorageResultType.Success===a&&b&&"Login"===b.Action?b.Result?Eb.loginAndLogoutReload():b.ErrorCode?(this.submitRequest(!1),this.submitError(sb.getNotification(b.ErrorCode))):this.submitRequest(!1):(this.submitRequest(!1),this.submitError(sb.getNotification(qb.Notification.UnknownError)))},this),this.email(),this.login(),this.password(),!!this.signMe(),this.bSendLanguage?this.mainLanguage():""),!0)},function(){return!this.submitRequest()}),this.facebookLoginEnabled=c.observable(!1),this.facebookCommand=sb.createCommand(this,function(){return a.open(Eb.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=sb.createCommand(this,function(){return a.open(Eb.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=sb.createCommand(this,function(){return a.open(Eb.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),s.constructorEnd(this)}function O(){q.call(this,"Right","SystemDropDown");var a=Eb.data();this.accounts=a.accounts,this.accountEmail=a.accountEmail,this.accountsLoading=a.accountsLoading,this.allowAddAccount=Eb.settingsGet("AllowAdditionalAccounts"),this.loading=c.computed(function(){return this.accountsLoading()},this),this.accountClick=h.bind(this.accountClick,this)
}function P(){O.call(this),s.constructorEnd(this)}function Q(){O.call(this),s.constructorEnd(this)}function R(){q.call(this,"Left","MailFolderList"),this.folderList=Eb.data().folderList,this.folderListSystem=Eb.data().folderListSystem,this.foldersChanging=Eb.data().foldersChanging,this.iDropOverTimer=0,this.allowContacts=!!Eb.settingsGet("ContactsIsAllowed"),s.constructorEnd(this)}function S(){q.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="";var a=Eb.data();this.popupVisibility=Eb.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,sb.initOnStartOrLangChange(function(){this.emptySubjectValue=sb.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 qb.Layout.NoPreview!==a.layout()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=c.computed(function(){var b=a.messageListEndSearch();return""===b?"":sb.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:b})}),this.messageListPagenator=c.computed(sb.computedPagenatorHelper(a.messageListPage,a.messageListPageCount)),this.checkAll=c.computed({read:function(){return 0<Eb.data().messageListCheckedOrSelected().length},write:function(a){a=!!a,h.each(Eb.data().messageList(),function(b){b.checked(a)}),a||Eb.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=Eb.data().messageList().length,b=Eb.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 Eb.data().spamFolder()===this.messageListEndFolder()},this),this.isSpamDisabled=c.computed(function(){return pb.Values.UnuseOptionValue===Eb.data().spamFolder()},this),this.isTrashFolder=c.computed(function(){return Eb.data().trashFolder()===this.messageListEndFolder()},this),this.canBeMoved=this.hasCheckedOrSelectedLines,this.clearCommand=sb.createCommand(this,function(){xb.showScreenPopup(C,[Eb.data().currentFolder()])}),this.multyForwardCommand=sb.createCommand(this,function(){xb.showScreenPopup(F,[qb.ComposeType.ForwardAsAttachment,Eb.data().messageListCheckedOrSelected()])},this.canBeMoved),this.deleteWithoutMoveCommand=sb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(qb.FolderType.Trash,!1)},this.canBeMoved),this.deleteCommand=sb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(qb.FolderType.Trash,!0)},this.canBeMoved),this.spamCommand=sb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(qb.FolderType.Spam,!0)},this.canBeMoved),this.moveCommand=sb.createCommand(this,sb.emptyFunction,this.canBeMoved),this.setCommand=sb.createCommand(this,sb.emptyFunction,this.hasCheckedLines),this.checkCommand=sb.createCommand(this,sb.emptyFunction,this.hasCheckedLines),this.reloadCommand=sb.createCommand(this,function(){Eb.data().messageListCompleteLoadingThrottle()||Eb.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?(qb.Layout.NoPreview===a.layout()&&xb.setHash(Eb.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<Eb.data().messageListCheckedOrSelected().length&&this.deleteCommand()},this)),Eb.sub("mailbox.message-list.selector.go-down",function(){this.selector.goDown()},this).sub("mailbox.message-list.selector.go-up",function(){this.selector.goUp()},this),this.moveOrDeleteResponse=h.bind(this.moveOrDeleteResponse,this),s.constructorEnd(this)}function T(){q.call(this,"Right","MailMessageView");var b="",d=Eb.data(),e=this,f=function(a){return sb.createCommand(e,function(){this.replyOrforward(a)},e.canBeRepliedOrForwarded)};this.oMessageScrollerDom=null,this.message=d.message,this.messageLoading=d.messageLoading,this.messageLoadingThrottle=d.messageLoadingThrottle,this.messagesBodiesDom=d.messagesBodiesDom,this.useThreads=d.useThreads,this.replySameFolder=d.replySameFolder,this.layout=d.layout,this.usePreviewPane=d.usePreviewPane,this.isMessageSelected=d.isMessageSelected,this.messageActiveDom=d.messageActiveDom,this.messageError=d.messageError,this.fullScreenMode=d.messageFullScreenMode,this.showFullInfo=c.observable(!1),this.messageVisibility=c.computed(function(){return!this.messageLoadingThrottle()&&!!this.message()},this),this.canBeRepliedOrForwarded=this.messageVisibility,this.closeMessage=sb.createCommand(this,function(){qb.Layout.NoPreview===d.layout()?Eb.historyBack():d.message(null)}),this.replyCommand=f(qb.ComposeType.Reply),this.replyAllCommand=f(qb.ComposeType.ReplyAll),this.forwardCommand=f(qb.ComposeType.Forward),this.forwardAsAttachmentCommand=f(qb.ComposeType.ForwardAsAttachment),this.editAsNewCommand=f(qb.ComposeType.EditAsNew),this.messageVisibilityCommand=sb.createCommand(this,sb.emptyFunction,this.messageVisibility),this.messageEditCommand=sb.createCommand(this,function(){this.editMessage()},this.messageVisibility),this.deleteCommand=sb.createCommand(this,function(){a.console.log(arguments)},this.messageVisibility),this.spamCommand=sb.createCommand(this,function(){a.console.log(arguments)},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(pb.DataImages.UserDotPic),this.viewUserPicVisible=c.observable(!1),this.message.subscribe(function(a){this.messageActiveDom(null),a&&(this.viewSubject(a.subject()),this.viewFromShort(a.fromToLine(!0,!0)),this.viewToShort(a.toToLine(!0,!0)),this.viewFrom(a.fromToLine(!1)),this.viewTo(a.toToLine(!1)),this.viewCc(a.ccToLine(!1)),this.viewBcc(a.bccToLine(!1)),this.viewDate(a.fullFormatDateValue()),this.viewMoment(a.momentDate()),this.viewLineAsCcc(a.lineAsCcc()),this.viewViewLink(a.viewLink()),this.viewDownloadLink(a.downloadLink()),b=Eb.cache().getUserPic(a.fromAsSingleEmail()),b!==this.viewUserPic()&&(this.viewUserPicVisible(!1),this.viewUserPic(pb.DataImages.UserDotPic),""!==b&&(this.viewUserPicVisible(!0),this.viewUserPic(b))))},this),this.fullScreenMode.subscribe(function(a){a?Ab.addClass("rl-message-fullscreen"):Ab.removeClass("rl-message-fullscreen"),sb.windowResize()}),this.messageLoadingThrottle.subscribe(function(a){a&&sb.windowResize()}),this.messageActiveDom.subscribe(function(){this.scrollMessageToTop()},this),this.goUpCommand=sb.createCommand(this,function(){Eb.pub("mailbox.message-list.selector.go-up")}),this.goDownCommand=sb.createCommand(this,function(){Eb.pub("mailbox.message-list.selector.go-down")}),s.constructorEnd(this)}function U(a){q.call(this,"Left","SettingsMenu"),this.menu=a.menu,s.constructorEnd(this)}function V(){q.call(this,"Right","SettingsPane"),s.constructorEnd(this)}function W(){var a=Eb.data();this.mainLanguage=a.mainLanguage,this.mainMessagesPerPage=a.mainMessagesPerPage,this.mainMessagesPerPageArray=pb.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 qb.DesktopNotifications.NotSupported!==a.desktopNotificationsPermisions()}),this.isDesktopNotificationsDenied=c.computed(function(){return qb.DesktopNotifications.NotSupported===a.desktopNotificationsPermisions()||qb.DesktopNotifications.Denied===a.desktopNotificationsPermisions()}),this.mainLanguageFullName=c.computed(function(){return sb.convertLangName(this.mainLanguage())},this),this.languageTrigger=c.observable(qb.SaveSettingsStep.Idle).extend({throttle:100}),this.mppTrigger=c.observable(qb.SaveSettingsStep.Idle),this.isAnimationSupported=vb.bAnimationSupported}function X(){var a=Eb.data();this.contactsAutosave=a.contactsAutosave,this.showPassword=c.observable(!1),this.allowContactsSync=!!Eb.settingsGet("ContactsSyncIsAllowed"),this.contactsSyncServer=Eb.settingsGet("ContactsSyncServer"),this.contactsSyncUser=Eb.settingsGet("ContactsSyncUser"),this.contactsSyncPass=Eb.settingsGet("ContactsSyncPassword"),this.contactsSyncPabUrl=Eb.settingsGet("ContactsSyncPabUrl")}function Y(){var a=Eb.data();this.accounts=a.accounts,this.processText=c.computed(function(){return a.accountsLoading()?sb.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 Z(){var a=Eb.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(qb.SaveSettingsStep.Idle),this.replyTrigger=c.observable(qb.SaveSettingsStep.Idle),this.signatureTrigger=c.observable(qb.SaveSettingsStep.Idle)}function $(){var a=Eb.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(qb.SaveSettingsStep.Idle),this.replyTrigger=c.observable(qb.SaveSettingsStep.Idle),this.signatureTrigger=c.observable(qb.SaveSettingsStep.Idle),this.identities=a.identities,this.processText=c.computed(function(){return a.identitiesLoading()?sb.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 _(){var a=Eb.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=sb.createCommand(this,function(){this.googleLoggined()||Eb.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=sb.createCommand(this,function(){Eb.googleDisconnect()}),this.connectFacebook=sb.createCommand(this,function(){this.facebookLoggined()||Eb.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=sb.createCommand(this,function(){Eb.facebookDisconnect()}),this.connectTwitter=sb.createCommand(this,function(){this.twitterLoggined()||Eb.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=sb.createCommand(this,function(){Eb.twitterDisconnect()})}function ab(){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=sb.createCommand(this,function(){this.changeProcess(!0),this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),Eb.remote().changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword())},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()}),this.onChangePasswordResponse=h.bind(this.onChangePasswordResponse,this)}function bb(){var a=Eb.data();this.foldersListError=a.foldersListError,this.folderList=a.folderList,this.processText=c.computed(function(){var a=Eb.data(),b=a.foldersLoading(),c=a.foldersCreating(),d=a.foldersDeleting(),e=a.foldersRenaming();return c?sb.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):d?sb.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):e?sb.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):b?sb.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=!!Eb.settingsGet("UseImapSubscribe")}function cb(){var d=this,e=Eb.data();this.mainTheme=e.mainTheme,this.customThemeType=c.observable(Eb.settingsGet("CustomThemeType")),this.customThemeImg=c.observable(Eb.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(){sb.windowResize()}),this.themeTrigger=c.observable(qb.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,Eb.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(qb.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=b.ajax({url:g,dataType:"json"}).done(function(a){a&&sb.isArray(a)&&2===a.length&&(!e||!e[0]||f&&f[0]||(f=b('<style id="rlThemeStyle"></style>'),e.after(f),e.remove()),f&&f[0]&&f.attr("data-href",g).attr("data-theme",a[0]).text(a[1]),d.themeTrigger(qb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(qb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Eb.remote().saveSettings(null,{Theme:c})},this)}function db(){sb.initDataConstructorBySettings(this)}function eb(){db.call(this);var a=function(a){return function(){var b=Eb.cache().getFolderFromCacheList(a());b&&b.type(qb.FolderType.User)}},d=function(a){return function(b){var c=Eb.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.observable(""),this.sentFolder.subscribe(a(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange"),this.sentFolder.subscribe(d(qb.FolderType.SentItems),this),this.draftFolder.subscribe(d(qb.FolderType.Draft),this),this.spamFolder.subscribe(d(qb.FolderType.Spam),this),this.trashFolder.subscribe(d(qb.FolderType.Trash),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||pb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.namespace="",this.folderList=c.observableArray([]),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.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();return sb.isArray(b)&&0<b.length&&(""!==c&&pb.Values.UnuseOptionValue!==c&&a.push(c),""!==d&&pb.Values.UnuseOptionValue!==d&&a.push(d),""!==e&&pb.Values.UnuseOptionValue!==e&&a.push(e),""!==f&&pb.Values.UnuseOptionValue!==f&&a.push(f)),a},this),this.folderListSystem=c.computed(function(){return h.compact(h.map(this.folderListSystemNames(),function(a){return Eb.cache().getFolderFromCacheList(a)}))},this),this.folderMenuForMove=c.computed(function(){return Eb.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){xb.setHash(Eb.link().mailBox(this.currentFolderFullNameHash(),1,sb.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 y,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this),this.messageFullScreenMode=c.observable(!1),this.messageError=c.observable(""),this.messagesBodiesDom=c.observable(null),this.messagesBodiesDom.subscribe(function(a){!a||a instanceof jQuery||this.messagesBodiesDom(b(a))},this),this.messageActiveDom=c.observable(null),this.isMessageSelected=c.computed(function(){return null!==this.message()},this),this.currentMessage=c.observable(null),this.message.subscribe(function(a){null===a&&(this.currentMessage(null),this.hideMessageBodies())},this),this.messageListChecked=c.computed(function(){return h.filter(this.messageList(),function(a){return a.checked()})},this),this.messageListCheckedOrSelected=c.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return h.union(a,b?[b]:[])},this),this.messageListCheckedUids=c.computed(function(){var a=[];return h.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),0<b.threadsLen()&&0===b.parentUid()&&b.lastInCollapsedThread()&&(a=h.union(a,b.threads())))}),a},this),this.messageListCheckedOrSelectedUidsWithSubMails=c.computed(function(){var a=[];return h.each(this.messageListCheckedOrSelected(),function(b){b&&(a.push(b.uid),0<b.threadsLen()&&0===b.parentUid()&&b.lastInCollapsedThread()&&(a=h.union(a,b.threads())))}),a},this),this.userQuota=c.observable(0),this.userUsageSize=c.observable(0),this.userUsageProc=c.computed(function(){var a=this.userQuota(),b=this.userUsageSize();return a>0?Math.ceil(b/a*100):0},this),this.useKeyboardShortcuts=c.observable(!0),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(qb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function fb(){this.oRequests={}}function gb(){fb.call(this),this.oRequests={}}function hb(){this.oEmailsPicsHashes={},this.oServices={}}function ib(){hb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function jb(a){r.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function kb(){r.call(this,"login",[N])}function lb(){r.call(this,"mailbox",[P,R,S,T]),this.oLastRoute={}}function mb(){jb.call(this,[Q,U,V]),sb.initOnStartOrLangChange(function(){this.sSettingsTitle=sb.i18n("TITLES/SETTINGS")},this,function(){Eb.setTitle(this.sSettingsTitle)})}function nb(){p.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibility=c.observable(!1),this.iframe=b('<iframe style="display:none" src="javascript:;" />').appendTo("body"),Bb.on("error",function(a){Eb&&a&&a.originalEvent&&a.originalEvent.message&&-1===sb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Eb.remote().jsError(sb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Ab.attr("class"),sb.microtime()-vb.now)})}function ob(){nb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.quotaDebounce=h.debounce(this.quota,3e4),a.setInterval(function(){Eb.pub("interval.30s")},3e4),a.setInterval(function(){Eb.pub("interval.1m")},6e4),a.setInterval(function(){Eb.pub("interval.2m")},12e4),a.setInterval(function(){Eb.pub("interval.3m")},18e4),a.setInterval(function(){Eb.pub("interval.5m")},3e5),a.setInterval(function(){Eb.pub("interval.10m")},6e5),b.wakeUp(function(){Eb.remote().jsVersion(function(b,c){qb.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Eb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Eb.settingsGet("Version"))},{},36e5)}var pb={},qb={},rb={},sb={},tb={},ub={},vb={},wb={settings:[],"settings-removed":[],"settings-disabled":[]},xb=null,yb=a.rainloopAppData||{},zb=a.rainloopI18N||{},Ab=b("html"),Bb=b(a),Cb=b(a.document),Db=a.Notification&&a.Notification.requestPermission?a.Notification:null,Eb=null;vb.now=(new Date).getTime(),vb.momentTrigger=c.observable(!0),vb.langChangeTrigger=c.observable(!0),vb.iAjaxErrorCount=0,vb.iTokenErrorCount=0,vb.iMessageBodyCacheCount=0,vb.bUnload=!1,vb.sUserAgent=(navigator.userAgent||"").toLowerCase(),vb.bIsiOSDevice=-1<vb.sUserAgent.indexOf("iphone")||-1<vb.sUserAgent.indexOf("ipod")||-1<vb.sUserAgent.indexOf("ipad"),vb.bIsAndroidDevice=-1<vb.sUserAgent.indexOf("android"),vb.bMobileDevice=vb.bIsiOSDevice||vb.bIsAndroidDevice,vb.bDisableNanoScroll=vb.bMobileDevice,vb.bAllowPdfPreview=!vb.bMobileDevice,vb.bAllowOpenPGP=!1,vb.bAnimationSupported=!vb.bMobileDevice&&Ab.hasClass("csstransitions"),vb.sAnimationType="",vb.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:"blockquote",removeButtons:"Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image",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:"12",fontSize_sizes:"10/10px;12/12px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px"},vb.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"},vb.bAllowPdfPreview&&navigator&&navigator.mimeTypes&&(vb.bAllowPdfPreview=!!h.find(navigator.mimeTypes,function(a){return a&&"application/pdf"===a.type})),pb.Defaults={},pb.Values={},pb.DataImages={},pb.Defaults.MessagesPerPage=20,pb.Defaults.ContactsPerPage=20,pb.Defaults.MessagesPerPageArray=[10,20,30,50,100],pb.Defaults.DefaultAjaxTimeout=2e4,pb.Defaults.SearchAjaxTimeout=12e4,pb.Defaults.SendMessageAjaxTimeout=2e5,pb.Defaults.SaveMessageAjaxTimeout=2e5,pb.Values.UnuseOptionValue="__UNUSE__",pb.Values.GmailFolderName="[Gmail]",pb.Values.ClientSideCookieIndexName="rlcsc",pb.Values.ImapDefaulPort=143,pb.Values.ImapDefaulSecurePort=993,pb.Values.SmtpDefaulPort=25,pb.Values.SmtpDefaulSecurePort=465,pb.Values.MessageBodyCacheLimit=15,pb.Values.AjaxErrorLimit=7,pb.Values.TokenErrorLimit=10,pb.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",pb.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",qb.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},qb.State={Empty:10,Login:20,Auth:30},qb.StateType={Webmail:0,Admin:1},qb.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,User:99},qb.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},qb.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},qb.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},qb.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},qb.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4},qb.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},qb.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},qb.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},qb.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},qb.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},qb.MessagePriority={Low:5,Normal:3,High:1},qb.EditorDefaultType={Html:"Html",Plain:"Plain"},qb.CustomThemeType={Light:"Light",Dark:"Dark"},qb.ServerSecure={None:0,SSL:1,TLS:2},qb.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},qb.EmailType={Defailt:0,Facebook:1,Google:2},qb.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},qb.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},qb.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},qb.ContactScopeType={Default:0,ShareAll:2},qb.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},qb.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,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},sb.trim=b.trim,sb.inArray=b.inArray,sb.isArray=h.isArray,sb.isFunc=h.isFunction,sb.isUnd=h.isUndefined,sb.isNull=h.isNull,sb.emptyFunction=function(){},sb.isNormal=function(a){return!sb.isUnd(a)&&!sb.isNull(a)},sb.windowResize=h.debounce(function(b){sb.isUnd(b)?Bb.resize():a.setTimeout(function(){Bb.resize()
},b)},50),sb.isPosNumeric=function(a,b){return sb.isNormal(a)?(sb.isUnd(b)?0:!b)?/^[1-9]+[0-9]*$/.test(a.toString()):/^[0-9]*$/.test(a.toString()):!1},sb.pInt=function(b){return sb.isNormal(b)&&""!==b?a.parseInt(b,10):0},sb.pString=function(a){return sb.isNormal(a)?""+a:""},sb.isNonEmptyArray=function(a){return sb.isArray(a)&&0<a.length},sb.exportPath=function(b,c,d){for(var e=null,f=b.split("."),g=d||a;f.length&&(e=f.shift());)f.length||sb.isUnd(c)?g=g[e]?g[e]:g[e]={}:g[e]=c},sb.pImport=function(a,b,c){a[b]=c},sb.pExport=function(a,b,c){return sb.isUnd(a[b])?c:a[b]},sb.encodeHtml=function(a){return sb.isNormal(a)?a.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""},sb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=sb.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},sb.timeOutAction=function(){var b={};return function(c,d,e){sb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),sb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),sb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(vb.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}}(),sb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},sb.i18n=function(a,b,c){var d="",e=sb.isUnd(zb[a])?sb.isUnd(c)?a:c:zb[a];if(!sb.isUnd(b)&&!sb.isNull(b))for(d in b)sb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},sb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(sb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(sb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",sb.i18n(c)))})})},sb.i18nToDoc=function(){a.rainloopI18N&&(zb=a.rainloopI18N||{},sb.i18nToNode(Cb),vb.langChangeTrigger(!vb.langChangeTrigger())),a.rainloopI18N={}},sb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?vb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&vb.langChangeTrigger.subscribe(a,b)},sb.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)},sb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},sb.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()},sb.replySubjectAdd=function(b,c,d){var e=null,f=sb.trim(c);return null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||sb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||sb.isUnd(e[1])||sb.isUnd(e[2])||sb.isUnd(e[3])?f=b+": "+c:(f=e[1]+(sb.pInt(e[2])+1)+e[3],f=e[1]+(sb.pInt(e[2])+1)+e[3]):f=b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),(sb.isUnd(d)?!0:d)?sb.fixLongSubject(f):f},sb.fixLongSubject=function(a){var b=0,c=null;a=sb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||sb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=sb.isUnd(c[2])?1:0+sb.pInt(c[2]),b+=sb.isUnd(c[4])?1:0+sb.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]+/," ")},sb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},sb.friendlySize=function(a){return a=sb.pInt(a),a>=1073741824?sb.roundNumber(a/1073741824,1)+"GB":a>=1048576?sb.roundNumber(a/1048576,1)+"MB":a>=1024?sb.roundNumber(a/1024,0)+"KB":a+"B"},sb.log=function(b){a.console&&a.console.log&&a.console.log(b)},sb.getNotification=function(a,b){return a=sb.pInt(a),qb.Notification.ClientViewError===a&&b?b:sb.isUnd(rb[a])?"":rb[a]},sb.initNotificationLanguage=function(){rb[qb.Notification.InvalidToken]=sb.i18n("NOTIFICATIONS/INVALID_TOKEN"),rb[qb.Notification.AuthError]=sb.i18n("NOTIFICATIONS/AUTH_ERROR"),rb[qb.Notification.AccessError]=sb.i18n("NOTIFICATIONS/ACCESS_ERROR"),rb[qb.Notification.ConnectionError]=sb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),rb[qb.Notification.CaptchaError]=sb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),rb[qb.Notification.SocialFacebookLoginAccessDisable]=sb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),rb[qb.Notification.SocialTwitterLoginAccessDisable]=sb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),rb[qb.Notification.SocialGoogleLoginAccessDisable]=sb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),rb[qb.Notification.DomainNotAllowed]=sb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),rb[qb.Notification.AccountNotAllowed]=sb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),rb[qb.Notification.CantGetMessageList]=sb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),rb[qb.Notification.CantGetMessage]=sb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),rb[qb.Notification.CantDeleteMessage]=sb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),rb[qb.Notification.CantMoveMessage]=sb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),rb[qb.Notification.CantCopyMessage]=sb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),rb[qb.Notification.CantSaveMessage]=sb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),rb[qb.Notification.CantSendMessage]=sb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),rb[qb.Notification.InvalidRecipients]=sb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),rb[qb.Notification.CantCreateFolder]=sb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),rb[qb.Notification.CantRenameFolder]=sb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),rb[qb.Notification.CantDeleteFolder]=sb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),rb[qb.Notification.CantDeleteNonEmptyFolder]=sb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),rb[qb.Notification.CantSubscribeFolder]=sb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),rb[qb.Notification.CantUnsubscribeFolder]=sb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),rb[qb.Notification.CantSaveSettings]=sb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),rb[qb.Notification.CantSavePluginSettings]=sb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),rb[qb.Notification.DomainAlreadyExists]=sb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),rb[qb.Notification.CantInstallPackage]=sb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),rb[qb.Notification.CantDeletePackage]=sb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),rb[qb.Notification.InvalidPluginPackage]=sb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),rb[qb.Notification.UnsupportedPluginPackage]=sb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),rb[qb.Notification.LicensingServerIsUnavailable]=sb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),rb[qb.Notification.LicensingExpired]=sb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),rb[qb.Notification.LicensingBanned]=sb.i18n("NOTIFICATIONS/LICENSING_BANNED"),rb[qb.Notification.DemoSendMessageError]=sb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),rb[qb.Notification.AccountAlreadyExists]=sb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),rb[qb.Notification.MailServerError]=sb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),rb[qb.Notification.UnknownNotification]=sb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),rb[qb.Notification.UnknownError]=sb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},sb.getUploadErrorDescByCode=function(a){var b="";switch(sb.pInt(a)){case qb.UploadErrorCode.FileIsTooBig:b=sb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case qb.UploadErrorCode.FilePartiallyUploaded:b=sb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case qb.UploadErrorCode.FileNoUploaded:b=sb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case qb.UploadErrorCode.MissingTempFolder:b=sb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case qb.UploadErrorCode.FileOnSaveingError:b=sb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case qb.UploadErrorCode.FileType:b=sb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=sb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},sb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=sb.pInt(d),0>=d?a[b].apply(a,sb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,sb.isArray(c)?c:[])},d))},sb.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===qb.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===qb.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},sb.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=sb.isUnd(d)?!0:d,e.canExecute=sb.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},sb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(qb.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(qb.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),vb.sAnimationType=qb.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(qb.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return qb.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(vb.bMobileDevice||a===qb.InterfaceAnimation.None)Ab.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),vb.sAnimationType=qb.InterfaceAnimation.None;else switch(a){case qb.InterfaceAnimation.Full:Ab.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),vb.sAnimationType=a;break;case qb.InterfaceAnimation.Normal:Ab.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),vb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=qb.DesktopNotifications.NotSupported;if(Db&&Db.permission)switch(Db.permission.toLowerCase()){case"granted":c=qb.DesktopNotifications.Allowed;break;case"denied":c=qb.DesktopNotifications.Denied;break;case"default":c=qb.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&qb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();qb.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):qb.DesktopNotifications.NotAllowed===c?Db.requestPermission(function(){b.desktopNotifications.valueHasMutated(),qb.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<sb.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<sb.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(pb.Defaults.MessagesPerPage),b.mainMessagesPerPage=b.messagesPerPage,b.mainMessagesPerPage=c.computed({read:b.messagesPerPage,write:function(a){-1<sb.inArray(sb.pInt(a),pb.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)},sb.createMomentDate=function(a){return sb.isUnd(a.moment)&&(a.moment=c.observable(f())),c.computed(function(){return vb.momentTrigger(),this.moment().fromNow()},a)},sb.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")?sb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?sb.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},sb.isFolderExpanded=function(a){var b=Eb.local().get(qb.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},sb.setExpandedFolder=function(a,b){var c=Eb.local().get(qb.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Eb.local().set(qb.ClientSideKeyName.ExpandedFolders,c)},sb.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Eb.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Eb.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})},sb.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"),sb.windowResize()}).after("<br />").before("<br />"))})}},sb.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()}))},sb.extendAsViewModel=function(a,b,c){b&&(c||(c=q),b.__name=a,tb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},sb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},wb.settings.push(a)},sb.removeSettingsViewModel=function(a){wb["settings-removed"].push(a)},sb.disableSettingsViewModel=function(a){wb["settings-disabled"].push(a)},sb.convertThemeName=function(a){return sb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},sb.quoteName=function(a){return a.replace(/["]/g,'\\"')},sb.microtime=function(){return(new Date).getTime()},sb.convertLangName=function(a,b){return sb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},sb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=sb.isUnd(a)?32:sb.pInt(a);b.length<a;)b+=c.substr(Math.round(Math.random()*c.length),1);return b},sb.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")},sb.draggeblePlace=function(){return b('<div class="draggablePlace"><span class="text"></span>&nbsp;<i class="icon-mail icon-white"></i></div>').appendTo("#rl-hidden")},sb.defautOptionsAfterRender=function(a,b){b&&!sb.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},sb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+sb.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")),sb.i18nToNode(d),s.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>'+sb.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)},sb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=sb.isUnd(d)?1e3:sb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?qb.SaveSettingsStep.TrueResult:qb.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,qb.SaveSettingsStep.Idle)},d)}},sb.settingsSaveHelperSimpleFunction=function(a,b){return sb.settingsSaveHelperFunction(null,a,b,1e3)},sb.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,"&lt;").replace(/>/g,"&gt;"):""},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(/&nbsp;/gi," ").replace(/<[^>]*>/gm,"").replace(/&gt;/gi,">").replace(/&lt;/gi,"<").replace(/&amp;/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,"")},sb.plainToHtml=function(a){return a.toString().replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")},sb.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},sb.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:sb.isUnd(c)?a.toString():c.toString(),custom:sb.isUnd(c)?!1:!0,title:sb.isUnd(c)?"":a.toString(),value:a.toString()};(sb.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}},ub={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return ub.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=ub._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 ub._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(!vb.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+'">'+sb.i18n(c.utils.unwrapObservable(d()))+"</span>"}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return'<span class="tooltip-class '+d+'">'+c()()+"</span>"}})}},c.bindingHandlers.dropdown={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!vb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){sb.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){sb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),sb.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=sb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=sb.pInt(e[2]),g=Bb.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(!vb.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),sb.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),sb.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(){sb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!vb.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){vb.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('&nbsp;&nbsp;<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){Eb.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=sb.trim(a),c=null;return""!==b?(c=new t,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(sb.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},sb.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=sb.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=sb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),sb.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 sb.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=sb.isNormal(b)?sb.pInt(b):1,c=sb.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+"/":"")},tb.oViewModelsHooks={},tb.oSimpleHooks={},tb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},tb.addHook=function(a,b){sb.isFunc(b)&&(sb.isArray(tb.oSimpleHooks[a])||(tb.oSimpleHooks[a]=[]),tb.oSimpleHooks[a].push(b))},tb.runHook=function(a,b){sb.isArray(tb.oSimpleHooks[a])&&(b=b||[],h.each(tb.oSimpleHooks[a],function(a){a.apply(null,b)}))},tb.mainSettingsGet=function(a){return Eb?Eb.settingsGet(a):null},tb.remoteRequest=function(a,b,c,d,e,f){Eb&&Eb.remote().defaultRequest(a,b,c,d,e,f)},tb.settingsGet=function(a,b){var c=tb.mainSettingsGet("Plugins");return c=c&&sb.isUnd(c[a])?null:c[a],c?sb.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=vb.oHtmlEditorDefaultConfig,d=Eb.settingsGet("Language"),e=!!Eb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=vb.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.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.fOnReady(),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.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(qb.EventKeyCode.Down,!1)},l.prototype.goUp=function(){this.newSelectPosition(qb.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&&!sb.inFocus()&&(-1<sb.inArray(a.keyCode,[qb.EventKeyCode.Up,qb.EventKeyCode.Down,qb.EventKeyCode.Insert,qb.EventKeyCode.Home,qb.EventKeyCode.End,qb.EventKeyCode.PageUp,qb.EventKeyCode.PageDown])?(f.newSelectPosition(a.keyCode,a.shiftKey),b=!1):qb.EventKeyCode.Delete!==a.keyCode||a.ctrlKey||a.shiftKey||(f.oCallbacks.onDelete&&f.oCallbacks.onDelete(),b=!1)),b})}},l.prototype.selectByUid=function(a,b){b=sb.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(qb.EventKeyCode.Down===b||qb.EventKeyCode.Up===b||qb.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case qb.EventKeyCode.Up:m===a?i=!0:j=a;break;case qb.EventKeyCode.Down:case qb.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(qb.EventKeyCode.Home===b||qb.EventKeyCode.End===b)qb.EventKeyCode.Home===b?j=k[0]:qb.EventKeyCode.End===b&&(j=k[k.length-1]);else if(qb.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(qb.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 qb.EventKeyCode.Down===b||qb.EventKeyCode.Insert===b||qb.EventKeyCode.Home===b||qb.EventKeyCode.PageUp===b?j=k[0]:(qb.EventKeyCode.Up===b||qb.EventKeyCode.End===b||qb.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(qb.EventKeyCode.Up===b||qb.EventKeyCode.Down===b)&&m.checked(!m.checked()):qb.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||qb.EventKeyCode.Up!==b&&qb.EventKeyCode.Down!==b?qb.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)?(d.top<0?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-a):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},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(pb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(pb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},m.prototype.get=function(a){var c=b.cookie(pb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!sb.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[pb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[pb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},n.prototype.get=function(b){var c=a.localStorage[pb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!sb.isUnd(d[b])?d[b]:null}catch(e){}return d},o.prototype.oDriver=null,o.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},o.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},p.prototype.bootstart=function(){},q.prototype.sPosition="",q.prototype.sTemplate="",q.prototype.viewModelName="",q.prototype.viewModelDom=null,q.prototype.viewModelTemplate=function(){return this.sTemplate},q.prototype.viewModelPosition=function(){return this.sPosition},q.prototype.cancelCommand=q.prototype.closeCommand=function(){},r.prototype.oCross=null,r.prototype.sScreenName="",r.prototype.aViewModels=[],r.prototype.viewModels=function(){return this.aViewModels},r.prototype.screenName=function(){return this.sScreenName},r.prototype.routes=function(){return null},r.prototype.__cross=function(){return this.oCross},r.prototype.__start=function(){var a=this.routes(),b=null,c=null;sb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||sb.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},s.constructorEnd=function(a){sb.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},s.prototype.sDefaultScreenName="",s.prototype.oScreens={},s.prototype.oBoot=null,s.prototype.oCurrentScreen=null,s.prototype.hideLoading=function(){b("#rl-loading").hide()},s.prototype.routeOff=function(){e.changed.active=!1},s.prototype.routeOn=function(){e.changed.active=!0},s.prototype.setBoot=function(a){return sb.isNormal(a)&&(this.oBoot=a),this},s.prototype.screen=function(a){return""===a||sb.isUnd(this.oScreens[a])?null:this.oScreens[a]},s.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=Eb.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=sb.createCommand(e,function(){xb.hideScreenPopup(a)})),tb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),sb.delegateRun(e,"onBuild",[h]),tb.runHook("view-model-post-build",[a.__name,e,h])):sb.log("Cannot find view model position: "+f)}return a?a.__vm:null},s.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},s.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),sb.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),tb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},s.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),sb.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),tb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),sb.delegateRun(a.__vm,"onFocus",[],500)))},s.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===sb.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,sb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),sb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(sb.delegateRun(c.oCurrentScreen,"onHide"),sb.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),sb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(sb.delegateRun(c.oCurrentScreen,"onShow"),tb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),sb.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),sb.delegateRun(a.__vm,"onShow"),sb.delegateRun(a.__vm,"onFocus",[],200),tb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},s.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(),tb.runHook("screen-pre-start",[a.screenName(),a]),sb.delegateRun(a,"onStart"),tb.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(){Ab.removeClass("rl-started-trigger").addClass("rl-started")},50)},s.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=sb.isUnd(c)?!1:!!c,(sb.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)},s.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},xb=new s,t.newInstanceFromJson=function(a){var b=new t;return b.initByJson(a)?b:null},t.prototype.name="",t.prototype.email="",t.prototype.privateType=null,t.prototype.clear=function(){this.email="",this.name="",this.privateType=null},t.prototype.validate=function(){return""!==this.name||""!==this.email},t.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},t.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},t.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=qb.EmailType.Facebook),null===this.privateType&&(this.privateType=qb.EmailType.Default)),this.privateType},t.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},t.prototype.parse=function(a){this.clear(),a=sb.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)},t.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=sb.trim(a.Name),this.email=sb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},t.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=sb.isUnd(b)?!1:!!b,c=sb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'<a href="mailto:'+sb.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+sb.encodeHtml(this.name)+"</a>":c?sb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=sb.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+sb.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+sb.encodeHtml(d)+"</a>"+sb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=sb.encodeHtml(d))):b&&(d='<a href="mailto:'+sb.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+sb.encodeHtml(this.email)+"</a>"))),d},t.prototype.mailsoParse=function(a){if(a=sb.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=sb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=sb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=sb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},t.prototype.inputoTagLine=function(){return 0<this.name.length?this.name+" ("+this.email+")":this.email},u.prototype.getNameAndEmailHelper=function(){var a="",b="";return sb.isNonEmptyArray(this.properties)&&h.each(this.properties,function(c){c&&(""===a&&qb.ContactPropertyType.FullName===c[0]?a=c[1]:""===b&&-1<sb.inArray(c[0],[qb.ContactPropertyType.EmailPersonal,qb.ContactPropertyType.EmailBussines,qb.ContactPropertyType.EmailOther])&&(b=c[1]))},this),""===b?null:[b,a]},u.prototype.parse=function(a){var b=!1;return a&&"Object/Contact"===a["@Object"]&&(this.idContact=sb.pInt(a.IdContact),this.idContactStr=sb.pString(a.IdContactStr),this.display=sb.pString(a.Display),this.readOnly=!!a.ReadOnly,this.scopeType=sb.pInt(a.ScopeType),sb.isNonEmptyArray(a.Properties)&&h.each(a.Properties,function(a){a&&a.Type&&sb.isNormal(a.Value)&&this.properties.push([sb.pInt(a.Type),sb.pString(a.Value)])},this),this.shared(qb.ContactScopeType.ShareAll===this.scopeType),b=!0),b},u.prototype.srcAttr=function(){return Eb.link().emptyContactPic()},u.prototype.generateUid=function(){return""+this.idContact},u.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(" ")},w.newInstanceFromJson=function(a){var b=new w;return b.initByJson(a)?b:null},w.prototype.mimeType="",w.prototype.fileName="",w.prototype.estimatedSize=0,w.prototype.friendlySize="",w.prototype.isInline=!1,w.prototype.isLinked=!1,w.prototype.cid="",w.prototype.cidWithOutTags="",w.prototype.contentLocation="",w.prototype.download="",w.prototype.folder="",w.prototype.uid="",w.prototype.mimeIndex="",w.prototype.initByJson=function(a){var b=!1;return a&&"Object/Attachment"===a["@Object"]&&(this.mimeType=(a.MimeType||"").toLowerCase(),this.fileName=a.FileName,this.estimatedSize=sb.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=sb.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),b=!0),b},w.prototype.isImage=function(){return-1<sb.inArray(this.mimeType.toLowerCase(),["image/png","image/jpg","image/jpeg","image/gif"])},w.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)&&-1===sb.inArray(this.mimeType,["text/html"])},w.prototype.isPdf=function(){return vb.bAllowPdfPreview&&"application/pdf"===this.mimeType},w.prototype.linkDownload=function(){return Eb.link().attachmentDownload(this.download)},w.prototype.linkPreview=function(){return Eb.link().attachmentPreview(this.download)},w.prototype.linkPreviewAsPlain=function(){return Eb.link().attachmentPreviewAsPlain(this.download)},w.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},w.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},w.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<sb.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<sb.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<sb.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<sb.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},x.prototype.id="",x.prototype.isInline=!1,x.prototype.isLinked=!1,x.prototype.CID="",x.prototype.contentLocation="",x.prototype.fromMessage=!1,x.prototype.cancel=sb.emptyFunction,x.prototype.initByUploadJson=function(a){var b=!1;return a&&(this.fileName(a.Name),this.size(sb.isUnd(a.Size)?0:sb.pInt(a.Size)),this.tempName(sb.isUnd(a.TempName)?"":a.TempName),this.isInline=!1,b=!0),b},y.newInstanceFromJson=function(a){var b=new y;return b.initByJson(a)?b:null},y.calculateFullFromatDateValue=function(a){return f.unix(a).format("LLL")},y.emailsToLine=function(a,b,c){var d=[],e=0,f=0;if(sb.isNonEmptyArray(a))for(e=0,f=a.length;f>e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},y.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(sb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=t.newInstanceFromJson(a[b]),d&&e.push(d);return e},y.replyHelper=function(a,b,c){if(a&&0<a.length)for(var d=0,e=a.length;e>d;d++)sb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},y.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(qb.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.pgpSignature(""),this.priority(qb.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)},y.prototype.computeSenderEmail=function(){var a=Eb.data().sentFolder(),b=Eb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},y.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.size(sb.pInt(a.Size)),this.from=y.initEmailsFromJson(a.From),this.to=y.initEmailsFromJson(a.To),this.cc=y.initEmailsFromJson(a.Cc),this.bcc=y.initEmailsFromJson(a.Bcc),this.replyTo=y.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(sb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(y.emailsToLine(this.from,!0)),this.toEmailsString(y.emailsToLine(this.to,!0)),this.parentUid(sb.pInt(a.ParentThread)),this.threads(sb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(sb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},y.prototype.initUpdateByMessageJson=function(a){var b=!1,c=qb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=sb.pInt(a.Priority),this.priority(-1<sb.inArray(c,[qb.MessagePriority.High,qb.MessagePriority.Low])?c:qb.MessagePriority.Normal),this.aDraftInfo=a.DraftInfo,this.sMessageId=a.MessageId,this.sInReplyTo=a.InReplyTo,this.sReferences=a.References,vb.bAllowOpenPGP&&(this.isPgpSigned(!!a.PgpSigned),this.isPgpEncrypted(!!a.PgpEncrypted),this.pgpSignature(a.PgpSignature)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.foundedCIDs=sb.isArray(a.FoundedCIDs)?a.FoundedCIDs:[],this.attachments(this.initAttachmentsFromJson(a.Attachments)),this.readReceipt(a.ReadReceipt||""),this.computeSenderEmail(),b=!0),b},y.prototype.initAttachmentsFromJson=function(a){var b=0,c=0,d=null,e=[];if(a&&"Collection/AttachmentCollection"===a["@Object"]&&sb.isNonEmptyArray(a["@Collection"]))for(b=0,c=a["@Collection"].length;c>b;b++)d=w.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0<this.foundedCIDs.length&&0<=sb.inArray(d.cidWithOutTags,this.foundedCIDs)&&(d.isLinked=!0),e.push(d));return e},y.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},y.prototype.fromToLine=function(a,b){return y.emailsToLine(this.from,a,b)},y.prototype.toToLine=function(a,b){return y.emailsToLine(this.to,a,b)},y.prototype.ccToLine=function(a,b){return y.emailsToLine(this.cc,a,b)},y.prototype.bccToLine=function(a,b){return y.emailsToLine(this.bcc,a,b)},y.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(" ")},y.prototype.hasVisibleAttachments=function(){return!!h.find(this.attachments(),function(a){return!a.isLinked})},y.prototype.findAttachmentByCid=function(a){var b=null,c=this.attachments();return sb.isNonEmptyArray(c)&&(a=a.replace(/^<+/,"").replace(/>+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},y.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return sb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},y.prototype.messageId=function(){return this.sMessageId},y.prototype.inReplyTo=function(){return this.sInReplyTo},y.prototype.references=function(){return this.sReferences},y.prototype.fromAsSingleEmail=function(){return sb.isArray(this.from)&&this.from[0]?this.from[0].email:""},y.prototype.viewLink=function(){return Eb.link().messageViewLink(this.requestHash)},y.prototype.downloadLink=function(){return Eb.link().messageDownloadLink(this.requestHash)},y.prototype.replyEmails=function(a){var b=[],c=sb.isUnd(a)?{}:a;return y.replyHelper(this.replyTo,c,b),0===b.length&&y.replyHelper(this.from,c,b),b},y.prototype.replyAllEmails=function(a){var b=[],c=[],d=sb.isUnd(a)?{}:a;return y.replyHelper(this.replyTo,d,b),0===b.length&&y.replyHelper(this.from,d,b),y.replyHelper(this.to,d,b),y.replyHelper(this.cc,d,c),[b,c]},y.prototype.textBodyToString=function(){return this.body?this.body.html():""},y.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0<a.length?a.join(", "):""},y.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()}},y.prototype.viewPopupMessage=function(c){sb.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))})},y.prototype.printMessage=function(){this.viewPopupMessage(!0)},y.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},y.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.requestHash=a.requestHash,this.subject(a.subject()),this.size(a.size()),this.dateTimeStampInUTC(a.dateTimeStampInUTC()),this.priority(a.priority()),this.fromEmailString(a.fromEmailString()),this.toEmailsString(a.toEmailsString()),this.emails=a.emails,this.from=a.from,this.to=a.to,this.cc=a.cc,this.bcc=a.bcc,this.replyTo=a.replyTo,this.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),this.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(qb.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},y.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=sb.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=sb.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]}),Bb.resize()),sb.windowResize(500))
},y.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){a=sb.isUnd(a)?!1:a;var c=this;this.body.data("rl-init-internal-images",!0),b("[data-x-src-cid]",this.body).each(function(){var d=c.findAttachmentByCid(b(this).attr("data-x-src-cid"));d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-src-location]",this.body).each(function(){var d=c.findAttachmentByContentLocation(b(this).attr("data-x-src-location"));d||(d=c.findAttachmentByCid(b(this).attr("data-x-src-location"))),d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-style-cid]",this.body).each(function(){var a="",d="",e=c.findAttachmentByCid(b(this).attr("data-x-style-cid"));e&&e.linkPreview&&(d=b(this).attr("data-x-style-cid-name"),""!==d&&(a=sb.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]),sb.windowResize(500)}},z.newInstanceFromJson=function(a){var b=new z;return b.initByJson(a)?b.initComputed():null},z.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 qb.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 qb.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){sb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){sb.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(qb.FolderType.Inbox===c&&Eb.data().foldersInboxUnreadCount(b),a>0){if(qb.FolderType.Draft===c)return""+a;if(b>0&&qb.FolderType.Trash!==c&&qb.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(){sb.timeOutAction("folder-list-folder-visibility-change",function(){Bb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){vb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case qb.FolderType.Inbox:b=sb.i18n("FOLDER_LIST/INBOX_NAME");break;case qb.FolderType.SentItems:b=sb.i18n("FOLDER_LIST/SENT_NAME");break;case qb.FolderType.Draft:b=sb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case qb.FolderType.Spam:b=sb.i18n("FOLDER_LIST/SPAM_NAME");break;case qb.FolderType.Trash:b=sb.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){vb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case qb.FolderType.Inbox:a="("+sb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case qb.FolderType.SentItems:a="("+sb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case qb.FolderType.Draft:a="("+sb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case qb.FolderType.Spam:a="("+sb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case qb.FolderType.Trash:a="("+sb.i18n("FOLDER_LIST/TRASH_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this.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},z.prototype.fullName="",z.prototype.fullNameRaw="",z.prototype.fullNameHash="",z.prototype.delimiter="",z.prototype.namespace="",z.prototype.deep=0,z.prototype.interval=0,z.prototype.isNamespaceFolder=!1,z.prototype.isGmailFolder=!1,z.prototype.isUnpaddigFolder=!1,z.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"},z.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?qb.FolderType.Inbox:qb.FolderType.User),b=!0),b},z.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},A.prototype.email="",A.prototype.changeAccountLink=function(){return Eb.link().change(this.email)},B.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},B.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},B.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+sb.quoteName(a)+'" <'+this.email()+">"},sb.extendAsViewModel("PopupsFolderClearViewModel",C),C.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},C.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},C.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsFolderCreateViewModel",D),D.prototype.sNoParentText="",D.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(sb.trim(a))},D.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},D.prototype.onShow=function(){this.clearPopup()},D.prototype.onFocus=function(){this.folderName.focused(!0)},D.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsFolderSystemViewModel",E),E.prototype.sChooseOnText="",E.prototype.sUnuseText="",E.prototype.onShow=function(a){var b="";switch(a=sb.isUnd(a)?qb.SetSystemFoldersNotification.None:a){case qb.SetSystemFoldersNotification.Sent:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case qb.SetSystemFoldersNotification.Draft:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case qb.SetSystemFoldersNotification.Spam:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case qb.SetSystemFoldersNotification.Trash:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},E.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsComposeViewModel",F),F.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[Eb.data().accountEmail()]=Eb.data().accountEmail(),b)switch(a){case qb.ComposeType.Empty:case qb.ComposeType.ForwardAsAttachment:d=Eb.data().accountEmail();break;case qb.ComposeType.Reply:case qb.ComposeType.ReplyAll:case qb.ComposeType.Forward:h.find(h.union(b.to,b.cc,b.bcc),e);break;case qb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Eb.data().accountEmail();return d},F.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},F.prototype.formattedFrom=function(a){var b=Eb.data().displayName(),c=Eb.data().accountEmail();return""===b?c:(sb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+sb.quoteName(b)+'" <'+c+">"},F.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),qb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&sb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&qb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(sb.trim(sb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=sb.getNotification(c&&c.ErrorCode?c.ErrorCode:qb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||sb.getNotification(qb.Notification.CantSendMessage))))},F.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),qb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Eb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Eb.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()?sb.i18n("COMPOSE/SAVED_TIME",{TIME:f.unix(this.savedTime()-1).format("LT")}):""),d=!0,this.bFromDraft&&Eb.cache().setFolderHash(this.draftFolder(),""))),this.modalVisibility()||d||(this.savedError(!0),this.savedOrSendingText(sb.getNotification(qb.Notification.CantSaveMessage)))},F.prototype.onHide=function(){this.reset(),xb.routeOn()},F.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=sb.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=sb.convertPlainTextToHtml(a))}return a},F.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)})},300):this.oEditor&&a(this.oEditor)}},F.prototype.onShow=function(a,c,d){xb.routeOff();var e=this,f="",g="",i="",j="",k="",l=null,m="",n="",o=[],p={},q=Eb.data().accountEmail(),r=Eb.data().signature(),s=Eb.data().signatureToAll(),t=[],u=null,v=null,w=a||qb.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&&sb.isNormal(c)&&(v=sb.isArray(c)&&1===c.length?c[0]:sb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),sb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),sb.removeBlockquoteSwitcher(l),m=l.html(),w){case qb.ComposeType.Empty:break;case qb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(sb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.sReferences);break;case qb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(sb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.references());break;case qb.ComposeType.Forward:this.subject(sb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.sReferences);break;case qb.ComposeType.ForwardAsAttachment:this.subject(sb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.sReferences);break;case qb.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=sb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case qb.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=sb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case qb.ComposeType.Reply:case qb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=sb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="<br /><br />"+n+":<blockquote><p>"+m+"</p></blockquote>";break;case qb.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m="<br /><br /><br />"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"<br />"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"<br />"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0<i.length?"<br />"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"<br />"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+sb.encodeHtml(j)+"<br />"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+sb.encodeHtml(k)+"<br /><br />"+m;break;case qb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&qb.ComposeType.EditAsNew!==w&&qb.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 qb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),qb.EditorDefaultType.Html!==Eb.data().editorDefaultType()&&a.modeToggle(!1)})):sb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),sb.isNonEmptyArray(t)&&Eb.remote().messageUploadAttachments(function(a,b){if(qb.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()},F.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},F.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},F.prototype.tryToClosePopup=function(){var a=this;xb.showScreenPopup(L,[sb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&sb.delegateRun(a,"closeCommand")}])},F.prototype.onBuild=function(){this.initUploader();var a=this,c=null;Bb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Eb.data().useKeyboardShortcuts()&&(b.ctrlKey&&qb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&qb.EventKeyCode.Enter===b.keyCode?(a.sendCommand(),c=!1):qb.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1)),c}),Bb.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",Eb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},F.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},F.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=sb.pInt(Eb.settingsGet("AttachmentLimit")),c=new g({action:Eb.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;sb.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=sb.isUnd(d.FileName)?"":d.FileName.toString(),g=sb.isNormal(d.Size)?sb.pInt(d.Size):null,h=new x(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(sb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;sb.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=sb.getUploadErrorDescByCode(f):g||(e=sb.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)),sb.isUnd(a[b])&&delete a[b])},this)),this.addAttachmentEnabled(!0).dragAndDropEnabled(c.isDragAndDropSupported())):this.addAttachmentEnabled(!1).dragAndDropEnabled(!1)}},F.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},F.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 x(a.requestHash,d,a.size()),c.fromMessage=!0,c.cancel=e(a.requestHash),c.waiting(!1).uploading(!0),this.attachments.push(c)}},F.prototype.addDropboxAttachment=function(a){var b=this,c=function(a){return function(){b.attachments.remove(function(b){return b&&b.id===a})}},d=sb.pInt(Eb.settingsGet("AttachmentLimit")),e=null,f=a.bytes;return e=new x(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(sb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Eb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),qb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(sb.getUploadErrorDescByCode(qb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},F.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=sb.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(qb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case qb.ComposeType.Reply:case qb.ComposeType.ReplyAll:i=h.isLinked;break;case qb.ComposeType.Forward:case qb.ComposeType.Draft:case qb.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new x(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))}}},F.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},F.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(sb.getUploadErrorDescByCode(qb.UploadErrorCode.FileNoUploaded))},this)},F.prototype.isEmptyForm=function(a){a=sb.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())},F.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.bReloadFolder=!1,this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},F.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},F.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},sb.extendAsViewModel("PopupsContactsViewModel",G),G.prototype.setShareToNone=function(){this.viewScopeType(qb.ContactScopeType.Default)},G.prototype.setShareToAll=function(){this.viewScopeType(qb.ContactScopeType.ShareAll)},G.prototype.addNewProperty=function(a){var b=new v(a,"");b.focused(!0),this.viewProperties.push(b)},G.prototype.addNewEmail=function(){this.addNewProperty(qb.ContactPropertyType.EmailPersonal)},G.prototype.addNewPhone=function(){this.addNewProperty(qb.ContactPropertyType.MobilePersonal)},G.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Eb.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(sb.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},G.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))},G.prototype.deleteSelectedContacts=function(){0<this.contactsCheckedOrSelected().length&&(Eb.remote().contactsDelete(h.bind(this.deleteResponse,this),this.contactsCheckedOrSelectedUids()),this.removeCheckedOrSelectedContactsFromList())},G.prototype.deleteResponse=function(a,b){500<(qb.StorageResultType.Success===a&&b&&b.Time?sb.pInt(b.Time):0)?this.reloadContactList(this.bDropPageAfterDelete):h.delay(function(a){return function(){a.reloadContactList(a.bDropPageAfterDelete)}}(this),500)},G.prototype.removeProperty=function(a){this.viewProperties.remove(a)},G.prototype.populateViewContact=function(a){var b="",c="",d="",e="",f=[];this.watchHash(!1),this.emptySelection(!1),this.viewReadOnly(!1),this.viewScopeType(qb.ContactScopeType.Default),a&&(b=a.idContact,c=a.idContactStr,sb.isNonEmptyArray(a.properties)&&h.each(a.properties,function(a){a&&a[0]&&(qb.ContactPropertyType.LastName===a[0]?d=a[1]:qb.ContactPropertyType.FirstName===a[0]?e=a[1]:-1===sb.inArray(a[0],[qb.ContactPropertyType.FullName])&&f.push(new v(a[0],a[1])))}),this.viewReadOnly(!!a.readOnly),this.viewScopeType(a.scopeType)),f.unshift(new v(qb.ContactPropertyType.FirstName,e,!1,"CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME")),f.unshift(new v(qb.ContactPropertyType.LastName,d,!a,"CONTACTS/PLACEHOLDER_ENTER_LAST_NAME")),this.viewID(b),this.viewIDStr(c),this.viewProperties([]),this.viewProperties(f),this.watchDirty(!1),this.watchHash(!0)},G.prototype.reloadContactList=function(a){var b=this,c=(this.contactsPage()-1)*pb.Defaults.ContactsPerPage;this.bDropPageAfterDelete=!1,(sb.isUnd(a)?1:!a)||(this.contactsPage(1),c=0),this.contacts.loading(!0),Eb.remote().contacts(function(a,c){var d=0,e=[];qb.StorageResultType.Success===a&&c&&c.Result&&c.Result.List&&sb.isNonEmptyArray(c.Result.List)&&(e=h.map(c.Result.List,function(a){var c=new u;return c.parse(a,b.contactsSharingIsAllowed)?c:null}),e=h.compact(e),d=sb.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,pb.Defaults.ContactsPerPage,this.search())},G.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=Eb.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(sb.pInt(a.value)),d.reloadContactList())}),Bb.on("keydown",function(a){var b=!0;return a&&d.modalVisibility()&&(qb.EventKeyCode.Esc===a.keyCode?(sb.delegateRun(d,"closeCommand"),b=!1):a.ctrlKey&&qb.EventKeyCode.S===a.keyCode&&(d.saveCommand(),b=!1)),b}),this.initUploader()},G.prototype.onShow=function(){xb.routeOff(),this.reloadContactList(!0)},G.prototype.onHide=function(){xb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},sb.extendAsViewModel("PopupsAdvancedSearchViewModel",H),H.prototype.buildSearchStringValue=function(a){return-1<a.indexOf(" ")&&(a='"'+a+'"'),a},H.prototype.buildSearchString=function(){var a=[],b=sb.trim(this.from()),c=sb.trim(this.to()),d=sb.trim(this.subject()),e=sb.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)),sb.trim(a.join(" "))},H.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)},H.prototype.onShow=function(){this.clearPopup()},H.prototype.onFocus=function(){this.fromFocus(!0)},H.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsAddAccountViewModel",I),I.prototype.clearPopup=function(){this.email(""),this.login(""),this.password(""),this.emailError(!1),this.loginError(!1),this.passwordError(!1),this.submitRequest(!1),this.submitError("")},I.prototype.onShow=function(){this.clearPopup()},I.prototype.onFocus=function(){this.emailFocus(!0)},I.prototype.onBuild=function(){this.allowCustomLogin(!!Eb.settingsGet("AllowCustomLogin"));var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsIdentityViewModel",J),J.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("")},J.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===Eb.data().accountEmail()))},J.prototype.onFocus=function(){this.owner()||this.email.focused(!0)},J.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsLanguagesViewModel",K),K.prototype.languageEnName=function(a){return sb.convertLangName(a,!0)},K.prototype.resetMainLanguage=function(){var a=Eb.data().mainLanguage();h.each(this.languages(),function(b){b.selected(b.key===a)})},K.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},K.prototype.onHide=function(){this.exp(!1)},K.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},K.prototype.changeLanguage=function(a){Eb.data().mainLanguage(a),this.cancelCommand()},sb.extendAsViewModel("PopupsAskViewModel",L),L.prototype.clearPopup=function(){this.askDesc(""),this.yesButton(sb.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton(sb.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},L.prototype.yesClick=function(){sb.isFunc(this.fYesAction)&&this.fYesAction.call(null),this.cancelCommand()},L.prototype.noClick=function(){sb.isFunc(this.fNoAction)&&this.fNoAction.call(null),this.cancelCommand()},L.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)},L.prototype.onFocus=function(){this.yesFocus(!0)},L.prototype.onHide=function(){},L.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&(qb.EventKeyCode.Tab===b.keyCode||qb.EventKeyCode.Right===b.keyCode||qb.EventKeyCode.Left===b.keyCode)&&(a.yesFocus()?a.noFocus(!0):a.yesFocus(!0),c=!1),c})},sb.extendAsViewModel("PopupsPgpKey",M),M.prototype.clearPopup=function(){this.bPrivate=null,this.fCallback=null},M.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&qb.EventKeyCode.Esc===b.keyCode&&(sb.delegateRun(a,"closeCommand"),c=!1),c})},M.prototype.onShow=function(a,b){this.clearPopup(),this.bPrivate=a,this.fCallback=b},sb.extendAsViewModel("LoginViewModel",N),N.prototype.onShow=function(){xb.routeOff(),h.delay(h.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0),Eb.settingsGet("UserLanguage")&&b.cookie("rllang",Eb.data().language(),{expires:30})},this),100)},N.prototype.onHide=function(){this.submitFocus(!1),this.emailFocus(!1)},N.prototype.onBuild=function(){var c=this,d=Eb.settingsGet("JsHash"),e=function(a){a=sb.pInt(a),0===a?(c.submitRequest(!0),Eb.loginAndLogoutReload()):c.submitError(sb.getNotification(a))};switch(this.facebookLoginEnabled(!!Eb.settingsGet("AllowFacebookSocial")),this.twitterLoginEnabled(!!Eb.settingsGet("AllowTwitterSocial")),this.googleLoginEnabled(!!Eb.settingsGet("AllowGoogleSocial")),(Eb.settingsGet("SignMe")||"unused").toLowerCase()){case qb.LoginSignMeTypeAsString.DefaultOff:this.signMeType(qb.LoginSignMeType.DefaultOff);break;case qb.LoginSignMeTypeAsString.DefaultOn:this.signMeType(qb.LoginSignMeType.DefaultOn);break;default:case qb.LoginSignMeTypeAsString.Unused:this.signMeType(qb.LoginSignMeType.Unused)}this.email(Eb.data().devEmail),this.login(Eb.data().devLogin),this.password(Eb.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(){Eb.data().language.subscribe(function(a){c.langRequest(!0),b.ajax({url:Eb.link().langLink(a),dataType:"script",cache:!0}).done(function(){c.bSendLanguage=!0,sb.i18nToDoc(),b.cookie("rllang",Eb.data().language(),{expires:30})
}).always(function(){c.langRequest(!1)})})},50)},N.prototype.selectLanguage=function(){xb.showScreenPopup(K)},h.extend(O.prototype,q.prototype),O.prototype.accountClick=function(a,b){if(a&&b&&!sb.isUnd(b.which)&&1===b.which){var c=this;this.accountsLoading(!0),h.delay(function(){c.accountsLoading(!1)},1e3)}return!0},O.prototype.emailTitle=function(){return Eb.data().accountEmail()},O.prototype.settingsClick=function(){xb.setHash(Eb.link().settings())},O.prototype.addAccountClick=function(){this.allowAddAccount&&xb.showScreenPopup(I)},O.prototype.logoutClick=function(){Eb.remote().logout(function(){a.__rlah_clear&&a.__rlah_clear(),Eb.loginAndLogoutReload(!0,Eb.settingsGet("ParentEmail")&&0<Eb.settingsGet("ParentEmail").length)})},sb.extendAsViewModel("MailBoxSystemDropDownViewModel",P,O),sb.extendAsViewModel("SettingsSystemDropDownViewModel",Q,O),sb.extendAsViewModel("MailBoxFolderListViewModel",R),R.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(),sb.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=Eb.data(),d=c.dataFor(this);d&&(qb.Layout.NoPreview===b.layout()&&b.message(null),d.fullNameRaw===b.currentFolderFullNameRaw()&&Eb.cache().setFolderHash(d.fullNameRaw,""),xb.setHash(Eb.link().mailBox(d.fullNameHash)))})},R.prototype.messagesDropOver=function(b){a.clearTimeout(this.iDropOverTimer),b&&b.collapsed()&&(this.iDropOverTimer=a.setTimeout(function(){b.collapsed(!1),sb.setExpandedFolder(b.fullNameHash,!0),sb.windowResize()},500))},R.prototype.messagesDropOut=function(){a.clearTimeout(this.iDropOverTimer)},R.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");S&&S.__vm&&sb.isNormal(c)&&sb.isArray(e)&&S.__vm.moveMessagesToFolder(c,e,a.fullNameRaw,d)}},R.prototype.composeClick=function(){xb.showScreenPopup(F)},R.prototype.createFolder=function(){xb.showScreenPopup(D)},R.prototype.configureFolders=function(){xb.setHash(Eb.link().settings("folders"))},R.prototype.contactsClick=function(){this.allowContacts&&xb.showScreenPopup(G)},sb.extendAsViewModel("MailBoxMessageListViewModel",S),S.prototype.emptySubjectValue="",S.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue),this.inputMessageListSearchFocus(!1)},S.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},S.prototype.removeMessagesFromList=function(a,b,c,d){c=sb.isNormal(c)?c:"",d=sb.isUnd(d)?!1:!!d;var e=0,f=Eb.data(),g=Eb.cache().getFolderFromCacheList(a),i=""===c?null:Eb.cache().getFolderFromCacheList(c||""),j=f.currentFolderFullNameRaw(),k=f.message(),l=j===a?h.filter(f.messageList(),function(a){return a&&-1<sb.inArray(a.uid,b)}):[];h.each(l,function(a){a&&a.unseen()&&e++}),g&&!d&&(g.messageCountAll(0<=g.messageCountAll()-b.length?g.messageCountAll()-b.length:0),e>0&&g.messageCountUnread(0<=g.messageCountUnread()-e?g.messageCountUnread()-e:0)),i&&(i.messageCountAll(i.messageCountAll()+b.length),e>0&&i.messageCountUnread(i.messageCountUnread()+e)),0<l.length&&(d?h.each(l,function(a){a.checked(!1)}):(h.each(l,function(a){k&&k.requestHash===a.requestHash&&(k=null,f.message(null)),a.deleted(!0)}),h.delay(function(){h.each(l,function(a){f.messageList.remove(a)})},400),Eb.data().messageListIsNotCompleted(!0),Eb.cache().setFolderHash(a,"")),sb.isNormal(c)&&Eb.cache().setFolderHash(c||"",""))},S.prototype.removeCheckedOrSelectedMessagesFromList=function(a){this.removeMessagesFromList(Eb.data().currentFolderFullNameRaw(),h.map(Eb.data().messageListCheckedOrSelected(),function(a){return a.uid}),a)},S.prototype.moveOrDeleteResponse=function(b,c){qb.StorageResultType.Success===b&&Eb.data().currentFolder()&&(c&&sb.isArray(c.Result)&&2===c.Result.length?Eb.cache().setFolderHash(c.Result[0],c.Result[1]):(c&&-1<sb.inArray(c.ErrorCode,[qb.Notification.CantMoveMessage,qb.Notification.CantCopyMessage])&&a.alert(sb.getNotification(c.ErrorCode)),Eb.cache().setFolderHash(Eb.data().currentFolderFullNameRaw(),"")),Eb.reloadMessageList(),Eb.quotaDebounce())},S.prototype.moveMessagesToFolder=function(a,b,c,d){if(a!==c&&sb.isArray(b)&&0<b.length){var e=Eb.cache().getFolderFromCacheList(a),f=Eb.cache().getFolderFromCacheList(c);if(e&&f)return d=sb.isUnd(d)?!1:!!d,Eb.remote()[d?"messagesCopy":"messagesMove"](this.moveOrDeleteResponse,e.fullNameRaw,f.fullNameRaw,b),f.actionBlink(!0),this.removeMessagesFromList(a,b,c,d),!0}return!1},S.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()?this.moveMessagesToFolder(Eb.data().currentFolderFullNameRaw(),Eb.data().messageListCheckedOrSelectedUidsWithSubMails(),a):!1},S.prototype.deleteSelectedMessageFromCurrentFolder=function(a,b){if(this.canBeMoved()){b=sb.isUnd(b)?!0:!!b,b&&(qb.FolderType.Spam===a&&pb.Values.UnuseOptionValue===Eb.data().spamFolder()||qb.FolderType.Trash===a&&pb.Values.UnuseOptionValue===Eb.data().trashFolder())&&(b=!1);var c=this,d=null,e=Eb.data().currentFolderFullNameRaw(),f=Eb.cache().getFolderFromCacheList(qb.FolderType.Spam===a?Eb.data().spamFolder():Eb.data().trashFolder());!f&&b?xb.showScreenPopup(E,[qb.FolderType.Spam===a?qb.SetSystemFoldersNotification.Spam:qb.SetSystemFoldersNotification.Trash]):!b||f&&Eb.data().currentFolderFullNameRaw()===f.fullNameRaw?(d=Eb.data().messageListCheckedOrSelectedUidsWithSubMails(),xb.showScreenPopup(L,[sb.i18n("POPUPS_ASK/DESC_WANT_DELETE_MESSAGES"),function(){Eb.remote().messagesDelete(c.moveOrDeleteResponse,e,d),c.removeCheckedOrSelectedMessagesFromList()}])):f&&(Eb.remote().messagesMove(this.moveOrDeleteResponse,e,f.fullNameRaw,Eb.data().messageListCheckedOrSelectedUidsWithSubMails()),f.actionBlink(!0),this.removeCheckedOrSelectedMessagesFromList(f.fullNameRaw))}},S.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=sb.draggeblePlace();return c.data("rl-folder",Eb.data().currentFolderFullNameRaw()),c.data("rl-uids",Eb.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Eb.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},S.prototype.onMessageResponse=function(a,b,c){var d=Eb.data();d.messageLoading(!1),qb.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):qb.StorageResultType.Unload===a?(d.message(null),d.messageError("")):qb.StorageResultType.Abort!==a&&(d.message(null),d.messageError(b&&b.ErrorCode?sb.getNotification(b.ErrorCode):sb.getNotification(qb.Notification.UnknownError)))},S.prototype.populateMessageBody=function(a){a&&(Eb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Eb.data().messageLoading(!0):sb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},S.prototype.setAction=function(a,b,c){var d=[],e=null,f=Eb.cache(),g=0;if(sb.isUnd(c)&&(c=Eb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0<d.length){switch(b){case qb.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),Eb.remote().messageSetSeen(sb.emptyFunction,a,d,!0);break;case qb.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),Eb.remote().messageSetSeen(sb.emptyFunction,a,d,!1);break;case qb.MessageSetAction.SetFlag:h.each(c,function(a){a.flagged(!0),f.storeMessageFlagsToCache(a)}),Eb.remote().messageSetFlagged(sb.emptyFunction,a,d,!0);break;case qb.MessageSetAction.UnsetFlag:h.each(c,function(a){a.flagged(!1),f.storeMessageFlagsToCache(a)}),Eb.remote().messageSetFlagged(sb.emptyFunction,a,d,!1)}Eb.reloadFlagsCurrentMessageListAndMessageFromCache()}},S.prototype.setActionForAll=function(a,b){var c=null,d=Eb.data().messageList(),e=Eb.cache();if(""!==a&&(c=e.getFolderFromCacheList(a))){switch(b){case qb.MessageSetAction.SetSeen:c=e.getFolderFromCacheList(a),c&&(h.each(d,function(a){a.unseen(!1)}),c.messageCountUnread(0),e.clearMessageFlagsFromCacheByFolder(a)),Eb.remote().messageSetSeenToAll(sb.emptyFunction,a,!0);break;case qb.MessageSetAction.UnsetSeen:c=e.getFolderFromCacheList(a),c&&(h.each(d,function(a){a.unseen(!0)}),c.messageCountUnread(c.messageCountAll()),e.clearMessageFlagsFromCacheByFolder(a)),Eb.remote().messageSetSeenToAll(sb.emptyFunction,a,!1)}Eb.reloadFlagsCurrentMessageListAndMessageFromCache()}},S.prototype.listSetSeen=function(){this.setAction(Eb.data().currentFolderFullNameRaw(),qb.MessageSetAction.SetSeen,Eb.data().messageListCheckedOrSelected())},S.prototype.listSetAllSeen=function(){this.setActionForAll(Eb.data().currentFolderFullNameRaw(),qb.MessageSetAction.SetSeen)},S.prototype.listUnsetSeen=function(){this.setAction(Eb.data().currentFolderFullNameRaw(),qb.MessageSetAction.UnsetSeen,Eb.data().messageListCheckedOrSelected())},S.prototype.listSetFlags=function(){this.setAction(Eb.data().currentFolderFullNameRaw(),qb.MessageSetAction.SetFlag,Eb.data().messageListCheckedOrSelected())},S.prototype.listUnsetFlags=function(){this.setAction(Eb.data().currentFolderFullNameRaw(),qb.MessageSetAction.UnsetFlag,Eb.data().messageListCheckedOrSelected())},S.prototype.onBuild=function(a){var d=this,e=Eb.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()&&(Eb.data().messageListThreadFolder(b.folderFullNameRaw),a=Eb.data().messageListThreadUids(),b.lastInCollapsedThread()?a.push(0<b.parentUid()?b.parentUid():b.uid):a=h.without(a,0<b.parentUid()?b.parentUid():b.uid),Eb.data().messageListThreadUids(h.uniq(a)),b.lastInCollapsedThreadLoading(!0),b.lastInCollapsedThread(!b.lastInCollapsedThread()),Eb.reloadMessageList()),!1}),this.selector.init(this.oContentVisible,this.oContentScrollable),Cb.on("keydown",function(a){var b=!0,c=a?a.keyCode:0;return a&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!Eb.popupVisibility()&&!e.messageFullScreenMode()&&!sb.inFocus()&&(qb.Layout.NoPreview===e.layout()&&(e.message()||qb.EventKeyCode.Delete!==c&&qb.EventKeyCode.A!==c)||a.ctrlKey&&qb.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&&xb.setHash(Eb.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<sb.inArray(a.uid,f)?d.setAction(a.folderFullNameRaw,a.flagged()?qb.MessageSetAction.UnsetFlag:qb.MessageSetAction.SetFlag,b):d.setAction(a.folderFullNameRaw,a.flagged()?qb.MessageSetAction.UnsetFlag:qb.MessageSetAction.SetFlag,[a]))}),c.computed(function(){var a=Eb.data(),b=this.viewModelVisibility(),c=Eb.popupVisibility(),d=a.useKeyboardShortcuts(),e=a.messageFullScreenMode();this.selector.useKeyboard(b&&d&&!e&&!c)},this).extend({notify:"always"}),this.initUploaderForAppend(),!vb.bMobileDevice&&Eb.settingsGet("AllowPrefetch")&&i&&(i.setIdleDuration(10),i.idle(function(){d.prefetchNextTick()}))},S.prototype.prefetchNextTick=function(){if(!this.bPrefetch&&!i.now()&&this.viewModelVisibility()){var a=this,b=Eb.cache(),c=h.find(this.messageList(),function(a){return a&&!b.hasRequestedMessage(a.folderFullNameRaw,a.uid)});c&&(this.bPrefetch=!0,Eb.cache().addRequestedMessage(c.folderFullNameRaw,c.uid),Eb.remote().message(function(b,c){var d=!(qb.StorageResultType.Success!==b||!c||!c.Result);h.delay(function(){a.bPrefetch=!1,d&&a.prefetchNextTick()},1e3)},c.folderFullNameRaw,c.uid))}},S.prototype.composeClick=function(){xb.showScreenPopup(F)},S.prototype.advancedSearchClick=function(){xb.showScreenPopup(H)},S.prototype.quotaTooltip=function(){return sb.i18n("MESSAGE_LIST/QUOTA_SIZE",{SIZE:sb.friendlySize(this.userUsageSize()),PROC:this.userUsageProc(),LIMIT:sb.friendlySize(this.userQuota())})},S.prototype.initUploaderForAppend=function(){if(!Eb.settingsGet("AllowAppendMessage")||!this.dragOverArea())return!1;var a=new g({action:Eb.link().append(),name:"AppendFile",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,hidden:{Folder:function(){return Eb.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?(Eb.data().messageListLoading(!0),!0):!1},this)).on("onComplete",h.bind(function(){Eb.reloadMessageList(!0,!0)},this)),!!a},sb.extendAsViewModel("MailBoxMessageViewViewModel",T),T.prototype.scrollToTop=function(){var a=b(".messageItem.nano .content",this.viewModelDom);a&&a[0]?a.scrollTop(0):b(".messageItem",this.viewModelDom).scrollTop(0),sb.windowResize()},T.prototype.fullScreen=function(){this.fullScreenMode(!0),sb.windowResize()},T.prototype.unFullScreen=function(){this.fullScreenMode(!1),sb.windowResize()},T.prototype.toggleFullScreen=function(){sb.removeSelection(),this.fullScreenMode(!this.fullScreenMode()),sb.windowResize()},T.prototype.replyOrforward=function(a){xb.showScreenPopup(F,[a,Eb.data().message()])},T.prototype.receivePrivateKey=function(){var b=this;xb.showScreenPopup(M,[!0,function(c,d){var e,f,g,h=b.message();if(h)try{e=a.openpgp.message.readArmored(h.plainRaw),f=a.openpgp.key.readArmored(d),e&&f&&f.keys&&f.keys[0]&&(g=f.keys[0],""!==c&&g.decrypt(c),h.body.html('<pre class="b-plain-openpgp encrypted">'+a.openpgp.decryptMessage(g,e)+"</pre>"))}catch(i){}}])},T.prototype.onBuild=function(a){var d=this,e=Eb.data();Cb.on("keydown",function(a){var b=!0,c=a?a.keyCode:0;return c>0&&qb.EventKeyCode.Esc===c&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!sb.inFocus()&&e.message()&&(d.fullScreenMode(!1),qb.Layout.NoPreview===e.layout()&&Eb.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&&Eb.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&&Eb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},T.prototype.isDraftFolder=function(){return Eb.data().message()&&Eb.data().draftFolder()===Eb.data().message().folderFullNameRaw},T.prototype.isSentFolder=function(){return Eb.data().message()&&Eb.data().sentFolder()===Eb.data().message().folderFullNameRaw},T.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},T.prototype.composeClick=function(){xb.showScreenPopup(F)},T.prototype.editMessage=function(){Eb.data().message()&&xb.showScreenPopup(F,[qb.ComposeType.Draft,Eb.data().message()])},T.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},T.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},T.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Eb.remote().sendReadReceiptMessage(sb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),sb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),sb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":a.readReceipt()})),a.isReadReceipt(!0),Eb.cache().storeMessageFlagsToCache(a),Eb.reloadFlagsCurrentMessageListAndMessageFromCache())},sb.extendAsViewModel("SettingsMenuViewModel",U),U.prototype.link=function(a){return Eb.link().settings(a)},U.prototype.backToMailBoxClick=function(){xb.setHash(Eb.link().inbox())},sb.extendAsViewModel("SettingsPaneViewModel",V),V.prototype.onShow=function(){Eb.data().message(null)},V.prototype.backToMailBoxClick=function(){xb.setHash(Eb.link().inbox())},sb.addSettingsViewModel(W,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),W.prototype.toggleLayout=function(){this.layout(qb.Layout.NoPreview===this.layout()?qb.Layout.SidePreview:qb.Layout.NoPreview)},W.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Eb.data(),d=sb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(qb.SaveSettingsStep.Animate),b.ajax({url:Eb.link().langLink(c),dataType:"script",cache:!0}).done(function(){sb.i18nToDoc(),a.languageTrigger(qb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(qb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(qb.SaveSettingsStep.Idle)},1e3)}),Eb.remote().saveSettings(sb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Eb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){sb.timeOutAction("SaveDesktopNotifications",function(){Eb.remote().saveSettings(sb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){sb.timeOutAction("SaveReplySameFolder",function(){Eb.remote().saveSettings(sb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Eb.remote().saveSettings(sb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Eb.remote().saveSettings(sb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},W.prototype.onShow=function(){Eb.data().desktopNotifications.valueHasMutated()},W.prototype.selectLanguage=function(){xb.showScreenPopup(K)},sb.addSettingsViewModel(X,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),X.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},X.prototype.onBuild=function(){Eb.data().contactsAutosave.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},X.prototype.onShow=function(){this.showPassword(!1)},sb.addSettingsViewModel(Y,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),Y.prototype.addNewAccount=function(){xb.showScreenPopup(I)},Y.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Eb.remote().accountDelete(function(b,c){qb.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(xb.routeOff(),xb.setHash(Eb.link().root(),!0),xb.routeOff(),h.defer(function(){a.location.reload()})):Eb.accountsAndIdentities()},b.email))}},sb.addSettingsViewModel(Z,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),Z.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Eb.data().signature();this.editor=new k(a.signatureDom(),function(){Eb.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)})}},Z.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Eb.data(),c=sb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=sb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=sb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Eb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Eb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Eb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Eb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},sb.addSettingsViewModel($,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),$.prototype.addNewIdentity=function(){xb.showScreenPopup(J)},$.prototype.editIdentity=function(a){xb.showScreenPopup(J,[a])},$.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Eb.remote().identityDelete(function(){Eb.accountsAndIdentities()},a.id))}},$.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Eb.data().signature();this.editor=new k(a.signatureDom(),function(){Eb.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)})}},$.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=Eb.data(),c=sb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=sb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=sb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Eb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Eb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Eb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Eb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},sb.addSettingsViewModel(_,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),sb.addSettingsViewModel(ab,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),ab.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},ab.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),qb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},sb.addSettingsViewModel(bb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),bb.prototype.folderEditOnEnter=function(a){var b=a?sb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,""),Eb.data().foldersRenaming(!0),Eb.remote().folderRename(function(a,b){Eb.data().foldersRenaming(!1),qb.StorageResultType.Success===a&&b&&b.Result||Eb.data().foldersListError(b&&b.ErrorCode?sb.getNotification(b.ErrorCode):sb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Eb.folders()},a.fullNameRaw,b),Eb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},bb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},bb.prototype.onShow=function(){Eb.data().foldersListError("")},bb.prototype.createFolder=function(){xb.showScreenPopup(D)},bb.prototype.systemFolder=function(){xb.showScreenPopup(E)},bb.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&&(Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,""),Eb.data().folderList.remove(b),Eb.data().foldersDeleting(!0),Eb.remote().folderDelete(function(a,b){Eb.data().foldersDeleting(!1),qb.StorageResultType.Success===a&&b&&b.Result||Eb.data().foldersListError(b&&b.ErrorCode?sb.getNotification(b.ErrorCode):sb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Eb.folders()},a.fullNameRaw),Eb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0<a.privateMessageCountAll()&&Eb.data().foldersListError(sb.getNotification(qb.Notification.CantDeleteNonEmptyFolder))},bb.prototype.subscribeFolder=function(a){Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,""),Eb.remote().folderSetSubscribe(sb.emptyFunction,a.fullNameRaw,!0),a.subScribed(!0)},bb.prototype.unSubscribeFolder=function(a){Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,""),Eb.remote().folderSetSubscribe(sb.emptyFunction,a.fullNameRaw,!1),a.subScribed(!1)},sb.addSettingsViewModel(cb,"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes"),cb.prototype.removeCustomThemeImg=function(){this.customThemeImg("")},cb.prototype.onBuild=function(){var a=this,b=Eb.data().theme();this.themesObjects(h.map(Eb.data().themes(),function(a){return{name:a,nameDisplay:sb.convertThemeName(a),selected:c.observable(a===b),themePreviewSrc:Eb.link().themePreviewLink(a)}})),h.delay(function(){a.customThemeType.subscribe(function(a){Eb.remote().saveSettings(function(){Eb.data().theme.valueHasMutated()},{CustomThemeType:a})}),a.customThemeImg.subscribe(function(a){Eb.remote().saveSettings(function(){Eb.data().theme.valueHasMutated()},{CustomThemeImg:a})})},50),this.initCustomThemeUploader()},cb.prototype.initCustomThemeUploader=function(){if(this.customThemeUploaderButton()){var b=new g({action:Eb.link().uploadBackground(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,clickElement:this.customThemeUploaderButton()});return b.on("onSelect",h.bind(function(b,c){var d=sb.isUnd(c.FileName)?"":c.FileName.toString(),e=d.substring(d.length-4,d.length),f=sb.isNormal(c.Size)?sb.pInt(c.Size):null;return-1===sb.inArray(e,["jpeg",".jpg",".png"])?(a.alert(sb.i18n("SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR")),!1):f>1048576?(a.alert(sb.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(d&&d.ErrorCode?sb.getUploadErrorDescByCode(d.ErrorCode):sb.getUploadErrorDescByCode(qb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},db.prototype.populateDataOnStart=function(){var a=sb.pInt(Eb.settingsGet("Layout")),b=Eb.settingsGet("Languages"),c=Eb.settingsGet("Themes");sb.isArray(b)&&this.languages(b),sb.isArray(c)&&this.themes(c),this.mainLanguage(Eb.settingsGet("Language")),this.mainTheme(Eb.settingsGet("Theme")),this.allowCustomTheme(!!Eb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Eb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Eb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Eb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Eb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Eb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Eb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Eb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Eb.settingsGet("EditorDefaultType")),this.showImages(!!Eb.settingsGet("ShowImages")),this.contactsAutosave(!!Eb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Eb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Eb.settingsGet("MPP")),this.desktopNotifications(!!Eb.settingsGet("DesktopNotifications")),this.useThreads(!!Eb.settingsGet("UseThreads")),this.replySameFolder(!!Eb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Eb.settingsGet("UseCheckboxesInList")),this.layout(qb.Layout.SidePreview),-1<sb.inArray(a,[qb.Layout.NoPreview,qb.Layout.SidePreview,qb.Layout.BottomPreview])&&this.layout(a),this.facebookEnable(!!Eb.settingsGet("AllowFacebookSocial")),this.facebookAppID(Eb.settingsGet("FacebookAppID")),this.facebookAppSecret(Eb.settingsGet("FacebookAppSecret")),this.twitterEnable(!!Eb.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(Eb.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(Eb.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!Eb.settingsGet("AllowGoogleSocial")),this.googleClientID(Eb.settingsGet("GoogleClientID")),this.googleClientSecret(Eb.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!Eb.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(Eb.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!Eb.settingsGet("ContactsIsAllowed"))},h.extend(eb.prototype,db.prototype),eb.prototype.purgeMessageBodyCache=function(){var a=0,c=null,d=vb.iMessageBodyCacheCount-pb.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)))},eb.prototype.populateDataOnStart=function(){db.prototype.populateDataOnStart.call(this),this.accountEmail(Eb.settingsGet("Email")),this.accountIncLogin(Eb.settingsGet("IncLogin")),this.accountOutLogin(Eb.settingsGet("OutLogin")),this.projectHash(Eb.settingsGet("ProjectHash")),this.displayName(Eb.settingsGet("DisplayName")),this.replyTo(Eb.settingsGet("ReplyTo")),this.signature(Eb.settingsGet("Signature")),this.signatureToAll(!!Eb.settingsGet("SignatureToAll")),this.lastFoldersHash=Eb.local().get(qb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Eb.settingsGet("RemoteSuggestions"),this.devEmail=Eb.settingsGet("DevEmail"),this.devLogin=Eb.settingsGet("DevLogin"),this.devPassword=Eb.settingsGet("DevPassword")},eb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&sb.isNormal(c)&&""!==c){if(sb.isArray(d)&&0<d.length){var e=Eb.cache(),f=0,g=d.length,i=function(b,c,d){var e=null;Db&&Eb.data().useDesktopNotifications()&&(e=new Db(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(Eb.link().notificationMailIcon(),Eb.data().accountEmail(),sb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Eb.link().notificationMailIcon(),y.emailsToLine(y.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Eb.cache().setFolderUidNext(b,c)}},eb.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=Eb.cache().getFolderFromCacheList(g),f||(f=z.newInstanceFromJson(e),f&&(Eb.cache().setFolderToCacheList(g,f),Eb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=pb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!sb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Eb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),sb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),sb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&sb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},eb.prototype.setFolders=function(a){var b=[],c=!1,d=Eb.data(),e=function(a){return""===a||pb.Values.UnuseOptionValue===a||null!==Eb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&sb.isArray(a.Result["@Collection"])&&(sb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Eb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Eb.settingsGet("SentFolder")+Eb.settingsGet("DraftFolder")+Eb.settingsGet("SpamFolder")+Eb.settingsGet("TrashFolder")+Eb.settingsGet("NullFolder")&&(Eb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Eb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Eb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Eb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),c=!0),d.sentFolder(e(Eb.settingsGet("SentFolder"))),d.draftFolder(e(Eb.settingsGet("DraftFolder"))),d.spamFolder(e(Eb.settingsGet("SpamFolder"))),d.trashFolder(e(Eb.settingsGet("TrashFolder"))),c&&Eb.remote().saveSystemFolders(sb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),NullFolder:"NullFolder"}),Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))
},eb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},eb.prototype.getNextFolderNames=function(a){a=sb.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=Eb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},eb.prototype.setMessage=function(c,d){var e=!1,f=!1,g=!1,h=null,i=null,j="",k="",l=!1,m=!1,n=null,o=this.messagesBodiesDom(),p=this.message();if(c&&p&&c.Result&&"Object/Message"===c.Result["@Object"]&&p.folderFullNameRaw===c.Result.Folder&&p.uid===c.Result.Uid){if(this.messageError(""),p.initUpdateByMessageJson(c.Result),Eb.cache().addRequestedMessage(p.folderFullNameRaw,p.uid),d||p.initFlagsByJson(c.Result),o=o&&o[0]?o:null){if(j="rl-"+p.requestHash.replace(/[^a-zA-Z0-9]/g,""),i=o.find("#"+j),i&&i[0])p.body=i,p.body&&(p.body.data("rl-cache-count",++vb.iMessageBodyCacheCount),p.isRtl(!!p.body.data("rl-is-rtl")),p.isHtml(!!p.body.data("rl-is-html")),p.hasImages(!!p.body.data("rl-has-images")),p.plainRaw=sb.pString(p.body.data("rl-plain-raw")));else{if(f=!!c.Result.HasExternals,g=!!c.Result.HasInternals,h=b('<div id="'+j+'" />').hide().addClass("rl-cache-class"),h.data("rl-cache-count",++vb.iMessageBodyCacheCount),sb.isNormal(c.Result.Html)&&""!==c.Result.Html)e=!0,h.html(c.Result.Html.toString()).addClass("b-text-part html");else if(sb.isNormal(c.Result.Plain)&&""!==c.Result.Plain){if(e=!1,k=c.Result.Plain.toString(),vb.bAllowOpenPGP&&(p.isPgpSigned()||p.isPgpEncrypted())&&sb.isNormal(c.Result.PlainRaw)){if(m=/---BEGIN PGP MESSAGE---/.test(c.Result.PlainRaw),m||(l=/-----BEGIN PGP SIGNED MESSAGE-----/.test(c.Result.PlainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(c.Result.PlainRaw)),l&&p.isPgpSigned()&&p.pgpSignature()){k='<pre class="b-plain-openpgp signed">'+c.Result.PlainRaw+"</pre>";try{n=a.openpgp.cleartext.readArmored(c.Result.PlainRaw)}catch(q){}n&&n.getText?k=n.getText():l=!1}else if(m&&p.isPgpEncrypted()){try{n=a.openpgp.message.readArmored(c.Result.PlainRaw)}catch(q){}k='<pre class="b-plain-openpgp encrypted">'+c.Result.PlainRaw+"</pre>"}(l||m)&&(h.data("rl-plain-raw",c.Result.PlainRaw),h.data("rl-plain-pgp-encrypted",m),h.data("rl-plain-pgp-signed",l))}h.html(k).addClass("b-text-part plain")}else e=!1;c.Result.Rtl&&(h.data("rl-is-rtl",!0),h.addClass("rtl-text-part")),p.body=h,p.body&&(o.append(p.body),p.body.data("rl-is-html",e),p.body.data("rl-has-images",f),p.isRtl(!!p.body.data("rl-is-rtl")),p.isHtml(!!p.body.data("rl-is-html")),p.hasImages(!!p.body.data("rl-has-images")),p.plainRaw=sb.pString(p.body.data("rl-plain-raw"))),g&&p.showInternalImages(!0),p.hasImages()&&this.showImages()&&p.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()}vb.bAllowOpenPGP&&p.body?(p.isPgpSigned(!!p.body.data("rl-plain-pgp-signed")),p.isPgpEncrypted(!!p.body.data("rl-plain-pgp-encrypted"))):(p.isPgpSigned(!1),p.isPgpEncrypted(!1)),this.messageActiveDom(p.body),this.hideMessageBodies(),p.body.show(),h&&sb.initBlockquoteSwitcher(h)}Eb.cache().initMessageFlagsFromCache(p),p.unseen()&&Eb.setMessageSeen(p),sb.windowResize()}},eb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&sb.isArray(a.Result["@Collection"])){var c=Eb.data(),d=Eb.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=sb.pInt(a.Result.MessageResultCount),j=sb.pInt(a.Result.Offset),sb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Eb.cache().getFolderFromCacheList(sb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Eb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),sb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),sb.isNormal(a.Result.MessageUnseenCount)&&(sb.pInt(p.messageCountUnread())!==sb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Eb.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=y.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Eb.cache().initMessageFlagsFromCache(o):Eb.cache().storeMessageFlagsToCache(o),o.lastInCollapsedThread(e&&-1<sb.inArray(sb.pInt(o.uid),e)?!0:!1),k.push(o)));c.messageListCount(i),c.messageListSearch(sb.isNormal(a.Result.Search)?a.Result.Search:""),c.messageListEndSearch(sb.isNormal(a.Result.Search)?a.Result.Search:""),c.messageListEndFolder(sb.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||Eb.data().useThreads())&&Eb.folderInformation(p.fullNameRaw,k)}else Eb.data().messageListCount(0),Eb.data().messageList([]),Eb.data().messageListError(sb.getNotification(a&&a.ErrorCode?a.ErrorCode:qb.Notification.CantGetMessageList))},fb.prototype.oRequests={},fb.prototype.defaultResponse=function(b,c,d,e,f,g){var i=function(){qb.StorageResultType.Success!==d&&vb.bUnload&&(d=qb.StorageResultType.Unload),qb.StorageResultType.Success===d&&e&&!e.Result?(e&&-1<sb.inArray(e.ErrorCode,[qb.Notification.AuthError,qb.Notification.AccessError,qb.Notification.ConnectionError,qb.Notification.DomainNotAllowed,qb.Notification.AccountNotAllowed,qb.Notification.MailServerError,qb.Notification.UnknownNotification,qb.Notification.UnknownError])&&vb.iAjaxErrorCount++,e&&qb.Notification.InvalidToken===e.ErrorCode&&vb.iTokenErrorCount++,pb.Values.TokenErrorLimit<vb.iTokenErrorCount&&Eb.loginAndLogoutReload(!0),(e.Logout||pb.Values.AjaxErrorLimit<vb.iAjaxErrorCount)&&(a.__rlah_clear&&a.__rlah_clear(),Eb.loginAndLogoutReload(!0))):qb.StorageResultType.Success===d&&e&&e.Result&&(vb.iAjaxErrorCount=0,vb.iTokenErrorCount=0),b&&(tb.runHook("ajax-default-response",[c,qb.StorageResultType.Success===d?e:null,d,f,g]),b(d,qb.StorageResultType.Success===d?e:null,f,c,g))};switch(d){case"success":d=qb.StorageResultType.Success;break;case"abort":d=qb.StorageResultType.Abort;break;default:d=qb.StorageResultType.Error}qb.StorageResultType.Error===d?h.delay(i,300):i()},fb.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=sb.isNormal(e)?e:2e4,f=sb.isUnd(f)?"":sb.pString(f),g=sb.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=Eb.settingsGet("Token")),m=b.ajax({type:j?"POST":"GET",url:Eb.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=sb.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<sb.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},fb.prototype.defaultRequest=function(a,b,c,d,e,f){c=c||{},c.Action=b,e=sb.pString(e),tb.runHook("ajax-default-request",[b,c,e]),this.ajaxRequest(a,c,sb.isUnd(d)?pb.Defaults.DefaultAjaxTimeout:sb.pInt(d),e,f)},fb.prototype.noop=function(a){this.defaultRequest(a,"Noop")},fb.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})},fb.prototype.jsInfo=function(a,b,c,d){this.defaultRequest(a,"JsInfo",{Type:b,Data:c,IsError:(sb.isUnd(d)?1:!d)?"0":"1"})},fb.prototype.jsVersion=function(a,b){this.defaultRequest(a,"Version",{Version:b})},h.extend(gb.prototype,fb.prototype),gb.prototype.folders=function(a){this.defaultRequest(a,"Folders",{SentFolder:Eb.settingsGet("SentFolder"),DraftFolder:Eb.settingsGet("DraftFolder"),SpamFolder:Eb.settingsGet("SpamFolder"),TrashFolder:Eb.settingsGet("TrashFolder")},null,"",["Folders"])},gb.prototype.login=function(a,b,c,d,e,f){this.defaultRequest(a,"Login",{Email:b,Login:c,Password:d,Language:f||"",SignMe:e?"1":"0"})},gb.prototype.accountAdd=function(a,b,c,d){this.defaultRequest(a,"AccountAdd",{Email:b,Login:c,Password:d})},gb.prototype.accountDelete=function(a,b){this.defaultRequest(a,"AccountDelete",{EmailToDelete:b})},gb.prototype.identityUpdate=function(a,b,c,d,e,f){this.defaultRequest(a,"IdentityUpdate",{Id:b,Email:c,Name:d,ReplyTo:e,Bcc:f})},gb.prototype.identityDelete=function(a,b){this.defaultRequest(a,"IdentityDelete",{IdToDelete:b})},gb.prototype.accountsAndIdentities=function(a){this.defaultRequest(a,"AccountsAndIdentities")},gb.prototype.messageList=function(a,b,c,d,e,f){b=sb.pString(b);var g=Eb.data(),h=Eb.cache().getFolderHash(b);f=sb.isUnd(f)?!1:!!f,c=sb.isUnd(c)?0:sb.pInt(c),d=sb.isUnd(c)?20:sb.pInt(d),e=sb.pString(e),""===h||""!==e&&-1!==e.indexOf("has:")?this.defaultRequest(a,"MessageList",{Folder:b,Offset:c,Limit:d,Search:e,UidNext:"INBOX"===b?Eb.cache().getFolderUidNext(b):"",UseThreads:Eb.data().threading()&&Eb.data().useThreads()?"1":"0",ExpandedThreadUid:g.threading()&&b===g.messageListThreadFolder()?g.messageListThreadUids().join(","):""},""===e?pb.Defaults.DefaultAjaxTimeout:pb.Defaults.SearchAjaxTimeout,"",f?[]:["MessageList"]):this.defaultRequest(a,"MessageList",{},""===e?pb.Defaults.DefaultAjaxTimeout:pb.Defaults.SearchAjaxTimeout,"MessageList/"+ub.urlsafe_encode([b,c,d,e,g.projectHash(),h,"INBOX"===b?Eb.cache().getFolderUidNext(b):"",g.threading()&&g.useThreads()?"1":"0",g.threading()&&b===g.messageListThreadFolder()?g.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),f?[]:["MessageList"])},gb.prototype.messageUploadAttachments=function(a,b){this.defaultRequest(a,"MessageUploadAttachments",{Attachments:b},999e3)},gb.prototype.message=function(a,b,c){return b=sb.pString(b),c=sb.pInt(c),Eb.cache().getFolderFromCacheList(b)&&c>0?(this.defaultRequest(a,"Message",{},null,"Message/"+ub.urlsafe_encode([b,c,Eb.data().projectHash(),Eb.data().threading()&&Eb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},gb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},gb.prototype.folderInformation=function(a,b,c){var d=!0,e=Eb.cache(),f=[];sb.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:sb.isArray(f)?f.join(","):"",UidNext:"INBOX"===b?Eb.cache().getFolderUidNext(b):""}):Eb.data().useThreads()&&Eb.reloadFlagsCurrentMessageListAndMessageFromCache()},gb.prototype.folderInformationMultiply=function(a,b){this.defaultRequest(a,"FolderInformationMultiply",{Folders:b})},gb.prototype.logout=function(a){this.defaultRequest(a,"Logout")},gb.prototype.messageSetFlagged=function(a,b,c,d){this.defaultRequest(a,"MessageSetFlagged",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})},gb.prototype.messageSetSeen=function(a,b,c,d){this.defaultRequest(a,"MessageSetSeen",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})},gb.prototype.messageSetSeenToAll=function(a,b,c){this.defaultRequest(a,"MessageSetSeenToAll",{Folder:b,SetAction:c?"1":"0"})},gb.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},pb.Defaults.SaveMessageAjaxTimeout)},gb.prototype.sendReadReceiptMessage=function(a,b,c,d,e,f){this.defaultRequest(a,"SendReadReceiptMessage",{MessageFolder:b,MessageUid:c,ReadReceipt:d,Subject:e,Text:f})},gb.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},pb.Defaults.SendMessageAjaxTimeout)},gb.prototype.saveSystemFolders=function(a,b){this.defaultRequest(a,"SystemFoldersUpdate",b)},gb.prototype.saveSettings=function(a,b){this.defaultRequest(a,"SettingsUpdate",b)},gb.prototype.changePassword=function(a,b,c){this.defaultRequest(a,"ChangePassword",{PrevPassword:b,NewPassword:c})},gb.prototype.folderCreate=function(a,b,c){this.defaultRequest(a,"FolderCreate",{Folder:b,Parent:c},null,"",["Folders"])},gb.prototype.folderDelete=function(a,b){this.defaultRequest(a,"FolderDelete",{Folder:b},null,"",["Folders"])},gb.prototype.folderRename=function(a,b,c){this.defaultRequest(a,"FolderRename",{Folder:b,NewFolderName:c},null,"",["Folders"])},gb.prototype.folderClear=function(a,b){this.defaultRequest(a,"FolderClear",{Folder:b})},gb.prototype.folderSetSubscribe=function(a,b,c){this.defaultRequest(a,"FolderSubscribe",{Folder:b,Subscribe:c?"1":"0"})},gb.prototype.messagesMove=function(a,b,c,d){this.defaultRequest(a,"MessageMove",{FromFolder:b,ToFolder:c,Uids:d.join(",")},null,"",["MessageList","Message"])},gb.prototype.messagesCopy=function(a,b,c,d){this.defaultRequest(a,"MessageCopy",{FromFolder:b,ToFolder:c,Uids:d.join(",")})},gb.prototype.messagesDelete=function(a,b,c){this.defaultRequest(a,"MessageDelete",{Folder:b,Uids:c.join(",")},null,"",["MessageList","Message"])},gb.prototype.appDelayStart=function(a){this.defaultRequest(a,"AppDelayStart")},gb.prototype.quota=function(a){this.defaultRequest(a,"Quota")},gb.prototype.contacts=function(a,b,c,d){this.defaultRequest(a,"Contacts",{Offset:b,Limit:c,Search:d},null,"",["Contacts"])},gb.prototype.contactSave=function(a,b,c,d,e,f){this.defaultRequest(a,"ContactSave",{RequestUid:b,Uid:sb.trim(c),UidStr:sb.trim(d),ScopeType:e,Properties:f})},gb.prototype.contactsDelete=function(a,b){this.defaultRequest(a,"ContactsDelete",{Uids:b.join(",")})},gb.prototype.suggestions=function(a,b,c){this.defaultRequest(a,"Suggestions",{Query:b,Page:c},null,"",["Suggestions"])},gb.prototype.servicesPics=function(a){this.defaultRequest(a,"ServicesPics")},gb.prototype.emailsPicsHashes=function(a){this.defaultRequest(a,"EmailsPicsHashes")},gb.prototype.facebookUser=function(a){this.defaultRequest(a,"SocialFacebookUserInformation")},gb.prototype.facebookDisconnect=function(a){this.defaultRequest(a,"SocialFacebookDisconnect")},gb.prototype.twitterUser=function(a){this.defaultRequest(a,"SocialTwitterUserInformation")},gb.prototype.twitterDisconnect=function(a){this.defaultRequest(a,"SocialTwitterDisconnect")},gb.prototype.googleUser=function(a){this.defaultRequest(a,"SocialGoogleUserInformation")},gb.prototype.googleDisconnect=function(a){this.defaultRequest(a,"SocialGoogleDisconnect")},gb.prototype.socialUsers=function(a){this.defaultRequest(a,"SocialUsers")},hb.prototype.oEmailsPicsHashes={},hb.prototype.oServices={},hb.prototype.clear=function(){this.oServices={},this.oEmailsPicsHashes={}},hb.prototype.getUserPic=function(a){var b="",c="",d=a.toLowerCase(),e=sb.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];return""===e?(c=d.substr(a.indexOf("@")+1),b=""!==c&&this.oServices[c]?this.oServices[c]:""):b=Eb.link().getUserPicUrlFromHash(e),b},hb.prototype.setServicesData=function(a){this.oServices=a},hb.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a},h.extend(ib.prototype,hb.prototype),ib.prototype.oFoldersCache={},ib.prototype.oFoldersNamesCache={},ib.prototype.oFolderHashCache={},ib.prototype.oFolderUidNextCache={},ib.prototype.oMessageListHashCache={},ib.prototype.oMessageFlagsCache={},ib.prototype.oBodies={},ib.prototype.oNewMessage={},ib.prototype.oRequestedMessage={},ib.prototype.clear=function(){hb.prototype.clear.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oBodies={}},ib.prototype.getMessageKey=function(a,b){return a+"#"+b},ib.prototype.addRequestedMessage=function(a,b){this.oRequestedMessage[this.getMessageKey(a,b)]=!0},ib.prototype.hasRequestedMessage=function(a,b){return!0===this.oRequestedMessage[this.getMessageKey(a,b)]},ib.prototype.addNewMessageCache=function(a,b){this.oNewMessage[this.getMessageKey(a,b)]=!0},ib.prototype.hasNewMessageAndRemoveFromCache=function(a,b){return this.oNewMessage[this.getMessageKey(a,b)]?(this.oNewMessage[this.getMessageKey(a,b)]=null,!0):!1},ib.prototype.clearNewMessageCache=function(){this.oNewMessage={}},ib.prototype.getFolderFullNameRaw=function(a){return""!==a&&this.oFoldersNamesCache[a]?this.oFoldersNamesCache[a]:""},ib.prototype.setFolderFullNameRaw=function(a,b){this.oFoldersNamesCache[a]=b},ib.prototype.getFolderHash=function(a){return""!==a&&this.oFolderHashCache[a]?this.oFolderHashCache[a]:""},ib.prototype.setFolderHash=function(a,b){this.oFolderHashCache[a]=b},ib.prototype.getFolderUidNext=function(a){return""!==a&&this.oFolderUidNextCache[a]?this.oFolderUidNextCache[a]:""},ib.prototype.setFolderUidNext=function(a,b){this.oFolderUidNextCache[a]=b},ib.prototype.getFolderFromCacheList=function(a){return""!==a&&this.oFoldersCache[a]?this.oFoldersCache[a]:null},ib.prototype.setFolderToCacheList=function(a,b){this.oFoldersCache[a]=b},ib.prototype.removeFolderFromCacheList=function(a){this.setFolderToCacheList(a,null)},ib.prototype.getMessageFlagsFromCache=function(a,b){return this.oMessageFlagsCache[a]&&this.oMessageFlagsCache[a][b]?this.oMessageFlagsCache[a][b]:null},ib.prototype.setMessageFlagsToCache=function(a,b,c){this.oMessageFlagsCache[a]||(this.oMessageFlagsCache[a]={}),this.oMessageFlagsCache[a][b]=c},ib.prototype.clearMessageFlagsFromCacheByFolder=function(a){this.oMessageFlagsCache[a]={}},ib.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<sb.pInt(d)),a.hasFlaggedSubMessage(e&&0<sb.pInt(e)))}},ib.prototype.storeMessageFlagsToCache=function(a){a&&this.setMessageFlagsToCache(a.folderFullNameRaw,a.uid,[a.unseen(),a.flagged(),a.answered(),a.forwarded(),a.isReadReceipt()])},ib.prototype.storeMessageFlagsToCacheByFolderAndUid=function(a,b,c){sb.isArray(c)&&0<c.length&&this.setMessageFlagsToCache(a,b,c)},h.extend(jb.prototype,r.prototype),jb.prototype.onRoute=function(a){var d=this,e=null,f=null,g=null,i=null;f=h.find(wb.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}),f&&(h.find(wb["settings-removed"],function(a){return a&&a===f})&&(f=null),f&&h.find(wb["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=Eb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),sb.delegateRun(e,"onBuild",[i])):sb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(sb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),sb.delegateRun(d.oCurrentSubScreen,"onShow"),sb.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)),sb.windowResize()})):xb.setHash(Eb.link().settings(),!1,!0)},jb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(sb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},jb.prototype.onBuild=function(){h.each(wb.settings,function(a){a&&a.__rlSettingsData&&!h.find(wb["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(wb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},jb.prototype.routes=function(){var a=h.find(wb.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=sb.isUnd(c.subname)?b:sb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(kb.prototype,r.prototype),kb.prototype.onShow=function(){Eb.setTitle("")},h.extend(lb.prototype,r.prototype),lb.prototype.oLastRoute={},lb.prototype.setNewTitle=function(){var a=Eb.data().accountEmail(),b=Eb.data().foldersInboxUnreadCount();Eb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+sb.i18n("TITLES/MAILBOX"))},lb.prototype.onShow=function(){this.setNewTitle()},lb.prototype.onRoute=function(a,b,c,d){if(sb.isUnd(d)?1:!d){var e=Eb.data(),f=Eb.cache().getFolderFullNameRaw(a),g=Eb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),qb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Eb.reloadMessageList())}else qb.Layout.NoPreview!==Eb.data().layout()||Eb.data().message()||Eb.historyBack()},lb.prototype.onStart=function(){var a=Eb.data(),b=function(){sb.windowResize()};(Eb.settingsGet("AllowAdditionalAccounts")||Eb.settingsGet("AllowIdentities"))&&Eb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Eb.folderInformation("INBOX")},1e3),h.delay(function(){Eb.quota()},5e3),h.delay(function(){Eb.remote().appDelayStart(sb.emptyFunction)},35e3),Ab.toggleClass("rl-no-preview-pane",qb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Ab.toggleClass("rl-no-preview-pane",qb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},lb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=sb.pString(b[0]),b[1]=sb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=sb.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]=sb.pString(b[0]),b[1]=sb.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(mb.prototype,jb.prototype),mb.prototype.onShow=function(){Eb.setTitle(this.sSettingsTitle)},h.extend(nb.prototype,p.prototype),nb.prototype.oSettings=null,nb.prototype.oPlugins=null,nb.prototype.oLocal=null,nb.prototype.oLink=null,nb.prototype.oSubs={},nb.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):(vb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},nb.prototype.link=function(){return null===this.oLink&&(this.oLink=new j),this.oLink},nb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new o),this.oLocal},nb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=sb.isNormal(yb)?yb:{}),sb.isUnd(this.oSettings[a])?null:this.oSettings[a]},nb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=sb.isNormal(yb)?yb:{}),this.oSettings[a]=b},nb.prototype.setTitle=function(b){b=(sb.isNormal(b)&&0<b.length?b+" - ":"")+Eb.settingsGet("Title")||"",a.document.title="_",a.document.title=b},nb.prototype.loginAndLogoutReload=function(b,c){var d=sb.pString(Eb.settingsGet("CustomLogoutLink")),e=!!Eb.settingsGet("InIframe");b=sb.isUnd(b)?!1:!!b,c=sb.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):(xb.routeOff(),xb.setHash(Eb.link().root(),!0),xb.routeOff(),h.delay(function(){e&&a.parent?a.parent.location.reload():a.location.reload()},100))},nb.prototype.historyBack=function(){a.history.back()},nb.prototype.getAutocomplete=function(a,b){b([],a)},nb.prototype.sub=function(a,b,c){return sb.isUnd(this.oSubs[a])&&(this.oSubs[a]=[]),this.oSubs[a].push([b,c]),this},nb.prototype.pub=function(a,b){return tb.runHook("rl-pub",[a,b]),sb.isUnd(this.oSubs[a])||h.each(this.oSubs[a],function(a){a[0]&&a[0].apply(a[1]||null,b||[])}),this},nb.prototype.bootstart=function(){sb.initOnStartOrLangChange(function(){sb.initNotificationLanguage()},null),h.delay(function(){sb.windowResize()},1e3),ssm.addState({id:"mobile",maxWidth:767,onEnter:function(){Ab.addClass("ssm-state-mobile")},onLeave:function(){Ab.removeClass("ssm-state-mobile")}}),ssm.addState({id:"tablet",minWidth:768,maxWidth:999,onEnter:function(){Ab.addClass("ssm-state-tablet")},onLeave:function(){Ab.removeClass("ssm-state-tablet")}}),ssm.addState({id:"desktop",minWidth:1e3,maxWidth:1400,onEnter:function(){Ab.addClass("ssm-state-desktop")},onLeave:function(){Ab.removeClass("ssm-state-desktop")}}),ssm.addState({id:"desktop-large",minWidth:1400,onEnter:function(){Ab.addClass("ssm-state-desktop-large")},onLeave:function(){Ab.removeClass("ssm-state-desktop-large")}}),ssm.ready()},h.extend(ob.prototype,nb.prototype),ob.prototype.oData=null,ob.prototype.oRemote=null,ob.prototype.oCache=null,ob.prototype.data=function(){return null===this.oData&&(this.oData=new eb),this.oData},ob.prototype.remote=function(){return null===this.oRemote&&(this.oRemote=new gb),this.oRemote},ob.prototype.cache=function(){return null===this.oCache&&(this.oCache=new ib),this.oCache},ob.prototype.reloadFlagsCurrentMessageListAndMessageFromCache=function(){var a=Eb.cache();h.each(Eb.data().messageList(),function(b){a.initMessageFlagsFromCache(b)}),a.initMessageFlagsFromCache(Eb.data().message())},ob.prototype.reloadMessageList=function(a,b){var c=Eb.data(),d=(c.messageListPage()-1)*c.messagesPerPage();(sb.isUnd(b)?1:!b)||Eb.cache().setFolderHash(c.currentFolderFullNameRaw(),""),(sb.isUnd(a)?1:!a)||(c.messageListPage(1),d=0),c.messageListLoading(!0),Eb.remote().messageList(function(a,b,d){qb.StorageResultType.Success===a&&b&&b.Result?(c.messageListError(""),c.messageListLoading(!1),c.setMessageList(b,d)):qb.StorageResultType.Unload===a?(c.messageListError(""),c.messageListLoading(!1)):qb.StorageResultType.Abort!==a&&(c.messageList([]),c.messageListLoading(!1),c.messageListError(b&&b.ErrorCode?sb.getNotification(b.ErrorCode):sb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST")))},c.currentFolderFullNameRaw(),d,c.messagesPerPage(),c.messageListSearch())},ob.prototype.recacheInboxMessageList=function(){Eb.remote().messageList(sb.emptyFunction,"INBOX",0,Eb.data().messagesPerPage(),"",!0)},ob.prototype.folders=function(a){this.data().foldersLoading(!0),this.remote().folders(h.bind(function(b,c){Eb.data().foldersLoading(!1),qb.StorageResultType.Success===b?(this.data().setFolders(c),a&&a(!0)):a&&a(!1)},this))},ob.prototype.accountsAndIdentities=function(){var a=Eb.data();a.accountsLoading(!0),a.identitiesLoading(!0),Eb.remote().accountsAndIdentities(function(b,c){if(a.accountsLoading(!1),a.identitiesLoading(!1),qb.StorageResultType.Success===b&&c.Result){var d=Eb.settingsGet("ParentEmail"),e=a.accountEmail();d=""===d?e:d,sb.isArray(c.Result.Accounts)&&a.accounts(h.map(c.Result.Accounts,function(a){return new A(a,a!==d)})),sb.isArray(c.Result.Identities)&&a.identities(h.map(c.Result.Identities,function(a){var b=sb.pString(a.Id),c=sb.pString(a.Email),d=new B(b,c,b!==e);return d.name(sb.pString(a.Name)),d.replyTo(sb.pString(a.ReplyTo)),d.bcc(sb.pString(a.Bcc)),d}))}})},ob.prototype.quota=function(){this.remote().quota(function(a,b){qb.StorageResultType.Success===a&&b&&b.Result&&sb.isArray(b.Result)&&2===b.Result.length&&sb.isPosNumeric(b.Result[0],!0)&&sb.isPosNumeric(b.Result[1],!0)&&(Eb.data().userQuota(1024*sb.pInt(b.Result[1])),Eb.data().userUsageSize(1024*sb.pInt(b.Result[0])))})},ob.prototype.folderInformation=function(a,b){""!==sb.trim(a)&&this.remote().folderInformation(function(a,b){if(qb.StorageResultType.Success===a&&b&&b.Result&&b.Result.Hash&&b.Result.Folder){var c=f().unix(),d=Eb.cache().getFolderHash(b.Result.Folder),e=Eb.cache().getFolderFromCacheList(b.Result.Folder),g=!1,h="",i=[],j=!1,k=null;if(e){if(e.interval=c,b.Result.Hash&&Eb.cache().setFolderHash(b.Result.Folder,b.Result.Hash),sb.isNormal(b.Result.MessageCount)&&e.messageCountAll(b.Result.MessageCount),sb.isNormal(b.Result.MessageUnseenCount)&&(sb.pInt(e.messageCountUnread())!==sb.pInt(b.Result.MessageUnseenCount)&&(j=!0),e.messageCountUnread(b.Result.MessageUnseenCount)),j&&Eb.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],Eb.cache().storeMessageFlagsToCacheByFolderAndUid(e.fullNameRaw,h.toString(),[!k.IsSeen,!!k.IsFlagged,!!k.IsAnswered,!!k.IsForwarded,!!k.IsReadReceipt]));g&&Eb.reloadFlagsCurrentMessageListAndMessageFromCache()}Eb.data().initUidNextAndNewMessages(e.fullNameRaw,b.Result.UidNext,b.Result.NewMessages),b.Result.Hash!==d||""===d?e.fullNameRaw===Eb.data().currentFolderFullNameRaw()?Eb.reloadMessageList():"INBOX"===e.fullNameRaw&&Eb.recacheInboxMessageList():j&&e.fullNameRaw===Eb.data().currentFolderFullNameRaw()&&(i=Eb.data().messageList(),sb.isNonEmptyArray(i)&&Eb.folderInformation(e.fullNameRaw,i))}}},a,b)},ob.prototype.folderInformationMultiply=function(a){a=sb.isUnd(a)?!1:!!a;var b=f().unix(),c=Eb.data().getNextFolderNames(a);sb.isNonEmptyArray(c)&&this.remote().folderInformationMultiply(function(c,d){qb.StorageResultType.Success===c&&d&&d.Result&&d.Result.List&&sb.isNonEmptyArray(d.Result.List)&&(h.each(d.Result.List,function(a){var c=[],d=Eb.cache().getFolderHash(a.Folder),e=Eb.cache().getFolderFromCacheList(a.Folder),f=!1;e&&(e.interval=b,a.Hash&&Eb.cache().setFolderHash(a.Folder,a.Hash),sb.isNormal(a.MessageCount)&&e.messageCountAll(a.MessageCount),sb.isNormal(a.MessageUnseenCount)&&(sb.pInt(e.messageCountUnread())!==sb.pInt(a.MessageUnseenCount)&&(f=!0),e.messageCountUnread(a.MessageUnseenCount)),f&&Eb.cache().clearMessageFlagsFromCacheByFolder(e.fullNameRaw),a.Hash!==d||""===d?e.fullNameRaw===Eb.data().currentFolderFullNameRaw()&&Eb.reloadMessageList():f&&e.fullNameRaw===Eb.data().currentFolderFullNameRaw()&&(c=Eb.data().messageList(),sb.isNonEmptyArray(c)&&Eb.folderInformation(e.fullNameRaw,c)))}),a&&Eb.folderInformationMultiply(!0))},c)},ob.prototype.setMessageSeen=function(a){if(a.unseen()){a.unseen(!1);
var b=Eb.cache().getFolderFromCacheList(a.folderFullNameRaw);b&&b.messageCountUnread(0<=b.messageCountUnread()-1?b.messageCountUnread()-1:0),Eb.cache().storeMessageFlagsToCache(a),Eb.reloadFlagsCurrentMessageListAndMessageFromCache()}Eb.remote().messageSetSeen(sb.emptyFunction,a.folderFullNameRaw,[a.uid],!0)},ob.prototype.googleConnect=function(){a.open(Eb.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")},ob.prototype.twitterConnect=function(){a.open(Eb.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")},ob.prototype.facebookConnect=function(){a.open(Eb.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")},ob.prototype.socialUsers=function(a){var b=Eb.data();a&&(b.googleActions(!0),b.facebookActions(!0),b.twitterActions(!0)),Eb.remote().socialUsers(function(a,c){qb.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)})},ob.prototype.googleDisconnect=function(){Eb.data().googleActions(!0),Eb.remote().googleDisconnect(function(){Eb.socialUsers()})},ob.prototype.facebookDisconnect=function(){Eb.data().facebookActions(!0),Eb.remote().facebookDisconnect(function(){Eb.socialUsers()})},ob.prototype.twitterDisconnect=function(){Eb.data().twitterActions(!0),Eb.remote().twitterDisconnect(function(){Eb.socialUsers()})},ob.prototype.folderListOptionsBuilder=function(b,c,d,e,f,g,h,i,j,k){var l=0,m=0,n=null,o="   ",p=[];for(j=sb.isNormal(j)?j:0<b.length,k=sb.isUnd(k)?!1:!!k,f=sb.isNormal(f)?f:0,g=sb.isNormal(g)?g:null,h=sb.isNormal(h)?h:null,i=sb.isNormal(i)?i:null,sb.isArray(d)||(d=[]),sb.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<sb.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)&&(qb.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<sb.inArray(n.fullNameRaw,d)||qb.FolderType.User!==n.type()||(g?g.call(null,n):!1)}),n.subScribed()&&0<n.subFolders().length&&(p=p.concat(Eb.folderListOptionsBuilder([],n.subFolders(),d,[],n.isUnpaddigFolder?f+1:f,g,h,i,j,k)));return p},ob.prototype.getAutocomplete=function(a,b){var c=[];Eb.remote().suggestions(function(a,d){qb.StorageResultType.Success===a&&d&&sb.isArray(d.Result)?(c=h.map(d.Result,function(a){return a&&a[0]?new t(a[0],a[1]):null}),b(h.compact(c))):qb.StorageResultType.Abort!==a&&b([])},a)},ob.prototype.emailsPicsHashes=function(){Eb.remote().emailsPicsHashes(function(a,b){qb.StorageResultType.Success===a&&b&&b.Result&&Eb.cache().setEmailsPicsHashesData(b.Result)})},ob.prototype.mailToHelper=function(b){if(b&&"mailto:"===b.toString().toLowerCase().substr(0,7)){var c=null;if(c=new t,c.parse(a.decodeURI(b.toString().substr(7).replace(/\?.+$/,""))),c&&c.email)return xb.showScreenPopup(F,[qb.ComposeType.Empty,null,[c]]),!0}return!1},ob.prototype.bootstart=function(){Eb.pub("rl.bootstart"),nb.prototype.bootstart.call(this),Eb.data().populateDataOnStart();var c="",d=Eb.settingsGet("JsHash"),e=Eb.settingsGet("AllowGoogleSocial"),f=Eb.settingsGet("AllowFacebookSocial"),g=Eb.settingsGet("AllowTwitterSocial");Eb.settingsGet("ChangePasswordIsAllowed")||sb.removeSettingsViewModel(ab),Eb.settingsGet("ContactsIsAllowed")||sb.removeSettingsViewModel(X),Eb.settingsGet("AllowAdditionalAccounts")||sb.removeSettingsViewModel(Y),Eb.settingsGet("AllowIdentities")?sb.removeSettingsViewModel(Z):sb.removeSettingsViewModel($),e||f||g||sb.removeSettingsViewModel(_),Eb.settingsGet("AllowThemes")||sb.removeSettingsViewModel(cb),sb.initOnStartOrLangChange(function(){b.extend(!0,b.magnificPopup.defaults,{tClose:sb.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:sb.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:sb.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:sb.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:sb.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:sb.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:sb.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this),a.SimplePace&&(a.SimplePace.set(70),a.SimplePace.sleep()),Eb.settingsGet("Auth")?(this.setTitle(sb.i18n("TITLES/LOADING")),this.folders(h.bind(function(c){xb.hideLoading(),c?(a.crypto&&a.crypto.getRandomValues&&Eb.settingsGet("OpenPGP")?b.ajax({url:Eb.link().openPgpJs(),dataType:"script",cache:!0,success:function(){a.openpgp&&(vb.bAllowOpenPGP=!0,Eb.pub("openpgp.init"))}}):vb.bAllowOpenPGP=!1,xb.startScreens([lb,mb]),(e||f||g)&&Eb.socialUsers(!0),Eb.sub("interval.2m",function(){Eb.folderInformation("INBOX")}),Eb.sub("interval.2m",function(){var a=Eb.data().currentFolderFullNameRaw();"INBOX"!==a&&Eb.folderInformation(a)}),Eb.sub("interval.3m",function(){Eb.folderInformationMultiply()}),Eb.sub("interval.5m",function(){Eb.quota()}),h.delay(function(){Eb.folderInformationMultiply(!0)},500),h.delay(function(){Eb.emailsPicsHashes(),Eb.remote().servicesPics(function(a,b){qb.StorageResultType.Success===a&&b&&b.Result&&Eb.cache().setServicesData(b.Result)})},2e3),tb.runHook("rl-start-user-screens"),Eb.pub("rl.bootstart-user-screens")):(xb.startScreens([kb]),tb.runHook("rl-start-login-screens"),Eb.pub("rl.bootstart-login-screens")),a.SimplePace&&a.SimplePace.set(100),vb.bMobileDevice||h.defer(function(){sb.initLayoutResizer("#rl-left","#rl-right",qb.ClientSideKeyName.FolderListSize)})},this))):(c=sb.pString(Eb.settingsGet("CustomLoginLink")),c?(xb.routeOff(),xb.setHash(Eb.link().root(),!0),xb.routeOff(),h.defer(function(){a.location.href=c})):(xb.hideLoading(),xb.startScreens([kb]),tb.runHook("rl-start-login-screens"),Eb.pub("rl.bootstart-login-screens"),a.SimplePace&&a.SimplePace.set(100))),e&&(a["rl_"+d+"_google_service"]=function(){Eb.data().googleActions(!0),Eb.socialUsers()}),f&&(a["rl_"+d+"_facebook_service"]=function(){Eb.data().facebookActions(!0),Eb.socialUsers()}),g&&(a["rl_"+d+"_twitter_service"]=function(){Eb.data().twitterActions(!0),Eb.socialUsers()}),Eb.sub("interval.1m",function(){vb.momentTrigger(!vb.momentTrigger())}),tb.runHook("rl-start-screens"),Eb.pub("rl.bootstart-end")},Eb=new ob,Ab.addClass(vb.bMobileDevice?"mobile":"no-mobile"),Bb.keydown(sb.killCtrlAandS).keyup(sb.killCtrlAandS),Bb.unload(function(){vb.bUnload=!0}),a.rl=a.rl||{},a.rl.addHook=tb.addHook,a.rl.settingsGet=tb.mainSettingsGet,a.rl.remoteRequest=tb.remoteRequest,a.rl.pluginSettingsGet=tb.settingsGet,a.rl.addSettingsViewModel=sb.addSettingsViewModel,a.rl.createCommand=sb.createCommand,a.rl.EmailModel=t,a.rl.Enums=qb,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={},xb.setBoot(Eb).bootstart(),Ab.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);