snappymail/rainloop/v/0.0.0/static/js/app.min.js
2013-12-28 18:11:19 +04:00

9 lines
224 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){"use strict";function i(){this.sBase="#/",this.sCdnStaticDomain=Cb.settingsGet("CdnStaticDomain"),this.sVersion=Cb.settingsGet("Version"),this.sSpecSuffix=Cb.settingsGet("AuthAccountHash")||"0",this.sServer=(Cb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function j(a,c,d,e){var f={DisableHtml:!1,onSwitch:!1,LangSwitcherConferm:"EDITOR_TEXT_SWITCHER_CONFIRM",LangSwitcherTextLabel:"EDITOR_SWITCHER_TEXT_LABEL",LangSwitcherHtmlLabel:"EDITOR_SWITCHER_HTML_LABEL"};this.bIe=!!/msie/.test(navigator.userAgent.toLowerCase()),e=b.extend(f,qb.isUnd(e)?{}:e),this.oOptions=e,this.bOnlyPlain=!!this.oOptions.DisableHtml,this.fOnSwitch=this.oOptions.onSwitch,this.textarea=b(a).empty().addClass("editorTextArea"),this.htmlarea=b(c).empty().addClass("editorHtmlArea").prop("contentEditable","true"),this.toolbar=b(d).empty().addClass("editorToolbar"),j.htmlInitEditor.apply(this),j.htmlInitToolbar.apply(this),j.htmlAttachEditorEvents.apply(this),this.bOnlyPlain&&this.toolbar.hide()}function k(a,b,c,d,e){this.list=a,this.selectedItem=b,this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.oContentVisible=null,this.oContentScrollable=null,this.sItemSelector=c,this.sItemSelectedSelector=d,this.sItemCheckedSelector=e,this.sLastUid="",this.oCallbacks={},this.iSelectTimer=0,this.bUseKeyboard=!0,this.emptyFunction=function(){},this.useItemSelectCallback=!0,this.throttleSelection=!1,this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&(this.throttleSelection?(this.throttleSelection=!1,this.selectItemCallbacksThrottle(a)):this.selectItemCallbacks(a))},this);var f=this,g=[],i=null;this.list.subscribe(function(){var a=this,b=this.list();qb.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),qb.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1<qb.inArray(b.getItemUid(a),g)&&(a.checked(!0),c--),null!==i&&i===b.getItemUid(a)&&(a.selected(!0),i=null,b.selectedItem(a))})}this.useItemSelectCallback=!0,g=[],i=null},this),this.list.setSelectedByUid=function(a){f.selectByUid(a,!1)},this.selectItemCallbacksThrottle=h.debounce(this.selectItemCallbacks,300)}function l(){}function m(){}function n(){var a=[m,l],b=h.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function o(){}function p(a,b){this.sPosition=qb.pString(a),this.sTemplate=qb.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function q(a,b){this.sScreenName=a,this.aViewModels=qb.isArray(b)?b:[]}function r(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null,this.popupVisibility=c.observable(!1),this.popupVisibility.subscribe(function(a){Cb&&Cb.popupVisibility(a)})}function s(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function t(){this.idContact=0,this.idContactStr="",this.display="",this.properties=[],this.readOnly=!1,this.scopeType=ob.ContactScopeType.Default,this.checked=c.observable(!1),this.selected=c.observable(!1),this.deleted=c.observable(!1),this.shared=c.observable(!1)}function u(a,b,d,e){this.type=c.observable(qb.isUnd(a)?ob.ContactPropertyType.Unknown:a),this.focused=c.observable(qb.isUnd(d)?!1:!!d),this.value=c.observable(qb.pString(b)),this.placeholder=c.observable(e||""),this.placeholderValue=c.computed(function(){var a=this.placeholder();return a?qb.i18n(a):""},this)}function v(){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 w(a,b,d,e,f,g,h){this.id=a,this.isInline=qb.isUnd(e)?!1:!!e,this.isLinked=qb.isUnd(f)?!1:!!f,this.CID=qb.isUnd(g)?"":g,this.contentLocation=qb.isUnd(h)?"":h,this.fromMessage=!1,this.fileName=c.observable(b),this.size=c.observable(qb.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?"":qb.friendlySize(this.size())},this)}function x(){this.folderFullNameRaw="",this.uid="",this.requestHash="",this.subject=c.observable(""),this.size=c.observable(0),this.dateTimeStampInUTC=c.observable(0),this.priority=c.observable(ob.MessagePriority.Normal),this.fromEmailString=c.observable(""),this.toEmailsString=c.observable(""),this.senderEmailsString=c.observable(""),this.prefetched=!1,this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.newForAnimation=c.observable(!1),this.deleted=c.observable(!1),this.unseen=c.observable(!1),this.flagged=c.observable(!1),this.answered=c.observable(!1),this.forwarded=c.observable(!1),this.selected=c.observable(!1),this.checked=c.observable(!1),this.hasAttachments=c.observable(!1),this.attachmentsMainType=c.observable(""),this.moment=c.observable(f()),this.attachmentIconClass=c.computed(function(){var a="";if(this.hasAttachments())switch(a="icon-attachment",this.attachmentsMainType()){case"image":a="icon-image";break;case"archive":a="icon-file-zip";break;case"doc":a="icon-file-text"}return a},this),this.fullFormatDateValue=c.computed(function(){return x.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.fullFormatDateValue=c.computed(function(){return x.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.momentDate=qb.createMomentDate(this),this.momentShortDate=qb.createMomentShortDate(this),this.dateTimeStampInUTC.subscribe(function(a){var b=f().unix();this.moment(f.unix(a>b?b:a))},this),this.body=null,this.isRtl=c.observable(!1),this.isHtml=c.observable(!1),this.hasImages=c.observable(!1),this.attachments=c.observableArray([]),this.priority=c.observable(ob.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=c.observable(0),this.threads=c.observableArray([]),this.threadsLen=c.observable(0),this.hasUnseenSubMessage=c.observable(!1),this.hasFlaggedSubMessage=c.observable(!1),this.lastInCollapsedThread=c.observable(!1),this.lastInCollapsedThreadLoading=c.observable(!1),this.threadsLenResult=c.computed(function(){var a=this.threadsLen();return 0===this.parentUid()&&a>0?a+1:""},this)}function y(){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(ob.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 z(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function A(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 B(){p.call(this,"Popups","PopupsFolderClear"),this.selectedFolder=c.observable(null),this.clearingProcess=c.observable(!1),this.clearingError=c.observable(""),this.folderFullNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this),this.folderNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.localName():""},this),this.dangerDescHtml=c.computed(function(){return qb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=qb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Cb.data().message(null),Cb.data().messageList([]),this.clearingProcess(!0),Cb.cache().setFolderHash(b.fullNameRaw,""),Cb.remote().folderClear(function(b,c){a.clearingProcess(!1),ob.StorageResultType.Success===b&&c&&c.Result?(Cb.reloadMessageList(!0),a.cancelCommand()):c&&c.ErrorCode?a.clearingError(qb.getNotification(c.ErrorCode)):a.clearingError(qb.getNotification(ob.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),r.constructorEnd(this)}function C(){p.call(this,"Popups","PopupsFolderCreate"),qb.initOnStartOrLangChange(function(){this.sNoParentText=qb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.focusTrigger=c.observable(!1),this.selectedParentValue=c.observable(nb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Cb.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)}),Cb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=qb.createCommand(this,function(){var a=Cb.data(),b=this.selectedParentValue();""===b&&1<a.namespace.length&&(b=a.namespace.substr(0,a.namespace.length-1)),a.foldersCreating(!0),Cb.remote().folderCreate(function(a,b){Cb.data().foldersCreating(!1),ob.StorageResultType.Success===a&&b&&b.Result?Cb.folders():Cb.data().foldersListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"))},this.folderName(),b),this.cancelCommand()},function(){return this.simpleFolderNameValidation(this.folderName())}),this.defautOptionsAfterRender=qb.defautOptionsAfterRender,r.constructorEnd(this)}function D(){p.call(this,"Popups","PopupsFolderSystem"),qb.initOnStartOrLangChange(function(){this.sChooseOnText=qb.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE"),this.sUnuseText=qb.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME")},this),this.notification=c.observable(""),this.folderSelectList=c.computed(function(){return Cb.folderListOptionsBuilder([],Cb.data().folderList(),Cb.data().folderListSystemNames(),[["",this.sChooseOnText],[nb.Values.UnuseOptionValue,this.sUnuseText]])},this);var a=Cb.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(){Cb.settingsSet("SentFolder",b.sentFolder()),Cb.settingsSet("DraftFolder",b.draftFolder()),Cb.settingsSet("SpamFolder",b.spamFolder()),Cb.settingsSet("TrashFolder",b.trashFolder()),Cb.remote().saveSystemFolders(qb.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder(),NullFolder:"NullFolder"})},1e3),e=function(){Cb.settingsSet("SentFolder",b.sentFolder()),Cb.settingsSet("DraftFolder",b.draftFolder()),Cb.settingsSet("SpamFolder",b.spamFolder()),Cb.settingsSet("TrashFolder",b.trashFolder()),d()},this.sentFolder.subscribe(e),this.draftFolder.subscribe(e),this.spamFolder.subscribe(e),this.trashFolder.subscribe(e),this.defautOptionsAfterRender=qb.defautOptionsAfterRender,r.constructorEnd(this)}function E(){p.call(this,"Popups","PopupsCompose"),this.oEditor=null,this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bReloadFolder=!1,this.bAllowIdentities=Cb.settingsGet("AllowIdentities");var b=this,d=Cb.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.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.composeEditorTextArea=c.observable(null),this.composeEditorHtmlArea=c.observable(null),this.composeEditorToolbar=c.observable(null),this.identities=Cb.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!==Cb.data().accountEmail()&&(c=h.find(d,function(a){return a&&e===a.id}),a=c?c.formattedNameForCompose():"",b=c?c.formattedNameForEmail():"",""===a&&d[0])?(this.currentIdentityID(d[0].id),""):(""===a&&(a=this.formattedFrom(!1),b=this.formattedFrom(!0)),this.currentIdentityString(a),this.currentIdentityResultEmail(b),a)},this),this.to.subscribe(function(a){this.emptyToError()&&0<a.length&&this.emptyToError(!1)},this),this.canBeSended=c.computed(function(){return!this.sending()&&!this.saving()&&0===this.attachmentsInProcess().length&&0<this.to().length},this),this.canBeSendedOrSaved=c.computed(function(){return!this.sending()&&!this.saving()},this),this.deleteCommand=qb.createCommand(this,function(){var a=null,b=this.draftFolder(),c=this.draftUid();this.bFromDraft&&(a=Cb.data().message(),a&&b===a.folderFullNameRaw&&c===a.uid&&Cb.data().message(null)),Cb.data().currentFolderFullNameRaw()===this.draftFolder()&&h.each(Cb.data().messageList(),function(a){a&&b===a.folderFullNameRaw&&c===a.uid&&a.deleted(!0)}),Cb.data().messageListIsNotCompleted(!0),Cb.remote().messagesDelete(function(){Cb.cache().setFolderHash(b,""),Cb.reloadMessageList()},this.draftFolder(),[this.draftUid()]),this.bReloadFolder=!1,vb.hideScreenPopup(E)},function(){return this.isDraftFolderMessage()}),this.sendMessageResponse=h.bind(this.sendMessageResponse,this),this.saveMessageResponse=h.bind(this.saveMessageResponse,this),this.sendCommand=qb.createCommand(this,function(){var a=qb.trim(this.to()),b=Cb.data().sentFolder(),c=[];0===a.length?this.emptyToError(!0):(Cb.data().replySameFolder()&&qb.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&qb.isNormal(this.aDraftInfo[2])&&0<this.aDraftInfo[2].length&&(b=this.aDraftInfo[2]),""===b?vb.showScreenPopup(D,[ob.SetSystemFoldersNotification.Sent]):(this.sendError(!1),this.sending(!0),this.bReloadFolder=!0,qb.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&(c=Cb.cache().getMessageFlagsFromCache(this.aDraftInfo[2],this.aDraftInfo[1]),c&&("forward"===this.aDraftInfo[0]?c[3]=!0:c[2]=!0,Cb.cache().setMessageFlagsToCache(this.aDraftInfo[2],this.aDraftInfo[1],c),Cb.reloadFlagsCurrentMessageListAndMessageFromCache())),b=nb.Values.UnuseOptionValue===b?"":b,Cb.cache().setFolderHash(this.draftFolder(),""),Cb.cache().setFolderHash(b,""),Cb.remote().sendMessage(this.sendMessageResponse,this.draftFolder(),this.draftUid(),b,this.currentIdentityResultEmail(),a,this.cc(),this.bcc(),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences)))},this.canBeSendedOrSaved),this.saveCommand=qb.createCommand(this,function(){Cb.data().draftFolderNotEnabled()?vb.showScreenPopup(D,[ob.SetSystemFoldersNotification.Draft]):(this.savedError(!1),this.saving(!0),this.bReloadFolder=!0,Cb.cache().setFolderHash(Cb.data().draftFolder(),""),Cb.remote().saveMessage(this.saveMessageResponse,this.draftFolder(),this.draftUid(),Cb.data().draftFolder(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc(),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences))},this.canBeSendedOrSaved),Cb.sub("interval.1m",function(){!this.modalVisibility()||Cb.data().draftFolderNotEnabled()||this.isEmptyForm(!1)||this.saving()||this.sending()||this.savedError()||this.saveCommand()},this),qb.initOnStartOrLangChange(null,this,function(){this.oEditor&&this.oEditor.initLanguage(qb.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),qb.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),qb.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}),this.showCcAndBcc.subscribe(function(){this.triggerForResize()},this),this.dropboxEnabled=c.observable(Cb.settingsGet("DropboxApiKey")?!0:!1),this.dropboxCommand=qb.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,Cb.reloadMessageList())},this),this.driveEnabled=c.observable(!1),this.driveCommand=qb.createCommand(this,function(){return!0},function(){return this.driveEnabled()}),r.constructorEnd(this)}function F(){p.call(this,"Popups","PopupsContacts");var a=this,b=ob.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.currentContact=c.observable(null),this.contactsSharingIsAllowed=!!Cb.settingsGet("ContactsSharingIsAllowed"),this.contactsPage=c.observable(1),this.contactsPageCount=c.computed(function(){var a=Math.ceil(this.contactsCount()/nb.Defaults.ContactsPerPage);return 0>=a?1:a},this),this.contactsPagenator=c.computed(qb.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(ob.ContactScopeType.Default),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(ob.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1<qb.inArray(a.type(),d)}),this.viewPropertiesEmails=this.viewProperties.filter(function(a){return-1<qb.inArray(a.type(),e)}),this.shareIcon=c.computed(function(){return ob.ContactScopeType.ShareAll===this.viewScopeType()?"icon-earth":"icon-share"},this),this.shareToNone=c.computed(function(){return ob.ContactScopeType.ShareAll!==this.viewScopeType()},this),this.shareToAll=c.computed(function(){return ob.ContactScopeType.ShareAll===this.viewScopeType()},this),this.viewHasNonEmptyRequaredProperties=c.computed(function(){var a=this.viewPropertiesNames(),b=this.viewPropertiesEmails(),c=function(a){return""!==qb.trim(a.value())};return!(!h.find(a,c)&&!h.find(b,c))},this),this.viewPropertiesPhones=this.viewProperties.filter(function(a){return-1<qb.inArray(a.type(),f)}),this.viewPropertiesOther=this.viewProperties.filter(function(a){return-1<qb.inArray(a.type(),g)}),this.viewPropertiesEmailsNonEmpty=this.viewPropertiesNames.filter(function(a){return""!==qb.trim(a.value())}),this.viewPropertiesEmailsEmptyAndOnFocused=this.viewPropertiesEmails.filter(function(a){var b=a.focused();return""===qb.trim(a.value())&&!b}),this.viewPropertiesPhonesEmptyAndOnFocused=this.viewPropertiesPhones.filter(function(a){var b=a.focused();return""===qb.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=Cb.data().useCheckboxesInList,this.search.subscribe(function(){this.reloadContactList()},this),this.contacts.subscribe(function(){qb.windowResize()},this),this.viewProperties.subscribe(function(){qb.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 k(this.contacts,this.currentContact,".e-contact-item .actionHandle",".e-contact-item.selected",".e-contact-item .checkboxItem"),this.selector.on("onItemSelect",h.bind(function(a){this.populateViewContact(a?a:null)},this)),this.selector.on("onItemGetUid",function(a){return a?a.generateUid():""}),this.selector.on("onDelete",h.bind(function(){this.deleteCommand()},this)),this.newCommand=qb.createCommand(this,function(){this.populateViewContact(null),this.currentContact(null)}),this.deleteCommand=qb.createCommand(this,function(){this.deleteSelectedContacts(),this.emptySelection(!0)},function(){return 0<this.contactsCheckedOrSelected().length}),this.newMessageCommand=qb.createCommand(this,function(){var a=this.contactsCheckedOrSelected(),b=[];qb.isNonEmptyArray(a)&&(b=h.map(a,function(a){if(a){var b=a.getNameAndEmailHelper(),c=b?new s(b[0],b[1]):null;if(c&&c.validate())return c}return null}),b=h.compact(b)),qb.isNonEmptyArray(b)&&(vb.hideScreenPopup(F),vb.showScreenPopup(E,[ob.ComposeType.Empty,null,b]))},function(){return 0<this.contactsCheckedOrSelected().length}),this.clearCommand=qb.createCommand(this,function(){this.search("")}),this.saveCommand=qb.createCommand(this,function(){this.viewSaving(!0),this.viewSaveTrigger(ob.SaveSettingsStep.Animate);var b=qb.fakeMd5(),c=[];h.each(this.viewProperties(),function(a){a.type()&&""!==qb.trim(a.value())&&c.push([a.type(),a.value()])}),Cb.remote().contactSave(function(c,d){var e=!1;a.viewSaving(!1),ob.StorageResultType.Success===c&&d&&d.Result&&d.Result.RequestUid===b&&0<qb.pInt(d.Result.ResultID)&&(""===a.viewID()&&a.viewID(qb.pInt(d.Result.ResultID)),""===a.viewIDStr()&&a.viewIDStr(qb.pString(d.Result.ResultIDStr)),a.reloadContactList(),e=!0),h.delay(function(){a.viewSaveTrigger(e?ob.SaveSettingsStep.TrueResult:ob.SaveSettingsStep.FalseResult)},300),e&&(a.watchDirty(!1),h.delay(function(){a.viewSaveTrigger(ob.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),r.constructorEnd(this)}function G(){p.call(this,"Popups","PopupsAdvancedSearch"),this.fromFocus=c.observable(!1),this.from=c.observable(""),this.to=c.observable(""),this.subject=c.observable(""),this.text=c.observable(""),this.selectedDateValue=c.observable(-1),this.hasAttachments=c.observable(!1),this.starred=c.observable(!1),this.unseen=c.observable(!1),this.searchCommand=qb.createCommand(this,function(){var a=this.buildSearchString();""!==a&&Cb.data().mainMessageListSearch(a),this.cancelCommand()}),r.constructorEnd(this)}function H(){p.call(this,"Popups","PopupsAddAccount"),this.email=c.observable(""),this.login=c.observable(""),this.password=c.observable(""),this.emailError=c.observable(!1),this.loginError=c.observable(!1),this.passwordError=c.observable(!1),this.email.subscribe(function(){this.emailError(!1)},this),this.login.subscribe(function(){this.loginError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.allowCustomLogin=c.observable(!1),this.submitRequest=c.observable(!1),this.submitError=c.observable(""),this.emailFocus=c.observable(!1),this.loginFocus=c.observable(!1),this.addAccountCommand=qb.createCommand(this,function(){return this.emailError(""===qb.trim(this.email())),this.passwordError(""===qb.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),Cb.remote().accountAdd(h.bind(function(a,b){this.submitRequest(!1),ob.StorageResultType.Success===a&&b&&"AccountAdd"===b.Action?b.Result?(Cb.accountsAndIdentities(),this.cancelCommand()):b.ErrorCode&&this.submitError(qb.getNotification(b.ErrorCode)):this.submitError(qb.getNotification(ob.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),r.constructorEnd(this)}function I(){p.call(this,"Popups","PopupsIdentity"),this.id="",this.edit=c.observable(!1),this.owner=c.observable(!1),this.email=c.observable("").validateEmail(),this.email.focused=c.observable(!1),this.name=c.observable(""),this.name.focused=c.observable(!1),this.replyTo=c.observable("").validateSimpleEmail(),this.replyTo.focused=c.observable(!1),this.bcc=c.observable("").validateSimpleEmail(),this.bcc.focused=c.observable(!1),this.submitRequest=c.observable(!1),this.submitError=c.observable(""),this.addOrEditIdentityCommand=qb.createCommand(this,function(){return this.email.hasError()||this.email.hasError(""===qb.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),Cb.remote().identityUpdate(h.bind(function(a,b){this.submitRequest(!1),ob.StorageResultType.Success===a&&b?b.Result?(Cb.accountsAndIdentities(),this.cancelCommand()):b.ErrorCode&&this.submitError(qb.getNotification(b.ErrorCode)):this.submitError(qb.getNotification(ob.Notification.UnknownError))},this),this.id,this.email(),this.name(),this.replyTo(),this.bcc()),!0)},function(){return!this.submitRequest()}),this.label=c.computed(function(){return qb.i18n("POPUPS_IDENTITIES/"+(this.edit()?"TITLE_UPDATE_IDENTITY":"TITLE_ADD_IDENTITY"))},this),this.button=c.computed(function(){return qb.i18n("POPUPS_IDENTITIES/"+(this.edit()?"BUTTON_UPDATE_IDENTITY":"BUTTON_ADD_IDENTITY"))},this),r.constructorEnd(this)}function J(){p.call(this,"Popups","PopupsLanguages"),this.exp=c.observable(!1),this.languages=c.computed(function(){return h.map(Cb.data().languages(),function(a){return{key:a,selected:c.observable(!1),fullName:qb.convertLangName(a)}})}),Cb.data().mainLanguage.subscribe(function(){this.resetMainLanguage()},this),r.constructorEnd(this)}function K(){p.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,r.constructorEnd(this)}function L(){p.call(this,"Right","Login");var b=Cb.data();this.email=c.observable(""),this.login=c.observable(""),this.password=c.observable(""),this.signMe=c.observable(!1),this.logoMain=c.observable("RainLoop"),this.emailError=c.observable(!1),this.loginError=c.observable(!1),this.passwordError=c.observable(!1),this.emailFocus=c.observable(!1),this.loginFocus=c.observable(!1),this.submitFocus=c.observable(!1),this.email.subscribe(function(){this.emailError(!1)},this),this.login.subscribe(function(){this.loginError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=c.observable(!1),this.submitError=c.observable(""),this.allowCustomLogin=b.allowCustomLogin,this.allowLanguagesOnLogin=b.allowLanguagesOnLogin,this.langRequest=c.observable(!1),this.mainLanguage=b.mainLanguage,this.bSendLanguage=!1,this.mainLanguageFullName=c.computed(function(){return qb.convertLangName(this.mainLanguage())},this),this.signMeType=c.observable(ob.LoginSignMeType.Unused),this.signMeType.subscribe(function(a){this.signMe(ob.LoginSignMeType.DefaultOn===a)},this),this.signMeVisibility=c.computed(function(){return ob.LoginSignMeType.Unused!==this.signMeType()},this),this.submitCommand=qb.createCommand(this,function(){return this.emailError(""===qb.trim(this.email())),this.passwordError(""===qb.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),Cb.remote().login(h.bind(function(a,b){ob.StorageResultType.Success===a&&b&&"Login"===b.Action?b.Result?Cb.loginAndLogoutReload():b.ErrorCode?(this.submitRequest(!1),this.submitError(qb.getNotification(b.ErrorCode))):this.submitRequest(!1):(this.submitRequest(!1),this.submitError(qb.getNotification(ob.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=qb.createCommand(this,function(){return a.open(Cb.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=qb.createCommand(this,function(){return a.open(Cb.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=qb.createCommand(this,function(){return a.open(Cb.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),r.constructorEnd(this)}function M(){p.call(this,"Right","SystemDropDown");var a=Cb.data();this.accounts=a.accounts,this.accountEmail=a.accountEmail,this.accountsLoading=a.accountsLoading,this.allowAddAccount=Cb.settingsGet("AllowAdditionalAccounts"),this.loading=c.computed(function(){return this.accountsLoading()},this),this.accountClick=h.bind(this.accountClick,this)}function N(){M.call(this),r.constructorEnd(this)}function O(){M.call(this),r.constructorEnd(this)
}function P(){p.call(this,"Left","MailFolderList"),this.folderList=Cb.data().folderList,this.folderListSystem=Cb.data().folderListSystem,this.iDropOverTimer=0,this.allowContacts=!!Cb.settingsGet("ContactsIsAllowed"),r.constructorEnd(this)}function Q(){p.call(this,"Right","MailMessageList"),this.sLastUid=null,this.emptySubjectValue="";var a=Cb.data();this.popupVisibility=Cb.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,qb.initOnStartOrLangChange(function(){this.emptySubjectValue=qb.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this),this.userQuota=a.userQuota,this.userUsageSize=a.userUsageSize,this.userUsageProc=a.userUsageProc,this.dragOver=c.observable(!1).extend({throttle:1}),this.dragOverEnter=c.observable(!1).extend({throttle:1}),this.dragOverArea=c.observable(null),this.dragOverBodyArea=c.observable(null),this.messageListItemTemplate=c.computed(function(){return a.usePreviewPane()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=c.computed(function(){var b=a.messageListEndSearch();return""===b?"":qb.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:b})}),this.messageListPagenator=c.computed(qb.computedPagenatorHelper(a.messageListPage,a.messageListPageCount)),this.checkAll=c.computed({read:function(){return 0<Cb.data().messageListCheckedOrSelected().length},write:function(a){a=!!a,h.each(Cb.data().messageList(),function(b){b.checked(a)}),a||Cb.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=Cb.data().messageList().length,b=Cb.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 Cb.data().spamFolder()===this.messageListEndFolder()},this),this.isSpamDisabled=c.computed(function(){return nb.Values.UnuseOptionValue===Cb.data().spamFolder()},this),this.isTrashFolder=c.computed(function(){return Cb.data().trashFolder()===this.messageListEndFolder()},this),this.canBeMoved=this.hasCheckedOrSelectedLines,this.clearCommand=qb.createCommand(this,function(){vb.showScreenPopup(B,[Cb.data().currentFolder()])}),this.multyForwardCommand=qb.createCommand(this,function(){vb.showScreenPopup(E,[ob.ComposeType.ForwardAsAttachment,Cb.data().messageListCheckedOrSelected()])},this.canBeMoved),this.deleteWithoutMoveCommand=qb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(ob.FolderType.Trash,!1)},this.canBeMoved),this.deleteCommand=qb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(ob.FolderType.Trash,!0)},this.canBeMoved),this.spamCommand=qb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(ob.FolderType.Spam,!0)},this.canBeMoved),this.moveCommand=qb.createCommand(this,qb.emptyFunction,this.canBeMoved),this.setCommand=qb.createCommand(this,qb.emptyFunction,this.hasCheckedLines),this.checkCommand=qb.createCommand(this,qb.emptyFunction,this.hasCheckedLines),this.reloadCommand=qb.createCommand(this,function(){Cb.data().messageListCompleteLoadingThrottle()||Cb.reloadMessageList(!1,!0)}),this.quotaTooltip=h.bind(this.quotaTooltip,this),this.selector=new k(this.messageList,this.currentMessage,".messageListItem .actionHandle",".messageListItem.selected",".messageListItem .checkboxMessage"),this.selector.on("onItemSelect",h.bind(function(b){b?(a.message(a.staticMessageList.populateByMessageListItem(b)),this.populateMessageBody(a.message())):a.message(null)},this)),this.selector.on("onItemGetUid",function(a){return a?a.generateUid():""}),this.selector.on("onDelete",h.bind(function(){0<Cb.data().messageListCheckedOrSelected().length&&this.deleteCommand()},this)),Cb.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),r.constructorEnd(this)}function R(){p.call(this,"Right","MailMessageView");var b="",d=Cb.data(),e=this,f=function(a){return qb.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.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=qb.createCommand(this,function(){d.message(null)}),this.replyCommand=f(ob.ComposeType.Reply),this.replyAllCommand=f(ob.ComposeType.ReplyAll),this.forwardCommand=f(ob.ComposeType.Forward),this.forwardAsAttachmentCommand=f(ob.ComposeType.ForwardAsAttachment),this.messageVisibilityCommand=qb.createCommand(this,qb.emptyFunction,this.messageVisibility),this.messageEditCommand=qb.createCommand(this,function(){this.editMessage()},this.messageVisibility),this.deleteCommand=qb.createCommand(this,function(){a.console.log(arguments)},this.messageVisibility),this.spamCommand=qb.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.viewHasImages=c.observable(!1),this.viewHasVisibleAttachments=c.observable(!1),this.viewAttachments=c.observableArray([]),this.viewIsHtml=c.observable(!1),this.viewIsRtl=c.observable(!1),this.viewViewLink=c.observable(""),this.viewDownloadLink=c.observable(""),this.viewUserPic=c.observable(nb.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.viewHasImages(a.hasImages()),this.viewHasVisibleAttachments(a.hasVisibleAttachments()),this.viewAttachments(a.attachments()),this.viewIsHtml(a.isHtml()),this.viewIsRtl(a.isRtl()),this.viewViewLink(a.viewLink()),this.viewDownloadLink(a.downloadLink()),b=Cb.cache().getUserPic(a.fromAsSingleEmail()),b!==this.viewUserPic()&&(this.viewUserPicVisible(!1),this.viewUserPic(nb.DataImages.UserDotPic),""!==b&&(this.viewUserPicVisible(!0),this.viewUserPic(b))))},this),this.fullScreenMode.subscribe(function(a){a?yb.addClass("rl-message-fullscreen"):yb.removeClass("rl-message-fullscreen"),qb.windowResize()}),this.messageLoadingThrottle.subscribe(function(a){a&&qb.windowResize()}),this.messageActiveDom.subscribe(function(){this.scrollMessageToTop()},this),this.goUpCommand=qb.createCommand(this,function(){Cb.pub("mailbox.message-list.selector.go-up")}),this.goDownCommand=qb.createCommand(this,function(){Cb.pub("mailbox.message-list.selector.go-down")}),r.constructorEnd(this)}function S(a){p.call(this,"Left","SettingsMenu"),this.menu=a.menu,r.constructorEnd(this)}function T(){p.call(this,"Right","SettingsPane"),r.constructorEnd(this)}function U(){var a=Cb.data();this.mainLanguage=a.mainLanguage,this.mainMessagesPerPage=a.mainMessagesPerPage,this.mainMessagesPerPageArray=nb.Defaults.MessagesPerPageArray,this.editorDefaultType=a.editorDefaultType,this.showImages=a.showImages,this.interfaceAnimation=a.interfaceAnimation,this.useDesktopNotifications=a.useDesktopNotifications,this.threading=a.threading,this.useThreads=a.useThreads,this.replySameFolder=a.replySameFolder,this.usePreviewPane=a.usePreviewPane,this.useCheckboxesInList=a.useCheckboxesInList,this.allowLanguagesOnSettings=a.allowLanguagesOnSettings,this.isDesktopNotificationsSupported=c.computed(function(){return ob.DesktopNotifications.NotSupported!==a.desktopNotificationsPermisions()}),this.isDesktopNotificationsDenied=c.computed(function(){return ob.DesktopNotifications.NotSupported===a.desktopNotificationsPermisions()||ob.DesktopNotifications.Denied===a.desktopNotificationsPermisions()}),this.mainLanguageFullName=c.computed(function(){return qb.convertLangName(this.mainLanguage())},this),this.languageTrigger=c.observable(ob.SaveSettingsStep.Idle).extend({throttle:100}),this.mppTrigger=c.observable(ob.SaveSettingsStep.Idle),this.isAnimationSupported=tb.bAnimationSupported}function V(){var a=Cb.data();this.contactsAutosave=a.contactsAutosave,this.showPassword=c.observable(!1),this.allowContactsSync=!!Cb.settingsGet("ContactsSyncIsAllowed"),this.contactsSyncServer=Cb.settingsGet("ContactsSyncServer"),this.contactsSyncUser=Cb.settingsGet("ContactsSyncUser"),this.contactsSyncPass=Cb.settingsGet("ContactsSyncPassword"),this.contactsSyncPabUrl=Cb.settingsGet("ContactsSyncPabUrl")}function W(){var a=Cb.data();this.accounts=a.accounts,this.processText=c.computed(function(){return a.accountsLoading()?qb.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 X(){var a=Cb.data();this.displayName=a.displayName,this.signature=a.signature,this.replyTo=a.replyTo,this.displayNameTrigger=c.observable(ob.SaveSettingsStep.Idle),this.replyTrigger=c.observable(ob.SaveSettingsStep.Idle),this.signatureTrigger=c.observable(ob.SaveSettingsStep.Idle)}function Y(){var a=Cb.data();this.displayName=a.displayName,this.signature=a.signature,this.replyTo=a.replyTo,this.displayNameTrigger=c.observable(ob.SaveSettingsStep.Idle),this.replyTrigger=c.observable(ob.SaveSettingsStep.Idle),this.signatureTrigger=c.observable(ob.SaveSettingsStep.Idle),this.identities=a.identities,this.processText=c.computed(function(){return a.identitiesLoading()?qb.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 Z(){var a=Cb.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=qb.createCommand(this,function(){this.googleLoggined()||Cb.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=qb.createCommand(this,function(){Cb.googleDisconnect()}),this.connectFacebook=qb.createCommand(this,function(){this.facebookLoggined()||Cb.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=qb.createCommand(this,function(){Cb.facebookDisconnect()}),this.connectTwitter=qb.createCommand(this,function(){this.twitterLoggined()||Cb.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=qb.createCommand(this,function(){Cb.twitterDisconnect()})}function $(){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=qb.createCommand(this,function(){this.changeProcess(!0),this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),Cb.remote().changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword())},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()}),this.onChangePasswordResponse=h.bind(this.onChangePasswordResponse,this)}function _(){var a=Cb.data();this.foldersListError=a.foldersListError,this.folderList=a.folderList,this.processText=c.computed(function(){var a=Cb.data(),b=a.foldersLoading(),c=a.foldersCreating(),d=a.foldersDeleting(),e=a.foldersRenaming();return c?qb.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):d?qb.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):e?qb.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):b?qb.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=!!Cb.settingsGet("UseImapSubscribe")}function ab(){var d=this,e=Cb.data();this.mainTheme=e.mainTheme,this.customThemeType=c.observable(Cb.settingsGet("CustomThemeType")),this.customThemeImg=c.observable(Cb.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(){qb.windowResize()}),this.themeTrigger=c.observable(ob.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,Cb.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(ob.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=b.ajax({url:g,dataType:"json"}).done(function(a){a&&qb.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(ob.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(ob.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Cb.remote().saveSettings(null,{Theme:c})},this)}function bb(){qb.initDataConstructorBySettings(this)}function cb(){bb.call(this);var a=function(a){return function(){var b=Cb.cache().getFolderFromCacheList(a());b&&b.type(ob.FolderType.User)}},d=function(a){return function(b){var c=Cb.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(ob.FolderType.SentItems),this),this.draftFolder.subscribe(d(ob.FolderType.Draft),this),this.spamFolder.subscribe(d(ob.FolderType.Spam),this),this.trashFolder.subscribe(d(ob.FolderType.Trash),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||nb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.replyTo=c.observable(""),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.namespace="",this.folderList=c.observableArray([]),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.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 qb.isArray(b)&&0<b.length&&(""!==c&&nb.Values.UnuseOptionValue!==c&&a.push(c),""!==d&&nb.Values.UnuseOptionValue!==d&&a.push(d),""!==e&&nb.Values.UnuseOptionValue!==e&&a.push(e),""!==f&&nb.Values.UnuseOptionValue!==f&&a.push(f)),a},this),this.folderListSystem=c.computed(function(){return h.compact(h.map(this.folderListSystemNames(),function(a){return Cb.cache().getFolderFromCacheList(a)}))},this),this.folderMenuForMove=c.computed(function(){return Cb.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){vb.setHash(Cb.link().mailBox(this.currentFolderFullNameHash(),1,qb.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 x,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(ob.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function db(){this.oRequests={}}function eb(){db.call(this),this.oRequests={}}function fb(){this.oEmailsPicsHashes={},this.oServices={}}function gb(){fb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function hb(a){q.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function ib(){q.call(this,"login",[L])}function jb(){q.call(this,"mailbox",[N,P,Q,R]),this.oLastRoute={}}function kb(){hb.call(this,[O,S,T]),qb.initOnStartOrLangChange(function(){this.sSettingsTitle=qb.i18n("TITLES/SETTINGS")},this,function(){Cb.setTitle(this.sSettingsTitle)})}function lb(){o.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"),zb.on("error",function(a){Cb&&a&&a.originalEvent&&a.originalEvent.message&&-1===qb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Cb.remote().jsError(qb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",yb.attr("class"),qb.microtime()-tb.now)})}function mb(){lb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.quotaDebounce=h.debounce(this.quota,3e4),a.setInterval(function(){Cb.pub("interval.30s")},3e4),a.setInterval(function(){Cb.pub("interval.1m")},6e4),a.setInterval(function(){Cb.pub("interval.2m")},12e4),a.setInterval(function(){Cb.pub("interval.3m")},18e4),a.setInterval(function(){Cb.pub("interval.5m")},3e5),a.setInterval(function(){Cb.pub("interval.10m")},6e5),b.wakeUp(function(){Cb.remote().jsVersion(function(b,c){ob.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Cb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Cb.settingsGet("Version"))},{},36e5)}var nb={},ob={},pb={},qb={},rb={},sb={},tb={},ub={settings:[],"settings-removed":[],"settings-disabled":[]},vb=null,wb=a.rainloopAppData||{},xb=a.rainloopI18N||{},yb=b("html"),zb=b(a),Ab=b(a.document),Bb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Cb=null;tb.now=(new Date).getTime(),tb.momentTrigger=c.observable(!0),tb.langChangeTrigger=c.observable(!0),tb.iAjaxErrorCount=0,tb.iTokenErrorCount=0,tb.iMessageBodyCacheCount=0,tb.bUnload=!1,tb.sUserAgent=(navigator.userAgent||"").toLowerCase(),tb.bIsiOSDevice=-1<tb.sUserAgent.indexOf("iphone")||-1<tb.sUserAgent.indexOf("ipod")||-1<tb.sUserAgent.indexOf("ipad"),tb.bIsAndroidDevice=-1<tb.sUserAgent.indexOf("android"),tb.bMobileDevice=tb.bIsiOSDevice||tb.bIsAndroidDevice,tb.bDisableNanoScroll=tb.bMobileDevice,tb.bAnimationSupported=!tb.bMobileDevice&&yb.hasClass("csstransitions"),tb.sAnimationType="",nb.Defaults={},nb.Values={},nb.DataImages={},nb.Defaults.MessagesPerPage=20,nb.Defaults.ContactsPerPage=20,nb.Defaults.MessagesPerPageArray=[10,20,30,50,100],nb.Defaults.DefaultAjaxTimeout=2e4,nb.Defaults.SearchAjaxTimeout=12e4,nb.Defaults.SendMessageAjaxTimeout=2e5,nb.Defaults.SaveMessageAjaxTimeout=2e5,nb.Values.UnuseOptionValue="__UNUSE__",nb.Values.GmailFolderName="[Gmail]",nb.Values.ClientSideCookieIndexName="rlcsc",nb.Values.ImapDefaulPort=143,nb.Values.ImapDefaulSecurePort=993,nb.Values.SmtpDefaulPort=25,nb.Values.SmtpDefaulSecurePort=465,nb.Values.MessageBodyCacheLimit=15,nb.Values.AjaxErrorLimit=7,nb.Values.TokenErrorLimit=10,nb.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",nb.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",ob.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},ob.State={Empty:10,Login:20,Auth:30},ob.StateType={Webmail:0,Admin:1},ob.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,User:99},ob.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},ob.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},ob.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft"},ob.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},ob.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4},ob.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},ob.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},ob.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},ob.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},ob.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},ob.MessagePriority={Low:5,Normal:3,High:1},ob.EditorDefaultType={Html:"Html",Plain:"Plain"},ob.CustomThemeType={Light:"Light",Dark:"Dark"},ob.ServerSecure={None:0,SSL:1,TLS:2},ob.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},ob.EmailType={Defailt:0,Facebook:1,Google:2},ob.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},ob.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},ob.ContactScopeType={Default:0,ShareAll:2},ob.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},ob.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,UnknownNotification:999,UnknownError:999},qb.trim=b.trim,qb.inArray=b.inArray,qb.isArray=h.isArray,qb.isFunc=h.isFunction,qb.isUnd=h.isUndefined,qb.isNull=h.isNull,qb.emptyFunction=function(){},qb.isNormal=function(a){return!qb.isUnd(a)&&!qb.isNull(a)},qb.windowResize=h.debounce(function(b){qb.isUnd(b)?zb.resize():a.setTimeout(function(){zb.resize()},b)},50),qb.isPosNumeric=function(a,b){return qb.isNormal(a)?(qb.isUnd(b)?0:!b)?/^[1-9]+[0-9]*$/.test(a.toString()):/^[0-9]*$/.test(a.toString()):!1},qb.pInt=function(b){return qb.isNormal(b)&&""!==b?a.parseInt(b,10):0},qb.pString=function(a){return qb.isNormal(a)?""+a:""},qb.isNonEmptyArray=function(a){return qb.isArray(a)&&0<a.length},qb.exportPath=function(b,c,d){for(var e=null,f=b.split("."),g=d||a;f.length&&(e=f.shift());)f.length||qb.isUnd(c)?g=g[e]?g[e]:g[e]={}:g[e]=c},qb.pImport=function(a,b,c){a[b]=c},qb.pExport=function(a,b,c){return qb.isUnd(a[b])?c:a[b]},qb.encodeHtml=function(a){return qb.isNormal(a)?a.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""},qb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=qb.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},qb.timeOutAction=function(){var b={};return function(c,d,e){qb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),qb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),qb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(tb.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}}(),qb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1
},qb.i18n=function(a,b,c){var d="",e=qb.isUnd(xb[a])?qb.isUnd(c)?a:c:xb[a];if(!qb.isUnd(b)&&!qb.isNull(b))for(d in b)qb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},qb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(qb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(qb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",qb.i18n(c)))})})},qb.i18nToDoc=function(){a.rainloopI18N&&(xb=a.rainloopI18N||{},qb.i18nToNode(Ab),tb.langChangeTrigger(!tb.langChangeTrigger())),a.rainloopI18N={}},qb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?tb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&tb.langChangeTrigger.subscribe(a,b)},qb.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)},qb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},qb.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()},qb.replySubjectAdd=function(b,c,d){var e=null,f=qb.trim(c);return null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||qb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||qb.isUnd(e[1])||qb.isUnd(e[2])||qb.isUnd(e[3])?f=b+": "+c:(f=e[1]+(qb.pInt(e[2])+1)+e[3],f=e[1]+(qb.pInt(e[2])+1)+e[3]):f=b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),(qb.isUnd(d)?!0:d)?qb.fixLongSubject(f):f},qb.fixLongSubject=function(a){var b=0,c=null;a=qb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||qb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=qb.isUnd(c[2])?1:0+qb.pInt(c[2]),b+=qb.isUnd(c[4])?1:0+qb.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]+/," ")},qb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},qb.friendlySize=function(a){return a=qb.pInt(a),a>=1073741824?qb.roundNumber(a/1073741824,1)+"GB":a>=1048576?qb.roundNumber(a/1048576,1)+"MB":a>=1024?qb.roundNumber(a/1024,0)+"KB":a+"B"},qb.log=function(b){a.console&&a.console.log&&a.console.log(b)},qb.getNotification=function(a){return a=qb.pInt(a),qb.isUnd(pb[a])?"":pb[a]},qb.initNotificationLanguage=function(){pb[ob.Notification.InvalidToken]=qb.i18n("NOTIFICATIONS/INVALID_TOKEN"),pb[ob.Notification.AuthError]=qb.i18n("NOTIFICATIONS/AUTH_ERROR"),pb[ob.Notification.AccessError]=qb.i18n("NOTIFICATIONS/ACCESS_ERROR"),pb[ob.Notification.ConnectionError]=qb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),pb[ob.Notification.CaptchaError]=qb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),pb[ob.Notification.SocialFacebookLoginAccessDisable]=qb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),pb[ob.Notification.SocialTwitterLoginAccessDisable]=qb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),pb[ob.Notification.SocialGoogleLoginAccessDisable]=qb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),pb[ob.Notification.DomainNotAllowed]=qb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),pb[ob.Notification.AccountNotAllowed]=qb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),pb[ob.Notification.CantGetMessageList]=qb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),pb[ob.Notification.CantGetMessage]=qb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),pb[ob.Notification.CantDeleteMessage]=qb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),pb[ob.Notification.CantMoveMessage]=qb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),pb[ob.Notification.CantCopyMessage]=qb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),pb[ob.Notification.CantSaveMessage]=qb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),pb[ob.Notification.CantSendMessage]=qb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),pb[ob.Notification.InvalidRecipients]=qb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),pb[ob.Notification.CantCreateFolder]=qb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),pb[ob.Notification.CantRenameFolder]=qb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),pb[ob.Notification.CantDeleteFolder]=qb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),pb[ob.Notification.CantDeleteNonEmptyFolder]=qb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),pb[ob.Notification.CantSubscribeFolder]=qb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),pb[ob.Notification.CantUnsubscribeFolder]=qb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),pb[ob.Notification.CantSaveSettings]=qb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),pb[ob.Notification.CantSavePluginSettings]=qb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),pb[ob.Notification.DomainAlreadyExists]=qb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),pb[ob.Notification.CantInstallPackage]=qb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),pb[ob.Notification.CantDeletePackage]=qb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),pb[ob.Notification.InvalidPluginPackage]=qb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),pb[ob.Notification.UnsupportedPluginPackage]=qb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),pb[ob.Notification.LicensingServerIsUnavailable]=qb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),pb[ob.Notification.LicensingExpired]=qb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),pb[ob.Notification.LicensingBanned]=qb.i18n("NOTIFICATIONS/LICENSING_BANNED"),pb[ob.Notification.DemoSendMessageError]=qb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),pb[ob.Notification.AccountAlreadyExists]=qb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),pb[ob.Notification.MailServerError]=qb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),pb[ob.Notification.UnknownNotification]=qb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),pb[ob.Notification.UnknownError]=qb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},qb.getUploadErrorDescByCode=function(a){var b="";switch(qb.pInt(a)){case ob.UploadErrorCode.FileIsTooBig:b=qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case ob.UploadErrorCode.FilePartiallyUploaded:b=qb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case ob.UploadErrorCode.FileNoUploaded:b=qb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case ob.UploadErrorCode.MissingTempFolder:b=qb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case ob.UploadErrorCode.FileOnSaveingError:b=qb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case ob.UploadErrorCode.FileType:b=qb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=qb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},qb.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===ob.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===ob.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},qb.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=qb.isUnd(d)?!0:d,e.canExecute=qb.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},qb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(ob.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(ob.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),tb.sAnimationType=ob.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.usePreviewPane=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.interfaceAnimation.subscribe(function(a){if(tb.bMobileDevice||a===ob.InterfaceAnimation.None)yb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),tb.sAnimationType=ob.InterfaceAnimation.None;else switch(a){case ob.InterfaceAnimation.Full:yb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),tb.sAnimationType=a;break;case ob.InterfaceAnimation.Normal:yb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),tb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=ob.DesktopNotifications.NotSupported;if(Bb&&Bb.permission)switch(Bb.permission.toLowerCase()){case"granted":c=ob.DesktopNotifications.Allowed;break;case"denied":c=ob.DesktopNotifications.Denied;break;case"default":c=ob.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&ob.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();ob.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):ob.DesktopNotifications.NotAllowed===c?Bb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),ob.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<qb.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<qb.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(nb.Defaults.MessagesPerPage),b.mainMessagesPerPage=b.messagesPerPage,b.mainMessagesPerPage=c.computed({read:b.messagesPerPage,write:function(a){-1<qb.inArray(qb.pInt(a),nb.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)},qb.createMomentDate=function(a){return qb.isUnd(a.moment)&&(a.moment=c.observable(f())),c.computed(function(){return tb.momentTrigger(),this.moment().fromNow()},a)},qb.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")?qb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?qb.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},qb.isFolderExpanded=function(a){var b=Cb.local().get(ob.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},qb.setExpandedFolder=function(a,b){var c=Cb.local().get(ob.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Cb.local().set(ob.ClientSideKeyName.ExpandedFolders,c)},qb.initLayoutResizer=function(a,c,d,e,f,g,i,j){e=e||300,f=f||500,g=g||f-e/2,i=i||300;var k=0,l=b(a),m=b(c),n=b(d),o=Cb.local().get(j)||g,p=function(a,b,c){if(b||c){var d=n.width(),e=b?b.size.width/d*100:null;null===e&&c&&(e=l.width()/d*100),null!==e&&(l.css({width:"",height:"",right:""+(100-e)+"%"}),m.css({width:"",height:"",left:""+e+"%"}))}},q=function(b,c){if(c&&c.element&&c.element[0].id&&"#"+c.element[0].id==""+a){var d=n.width();k=d-i,k=f>k?k:f,l.resizable("option","maxWidth",k),c.size&&c.size.width&&Cb.local().set(j,c.size.width),p(null,null,!0)}};o&&l.width(o),k=n.width()-i,k=f>k?k:f,l.resizable({minWidth:e,maxWidth:k,handles:"e",resize:p,stop:p}),p(null,null,!0),zb.resize(h.throttle(q,400))},qb.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"),qb.windowResize()}).after("<br />").before("<br />"))})}},qb.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()}))},qb.extendAsViewModel=function(a,b,c){b&&(c||(c=p),b.__name=a,rb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},qb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},ub.settings.push(a)},qb.removeSettingsViewModel=function(a){ub["settings-removed"].push(a)},qb.disableSettingsViewModel=function(a){ub["settings-disabled"].push(a)},qb.convertThemeName=function(a){return qb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},qb.quoteName=function(a){return a.replace(/["]/g,'\\"')},qb.microtime=function(){return(new Date).getTime()},qb.convertLangName=function(a,b){return qb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},qb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=qb.isUnd(a)?32:qb.pInt(a);b.length<a;)b+=c.substr(Math.round(Math.random()*c.length),1);return b},qb.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")},qb.draggeblePlace=function(){return b('<div class="draggablePlace"><span class="text"></span>&nbsp;<i class="icon-mail icon-white"></i></div>').appendTo("#rl-hidden")},qb.defautOptionsAfterRender=function(a,b){b&&!qb.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},qb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+qb.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")),qb.i18nToNode(d),r.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write('<html><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="robots" content="noindex, nofollow, noodp" /><title>'+qb.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)},qb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=qb.isUnd(d)?1e3:qb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?ob.SaveSettingsStep.TrueResult:ob.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,ob.SaveSettingsStep.Idle)},d)}},qb.settingsSaveHelperSimpleFunction=function(a,b){return qb.settingsSaveHelperFunction(null,a,b,1e3)},qb.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},qb.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:qb.isUnd(c)?a.toString():c.toString(),custom:qb.isUnd(c)?!1:!0,title:qb.isUnd(c)?"":a.toString(),value:a.toString()};(qb.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}},sb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return sb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=sb._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 sb._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(!tb.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+'">'+qb.i18n(c.utils.unwrapObservable(d()))+"</span>"}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return'<span class="tooltip-class '+d+'">'+c()()+"</span>"}})}},c.bindingHandlers.dropdown={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.modal={init:function(a,d){b(a).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){qb.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){qb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),qb.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=qb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=qb.pInt(e[2]),g=zb.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(!tb.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),qb.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),qb.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(){qb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!tb.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){tb.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){Cb.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=qb.trim(a),c=null;return""!==b?(c=new s,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(qb.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},qb.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=qb.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=qb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),qb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},i.prototype.root=function(){return this.sBase},i.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},i.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},i.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},i.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},i.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},i.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},i.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},i.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},i.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},i.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},i.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},i.prototype.settings=function(a){var b=this.sBase+"settings";return qb.isUnd(a)||""===a||(b+="/"+a),b},i.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},i.prototype.mailBox=function(a,b,c){b=qb.isNormal(b)?qb.pInt(b):1,c=qb.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},i.prototype.phpInfo=function(){return this.sServer+"Info"},i.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},i.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},i.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},i.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},i.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},i.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},i.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},rb.oViewModelsHooks={},rb.oSimpleHooks={},rb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},rb.addHook=function(a,b){qb.isFunc(b)&&(qb.isArray(rb.oSimpleHooks[a])||(rb.oSimpleHooks[a]=[]),rb.oSimpleHooks[a].push(b))},rb.runHook=function(a,b){qb.isArray(rb.oSimpleHooks[a])&&(b=b||[],h.each(rb.oSimpleHooks[a],function(a){a.apply(null,b)}))},rb.mainSettingsGet=function(a){return Cb?Cb.settingsGet(a):null},rb.remoteRequest=function(a,b,c,d,e,f){Cb&&Cb.remote().defaultRequest(a,b,c,d,e,f)},rb.settingsGet=function(a,b){var c=rb.mainSettingsGet("Plugins");return c=c&&qb.isUnd(c[a])?null:c[a],c?qb.isUnd(c[b])?null:c[b]:null},j.prototype.initLanguage=function(a,b,c){this.oOptions.LangSwitcherConferm=a,this.oOptions.LangSwitcherTextLabel=b,this.oOptions.LangSwitcherHtmlLabel=c},j.prototype.execCom=function(b,c,d){a.document&&(a.document.execCommand(b,c||!1,d||null),this.updateTextArea())},j.prototype.getEditorSelection=function(){var b=null;return a.getSelection?b=a.getSelection():a.document.getSelection?b=a.document.getSelection():a.document.selection&&(b=a.document.selection),b},j.prototype.getEditorRange=function(){var a=this.getEditorSelection();return a&&0!==a.rangeCount?a.getRangeAt?a.getRangeAt(0):a.createRange():null},j.prototype.ec=function(a,b,c){this.execCom(a,b,c)},j.prototype.heading=function(a){this.ec("formatblock",!1,this.bIe?"Heading "+a:"h"+a)},j.prototype.insertImage=function(a){this.isHtml()&&!this.bOnlyPlain&&(this.htmlarea.focus(),this.ec("insertImage",!1,a))},j.prototype.focus=function(){this.isHtml()&&!this.bOnlyPlain?this.htmlarea.focus():this.textarea.focus()},j.prototype.setcolor=function(a,b){var c=null,d="";this.bIe&&!document.addEventListener?(c=this.getEditorRange(),c&&c.execCommand("forecolor"===a?"ForeColor":"BackColor",!1,b)):(d=this.bIe?"forecolor"===a?"ForeColor":"BackColor":"forecolor"===a?"foreColor":"backColor",this.ec(d,!1,b))},j.prototype.isHtml=function(){return!0===this.bOnlyPlain?!1:this.textarea.is(":hidden")},j.prototype.toHtmlString=function(){return this.editor.innerHTML},j.prototype.toString=function(){return this.editor.innerText},j.prototype.updateTextArea=function(){this.textarea.val(this.toHtmlString())},j.prototype.updateHtmlArea=function(){this.editor.innerHTML=this.textarea.val()},j.prototype.setRawText=function(a,b){b&&!this.bOnlyPlain?(this.isHtml()||(this.textarea.val(""),this.switchToHtml()),this.textarea.val(a.toString()),this.updateHtmlArea()):(this.textarea.val(a.toString()),this.updateHtmlArea(),this.switchToPlain(!1))},j.prototype.clear=function(){this.textarea.val(""),this.editor.innerHTML="",this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()
},j.prototype.getTextForRequest=function(){return this.isHtml()?(this.updateTextArea(),this.textarea.val()):this.textarea.val()},j.prototype.getTextFromHtml=function(a){var b="",c="> ",d=function(){if(arguments&&1<arguments.length){var a=qb.trim(arguments[1]).replace(/__bq__start__([\s\S\n\r]*)__bq__end__/gm,d);return a="\n"+c+qb.trim(a).replace(/\n/gm,"\n"+c)+"\n>\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1<arguments.length?"\n"+qb.trim(arguments[1].replace(/[\s]/,""))+" ":""})}return""},e=function(){if(arguments&&1<arguments.length){var a=qb.trim(arguments[1]);return 0<a.length&&(a=a.replace(/<div[^>]*>([\s\S]*)<\/div>/gim,e),a="\n"+qb.trim(a)+"\n"),a}return""},f=function(){if(arguments&&1<arguments.length){var a=qb.trim(arguments[1]);return a}return""};return a=qb.isUnd(a)?!0:!!a,b=this.toHtmlString().replace(/[\s]+/gm," ").replace(/<br\s?\/?>/gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<hr[^>]*>/gim,"\n_______________________________\n\n").replace(/<img [^>]*>/gim,"").replace(/<div[^>]*>([\s\S]*)<\/div>/gim,e).replace(/<blockquote[^>]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/<a [^>]*>([\s\S]*?)<\/a>/gim,f).replace(/&nbsp;/gi," ").replace(/<[^>]*>/gm,"").replace(/&gt;/gi,">").replace(/&lt;/gi,"<").replace(/&amp;/gi,"&").replace(/&\w{2,6};/gi,""),(a?qb.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,d).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},j.prototype.getHtmlFromText=function(){return qb.convertPlainTextToHtml(this.textarea.val())},j.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()},j.prototype.switchToPlain=function(c){c=qb.isUnd(c)?!0:c;var d=this.getTextFromHtml(),e=h.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),b(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(d),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);c&&0!==qb.trim(d).length?e(a.confirm(this.oOptions.LangSwitcherConferm)):e(!0)},j.prototype.switcherLinkText=function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel},j.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar"),b(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!0)),this.textarea.val(this.getHtmlFromText()),this.updateHtmlArea(),this.textarea.hide(),this.htmlarea.show(),this.fOnSwitch&&this.fOnSwitch(!0)},j.prototype.addButton=function(c,d){var e=this;b("<div />").addClass("editorToolbarButtom").append(b('<a tabindex="-1" href="javascript:void(0);"></a>').addClass(c)).attr("title",d).click(function(d){qb.isUnd(j.htmlFunctions[c])?a.alert(c):j.htmlFunctions[c].apply(e,[b(this),d])}).appendTo(this.toolbar)},j.htmlInitToolbar=function(){this.bOnlyPlain||(this.addButton("bold","Bold"),this.addButton("italic","Italic"),this.addButton("underline","Underline"),this.addButton("strikethrough","Strikethrough"),this.addButton("removeformat","removeformat"),this.addButton("justifyleft","justifyleft"),this.addButton("justifycenter","justifycenter"),this.addButton("justifyright","justifyright"),this.addButton("horizontalrule","horizontalrule"),this.addButton("orderedlist","orderedlist"),this.addButton("unorderedlist","unorderedlist"),this.addButton("indent","indent"),this.addButton("outdent","outdent"),this.addButton("forecolor","forecolor"),function(a,b){a("<span />").addClass("editorSwitcher").text(b.switcherLinkText(!0)).click(function(){b.switchToggle()}).appendTo(b.toolbar)}(b,this))},j.htmlInitEditor=function(){this.editor=this.htmlarea[0],this.editor.innerHTML=this.textarea.val()},j.htmlAttachEditorEvents=function(){var b=this,c=function(a){return a&&a.type&&0===a.type.indexOf("image/")},d=function(d){if(d=(d&&d.originalEvent?d.originalEvent:d)||a.event){d.stopPropagation(),d.preventDefault();var e=null,f=null,g=d.files||(d.dataTransfer?d.dataTransfer.files:null);g&&1===g.length&&c(g[0])&&(f=g[0],e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}b.htmlarea.removeClass("editorDragOver")},e=function(){b.htmlarea.removeClass("editorDragOver")},f=function(a){a.stopPropagation(),a.preventDefault(),b.htmlarea.addClass("editorDragOver")},g=function(d){var e=d&&d.clipboardData?d.clipboardData:d&&d.originalEvent&&d.originalEvent.clipboardData?d.originalEvent.clipboardData:null;e&&e.items&&h.each(e.items,function(d){if(c(d)&&d.getAsFile){var e=null,f=d.getAsFile();f&&(e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}})};this.bOnlyPlain||a.File&&a.FileReader&&a.FileList&&(this.htmlarea.bind("dragover",f),this.htmlarea.bind("dragleave",e),this.htmlarea.bind("drop",d),this.htmlarea.bind("paste",g))},j.htmlColorPickerColors=function(){var a=[],b=[],c=0,d=0,e=0,f=0,g="";for(c=0;256>c;c+=85)g=c.toString(16),a.push(1===g.length?"0"+g:g);for(f=a.length,c=0;f>c;c++)for(d=0;f>d;d++)for(e=0;f>e;e++)b.push("#"+a[c]+a[d]+a[e]);return b}(),j.htmlFontPicker=function(){var c=b(a.document),d=!1,e=b('<div style="position: absolute;" class="editorFontStylePicker"><div class="editorFpFonts"></div></div>'),f=e.find(".editorFpFonts"),g=function(){};return b.each(["Arial","Arial Black","Courier New","Tahoma","Times New Roman","Verdana"],function(a,c){f.append(b('<a href="javascript:void(0);" tabindex="-1" class="editorFpFont" style="font-family: '+c+';">'+c+"</a>").click(function(){g(c)})),f.append("<br />")}),e.hide(),function(f,h,i){d||(e.appendTo(i),d=!0),g=h,c.unbind("click.fpNamespace"),a.setTimeout(function(){c.one("click.fpNamespace",function(){e.hide()})},500);var j=b(f).position();e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.htmlColorPicker=function(){var c=b(a.document),d=!1,e=b('<div style="position: absolute;" class="editorColorPicker"><div class="editorCpColors"></div></div>'),f=e.find(".editorCpColors"),g=function(){};return b.each(j.htmlColorPickerColors,function(a,b){f.append('<a href="javascript:void(0);" tabindex="-1" class="editorCpColor" style="background-color: '+b+';"></a>')}),e.hide(),b(".editorCpColor",f).click(function(a){var c=1,d="#000000",e=b(a.target).css("background-color"),f=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==f){for(delete f[0];3>=c;++c)f[c]=qb.pInt(f[c]).toString(16),1===f[c].length&&(f[c]="0"+f[c]);d="#"+f.join("")}else d=e;g(d)}),function(f,h,i){d||(e.appendTo(i),d=!0);var j=b(f).position();g=h,c.unbind("click.cpNamespace"),a.setTimeout(function(){c.one("click.cpNamespace",function(){e.hide()})},100),e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.htmlFunctions={bold:function(){this.ec("bold")},italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikethrough:function(){this.ec("strikethrough")},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")},justifyleft:function(){this.ec("justifyLeft")},justifycenter:function(){this.ec("justifyCenter")},justifyright:function(){this.ec("justifyRight")},horizontalrule:function(){this.ec("insertHorizontalRule",!1,"ht")},removeformat:function(){this.ec("removeFormat")},orderedlist:function(){this.ec("insertorderedlist")},unorderedlist:function(){this.ec("insertunorderedlist")},forecolor:function(a){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){j.htmlFontPicker(a,h.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}},k.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},k.prototype.goDown=function(){this.newSelectPosition(ob.EventKeyCode.Down,!1)},k.prototype.goUp=function(){this.newSelectPosition(ob.EventKeyCode.Up,!1)},k.prototype.init=function(d,e){if(this.oContentVisible=d,this.oContentScrollable=e,this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.sLastUid=f.getItemUid(b),b.selected()?(b.checked(!1),f.selectedItem(null)):b.checked(!b.checked())))}),b(a.document).on("keydown",function(a){var b=!0;return a&&f.bUseKeyboard&&!qb.inFocus()&&(-1<qb.inArray(a.keyCode,[ob.EventKeyCode.Up,ob.EventKeyCode.Down,ob.EventKeyCode.Insert,ob.EventKeyCode.Home,ob.EventKeyCode.End,ob.EventKeyCode.PageUp,ob.EventKeyCode.PageDown])?(f.newSelectPosition(a.keyCode,a.shiftKey),b=!1):ob.EventKeyCode.Delete!==a.keyCode||a.ctrlKey||a.shiftKey||(f.oCallbacks.onDelete&&f.oCallbacks.onDelete(),b=!1)),b})}},k.prototype.selectByUid=function(a,b){b=qb.isUnd(b)?!0:!!b,this.useItemSelectCallback=b;var c=h.find(this.list(),function(b){return a===this.getItemUid(b)},this);c&&this.selectedItem(c),this.useItemSelectCallback=!0},k.prototype.useKeyboard=function(a){this.bUseKeyboard=!!a},k.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},k.prototype.newSelectPosition=function(b,c){var d=this,e=0,f=10,g=!1,i=!1,j=null,k=this.list(),l=k?k.length:0,m=this.selectedItem();if(l>0)if(m){if(m)if(ob.EventKeyCode.Down===b||ob.EventKeyCode.Up===b||ob.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case ob.EventKeyCode.Up:m===a?i=!0:j=a;break;case ob.EventKeyCode.Down:case ob.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(ob.EventKeyCode.Home===b||ob.EventKeyCode.End===b)ob.EventKeyCode.Home===b?j=k[0]:ob.EventKeyCode.End===b&&(j=k[k.length-1]);else if(ob.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(ob.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 ob.EventKeyCode.Down===b||ob.EventKeyCode.Insert===b||ob.EventKeyCode.Home===b||ob.EventKeyCode.PageUp===b?j=k[0]:(ob.EventKeyCode.Up===b||ob.EventKeyCode.End===b||ob.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(ob.EventKeyCode.Up===b||ob.EventKeyCode.Down===b)&&m.checked(!m.checked()):ob.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||ob.EventKeyCode.Up!==b&&ob.EventKeyCode.Down!==b?ob.EventKeyCode.Insert===b&&m.checked(!m.checked()):m.checked(!m.checked()))},k.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemSelectedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(d.top<0?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-a):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},k.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},k.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked()))),c&&(this.selectedItem(a),this.sLastUid=d)}},k.prototype.on=function(a,b){this.oCallbacks[a]=b},l.supported=function(){return!0},l.prototype.set=function(a,c){var d=b.cookie(nb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(nb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},l.prototype.get=function(a){var c=b.cookie(nb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!qb.isUnd(d[a])?d[a]:null}catch(e){}return d},m.supported=function(){return!!a.localStorage},m.prototype.set=function(b,c){var d=a.localStorage[nb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[nb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},m.prototype.get=function(b){var c=a.localStorage[nb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!qb.isUnd(d[b])?d[b]:null}catch(e){}return d},n.prototype.oDriver=null,n.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},n.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},o.prototype.bootstart=function(){},p.prototype.sPosition="",p.prototype.sTemplate="",p.prototype.viewModelName="",p.prototype.viewModelDom=null,p.prototype.viewModelTemplate=function(){return this.sTemplate},p.prototype.viewModelPosition=function(){return this.sPosition},p.prototype.cancelCommand=p.prototype.closeCommand=function(){},q.prototype.oCross=null,q.prototype.sScreenName="",q.prototype.aViewModels=[],q.prototype.viewModels=function(){return this.aViewModels},q.prototype.screenName=function(){return this.sScreenName},q.prototype.routes=function(){return null},q.prototype.__cross=function(){return this.oCross},q.prototype.__start=function(){var a=this.routes(),b=null,c=null;qb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||qb.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},r.constructorEnd=function(a){qb.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},r.prototype.sDefaultScreenName="",r.prototype.oScreens={},r.prototype.oBoot=null,r.prototype.oCurrentScreen=null,r.prototype.hideLoading=function(){b("#rl-loading").hide()},r.prototype.routeOff=function(){e.changed.active=!1},r.prototype.routeOn=function(){e.changed.active=!0},r.prototype.setBoot=function(a){return qb.isNormal(a)&&(this.oBoot=a),this},r.prototype.screen=function(a){return""===a||qb.isUnd(this.oScreens[a])?null:this.oScreens[a]},r.prototype.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,qb.isArray(c)?c:[])},r.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=Cb.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=qb.createCommand(e,function(){vb.hideScreenPopup(a)})),rb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),this.delegateRun(e,"onBuild",[h]),rb.runHook("view-model-post-build",[a.__name,e,h])):qb.log("Cannot find view model position: "+f)}return a?a.__vm:null},r.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},r.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),rb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},r.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),rb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},r.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===qb.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,qb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),this.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onHide"),qb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),c.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onShow"),rb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),qb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),c.delegateRun(a.__vm,"onShow"),rb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},r.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(),rb.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),rb.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(){yb.removeClass("rl-started-trigger").addClass("rl-started")},50)},r.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=qb.isUnd(c)?!1:!!c,(qb.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},r.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},vb=new r,s.newInstanceFromJson=function(a){var b=new s;return b.initByJson(a)?b:null},s.prototype.name="",s.prototype.email="",s.prototype.privateType=null,s.prototype.clear=function(){this.email="",this.name="",this.privateType=null},s.prototype.validate=function(){return""!==this.name||""!==this.email},s.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},s.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},s.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=ob.EmailType.Facebook),null===this.privateType&&(this.privateType=ob.EmailType.Default)),this.privateType},s.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},s.prototype.parse=function(a){this.clear(),a=qb.trim(a);var b=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},s.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=qb.trim(a.Name),this.email=qb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},s.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=qb.isUnd(b)?!1:!!b,c=qb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'<a href="mailto:'+qb.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+qb.encodeHtml(this.name)+"</a>":c?qb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=qb.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+qb.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+qb.encodeHtml(d)+"</a>"+qb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=qb.encodeHtml(d))):b&&(d='<a href="mailto:'+qb.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+qb.encodeHtml(this.email)+"</a>"))),d},s.prototype.mailsoParse=function(a){if(a=qb.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=qb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=qb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=qb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},s.prototype.inputoTagLine=function(){return 0<this.name.length?this.name+" ("+this.email+")":this.email},t.prototype.getNameAndEmailHelper=function(){var a="",b="";return qb.isNonEmptyArray(this.properties)&&h.each(this.properties,function(c){c&&(""===a&&ob.ContactPropertyType.FullName===c[0]?a=c[1]:""===b&&-1<qb.inArray(c[0],[ob.ContactPropertyType.EmailPersonal,ob.ContactPropertyType.EmailBussines,ob.ContactPropertyType.EmailOther])&&(b=c[1]))},this),""===b?null:[b,a]},t.prototype.parse=function(a){var b=!1;return a&&"Object/Contact"===a["@Object"]&&(this.idContact=qb.pInt(a.IdContact),this.idContactStr=qb.pString(a.IdContactStr),this.display=qb.pString(a.Display),this.readOnly=!!a.ReadOnly,this.scopeType=qb.pInt(a.ScopeType),qb.isNonEmptyArray(a.Properties)&&h.each(a.Properties,function(a){a&&a.Type&&qb.isNormal(a.Value)&&this.properties.push([qb.pInt(a.Type),qb.pString(a.Value)])},this),this.shared(ob.ContactScopeType.ShareAll===this.scopeType),b=!0),b},t.prototype.srcAttr=function(){return Cb.link().emptyContactPic()},t.prototype.generateUid=function(){return""+this.idContact},t.prototype.lineAsCcc=function(){var a=[];return this.deleted()&&a.push("deleted"),this.selected()&&a.push("selected"),this.checked()&&a.push("checked"),this.shared()&&a.push("shared"),a.join(" ")},v.newInstanceFromJson=function(a){var b=new v;return b.initByJson(a)?b:null},v.prototype.mimeType="",v.prototype.fileName="",v.prototype.estimatedSize=0,v.prototype.friendlySize="",v.prototype.isInline=!1,v.prototype.isLinked=!1,v.prototype.cid="",v.prototype.cidWithOutTags="",v.prototype.contentLocation="",v.prototype.download="",v.prototype.folder="",v.prototype.uid="",v.prototype.mimeIndex="",v.prototype.initByJson=function(a){var b=!1;return a&&"Object/Attachment"===a["@Object"]&&(this.mimeType=a.MimeType,this.fileName=a.FileName,this.estimatedSize=qb.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=qb.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),b=!0),b},v.prototype.isImage=function(){return-1<qb.inArray(this.mimeType.toLowerCase(),["image/png","image/jpg","image/jpeg","image/gif"])},v.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)},v.prototype.linkDownload=function(){return Cb.link().attachmentDownload(this.download)},v.prototype.linkPreview=function(){return Cb.link().attachmentPreview(this.download)},v.prototype.linkPreviewAsPlain=function(){return Cb.link().attachmentPreviewAsPlain(this.download)},v.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},v.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},v.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<qb.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<qb.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<qb.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<qb.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},w.prototype.id="",w.prototype.isInline=!1,w.prototype.isLinked=!1,w.prototype.CID="",w.prototype.contentLocation="",w.prototype.fromMessage=!1,w.prototype.cancel=qb.emptyFunction,w.prototype.initByUploadJson=function(a){var b=!1;return a&&(this.fileName(a.Name),this.size(qb.isUnd(a.Size)?0:qb.pInt(a.Size)),this.tempName(qb.isUnd(a.TempName)?"":a.TempName),this.isInline=!1,b=!0),b},x.newInstanceFromJson=function(a){var b=new x;return b.initByJson(a)?b:null},x.calculateFullFromatDateValue=function(a){return f.unix(a).format("LLL")},x.emailsToLine=function(a,b,c){var d=[],e=0,f=0;if(qb.isNonEmptyArray(a))for(e=0,f=a.length;f>e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},x.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(qb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=s.newInstanceFromJson(a[b]),d&&e.push(d);return e},x.replyHelper=function(a,b,c){if(a&&0<a.length)for(var d=0,e=a.length;e>d;d++)qb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},x.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(ob.MessagePriority.Normal),this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.prefetched=!1,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.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.priority(ob.MessagePriority.Normal),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)},x.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(qb.pInt(a.Size)),this.from=x.initEmailsFromJson(a.From),this.to=x.initEmailsFromJson(a.To),this.cc=x.initEmailsFromJson(a.Cc),this.bcc=x.initEmailsFromJson(a.Bcc),this.replyTo=x.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(qb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(x.emailsToLine(this.from,!0)),this.toEmailsString(x.emailsToLine(this.to,!0)),this.parentUid(qb.pInt(a.ParentThread)),this.threads(qb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(qb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},x.prototype.computeSenderEmail=function(){var a=Cb.data().sentFolder(),b=Cb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},x.prototype.initUpdateByMessageJson=function(a){var b=!1,c=ob.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=qb.pInt(a.Priority),this.priority(-1<qb.inArray(c,[ob.MessagePriority.High,ob.MessagePriority.Low])?c:ob.MessagePriority.Normal),this.aDraftInfo=a.DraftInfo,this.sMessageId=a.MessageId,this.sInReplyTo=a.InReplyTo,this.sReferences=a.References,this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.foundedCIDs=qb.isArray(a.FoundedCIDs)?a.FoundedCIDs:[],this.attachments(this.initAttachmentsFromJson(a.Attachments)),this.computeSenderEmail(),b=!0),b},x.prototype.initAttachmentsFromJson=function(a){var b=0,c=0,d=null,e=[];if(a&&"Collection/AttachmentCollection"===a["@Object"]&&qb.isNonEmptyArray(a["@Collection"]))for(b=0,c=a["@Collection"].length;c>b;b++)d=v.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0<this.foundedCIDs.length&&0<=qb.inArray(d.cidWithOutTags,this.foundedCIDs)&&(d.isLinked=!0),e.push(d));return e},x.prototype.initFlagsByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.unseen(!a.IsSeen),this.flagged(!!a.IsFlagged),this.answered(!!a.IsAnswered),this.forwarded(!!a.IsForwarded),b=!0),b},x.prototype.fromToLine=function(a,b){return x.emailsToLine(this.from,a,b)},x.prototype.toToLine=function(a,b){return x.emailsToLine(this.to,a,b)},x.prototype.ccToLine=function(a,b){return x.emailsToLine(this.cc,a,b)},x.prototype.bccToLine=function(a,b){return x.emailsToLine(this.bcc,a,b)},x.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(" ")},x.prototype.hasVisibleAttachments=function(){return!!h.find(this.attachments(),function(a){return!a.isLinked})},x.prototype.findAttachmentByCid=function(a){var b=null,c=this.attachments();return qb.isNonEmptyArray(c)&&(a=a.replace(/^<+/,"").replace(/>+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},x.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return qb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},x.prototype.messageId=function(){return this.sMessageId},x.prototype.inReplyTo=function(){return this.sInReplyTo},x.prototype.references=function(){return this.sReferences
},x.prototype.fromAsSingleEmail=function(){return qb.isArray(this.from)&&this.from[0]?this.from[0].email:""},x.prototype.viewLink=function(){return Cb.link().messageViewLink(this.requestHash)},x.prototype.downloadLink=function(){return Cb.link().messageDownloadLink(this.requestHash)},x.prototype.replyEmails=function(a){var b=[],c=qb.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,c,b),0===b.length&&x.replyHelper(this.from,c,b),b},x.prototype.replyAllEmails=function(a){var b=[],c=[],d=qb.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,d,b),0===b.length&&x.replyHelper(this.from,d,b),x.replyHelper(this.to,d,b),x.replyHelper(this.cc,d,c),[b,c]},x.prototype.textBodyToString=function(){return this.body?this.body.html():""},x.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0<a.length?a.join(", "):""},x.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()}},x.prototype.viewPopupMessage=function(c){qb.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))})},x.prototype.printMessage=function(){this.viewPopupMessage(!0)},x.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},x.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.requestHash=a.requestHash,this.subject(a.subject()),this.size(a.size()),this.dateTimeStampInUTC(a.dateTimeStampInUTC()),this.priority(a.priority()),this.fromEmailString(a.fromEmailString()),this.toEmailsString(a.toEmailsString()),this.emails=a.emails,this.from=a.from,this.to=a.to,this.cc=a.cc,this.bcc=a.bcc,this.replyTo=a.replyTo,this.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),this.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(ob.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},x.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=qb.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=qb.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]}),zb.resize()),qb.windowResize(500))},x.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){a=qb.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=qb.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]),qb.windowResize(500)}},y.newInstanceFromJson=function(a){var b=new y;return b.initByJson(a)?b.initComputed():null},y.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 ob.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 ob.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){qb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){qb.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(ob.FolderType.Inbox===c&&Cb.data().foldersInboxUnreadCount(b),a>0){if(ob.FolderType.Draft===c)return""+a;if(b>0&&ob.FolderType.Trash!==c&&ob.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(){qb.timeOutAction("folder-list-folder-visibility-change",function(){zb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){tb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case ob.FolderType.Inbox:b=qb.i18n("FOLDER_LIST/INBOX_NAME");break;case ob.FolderType.SentItems:b=qb.i18n("FOLDER_LIST/SENT_NAME");break;case ob.FolderType.Draft:b=qb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case ob.FolderType.Spam:b=qb.i18n("FOLDER_LIST/SPAM_NAME");break;case ob.FolderType.Trash:b=qb.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){tb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case ob.FolderType.Inbox:a="("+qb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case ob.FolderType.SentItems:a="("+qb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case ob.FolderType.Draft:a="("+qb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case ob.FolderType.Spam:a="("+qb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case ob.FolderType.Trash:a="("+qb.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},y.prototype.fullName="",y.prototype.fullNameRaw="",y.prototype.fullNameHash="",y.prototype.delimiter="",y.prototype.namespace="",y.prototype.deep=0,y.prototype.interval=0,y.prototype.isNamespaceFolder=!1,y.prototype.isGmailFolder=!1,y.prototype.isUnpaddigFolder=!1,y.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"},y.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?ob.FolderType.Inbox:ob.FolderType.User),b=!0),b},y.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},z.prototype.email="",z.prototype.changeAccountLink=function(){return Cb.link().change(this.email)},A.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},A.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},A.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+qb.quoteName(a)+'" <'+this.email()+">"},qb.extendAsViewModel("PopupsFolderClearViewModel",B),B.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},B.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},B.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(vb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsFolderCreateViewModel",C),C.prototype.sNoParentText="",C.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(qb.trim(a))},C.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.focusTrigger(!1)},C.prototype.onShow=function(){this.clearPopup(),this.focusTrigger(!0)},C.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(vb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsFolderSystemViewModel",D),D.prototype.sChooseOnText="",D.prototype.sUnuseText="",D.prototype.onShow=function(a){var b="";switch(a=qb.isUnd(a)?ob.SetSystemFoldersNotification.None:a){case ob.SetSystemFoldersNotification.Sent:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case ob.SetSystemFoldersNotification.Draft:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case ob.SetSystemFoldersNotification.Spam:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case ob.SetSystemFoldersNotification.Trash:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},D.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(vb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsComposeViewModel",E),E.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};switch(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Cb.data().accountEmail()]=Cb.data().accountEmail(),a){case ob.ComposeType.Empty:d=Cb.data().accountEmail();break;case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:case ob.ComposeType.Forward:case ob.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case ob.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}return d},E.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},E.prototype.formattedFrom=function(a){var b=Cb.data().displayName(),c=Cb.data().accountEmail();return""===b?c:(qb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+qb.quoteName(b)+'" <'+c+">"},E.prototype.sendMessageResponse=function(b,c){var d=!1;this.sending(!1),ob.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&vb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&ob.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(qb.trim(qb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),a.alert(qb.getNotification(c&&c.ErrorCode?c.ErrorCode:ob.Notification.CantSendMessage))))},E.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),ob.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Cb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Cb.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()?qb.i18n("COMPOSE/SAVED_TIME",{TIME:f.unix(this.savedTime()-1).format("LT")}):""),d=!0,this.bFromDraft&&Cb.cache().setFolderHash(this.draftFolder(),""))),this.modalVisibility()||d||(this.savedError(!0),this.savedOrSendingText(qb.getNotification(ob.Notification.CantSaveMessage)))},E.prototype.onHide=function(){this.reset(),vb.routeOn()},E.prototype.onShow=function(a,c,d){vb.routeOff();var e=this,f="",g="",i="",j="",k="",l=null,m="",n="",o=[],p={},q=Cb.data().accountEmail(),r=[],s=null,t=null,u=!1,v=a||ob.ComposeType.Empty,w=function(a){for(var b=0,c=a.length,d=[];c>b;b++)d.push(a[b].toLine(!1));return d.join(", ")};if(c=c||null,c&&qb.isNormal(c)&&(t=qb.isArray(c)&&1===c.length?c[0]:qb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(v,t))),this.reset(),qb.isNonEmptyArray(d)&&this.to(w(d)),""!==v&&t){switch(j=t.fullFormatDateValue(),k=t.subject(),s=t.aDraftInfo,l=b(t.body).clone(),qb.removeBlockquoteSwitcher(l),m=l.html(),v){case ob.ComposeType.Empty:break;case ob.ComposeType.Reply:this.to(w(t.replyEmails(p))),this.subject(qb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences),u=!0;break;case ob.ComposeType.ReplyAll:o=t.replyAllEmails(p),this.to(w(o[0])),this.cc(w(o[1])),this.subject(qb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.references()),u=!0;break;case ob.ComposeType.Forward:this.subject(qb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.ForwardAsAttachment:this.subject(qb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.Draft:this.to(w(t.to)),this.cc(w(t.cc)),this.bcc(w(t.bcc)),this.bFromDraft=!0,this.draftFolder(t.folderFullNameRaw),this.draftUid(t.uid),this.subject(k),this.prepearMessageAttachments(t,v),this.aDraftInfo=qb.isNonEmptyArray(s)&&3===s.length?s:null,this.sInReplyTo=t.sInReplyTo,this.sReferences=t.sReferences}if(this.oEditor){switch(v){case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:f=t.fromToLine(!1,!0),n=qb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="<br /><br />"+n+":<blockquote><br />"+m+"</blockquote>";break;case ob.ComposeType.Forward:f=t.fromToLine(!1,!0),g=t.toToLine(!1,!0),i=t.ccToLine(!1,!0),m="<br /><br /><br />"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"<br />"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"<br />"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0<i.length?"<br />"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"<br />"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+qb.encodeHtml(j)+"<br />"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+qb.encodeHtml(k)+"<br /><br />"+m;break;case ob.ComposeType.ForwardAsAttachment:m=""}this.oEditor.setRawText(m,t.isHtml())}}else this.oEditor&&ob.ComposeType.Empty===v?this.oEditor.setRawText("<br />"+qb.convertPlainTextToHtml(Cb.data().signature()),ob.EditorDefaultType.Html===Cb.data().editorDefaultType()):qb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});""===this.to()&&this.to.focusTrigger(!this.to.focusTrigger()),r=this.getAttachmentsDownloadsForUpload(),qb.isNonEmptyArray(r)&&Cb.remote().messageUploadAttachments(function(a,b){if(ob.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},r),u&&this.oEditor&&this.oEditor.focus(),this.triggerForResize()},E.prototype.tryToClosePopup=function(){var a=this;vb.showScreenPopup(K,[qb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&vb.delegateRun(a,"closeCommand")}])},E.prototype.onBuild=function(){this.initEditor(),this.initUploader();var a=this,c=null;zb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Cb.data().useKeyboardShortcuts()&&(b.ctrlKey&&ob.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&ob.EventKeyCode.Enter===b.keyCode?(a.sendCommand(),c=!1):ob.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1)),c}),zb.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",Cb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},E.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},E.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new j(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}}),this.oEditor.initLanguage(qb.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),qb.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),qb.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}},E.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=qb.pInt(Cb.settingsGet("AttachmentLimit")),c=new g({action:Cb.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;qb.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=qb.isUnd(d.FileName)?"":d.FileName.toString(),g=qb.isNormal(d.Size)?qb.pInt(d.Size):null,h=new w(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(qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;qb.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=qb.getUploadErrorDescByCode(f):g||(e=qb.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)),qb.isUnd(a[b])&&delete a[b])},this)),this.addAttachmentEnabled(!0).dragAndDropEnabled(c.isDragAndDropSupported())):this.addAttachmentEnabled(!1).dragAndDropEnabled(!1)}},E.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},E.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 w(a.requestHash,d,a.size()),c.fromMessage=!0,c.cancel=e(a.requestHash),c.waiting(!1).uploading(!0),this.attachments.push(c)}},E.prototype.addDropboxAttachment=function(a){var b=this,c=function(a){return function(){b.attachments.remove(function(b){return b&&b.id===a})}},d=qb.pInt(Cb.settingsGet("AttachmentLimit")),e=null,f=a.bytes;return e=new w(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(qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Cb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),ob.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(qb.getUploadErrorDescByCode(ob.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},E.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=qb.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(ob.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:i=h.isLinked;break;case ob.ComposeType.Forward:case ob.ComposeType.Draft:i=!0}i=!0,i&&(g=new w(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))}}},E.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},E.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(qb.getUploadErrorDescByCode(ob.UploadErrorCode.FileNoUploaded))},this)},E.prototype.isEmptyForm=function(a){a=qb.isUnd(a)?!0:!!a;var b=a?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&b&&""===this.oEditor.getTextForRequest()},E.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bReloadFolder=!1,this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear()},E.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},E.prototype.triggerForResize=function(){this.resizer(!this.resizer())},qb.extendAsViewModel("PopupsContactsViewModel",F),F.prototype.setShareToNone=function(){this.viewScopeType(ob.ContactScopeType.Default)},F.prototype.setShareToAll=function(){this.viewScopeType(ob.ContactScopeType.ShareAll)},F.prototype.addNewProperty=function(a){var b=new u(a,"");b.focused(!0),this.viewProperties.push(b)},F.prototype.addNewEmail=function(){this.addNewProperty(ob.ContactPropertyType.EmailPersonal)},F.prototype.addNewPhone=function(){this.addNewProperty(ob.ContactPropertyType.MobilePersonal)},F.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))},F.prototype.deleteSelectedContacts=function(){0<this.contactsCheckedOrSelected().length&&(Cb.remote().contactsDelete(h.bind(this.deleteResponse,this),this.contactsCheckedOrSelectedUids()),this.removeCheckedOrSelectedContactsFromList())},F.prototype.deleteResponse=function(a,b){500<(ob.StorageResultType.Success===a&&b&&b.Time?qb.pInt(b.Time):0)?this.reloadContactList(this.bDropPageAfterDelete):h.delay(function(a){return function(){a.reloadContactList(a.bDropPageAfterDelete)}}(this),500)},F.prototype.removeProperty=function(a){this.viewProperties.remove(a)},F.prototype.populateViewContact=function(a){var b="",c="",d="",e="",f=[];this.watchHash(!1),this.emptySelection(!1),this.viewReadOnly(!1),this.viewScopeType(ob.ContactScopeType.Default),a&&(b=a.idContact,c=a.idContactStr,qb.isNonEmptyArray(a.properties)&&h.each(a.properties,function(a){a&&a[0]&&(ob.ContactPropertyType.LastName===a[0]?d=a[1]:ob.ContactPropertyType.FirstName===a[0]?e=a[1]:-1===qb.inArray(a[0],[ob.ContactPropertyType.FullName])&&f.push(new u(a[0],a[1])))}),this.viewReadOnly(!!a.readOnly),this.viewScopeType(a.scopeType)),f.unshift(new u(ob.ContactPropertyType.FirstName,e,!1,"CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME")),f.unshift(new u(ob.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)},F.prototype.reloadContactList=function(a){var b=this,c=(this.contactsPage()-1)*nb.Defaults.ContactsPerPage;this.bDropPageAfterDelete=!1,(qb.isUnd(a)?1:!a)||(this.contactsPage(1),c=0),this.contacts.loading(!0),Cb.remote().contacts(function(a,c){var d=0,e=[];ob.StorageResultType.Success===a&&c&&c.Result&&c.Result.List&&qb.isNonEmptyArray(c.Result.List)&&(e=h.map(c.Result.List,function(a){var c=new t;return c.parse(a,b.contactsSharingIsAllowed)?c:null}),e=h.compact(e),d=qb.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,nb.Defaults.ContactsPerPage,this.search())},F.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=Cb.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(qb.pInt(a.value)),d.reloadContactList())}),zb.on("keydown",function(a){var b=!0;return a&&d.modalVisibility()&&(ob.EventKeyCode.Esc===a.keyCode?(vb.delegateRun(d,"closeCommand"),b=!1):a.ctrlKey&&ob.EventKeyCode.S===a.keyCode&&(d.saveCommand(),b=!1)),b})},F.prototype.onShow=function(){vb.routeOff(),this.reloadContactList(!0)},F.prototype.onHide=function(){vb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},qb.extendAsViewModel("PopupsAdvancedSearchViewModel",G),G.prototype.buildSearchStringValue=function(a){return-1<a.indexOf(" ")&&(a='"'+a+'"'),a},G.prototype.buildSearchString=function(){var a=[],b=qb.trim(this.from()),c=qb.trim(this.to()),d=qb.trim(this.subject()),e=qb.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)),qb.trim(a.join(" "))},G.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)},G.prototype.onShow=function(){this.clearPopup(),this.fromFocus(!0)},G.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(vb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsAddAccountViewModel",H),H.prototype.clearPopup=function(){this.email(""),this.login(""),this.password(""),this.emailError(!1),this.loginError(!1),this.passwordError(!1),this.submitRequest(!1),this.submitError("")},H.prototype.onShow=function(){this.clearPopup(),this.emailFocus(!0)},H.prototype.onBuild=function(){this.allowCustomLogin(!!Cb.settingsGet("AllowCustomLogin"));var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(vb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsIdentityViewModel",I),I.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("")},I.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===Cb.data().accountEmail())),this.owner()||this.email.focused(!0)},I.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(vb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsLanguagesViewModel",J),J.prototype.languageEnName=function(a){return qb.convertLangName(a,!0)},J.prototype.resetMainLanguage=function(){var a=Cb.data().mainLanguage();h.each(this.languages(),function(b){b.selected(b.key===a)})},J.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},J.prototype.onHide=function(){this.exp(!1)},J.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(vb.delegateRun(a,"cancelCommand"),c=!1),c})},J.prototype.changeLanguage=function(a){Cb.data().mainLanguage(a),this.cancelCommand()},qb.extendAsViewModel("PopupsAskViewModel",K),K.prototype.clearPopup=function(){this.askDesc(""),this.yesButton(qb.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton(qb.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},K.prototype.yesClick=function(){qb.isFunc(this.fYesAction)&&this.fYesAction.call(null),this.cancelCommand()},K.prototype.noClick=function(){qb.isFunc(this.fNoAction)&&this.fNoAction.call(null),this.cancelCommand()},K.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),this.yesFocus(!0)},K.prototype.onHide=function(){},K.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&(ob.EventKeyCode.Tab===b.keyCode||ob.EventKeyCode.Right===b.keyCode||ob.EventKeyCode.Left===b.keyCode)&&(a.yesFocus()?a.noFocus(!0):a.yesFocus(!0),c=!1),c
})},qb.extendAsViewModel("LoginViewModel",L),L.prototype.onShow=function(){vb.routeOff(),h.delay(h.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0),Cb.settingsGet("UserLanguage")&&b.cookie("rllang",Cb.data().language(),{expires:30})},this),100)},L.prototype.onHide=function(){this.submitFocus(!1),this.emailFocus(!1)},L.prototype.onBuild=function(){var c=this,d=Cb.settingsGet("JsHash"),e=function(a){a=qb.pInt(a),0===a?(c.submitRequest(!0),Cb.loginAndLogoutReload()):c.submitError(qb.getNotification(a))};switch(this.facebookLoginEnabled(!!Cb.settingsGet("AllowFacebookSocial")),this.twitterLoginEnabled(!!Cb.settingsGet("AllowTwitterSocial")),this.googleLoginEnabled(!!Cb.settingsGet("AllowGoogleSocial")),(Cb.settingsGet("SignMe")||"unused").toLowerCase()){case ob.LoginSignMeTypeAsString.DefaultOff:this.signMeType(ob.LoginSignMeType.DefaultOff);break;case ob.LoginSignMeTypeAsString.DefaultOn:this.signMeType(ob.LoginSignMeType.DefaultOn);break;default:case ob.LoginSignMeTypeAsString.Unused:this.signMeType(ob.LoginSignMeType.Unused)}this.email(Cb.data().devEmail),this.login(Cb.data().devLogin),this.password(Cb.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(){Cb.data().language.subscribe(function(a){c.langRequest(!0),b.ajax({url:Cb.link().langLink(a),dataType:"script",cache:!0}).done(function(){c.bSendLanguage=!0,qb.i18nToDoc(),b.cookie("rllang",Cb.data().language(),{expires:30})}).always(function(){c.langRequest(!1)})})},50)},L.prototype.selectLanguage=function(){vb.showScreenPopup(J)},h.extend(M.prototype,p.prototype),M.prototype.accountClick=function(a,b){if(a&&b&&!qb.isUnd(b.which)&&1===b.which){var c=this;this.accountsLoading(!0),h.delay(function(){c.accountsLoading(!1)},1e3)}return!0},M.prototype.emailTitle=function(){return Cb.data().accountEmail()},M.prototype.settingsClick=function(){vb.setHash(Cb.link().settings())},M.prototype.addAccountClick=function(){this.allowAddAccount&&vb.showScreenPopup(H)},M.prototype.logoutClick=function(){Cb.remote().logout(function(){a.__rlah_clear&&a.__rlah_clear(),Cb.loginAndLogoutReload(!0,Cb.settingsGet("ParentEmail")&&0<Cb.settingsGet("ParentEmail").length)})},qb.extendAsViewModel("MailBoxSystemDropDownViewModel",N,M),qb.extendAsViewModel("SettingsSystemDropDownViewModel",O,M),qb.extendAsViewModel("MailBoxFolderListViewModel",P),P.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(),qb.setExpandedFolder(b.fullNameHash,d),b.collapsed(!d),a.preventDefault(),a.stopPropagation())}).on("click",".b-folders .e-item .e-link.selectable",function(a){a.preventDefault();var b=c.dataFor(this);b&&(Cb.data().usePreviewPane()||Cb.data().message(null),b.fullNameRaw===Cb.data().currentFolderFullNameRaw()&&Cb.cache().setFolderHash(b.fullNameRaw,""),vb.setHash(Cb.link().mailBox(b.fullNameHash)))})},P.prototype.messagesDropOver=function(b){a.clearTimeout(this.iDropOverTimer),b&&b.collapsed()&&(this.iDropOverTimer=a.setTimeout(function(){b.collapsed(!1),qb.setExpandedFolder(b.fullNameHash,!0),qb.windowResize()},500))},P.prototype.messagesDropOut=function(){a.clearTimeout(this.iDropOverTimer)},P.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");Q&&Q.__vm&&qb.isNormal(c)&&qb.isArray(e)&&Q.__vm.moveMessagesToFolder(c,e,a.fullNameRaw,d)}},P.prototype.composeClick=function(){vb.showScreenPopup(E)},P.prototype.contactsClick=function(){this.allowContacts&&vb.showScreenPopup(F)},qb.extendAsViewModel("MailBoxMessageListViewModel",Q),Q.prototype.emptySubjectValue="",Q.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue),this.inputMessageListSearchFocus(!1)},Q.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},Q.prototype.removeMessagesFromList=function(a,b,c,d){c=qb.isNormal(c)?c:"",d=qb.isUnd(d)?!1:!!d;var e=0,f=Cb.data(),g=Cb.cache().getFolderFromCacheList(a),i=""===c?null:Cb.cache().getFolderFromCacheList(c||""),j=f.currentFolderFullNameRaw(),k=f.message(),l=j===a?h.filter(f.messageList(),function(a){return a&&-1<qb.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),Cb.data().messageListIsNotCompleted(!0),Cb.cache().setFolderHash(a,"")),qb.isNormal(c)&&Cb.cache().setFolderHash(c||"",""))},Q.prototype.removeCheckedOrSelectedMessagesFromList=function(a){this.removeMessagesFromList(Cb.data().currentFolderFullNameRaw(),h.map(Cb.data().messageListCheckedOrSelected(),function(a){return a.uid}),a)},Q.prototype.moveOrDeleteResponse=function(b,c){ob.StorageResultType.Success===b&&Cb.data().currentFolder()&&(c&&qb.isArray(c.Result)&&2===c.Result.length?Cb.cache().setFolderHash(c.Result[0],c.Result[1]):(c&&-1<qb.inArray(c.ErrorCode,[ob.Notification.CantMoveMessage,ob.Notification.CantCopyMessage])&&a.alert(qb.getNotification(c.ErrorCode)),Cb.cache().setFolderHash(Cb.data().currentFolderFullNameRaw(),"")),Cb.reloadMessageList(),Cb.quotaDebounce())},Q.prototype.moveMessagesToFolder=function(a,b,c,d){if(a!==c&&qb.isArray(b)&&0<b.length){var e=Cb.cache().getFolderFromCacheList(a),f=Cb.cache().getFolderFromCacheList(c);if(e&&f)return d=qb.isUnd(d)?!1:!!d,Cb.remote()[d?"messagesCopy":"messagesMove"](this.moveOrDeleteResponse,e.fullNameRaw,f.fullNameRaw,b),f.actionBlink(!0),this.removeMessagesFromList(a,b,c,d),!0}return!1},Q.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()?this.moveMessagesToFolder(Cb.data().currentFolderFullNameRaw(),Cb.data().messageListCheckedOrSelectedUidsWithSubMails(),a):!1},Q.prototype.deleteSelectedMessageFromCurrentFolder=function(a,b){if(this.canBeMoved()){b=qb.isUnd(b)?!0:!!b,b&&(ob.FolderType.Spam===a&&nb.Values.UnuseOptionValue===Cb.data().spamFolder()||ob.FolderType.Trash===a&&nb.Values.UnuseOptionValue===Cb.data().trashFolder())&&(b=!1);var c=this,d=null,e=Cb.data().currentFolderFullNameRaw(),f=Cb.cache().getFolderFromCacheList(ob.FolderType.Spam===a?Cb.data().spamFolder():Cb.data().trashFolder());!f&&b?vb.showScreenPopup(D,[ob.FolderType.Spam===a?ob.SetSystemFoldersNotification.Spam:ob.SetSystemFoldersNotification.Trash]):!b||f&&Cb.data().currentFolderFullNameRaw()===f.fullNameRaw?(d=Cb.data().messageListCheckedOrSelectedUidsWithSubMails(),vb.showScreenPopup(K,[qb.i18n("POPUPS_ASK/DESC_WANT_DELETE_MESSAGES"),function(){Cb.remote().messagesDelete(c.moveOrDeleteResponse,e,d),c.removeCheckedOrSelectedMessagesFromList()}])):f&&(Cb.remote().messagesMove(this.moveOrDeleteResponse,e,f.fullNameRaw,Cb.data().messageListCheckedOrSelectedUidsWithSubMails()),f.actionBlink(!0),this.removeCheckedOrSelectedMessagesFromList(f.fullNameRaw))}},Q.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=qb.draggeblePlace();return c.data("rl-folder",Cb.data().currentFolderFullNameRaw()),c.data("rl-uids",Cb.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Cb.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},Q.prototype.onMessageResponse=function(a,b,c){var d=Cb.data();d.messageLoading(!1),ob.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):ob.StorageResultType.Unload===a?(d.message(null),d.messageError("")):ob.StorageResultType.Abort!==a&&(d.message(null),d.messageError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.getNotification(ob.Notification.UnknownError)))},Q.prototype.populateMessageBody=function(a){a&&(Cb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Cb.data().messageLoading(!0):qb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},Q.prototype.setAction=function(a,b,c){var d=[],e=null,f=Cb.cache(),g=0;if(qb.isUnd(c)&&(c=Cb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0<d.length){switch(b){case ob.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),Cb.remote().messageSetSeen(qb.emptyFunction,a,d,!0);break;case ob.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),Cb.remote().messageSetSeen(qb.emptyFunction,a,d,!1);break;case ob.MessageSetAction.SetFlag:h.each(c,function(a){a.flagged(!0),f.storeMessageFlagsToCache(a)}),Cb.remote().messageSetFlagged(qb.emptyFunction,a,d,!0);break;case ob.MessageSetAction.UnsetFlag:h.each(c,function(a){a.flagged(!1),f.storeMessageFlagsToCache(a)}),Cb.remote().messageSetFlagged(qb.emptyFunction,a,d,!1)}Cb.reloadFlagsCurrentMessageListAndMessageFromCache()}},Q.prototype.setActionForAll=function(a,b){var c=null,d=Cb.data().messageList(),e=Cb.cache();if(""!==a&&(c=e.getFolderFromCacheList(a))){switch(b){case ob.MessageSetAction.SetSeen:c=e.getFolderFromCacheList(a),c&&(h.each(d,function(a){a.unseen(!1)}),c.messageCountUnread(0),e.clearMessageFlagsFromCacheByFolder(a)),Cb.remote().messageSetSeenToAll(qb.emptyFunction,a,!0);break;case ob.MessageSetAction.UnsetSeen:c=e.getFolderFromCacheList(a),c&&(h.each(d,function(a){a.unseen(!0)}),c.messageCountUnread(c.messageCountAll()),e.clearMessageFlagsFromCacheByFolder(a)),Cb.remote().messageSetSeenToAll(qb.emptyFunction,a,!1)}Cb.reloadFlagsCurrentMessageListAndMessageFromCache()}},Q.prototype.listSetSeen=function(){this.setAction(Cb.data().currentFolderFullNameRaw(),ob.MessageSetAction.SetSeen,Cb.data().messageListCheckedOrSelected())},Q.prototype.listSetAllSeen=function(){this.setActionForAll(Cb.data().currentFolderFullNameRaw(),ob.MessageSetAction.SetSeen)},Q.prototype.listUnsetSeen=function(){this.setAction(Cb.data().currentFolderFullNameRaw(),ob.MessageSetAction.UnsetSeen,Cb.data().messageListCheckedOrSelected())},Q.prototype.listSetFlags=function(){this.setAction(Cb.data().currentFolderFullNameRaw(),ob.MessageSetAction.SetFlag,Cb.data().messageListCheckedOrSelected())},Q.prototype.listUnsetFlags=function(){this.setAction(Cb.data().currentFolderFullNameRaw(),ob.MessageSetAction.UnsetFlag,Cb.data().messageListCheckedOrSelected())},Q.prototype.onBuild=function(a){var d=this,e=Cb.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()&&(Cb.data().messageListThreadFolder(b.folderFullNameRaw),a=Cb.data().messageListThreadUids(),b.lastInCollapsedThread()?a.push(0<b.parentUid()?b.parentUid():b.uid):a=h.without(a,0<b.parentUid()?b.parentUid():b.uid),Cb.data().messageListThreadUids(h.uniq(a)),b.lastInCollapsedThreadLoading(!0),b.lastInCollapsedThread(!b.lastInCollapsedThread()),Cb.reloadMessageList()),!1}),this.selector.init(this.oContentVisible,this.oContentScrollable),Ab.on("keydown",function(a){var b=!0,c=a?a.keyCode:0;return a&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!Cb.popupVisibility()&&!e.messageFullScreenMode()&&!qb.inFocus()&&(e.usePreviewPane()||!e.message()&&(ob.EventKeyCode.Delete===c||ob.EventKeyCode.A===c))&&a.ctrlKey&&ob.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&&vb.setHash(Cb.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<qb.inArray(a.uid,f)?d.setAction(a.folderFullNameRaw,a.flagged()?ob.MessageSetAction.UnsetFlag:ob.MessageSetAction.SetFlag,b):d.setAction(a.folderFullNameRaw,a.flagged()?ob.MessageSetAction.UnsetFlag:ob.MessageSetAction.SetFlag,[a]))}),c.computed(function(){var a=Cb.data(),b=this.viewModelVisibility(),c=Cb.popupVisibility(),d=a.useKeyboardShortcuts(),e=a.messageFullScreenMode();this.selector.useKeyboard(b&&d&&!e&&!c)},this).extend({notify:"always"}),this.initUploaderForAppend()},Q.prototype.composeClick=function(){vb.showScreenPopup(E)},Q.prototype.advancedSearchClick=function(){vb.showScreenPopup(G)},Q.prototype.quotaTooltip=function(){return qb.i18n("MESSAGE_LIST/QUOTA_SIZE",{SIZE:qb.friendlySize(this.userUsageSize()),PROC:this.userUsageProc(),LIMIT:qb.friendlySize(this.userQuota())})},Q.prototype.initUploaderForAppend=function(){if(!Cb.settingsGet("AllowAppendMessage")||!this.dragOverArea())return!1;var a=new g({action:Cb.link().append(),name:"AppendFile",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,hidden:{Folder:function(){return Cb.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?(Cb.data().messageListLoading(!0),!0):!1},this)).on("onComplete",h.bind(function(){Cb.reloadMessageList(!0,!0)},this)),!!a},qb.extendAsViewModel("MailBoxMessageViewViewModel",R),R.prototype.scrollToTop=function(){var a=b(".messageItem.nano .content",this.viewModelDom);a&&a[0]?a.scrollTop(0):b(".messageItem",this.viewModelDom).scrollTop(0),qb.windowResize()},R.prototype.fullScreen=function(){this.fullScreenMode(!0),qb.windowResize()},R.prototype.unFullScreen=function(){this.fullScreenMode(!1),qb.windowResize()},R.prototype.toggleFullScreen=function(){qb.removeSelection(),this.fullScreenMode(!this.fullScreenMode()),qb.windowResize()},R.prototype.replyOrforward=function(a){vb.showScreenPopup(E,[a,Cb.data().message()])},R.prototype.onBuild=function(a){var d=this,e=Cb.data();Ab.on("keydown",function(a){var b=!0,c=a?a.keyCode:0;return c>0&&(ob.EventKeyCode.Backspace===c||ob.EventKeyCode.Esc===c)&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!qb.inFocus()&&e.message()&&(d.fullScreenMode(!1),e.usePreviewPane()||e.message(null),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Cb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},R.prototype.isDraftFolder=function(){return Cb.data().message()&&Cb.data().draftFolder()===Cb.data().message().folderFullNameRaw},R.prototype.isSentFolder=function(){return Cb.data().message()&&Cb.data().sentFolder()===Cb.data().message().folderFullNameRaw},R.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},R.prototype.composeClick=function(){vb.showScreenPopup(E)},R.prototype.editMessage=function(){Cb.data().message()&&vb.showScreenPopup(E,[ob.ComposeType.Draft,Cb.data().message()])},R.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},R.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},qb.extendAsViewModel("SettingsMenuViewModel",S),S.prototype.link=function(a){return Cb.link().settings(a)},S.prototype.backToMailBoxClick=function(){vb.setHash(Cb.link().inbox())},qb.extendAsViewModel("SettingsPaneViewModel",T),T.prototype.onShow=function(){Cb.data().message(null)},T.prototype.backToMailBoxClick=function(){vb.setHash(Cb.link().inbox())},qb.addSettingsViewModel(U,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),U.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Cb.data(),d=qb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(ob.SaveSettingsStep.Animate),b.ajax({url:Cb.link().langLink(c),dataType:"script",cache:!0}).done(function(){qb.i18nToDoc(),a.languageTrigger(ob.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(ob.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(ob.SaveSettingsStep.Idle)},1e3)}),Cb.remote().saveSettings(qb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Cb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){qb.timeOutAction("SaveDesktopNotifications",function(){Cb.remote().saveSettings(qb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){qb.timeOutAction("SaveReplySameFolder",function(){Cb.remote().saveSettings(qb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Cb.remote().saveSettings(qb.emptyFunction,{UseThreads:a?"1":"0"})}),c.usePreviewPane.subscribe(function(a){c.messageList([]),Cb.remote().saveSettings(qb.emptyFunction,{UsePreviewPane:a?"1":"0"})}),c.useCheckboxesInList.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},U.prototype.onShow=function(){Cb.data().desktopNotifications.valueHasMutated()},U.prototype.selectLanguage=function(){vb.showScreenPopup(J)},qb.addSettingsViewModel(V,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),V.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},V.prototype.onBuild=function(){Cb.data().contactsAutosave.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},V.prototype.onShow=function(){this.showPassword(!1)},qb.addSettingsViewModel(W,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),W.prototype.addNewAccount=function(){vb.showScreenPopup(H)},W.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);var b=function(b){return a===b};a&&(this.accounts.remove(b),Cb.remote().accountDelete(function(){Cb.accountsAndIdentities()},a.email))}},qb.addSettingsViewModel(X,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),X.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Cb.data(),c=qb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=qb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=qb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Cb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Cb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Cb.remote().saveSettings(e,{Signature:a})})},50)},qb.addSettingsViewModel(Y,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),Y.prototype.addNewIdentity=function(){vb.showScreenPopup(I)},Y.prototype.editIdentity=function(a){vb.showScreenPopup(I,[a])},Y.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Cb.remote().identityDelete(function(){Cb.accountsAndIdentities()},a.id))}},Y.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=Cb.data(),c=qb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=qb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=qb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Cb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Cb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Cb.remote().saveSettings(e,{Signature:a})})},50)},qb.addSettingsViewModel(Z,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),qb.addSettingsViewModel($,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),$.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},$.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),ob.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},qb.addSettingsViewModel(_,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),_.prototype.folderEditOnEnter=function(a){var b=a?qb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.data().foldersRenaming(!0),Cb.remote().folderRename(function(a,b){Cb.data().foldersRenaming(!1),ob.StorageResultType.Success===a&&b&&b.Result||Cb.data().foldersListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Cb.folders()},a.fullNameRaw,b),Cb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},_.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},_.prototype.onShow=function(){Cb.data().foldersListError("")},_.prototype.createFolder=function(){vb.showScreenPopup(C)},_.prototype.systemFolder=function(){vb.showScreenPopup(D)},_.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&&(Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.data().folderList.remove(b),Cb.data().foldersDeleting(!0),Cb.remote().folderDelete(function(a,b){Cb.data().foldersDeleting(!1),ob.StorageResultType.Success===a&&b&&b.Result||Cb.data().foldersListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Cb.folders()},a.fullNameRaw),Cb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0<a.privateMessageCountAll()&&Cb.data().foldersListError(qb.getNotification(ob.Notification.CantDeleteNonEmptyFolder))},_.prototype.subscribeFolder=function(a){Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.remote().folderSetSubscribe(qb.emptyFunction,a.fullNameRaw,!0),a.subScribed(!0)},_.prototype.unSubscribeFolder=function(a){Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.remote().folderSetSubscribe(qb.emptyFunction,a.fullNameRaw,!1),a.subScribed(!1)},qb.addSettingsViewModel(ab,"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes"),ab.prototype.removeCustomThemeImg=function(){this.customThemeImg("")},ab.prototype.onBuild=function(){var a=this,b=Cb.data().theme();this.themesObjects(h.map(Cb.data().themes(),function(a){return{name:a,nameDisplay:qb.convertThemeName(a),selected:c.observable(a===b),themePreviewSrc:Cb.link().themePreviewLink(a)}})),h.delay(function(){a.customThemeType.subscribe(function(a){Cb.remote().saveSettings(function(){Cb.data().theme.valueHasMutated()},{CustomThemeType:a})}),a.customThemeImg.subscribe(function(a){Cb.remote().saveSettings(function(){Cb.data().theme.valueHasMutated()},{CustomThemeImg:a})})},50),this.initCustomThemeUploader()},ab.prototype.initCustomThemeUploader=function(){if(this.customThemeUploaderButton()){var b=new g({action:Cb.link().uploadBackground(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,clickElement:this.customThemeUploaderButton()});return b.on("onSelect",h.bind(function(b,c){var d=qb.isUnd(c.FileName)?"":c.FileName.toString(),e=d.substring(d.length-4,d.length),f=qb.isNormal(c.Size)?qb.pInt(c.Size):null;return-1===qb.inArray(e,["jpeg",".jpg",".png"])?(a.alert(qb.i18n("SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR")),!1):f>1048576?(a.alert(qb.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?qb.getUploadErrorDescByCode(d.ErrorCode):qb.getUploadErrorDescByCode(ob.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},bb.prototype.populateDataOnStart=function(){var a=Cb.settingsGet("Languages"),b=Cb.settingsGet("Themes");qb.isArray(a)&&this.languages(a),qb.isArray(b)&&this.themes(b),this.mainLanguage(Cb.settingsGet("Language")),this.mainTheme(Cb.settingsGet("Theme")),this.allowCustomTheme(!!Cb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Cb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Cb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Cb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Cb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Cb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Cb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Cb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Cb.settingsGet("EditorDefaultType")),this.showImages(!!Cb.settingsGet("ShowImages")),this.contactsAutosave(!!Cb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Cb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Cb.settingsGet("MPP")),this.desktopNotifications(!!Cb.settingsGet("DesktopNotifications")),this.useThreads(!!Cb.settingsGet("UseThreads")),this.replySameFolder(!!Cb.settingsGet("ReplySameFolder")),this.usePreviewPane(!!Cb.settingsGet("UsePreviewPane")),this.useCheckboxesInList(!!Cb.settingsGet("UseCheckboxesInList")),this.facebookEnable(!!Cb.settingsGet("AllowFacebookSocial")),this.facebookAppID(Cb.settingsGet("FacebookAppID")),this.facebookAppSecret(Cb.settingsGet("FacebookAppSecret")),this.twitterEnable(!!Cb.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(Cb.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(Cb.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!Cb.settingsGet("AllowGoogleSocial")),this.googleClientID(Cb.settingsGet("GoogleClientID")),this.googleClientSecret(Cb.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!Cb.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(Cb.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!Cb.settingsGet("ContactsIsAllowed"))},h.extend(cb.prototype,bb.prototype),cb.prototype.purgeMessageBodyCache=function(){var a=0,c=null,d=tb.iMessageBodyCacheCount-nb.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)))},cb.prototype.populateDataOnStart=function(){bb.prototype.populateDataOnStart.call(this),this.accountEmail(Cb.settingsGet("Email")),this.accountIncLogin(Cb.settingsGet("IncLogin")),this.accountOutLogin(Cb.settingsGet("OutLogin")),this.projectHash(Cb.settingsGet("ProjectHash")),this.displayName(Cb.settingsGet("DisplayName")),this.replyTo(Cb.settingsGet("ReplyTo")),this.signature(Cb.settingsGet("Signature")),this.lastFoldersHash=Cb.local().get(ob.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Cb.settingsGet("RemoteSuggestions"),this.devEmail=Cb.settingsGet("DevEmail"),this.devLogin=Cb.settingsGet("DevLogin"),this.devPassword=Cb.settingsGet("DevPassword")},cb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&qb.isNormal(c)&&""!==c){if(qb.isArray(d)&&0<d.length){var e=Cb.cache(),f=0,g=d.length,i=function(b,c,d){var e=null;Bb&&Cb.data().useDesktopNotifications()&&(e=new Bb(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(Cb.link().notificationMailIcon(),Cb.data().accountEmail(),qb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Cb.link().notificationMailIcon(),x.emailsToLine(x.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Cb.cache().setFolderUidNext(b,c)}},cb.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=Cb.cache().getFolderFromCacheList(g),f||(f=y.newInstanceFromJson(e),f&&(Cb.cache().setFolderToCacheList(g,f),Cb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=nb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!qb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Cb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),qb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),qb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&qb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},cb.prototype.setFolders=function(a){var b=[],c=!1,d=Cb.data(),e=function(a){return""===a||nb.Values.UnuseOptionValue===a||null!==Cb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&qb.isArray(a.Result["@Collection"])&&(qb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Cb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Cb.settingsGet("SentFolder")+Cb.settingsGet("DraftFolder")+Cb.settingsGet("SpamFolder")+Cb.settingsGet("TrashFolder")+Cb.settingsGet("NullFolder")&&(Cb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Cb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Cb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Cb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),c=!0),d.sentFolder(e(Cb.settingsGet("SentFolder"))),d.draftFolder(e(Cb.settingsGet("DraftFolder"))),d.spamFolder(e(Cb.settingsGet("SpamFolder"))),d.trashFolder(e(Cb.settingsGet("TrashFolder"))),c&&Cb.remote().saveSystemFolders(qb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),NullFolder:"NullFolder"}),Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},cb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},cb.prototype.getNextFolderNames=function(a){a=qb.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=Cb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},cb.prototype.setMessage=function(a,c){var d=!1,e=!1,f=!1,g=null,h=null,i="",j=this.messagesBodiesDom(),k=this.message();a&&k&&a.Result&&"Object/Message"===a.Result["@Object"]&&k.folderFullNameRaw===a.Result.Folder&&k.uid===a.Result.Uid&&(this.messageError(""),k.initUpdateByMessageJson(a.Result),Cb.cache().addRequestedMessage(k.folderFullNameRaw,k.uid),c||k.initFlagsByJson(a.Result),j=j&&j[0]?j:null,j&&(i="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),h=j.find("#"+i),h&&h[0]?(h.data("rl-cache-count",++tb.iMessageBodyCacheCount),k.isRtl(!!h.data("rl-is-rtl")),k.isHtml(!!h.data("rl-is-html")),k.hasImages(!!h.data("rl-has-images")),k.body=h):(e=!!a.Result.HasExternals,f=!!a.Result.HasInternals,g=b('<div id="'+i+'" />').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++tb.iMessageBodyCacheCount),qb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):qb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,g.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,a.Result.Rtl&&(g.data("rl-is-rtl",!0),g.addClass("rtl-text-part")),j.append(g),g.data("rl-is-html",d),g.data("rl-has-images",e),k.isRtl(!!g.data("rl-is-rtl")),k.isHtml(!!g.data("rl-is-html")),k.hasImages(!!g.data("rl-has-images")),k.body=g,f&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),g&&qb.initBlockquoteSwitcher(g)),Cb.cache().initMessageFlagsFromCache(k),k.unseen()&&Cb.setMessageSeen(k),qb.windowResize())},cb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&qb.isArray(a.Result["@Collection"])){var c=Cb.data(),d=Cb.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=qb.pInt(a.Result.MessageResultCount),j=qb.pInt(a.Result.Offset),qb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Cb.cache().getFolderFromCacheList(qb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Cb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),qb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),qb.isNormal(a.Result.MessageUnseenCount)&&(qb.pInt(p.messageCountUnread())!==qb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Cb.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=x.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Cb.cache().initMessageFlagsFromCache(o):Cb.cache().storeMessageFlagsToCache(o),o.lastInCollapsedThread(e&&-1<qb.inArray(qb.pInt(o.uid),e)?!0:!1),k.push(o)));c.messageListCount(i),c.messageListSearch(qb.isNormal(a.Result.Search)?a.Result.Search:""),c.messageListEndSearch(qb.isNormal(a.Result.Search)?a.Result.Search:""),c.messageListEndFolder(qb.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||Cb.data().useThreads())&&Cb.folderInformation(p.fullNameRaw,k)}else Cb.data().messageListCount(0),Cb.data().messageList([]),Cb.data().messageListError(qb.getNotification(a&&a.ErrorCode?a.ErrorCode:ob.Notification.CantGetMessageList))},db.prototype.oRequests={},db.prototype.defaultResponse=function(b,c,d,e,f,g){var i=function(){ob.StorageResultType.Success!==d&&tb.bUnload&&(d=ob.StorageResultType.Unload),ob.StorageResultType.Success===d&&e&&!e.Result?(e&&-1<qb.inArray(e.ErrorCode,[ob.Notification.AuthError,ob.Notification.AccessError,ob.Notification.ConnectionError,ob.Notification.DomainNotAllowed,ob.Notification.AccountNotAllowed,ob.Notification.MailServerError,ob.Notification.UnknownNotification,ob.Notification.UnknownError])&&tb.iAjaxErrorCount++,e&&ob.Notification.InvalidToken===e.ErrorCode&&tb.iTokenErrorCount++,nb.Values.TokenErrorLimit<tb.iTokenErrorCount&&Cb.loginAndLogoutReload(!0),(e.Logout||nb.Values.AjaxErrorLimit<tb.iAjaxErrorCount)&&(a.__rlah_clear&&a.__rlah_clear(),Cb.loginAndLogoutReload(!0))):ob.StorageResultType.Success===d&&e&&e.Result&&(tb.iAjaxErrorCount=0,tb.iTokenErrorCount=0),b&&(rb.runHook("ajax-default-response",[c,ob.StorageResultType.Success===d?e:null,d,f,g]),b(d,ob.StorageResultType.Success===d?e:null,f,c,g))};switch(d){case"success":d=ob.StorageResultType.Success;break;case"abort":d=ob.StorageResultType.Abort;break;default:d=ob.StorageResultType.Error}ob.StorageResultType.Error===d?h.delay(i,300):i()},db.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=qb.isNormal(e)?e:2e4,f=qb.isUnd(f)?"":qb.pString(f),g=qb.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=Cb.settingsGet("Token")),m=b.ajax({type:j?"POST":"GET",url:Cb.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=qb.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<qb.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},db.prototype.defaultRequest=function(a,b,c,d,e,f){c=c||{},c.Action=b,e=qb.pString(e),rb.runHook("ajax-default-request",[b,c,e]),this.ajaxRequest(a,c,qb.isUnd(d)?nb.Defaults.DefaultAjaxTimeout:qb.pInt(d),e,f)},db.prototype.noop=function(a){this.defaultRequest(a,"Noop")},db.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})},db.prototype.jsInfo=function(a,b,c,d){this.defaultRequest(a,"JsInfo",{Type:b,Data:c,IsError:(qb.isUnd(d)?1:!d)?"0":"1"})},db.prototype.jsVersion=function(a,b){this.defaultRequest(a,"Version",{Version:b})},h.extend(eb.prototype,db.prototype),eb.prototype.folders=function(a){this.defaultRequest(a,"Folders",{SentFolder:Cb.settingsGet("SentFolder"),DraftFolder:Cb.settingsGet("DraftFolder"),SpamFolder:Cb.settingsGet("SpamFolder"),TrashFolder:Cb.settingsGet("TrashFolder")},null,"",["Folders"])},eb.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"})},eb.prototype.accountAdd=function(a,b,c,d){this.defaultRequest(a,"AccountAdd",{Email:b,Login:c,Password:d})},eb.prototype.accountDelete=function(a,b){this.defaultRequest(a,"AccountDelete",{EmailToDelete:b})},eb.prototype.identityUpdate=function(a,b,c,d,e,f){this.defaultRequest(a,"IdentityUpdate",{Id:b,Email:c,Name:d,ReplyTo:e,Bcc:f})},eb.prototype.identityDelete=function(a,b){this.defaultRequest(a,"IdentityDelete",{IdToDelete:b})},eb.prototype.accountsAndIdentities=function(a){this.defaultRequest(a,"AccountsAndIdentities")},eb.prototype.messageList=function(a,b,c,d,e,f){b=qb.pString(b);var g=Cb.data(),h=Cb.cache().getFolderHash(b);f=qb.isUnd(f)?!1:!!f,c=qb.isUnd(c)?0:qb.pInt(c),d=qb.isUnd(c)?20:qb.pInt(d),e=qb.pString(e),""===h||""!==e&&-1!==e.indexOf("has:")?this.defaultRequest(a,"MessageList",{Folder:b,Offset:c,Limit:d,Search:e,UidNext:"INBOX"===b?Cb.cache().getFolderUidNext(b):"",UseThreads:Cb.data().threading()&&Cb.data().useThreads()?"1":"0",ExpandedThreadUid:g.threading()&&b===g.messageListThreadFolder()?g.messageListThreadUids().join(","):""},""===e?nb.Defaults.DefaultAjaxTimeout:nb.Defaults.SearchAjaxTimeout,"",f?[]:["MessageList"]):this.defaultRequest(a,"MessageList",{},""===e?nb.Defaults.DefaultAjaxTimeout:nb.Defaults.SearchAjaxTimeout,"MessageList/"+sb.urlsafe_encode([b,c,d,e,g.projectHash(),h,"INBOX"===b?Cb.cache().getFolderUidNext(b):"",g.threading()&&g.useThreads()?"1":"0",g.threading()&&b===g.messageListThreadFolder()?g.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),f?[]:["MessageList"])},eb.prototype.messageUploadAttachments=function(a,b){this.defaultRequest(a,"MessageUploadAttachments",{Attachments:b},999e3)},eb.prototype.message=function(a,b,c){return b=qb.pString(b),c=qb.pInt(c),Cb.cache().getFolderFromCacheList(b)&&c>0?(this.defaultRequest(a,"Message",{},null,"Message/"+sb.urlsafe_encode([b,c,Cb.data().projectHash(),Cb.data().threading()&&Cb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},eb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},eb.prototype.folderInformation=function(a,b,c){var d=!0,e=Cb.cache(),f=[];qb.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:qb.isArray(f)?f.join(","):"",UidNext:"INBOX"===b?Cb.cache().getFolderUidNext(b):""}):Cb.data().useThreads()&&Cb.reloadFlagsCurrentMessageListAndMessageFromCache()},eb.prototype.folderInformationMultiply=function(a,b){this.defaultRequest(a,"FolderInformationMultiply",{Folders:b})},eb.prototype.logout=function(a){this.defaultRequest(a,"Logout")},eb.prototype.messageSetFlagged=function(a,b,c,d){this.defaultRequest(a,"MessageSetFlagged",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})},eb.prototype.messageSetSeen=function(a,b,c,d){this.defaultRequest(a,"MessageSetSeen",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})},eb.prototype.messageSetSeenToAll=function(a,b,c){this.defaultRequest(a,"MessageSetSeenToAll",{Folder:b,SetAction:c?"1":"0"})},eb.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},nb.Defaults.SaveMessageAjaxTimeout)},eb.prototype.sendMessage=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){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,Attachments:l},nb.Defaults.SendMessageAjaxTimeout)},eb.prototype.saveSystemFolders=function(a,b){this.defaultRequest(a,"SystemFoldersUpdate",b)},eb.prototype.saveSettings=function(a,b){this.defaultRequest(a,"SettingsUpdate",b)},eb.prototype.changePassword=function(a,b,c){this.defaultRequest(a,"ChangePassword",{PrevPassword:b,NewPassword:c})},eb.prototype.folderCreate=function(a,b,c){this.defaultRequest(a,"FolderCreate",{Folder:b,Parent:c},null,"",["Folders"])},eb.prototype.folderDelete=function(a,b){this.defaultRequest(a,"FolderDelete",{Folder:b},null,"",["Folders"])},eb.prototype.folderRename=function(a,b,c){this.defaultRequest(a,"FolderRename",{Folder:b,NewFolderName:c},null,"",["Folders"])},eb.prototype.folderClear=function(a,b){this.defaultRequest(a,"FolderClear",{Folder:b})},eb.prototype.folderSetSubscribe=function(a,b,c){this.defaultRequest(a,"FolderSubscribe",{Folder:b,Subscribe:c?"1":"0"})},eb.prototype.messagesMove=function(a,b,c,d){this.defaultRequest(a,"MessageMove",{FromFolder:b,ToFolder:c,Uids:d.join(",")},null,"",["MessageList","Message"])},eb.prototype.messagesCopy=function(a,b,c,d){this.defaultRequest(a,"MessageCopy",{FromFolder:b,ToFolder:c,Uids:d.join(",")})},eb.prototype.messagesDelete=function(a,b,c){this.defaultRequest(a,"MessageDelete",{Folder:b,Uids:c.join(",")},null,"",["MessageList","Message"])},eb.prototype.appDelayStart=function(a){this.defaultRequest(a,"AppDelayStart")},eb.prototype.quota=function(a){this.defaultRequest(a,"Quota")},eb.prototype.contacts=function(a,b,c,d){this.defaultRequest(a,"Contacts",{Offset:b,Limit:c,Search:d},null,"",["Contacts"])},eb.prototype.contactSave=function(a,b,c,d,e,f){this.defaultRequest(a,"ContactSave",{RequestUid:b,Uid:qb.trim(c),UidStr:qb.trim(d),ScopeType:e,Properties:f})},eb.prototype.contactsDelete=function(a,b){this.defaultRequest(a,"ContactsDelete",{Uids:b.join(",")})},eb.prototype.suggestions=function(a,b,c){this.defaultRequest(a,"Suggestions",{Query:b,Page:c},null,"",["Suggestions"])},eb.prototype.servicesPics=function(a){this.defaultRequest(a,"ServicesPics")},eb.prototype.emailsPicsHashes=function(a){this.defaultRequest(a,"EmailsPicsHashes")},eb.prototype.facebookUser=function(a){this.defaultRequest(a,"SocialFacebookUserInformation")},eb.prototype.facebookDisconnect=function(a){this.defaultRequest(a,"SocialFacebookDisconnect")},eb.prototype.twitterUser=function(a){this.defaultRequest(a,"SocialTwitterUserInformation")},eb.prototype.twitterDisconnect=function(a){this.defaultRequest(a,"SocialTwitterDisconnect")},eb.prototype.googleUser=function(a){this.defaultRequest(a,"SocialGoogleUserInformation")},eb.prototype.googleDisconnect=function(a){this.defaultRequest(a,"SocialGoogleDisconnect")},eb.prototype.socialUsers=function(a){this.defaultRequest(a,"SocialUsers")},fb.prototype.oEmailsPicsHashes={},fb.prototype.oServices={},fb.prototype.clear=function(){this.oServices={},this.oEmailsPicsHashes={}},fb.prototype.getUserPic=function(a){var b="",c="",d=a.toLowerCase(),e=qb.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];return""===e?(c=d.substr(a.indexOf("@")+1),b=""!==c&&this.oServices[c]?this.oServices[c]:""):b=Cb.link().getUserPicUrlFromHash(e),b},fb.prototype.setServicesData=function(a){this.oServices=a},fb.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a},h.extend(gb.prototype,fb.prototype),gb.prototype.oFoldersCache={},gb.prototype.oFoldersNamesCache={},gb.prototype.oFolderHashCache={},gb.prototype.oFolderUidNextCache={},gb.prototype.oMessageListHashCache={},gb.prototype.oMessageFlagsCache={},gb.prototype.oBodies={},gb.prototype.oNewMessage={},gb.prototype.oRequestedMessage={},gb.prototype.clear=function(){fb.prototype.clear.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oBodies={}},gb.prototype.getMessageKey=function(a,b){return a+"#"+b},gb.prototype.addRequestedMessage=function(a,b){this.oRequestedMessage[this.getMessageKey(a,b)]=!0},gb.prototype.hasRequestedMessage=function(a,b){return!0===this.oRequestedMessage[this.getMessageKey(a,b)]},gb.prototype.addNewMessageCache=function(a,b){this.oNewMessage[this.getMessageKey(a,b)]=!0},gb.prototype.hasNewMessageAndRemoveFromCache=function(a,b){return this.oNewMessage[this.getMessageKey(a,b)]?(this.oNewMessage[this.getMessageKey(a,b)]=null,!0):!1},gb.prototype.clearNewMessageCache=function(){this.oNewMessage={}},gb.prototype.getFolderFullNameRaw=function(a){return""!==a&&this.oFoldersNamesCache[a]?this.oFoldersNamesCache[a]:""},gb.prototype.setFolderFullNameRaw=function(a,b){this.oFoldersNamesCache[a]=b},gb.prototype.getFolderHash=function(a){return""!==a&&this.oFolderHashCache[a]?this.oFolderHashCache[a]:""},gb.prototype.setFolderHash=function(a,b){this.oFolderHashCache[a]=b},gb.prototype.getFolderUidNext=function(a){return""!==a&&this.oFolderUidNextCache[a]?this.oFolderUidNextCache[a]:""},gb.prototype.setFolderUidNext=function(a,b){this.oFolderUidNextCache[a]=b},gb.prototype.getFolderFromCacheList=function(a){return""!==a&&this.oFoldersCache[a]?this.oFoldersCache[a]:null},gb.prototype.setFolderToCacheList=function(a,b){this.oFoldersCache[a]=b},gb.prototype.removeFolderFromCacheList=function(a){this.setFolderToCacheList(a,null)},gb.prototype.getMessageFlagsFromCache=function(a,b){return this.oMessageFlagsCache[a]&&this.oMessageFlagsCache[a][b]?this.oMessageFlagsCache[a][b]:null},gb.prototype.setMessageFlagsToCache=function(a,b,c){this.oMessageFlagsCache[a]||(this.oMessageFlagsCache[a]={}),this.oMessageFlagsCache[a][b]=c},gb.prototype.clearMessageFlagsFromCacheByFolder=function(a){this.oMessageFlagsCache[a]={}},gb.prototype.initMessageFlagsFromCache=function(a){if(a){var b=this,c=this.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid),d=null,e=null;c&&4===c.length&&(a.unseen(c[0]),a.flagged(c[1]),a.answered(c[2]),a.forwarded(c[3])),0<a.threads().length&&(d=h.find(a.threads(),function(c){var d=b.getMessageFlagsFromCache(a.folderFullNameRaw,c);return d&&4===d.length&&!!d[0]}),e=h.find(a.threads(),function(c){var d=b.getMessageFlagsFromCache(a.folderFullNameRaw,c);return d&&4===d.length&&!!d[1]}),a.hasUnseenSubMessage(d&&0<qb.pInt(d)),a.hasFlaggedSubMessage(e&&0<qb.pInt(e)))}},gb.prototype.storeMessageFlagsToCache=function(a){a&&this.setMessageFlagsToCache(a.folderFullNameRaw,a.uid,[a.unseen(),a.flagged(),a.answered(),a.forwarded()])},gb.prototype.storeMessageFlagsToCacheByFolderAndUid=function(a,b,c){qb.isArray(c)&&4===c.length&&this.setMessageFlagsToCache(a,b,c)},h.extend(hb.prototype,q.prototype),hb.prototype.onRoute=function(a){var d=this,e=null,f=null,g=null,i=null;f=h.find(ub.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}),f&&(h.find(ub["settings-removed"],function(a){return a&&a===f})&&(f=null),f&&h.find(ub["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=Cb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),vb.delegateRun(e,"onBuild",[i])):qb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(vb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),vb.delegateRun(d.oCurrentSubScreen,"onShow"),h.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),qb.windowResize()})):vb.setHash(Cb.link().settings(),!1,!0)},hb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(vb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},hb.prototype.onBuild=function(){h.each(ub.settings,function(a){a&&a.__rlSettingsData&&!h.find(ub["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(ub["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},hb.prototype.routes=function(){var a=h.find(ub.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=qb.isUnd(c.subname)?b:qb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(ib.prototype,q.prototype),ib.prototype.onShow=function(){Cb.setTitle("")},h.extend(jb.prototype,q.prototype),jb.prototype.oLastRoute={},jb.prototype.setNewTitle=function(){var a=Cb.data().accountEmail(),b=Cb.data().foldersInboxUnreadCount();Cb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+qb.i18n("TITLES/MAILBOX"))},jb.prototype.onShow=function(){this.setNewTitle()},jb.prototype.onRoute=function(a,b,c){var d=Cb.data(),e=Cb.cache().getFolderFullNameRaw(a),f=Cb.cache().getFolderFromCacheList(e);f&&(d.currentFolder(f).messageListPage(b).messageListSearch(c),!d.usePreviewPane()&&d.message()&&d.message(null),Cb.reloadMessageList())},jb.prototype.onStart=function(){var a=Cb.data(),b=function(){qb.windowResize()};(Cb.settingsGet("AllowAdditionalAccounts")||Cb.settingsGet("AllowIdentities"))&&Cb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Cb.folderInformation("INBOX")},1e3),h.delay(function(){Cb.quota()},5e3),h.delay(function(){Cb.remote().appDelayStart(qb.emptyFunction)},35e3),yb.toggleClass("rl-no-preview-pane",!a.usePreviewPane()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.usePreviewPane.subscribe(function(a){yb.toggleClass("rl-no-preview-pane",!a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},jb.prototype.onBuild=function(){tb.bMobileDevice||h.defer(function(){qb.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",350,800,350,350,ob.ClientSideKeyName.MailBoxListSize)})},jb.prototype.routes=function(){var a=function(a,b){return b[0]=qb.pString(b[0]),b[1]=qb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=qb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2])]},b=function(a,b){return b[0]=qb.pString(b[0]),b[1]=qb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:b}],[/^([^\/]*)$/,{normalize_:a}]]},h.extend(kb.prototype,hb.prototype),kb.prototype.onShow=function(){Cb.setTitle(this.sSettingsTitle)},h.extend(lb.prototype,o.prototype),lb.prototype.oSettings=null,lb.prototype.oPlugins=null,lb.prototype.oLocal=null,lb.prototype.oLink=null,lb.prototype.oSubs={},lb.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):(tb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},lb.prototype.link=function(){return null===this.oLink&&(this.oLink=new i),this.oLink},lb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new n),this.oLocal},lb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=qb.isNormal(wb)?wb:{}),qb.isUnd(this.oSettings[a])?null:this.oSettings[a]},lb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=qb.isNormal(wb)?wb:{}),this.oSettings[a]=b},lb.prototype.setTitle=function(b){b=(qb.isNormal(b)&&0<b.length?b+" - ":"")+Cb.settingsGet("Title")||"",a.document.title="_",a.document.title=b},lb.prototype.loginAndLogoutReload=function(b,c){var d=qb.pString(Cb.settingsGet("CustomLogoutLink")),e=!!Cb.settingsGet("InIframe");b=qb.isUnd(b)?!1:!!b,c=qb.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):(vb.routeOff(),vb.setHash(Cb.link().root(),!0),vb.routeOff(),h.delay(function(){e&&a.parent?a.parent.location.reload():a.location.reload()},100))},lb.prototype.getAutocomplete=function(a,b){b([],a)},lb.prototype.sub=function(a,b,c){return qb.isUnd(this.oSubs[a])&&(this.oSubs[a]=[]),this.oSubs[a].push([b,c]),this},lb.prototype.pub=function(a,b){return qb.isUnd(this.oSubs[a])||h.each(this.oSubs[a],function(a){a[0]&&a[0].apply(a[1]||null,b||[])}),this},lb.prototype.bootstart=function(){qb.initOnStartOrLangChange(function(){qb.initNotificationLanguage()},null),h.delay(function(){qb.windowResize()},1e3)},h.extend(mb.prototype,lb.prototype),mb.prototype.oData=null,mb.prototype.oRemote=null,mb.prototype.oCache=null,mb.prototype.data=function(){return null===this.oData&&(this.oData=new cb),this.oData},mb.prototype.remote=function(){return null===this.oRemote&&(this.oRemote=new eb),this.oRemote},mb.prototype.cache=function(){return null===this.oCache&&(this.oCache=new gb),this.oCache},mb.prototype.reloadFlagsCurrentMessageListAndMessageFromCache=function(){var a=Cb.cache();h.each(Cb.data().messageList(),function(b){a.initMessageFlagsFromCache(b)}),a.initMessageFlagsFromCache(Cb.data().message())},mb.prototype.reloadMessageList=function(a,b){var c=Cb.data(),d=(c.messageListPage()-1)*c.messagesPerPage();(qb.isUnd(b)?1:!b)||Cb.cache().setFolderHash(c.currentFolderFullNameRaw(),""),(qb.isUnd(a)?1:!a)||(c.messageListPage(1),d=0),c.messageListLoading(!0),Cb.remote().messageList(function(a,b,d){ob.StorageResultType.Success===a&&b&&b.Result?(c.messageListError(""),c.messageListLoading(!1),c.setMessageList(b,d)):ob.StorageResultType.Unload===a?(c.messageListError(""),c.messageListLoading(!1)):ob.StorageResultType.Abort!==a&&(c.messageList([]),c.messageListLoading(!1),c.messageListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST")))},c.currentFolderFullNameRaw(),d,c.messagesPerPage(),c.messageListSearch())},mb.prototype.recacheInboxMessageList=function(){Cb.remote().messageList(qb.emptyFunction,"INBOX",0,Cb.data().messagesPerPage(),"",!0)},mb.prototype.folders=function(a){this.data().foldersLoading(!0),this.remote().folders(h.bind(function(b,c){Cb.data().foldersLoading(!1),ob.StorageResultType.Success===b?(this.data().setFolders(c),a&&a(!0)):a&&a(!1)},this))},mb.prototype.accountsAndIdentities=function(){var a=Cb.data();a.accountsLoading(!0),a.identitiesLoading(!0),Cb.remote().accountsAndIdentities(function(b,c){if(a.accountsLoading(!1),a.identitiesLoading(!1),ob.StorageResultType.Success===b&&c.Result){var d=Cb.settingsGet("ParentEmail"),e=a.accountEmail();d=""===d?e:d,qb.isArray(c.Result.Accounts)&&a.accounts(h.map(c.Result.Accounts,function(a){return new z(a,a!==d)})),qb.isArray(c.Result.Identities)&&a.identities(h.map(c.Result.Identities,function(a){var b=qb.pString(a.Id),c=qb.pString(a.Email),d=new A(b,c,b!==e);return d.name(qb.pString(a.Name)),d.replyTo(qb.pString(a.ReplyTo)),d.bcc(qb.pString(a.Bcc)),d}))}})},mb.prototype.quota=function(){this.remote().quota(function(a,b){ob.StorageResultType.Success===a&&b&&b.Result&&qb.isArray(b.Result)&&2===b.Result.length&&qb.isPosNumeric(b.Result[0],!0)&&qb.isPosNumeric(b.Result[1],!0)&&(Cb.data().userQuota(1024*qb.pInt(b.Result[1])),Cb.data().userUsageSize(1024*qb.pInt(b.Result[0])))})},mb.prototype.folderInformation=function(a,b){""!==qb.trim(a)&&this.remote().folderInformation(function(a,b){if(ob.StorageResultType.Success===a&&b&&b.Result&&b.Result.Hash&&b.Result.Folder){var c=f().unix(),d=Cb.cache().getFolderHash(b.Result.Folder),e=Cb.cache().getFolderFromCacheList(b.Result.Folder),g=!1,h="",i=[],j=!1,k=null;if(e){if(e.interval=c,b.Result.Hash&&Cb.cache().setFolderHash(b.Result.Folder,b.Result.Hash),qb.isNormal(b.Result.MessageCount)&&e.messageCountAll(b.Result.MessageCount),qb.isNormal(b.Result.MessageUnseenCount)&&(qb.pInt(e.messageCountUnread())!==qb.pInt(b.Result.MessageUnseenCount)&&(j=!0),e.messageCountUnread(b.Result.MessageUnseenCount)),j&&Cb.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],Cb.cache().storeMessageFlagsToCacheByFolderAndUid(e.fullNameRaw,h.toString(),[!k.IsSeen,!!k.IsFlagged,!!k.IsAnswered,!!k.IsForwarded]));g&&Cb.reloadFlagsCurrentMessageListAndMessageFromCache()}Cb.data().initUidNextAndNewMessages(e.fullNameRaw,b.Result.UidNext,b.Result.NewMessages),b.Result.Hash!==d||""===d?e.fullNameRaw===Cb.data().currentFolderFullNameRaw()?Cb.reloadMessageList():"INBOX"===e.fullNameRaw&&Cb.recacheInboxMessageList():j&&e.fullNameRaw===Cb.data().currentFolderFullNameRaw()&&(i=Cb.data().messageList(),qb.isNonEmptyArray(i)&&Cb.folderInformation(e.fullNameRaw,i))}}},a,b)},mb.prototype.folderInformationMultiply=function(a){a=qb.isUnd(a)?!1:!!a;var b=f().unix(),c=Cb.data().getNextFolderNames(a);qb.isNonEmptyArray(c)&&this.remote().folderInformationMultiply(function(c,d){ob.StorageResultType.Success===c&&d&&d.Result&&d.Result.List&&qb.isNonEmptyArray(d.Result.List)&&(h.each(d.Result.List,function(a){var c=[],d=Cb.cache().getFolderHash(a.Folder),e=Cb.cache().getFolderFromCacheList(a.Folder),f=!1;e&&(e.interval=b,a.Hash&&Cb.cache().setFolderHash(a.Folder,a.Hash),qb.isNormal(a.MessageCount)&&e.messageCountAll(a.MessageCount),qb.isNormal(a.MessageUnseenCount)&&(qb.pInt(e.messageCountUnread())!==qb.pInt(a.MessageUnseenCount)&&(f=!0),e.messageCountUnread(a.MessageUnseenCount)),f&&Cb.cache().clearMessageFlagsFromCacheByFolder(e.fullNameRaw),a.Hash!==d||""===d?e.fullNameRaw===Cb.data().currentFolderFullNameRaw()&&Cb.reloadMessageList():f&&e.fullNameRaw===Cb.data().currentFolderFullNameRaw()&&(c=Cb.data().messageList(),qb.isNonEmptyArray(c)&&Cb.folderInformation(e.fullNameRaw,c)))}),a&&Cb.folderInformationMultiply(!0))},c)},mb.prototype.setMessageSeen=function(a){if(a.unseen()){a.unseen(!1);var b=Cb.cache().getFolderFromCacheList(a.folderFullNameRaw);b&&b.messageCountUnread(0<=b.messageCountUnread()-1?b.messageCountUnread()-1:0),Cb.cache().storeMessageFlagsToCache(a),Cb.reloadFlagsCurrentMessageListAndMessageFromCache()}Cb.remote().messageSetSeen(qb.emptyFunction,a.folderFullNameRaw,[a.uid],!0)},mb.prototype.googleConnect=function(){a.open(Cb.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")},mb.prototype.twitterConnect=function(){a.open(Cb.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")},mb.prototype.facebookConnect=function(){a.open(Cb.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")},mb.prototype.socialUsers=function(a){var b=Cb.data();a&&(b.googleActions(!0),b.facebookActions(!0),b.twitterActions(!0)),Cb.remote().socialUsers(function(a,c){ob.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)})},mb.prototype.googleDisconnect=function(){Cb.data().googleActions(!0),Cb.remote().googleDisconnect(function(){Cb.socialUsers()})},mb.prototype.facebookDisconnect=function(){Cb.data().facebookActions(!0),Cb.remote().facebookDisconnect(function(){Cb.socialUsers()})},mb.prototype.twitterDisconnect=function(){Cb.data().twitterActions(!0),Cb.remote().twitterDisconnect(function(){Cb.socialUsers()})},mb.prototype.folderListOptionsBuilder=function(b,c,d,e,f,g,h,i,j,k){var l=0,m=0,n=null,o="   ",p=[];for(j=qb.isNormal(j)?j:0<b.length,k=qb.isUnd(k)?!1:!!k,f=qb.isNormal(f)?f:0,g=qb.isNormal(g)?g:null,h=qb.isNormal(h)?h:null,i=qb.isNormal(i)?i:null,qb.isArray(d)||(d=[]),qb.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<qb.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)&&(ob.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<qb.inArray(n.fullNameRaw,d)||ob.FolderType.User!==n.type()||(g?g.call(null,n):!1)}),n.subScribed()&&0<n.subFolders().length&&(p=p.concat(Cb.folderListOptionsBuilder([],n.subFolders(),d,[],n.isUnpaddigFolder?f+1:f,g,h,i,j,k)));
return p},mb.prototype.getAutocomplete=function(a,b){var c=[];Cb.remote().suggestions(function(a,d){ob.StorageResultType.Success===a&&d&&qb.isArray(d.Result)?(c=h.map(d.Result,function(a){return a&&a[0]?new s(a[0],a[1]):null}),b(h.compact(c))):ob.StorageResultType.Abort!==a&&b([])},a)},mb.prototype.emailsPicsHashes=function(){Cb.remote().emailsPicsHashes(function(a,b){ob.StorageResultType.Success===a&&b&&b.Result&&Cb.cache().setEmailsPicsHashesData(b.Result)})},mb.prototype.mailToHelper=function(b){if(b&&"mailto:"===b.toString().toLowerCase().substr(0,7)){var c=null;if(c=new s,c.parse(a.decodeURI(b.toString().substr(7).replace(/\?.+$/,""))),c&&c.email)return vb.showScreenPopup(E,[ob.ComposeType.Empty,null,[c]]),!0}return!1},mb.prototype.bootstart=function(){lb.prototype.bootstart.call(this),Cb.data().populateDataOnStart();var c="",d=Cb.settingsGet("JsHash"),e=Cb.settingsGet("AllowGoogleSocial"),f=Cb.settingsGet("AllowFacebookSocial"),g=Cb.settingsGet("AllowTwitterSocial");Cb.settingsGet("ChangePasswordIsAllowed")||qb.removeSettingsViewModel($),Cb.settingsGet("ContactsIsAllowed")||qb.removeSettingsViewModel(V),Cb.settingsGet("AllowAdditionalAccounts")||qb.removeSettingsViewModel(W),Cb.settingsGet("AllowIdentities")?qb.removeSettingsViewModel(X):qb.removeSettingsViewModel(Y),e||f||g||qb.removeSettingsViewModel(Z),Cb.settingsGet("AllowThemes")||qb.removeSettingsViewModel(ab),qb.initOnStartOrLangChange(function(){b.extend(!0,b.magnificPopup.defaults,{tClose:qb.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:qb.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:qb.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:qb.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:qb.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:qb.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:qb.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this),a.SimplePace&&(a.SimplePace.set(70),a.SimplePace.sleep()),Cb.settingsGet("Auth")?(this.setTitle(qb.i18n("TITLES/LOADING")),this.folders(h.bind(function(c){vb.hideLoading(),c?(vb.startScreens([jb,kb]),Ab.on("mousedown","#rl-center a",function(a){return!(a&&3!==a.which&&Cb.mailToHelper(b(this).attr("href")))}),(e||f||g)&&Cb.socialUsers(!0),Cb.sub("interval.2m",function(){Cb.folderInformation("INBOX")}),Cb.sub("interval.2m",function(){var a=Cb.data().currentFolderFullNameRaw();"INBOX"!==a&&Cb.folderInformation(a)}),Cb.sub("interval.3m",function(){Cb.folderInformationMultiply()}),Cb.sub("interval.5m",function(){Cb.quota()}),h.delay(function(){Cb.folderInformationMultiply(!0)},500),h.delay(function(){Cb.emailsPicsHashes(),Cb.remote().servicesPics(function(a,b){ob.StorageResultType.Success===a&&b&&b.Result&&Cb.cache().setServicesData(b.Result)})},2e3),rb.runHook("rl-start-user-screens")):(vb.startScreens([ib]),rb.runHook("rl-start-login-screens")),a.SimplePace&&a.SimplePace.set(100),tb.bMobileDevice||h.defer(function(){qb.initLayoutResizer("#rl-top-resizer-left","#rl-top-resizer-right","#rl-center",120,300,200,600,ob.ClientSideKeyName.FolderListSize)})},this))):(c=qb.pString(Cb.settingsGet("CustomLoginLink")),c?(vb.routeOff(),vb.setHash(Cb.link().root(),!0),vb.routeOff(),h.defer(function(){a.location.href=c})):(vb.hideLoading(),vb.startScreens([ib]),rb.runHook("rl-start-login-screens"),a.SimplePace&&a.SimplePace.set(100))),e&&(a["rl_"+d+"_google_service"]=function(){Cb.data().googleActions(!0),Cb.socialUsers()}),f&&(a["rl_"+d+"_facebook_service"]=function(){Cb.data().facebookActions(!0),Cb.socialUsers()}),g&&(a["rl_"+d+"_twitter_service"]=function(){Cb.data().twitterActions(!0),Cb.socialUsers()}),Cb.sub("interval.1m",function(){tb.momentTrigger(!tb.momentTrigger())}),rb.runHook("rl-start-screens")},Cb=new mb,yb.addClass(tb.bMobileDevice?"mobile":"no-mobile"),zb.keydown(qb.killCtrlAandS).keyup(qb.killCtrlAandS),zb.unload(function(){tb.bUnload=!0}),a.rl=a.rl||{},a.rl.addHook=rb.addHook,a.rl.settingsGet=rb.mainSettingsGet,a.rl.remoteRequest=rb.remoteRequest,a.rl.pluginSettingsGet=rb.settingsGet,a.rl.addSettingsViewModel=qb.addSettingsViewModel,a.rl.createCommand=qb.createCommand,a.rl.EmailModel=s,a.rl.Enums=ob,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={},vb.setBoot(Cb).bootstart(),yb.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,_);