mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
11 lines
No EOL
285 KiB
JavaScript
11 lines
No EOL
285 KiB
JavaScript
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||
!function(e,t,s,i,o,n,a,r,l,c){"use strict";function u(){this.sBase="#/",this.sServer="./?",this.sVersion=jt.settingsGet("Version"),this.sSpecSuffix=jt.settingsGet("AuthAccountHash")||"0",this.sStaticPrefix=jt.settingsGet("StaticPrefix")||"rainloop/v/"+this.sVersion+"/static/"}function d(e,s,i,o){var n=this;n.editor=null,n.iBlurTimer=0,n.fOnBlur=s||null,n.fOnReady=i||null,n.fOnModeChange=o||null,n.$element=t(e),n.resize=r.throttle(r.bind(n.resize,n),100),n.init()}function h(e,t,i,o,n,a){this.list=e,this.listChecked=s.computed(function(){return r.filter(this.list(),function(e){return e.checked()})},this).extend({rateLimit:0}),this.isListChecked=s.computed(function(){return 0<this.listChecked().length},this),this.focusedItem=s.observable(null),this.selectedItem=t,this.selectedItemUseCallback=!0,this.itemSelectedThrottle=r.debounce(r.bind(this.itemSelected,this),300),this.listChecked.subscribe(function(e){0<e.length?null===this.selectedItem()?this.selectedItem.valueHasMutated():this.selectedItem(null):this.bAutoSelect&&this.focusedItem()&&this.selectedItem(this.focusedItem())},this),this.selectedItem.subscribe(function(e){e?(this.isListChecked()&&r.each(this.listChecked(),function(e){e.checked(!1)}),this.selectedItemUseCallback&&this.itemSelectedThrottle(e)):this.selectedItemUseCallback&&this.itemSelected(null)},this),this.selectedItem.extend({toggleSubscribe:[null,function(e){e&&e.selected(!1)},function(e){e&&e.selected(!0)}]}),this.focusedItem.extend({toggleSubscribe:[null,function(e){e&&e.focused(!1)},function(e){e&&e.focused(!0)}]}),this.oContentVisible=null,this.oContentScrollable=null,this.sItemSelector=i,this.sItemSelectedSelector=o,this.sItemCheckedSelector=n,this.sItemFocusedSelector=a,this.sLastUid="",this.bAutoSelect=!0,this.oCallbacks={},this.emptyFunction=function(){},this.focusedItem.subscribe(function(e){e&&(this.sLastUid=this.getItemUid(e))},this);var l=[],c=[],u=null,d=null;this.list.subscribe(function(e){var t=this;Mt.isArray(e)&&r.each(e,function(e){if(e){var s=t.getItemUid(e);l.push(s),e.checked()&&c.push(s),null===u&&e.focused()&&(u=s),null===d&&e.selected()&&(d=s)}})},this,"beforeChange"),this.list.subscribe(function(e){var t=this,s=null,i=!1,o=[],n=u,a=!1,h=!1,p=0;this.selectedItemUseCallback=!1,this.focusedItem(null),this.selectedItem(null),Mt.isArray(e)&&(p=c.length,r.each(e,function(e){var s=t.getItemUid(e);o.push(s),null!==u&&u===s&&(t.focusedItem(e),u=null),p>0&&-1<Mt.inArray(s,c)&&(a=!0,e.checked(!0),p--),a||null===d||d!==s||(h=!0,t.selectedItem(e),d=null)}),this.selectedItemUseCallback=!0,a||h||!this.bAutoSelect||(t.focusedItem()?t.selectedItem(t.focusedItem()):0<e.length&&(null!==n&&(i=!1,n=r.find(l,function(e){return i&&-1<Mt.inArray(e,o)?e:(n===e&&(i=!0),!1)}),n&&(s=r.find(e,function(e){return n===t.getItemUid(e)}))),t.selectedItem(s||null),t.focusedItem(t.selectedItem())))),l=[],c=[],u=null,d=null},this)}function p(){}function m(){}function g(){var e=[m,p],t=r.find(e,function(e){return e.supported()});t&&(t=t,this.oDriver=new t)}function f(){}function b(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=Mt.pString(e),this.sTemplate=Mt.pString(t),this.sDefaultKeyScope=Lt.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelName="",this.viewModelVisibility=s.observable(!1),this.modalVisibility=s.observable(!1).extend({rateLimit:0}),this.viewModelDom=null}function y(e,t){this.sScreenName=e,this.aViewModels=Mt.isArray(t)?t:[]}function S(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null}function v(e,t){this.email=e||"",this.name=t||"",this.privateType=null,this.clearDuplicateName()}function C(){this.idContact=0,this.display="",this.properties=[],this.tags="",this.readOnly=!1,this.focused=s.observable(!1),this.selected=s.observable(!1),this.checked=s.observable(!1),this.deleted=s.observable(!1)}function w(e,t,i,o,n){this.type=s.observable(Mt.isUnd(e)?Lt.ContactPropertyType.Unknown:e),this.typeStr=s.observable(Mt.isUnd(t)?"":t),this.focused=s.observable(Mt.isUnd(o)?!1:!!o),this.value=s.observable(Mt.pString(i)),this.placeholder=s.observable(n||""),this.placeholderValue=s.computed(function(){var e=this.placeholder();return e?Mt.i18n(e):""},this),this.largeValue=s.computed(function(){return Lt.ContactPropertyType.Note===this.type()},this)}function T(){this.idContactTag=0,this.name=s.observable(""),this.readOnly=!1}function F(){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 A(e,t,i,o,n,a,r){this.id=e,this.isInline=Mt.isUnd(o)?!1:!!o,this.isLinked=Mt.isUnd(n)?!1:!!n,this.CID=Mt.isUnd(a)?"":a,this.contentLocation=Mt.isUnd(r)?"":r,this.fromMessage=!1,this.fileName=s.observable(t),this.size=s.observable(Mt.isUnd(i)?null:i),this.tempName=s.observable(""),this.progress=s.observable(""),this.error=s.observable(""),this.waiting=s.observable(!0),this.uploading=s.observable(!1),this.enabled=s.observable(!0),this.friendlySize=s.computed(function(){var e=this.size();return null===e?"":Mt.friendlySize(this.size())},this)}function E(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject=s.observable(""),this.subjectPrefix=s.observable(""),this.subjectSuffix=s.observable(""),this.size=s.observable(0),this.dateTimeStampInUTC=s.observable(0),this.priority=s.observable(Lt.MessagePriority.Normal),this.proxy=!1,this.fromEmailString=s.observable(""),this.fromClearEmailString=s.observable(""),this.toEmailsString=s.observable(""),this.toClearEmailsString=s.observable(""),this.senderEmailsString=s.observable(""),this.senderClearEmailsString=s.observable(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation=s.observable(!1),this.deleted=s.observable(!1),this.unseen=s.observable(!1),this.flagged=s.observable(!1),this.answered=s.observable(!1),this.forwarded=s.observable(!1),this.isReadReceipt=s.observable(!1),this.focused=s.observable(!1),this.selected=s.observable(!1),this.checked=s.observable(!1),this.hasAttachments=s.observable(!1),this.attachmentsMainType=s.observable(""),this.moment=s.observable(n(n.unix(0))),this.attachmentIconClass=s.computed(function(){var e="";if(this.hasAttachments())switch(e="icon-attachment",this.attachmentsMainType()){case"image":e="icon-image";break;case"archive":e="icon-file-zip";break;case"doc":e="icon-file-text"}return e},this),this.fullFormatDateValue=s.computed(function(){return E.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.momentDate=Mt.createMomentDate(this),this.momentShortDate=Mt.createMomentShortDate(this),this.dateTimeStampInUTC.subscribe(function(e){var t=n().unix();this.moment(n.unix(e>t?t:e))},this),this.body=null,this.plainRaw="",this.isHtml=s.observable(!1),this.hasImages=s.observable(!1),this.attachments=s.observableArray([]),this.isPgpSigned=s.observable(!1),this.isPgpEncrypted=s.observable(!1),this.pgpSignedVerifyStatus=s.observable(Lt.SignedVerifyStatus.None),this.pgpSignedVerifyUser=s.observable(""),this.priority=s.observable(Lt.MessagePriority.Normal),this.readReceipt=s.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=s.observable(0),this.threads=s.observableArray([]),this.threadsLen=s.observable(0),this.hasUnseenSubMessage=s.observable(!1),this.hasFlaggedSubMessage=s.observable(!1),this.lastInCollapsedThread=s.observable(!1),this.lastInCollapsedThreadLoading=s.observable(!1),this.threadsLenResult=s.computed(function(){var e=this.threadsLen();return 0===this.parentUid()&&e>0?e+1:""},this)}function N(){this.name=s.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.interval=0,this.selectable=!1,this.existen=!0,this.type=s.observable(Lt.FolderType.User),this.focused=s.observable(!1),this.selected=s.observable(!1),this.edited=s.observable(!1),this.collapsed=s.observable(!0),this.subScribed=s.observable(!0),this.subFolders=s.observableArray([]),this.deleteAccess=s.observable(!1),this.actionBlink=s.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=s.observable(""),this.name.subscribe(function(e){this.nameForEdit(e)},this),this.edited.subscribe(function(e){e&&this.nameForEdit(this.name())},this),this.privateMessageCountAll=s.observable(0),this.privateMessageCountUnread=s.observable(0),this.collapsedPrivate=s.observable(!0)}function R(e,t){this.email=e,this.deleteAccess=s.observable(!1),this.canBeDalete=s.observable(t)}function I(e,t,i){this.id=e,this.email=s.observable(t),this.name=s.observable(""),this.replyTo=s.observable(""),this.bcc=s.observable(""),this.deleteAccess=s.observable(!1),this.canBeDalete=s.observable(i)}function L(e){this.parentList=e,this.field=s.observable(Lt.FilterConditionField.From),this.fieldOptions=[{id:Lt.FilterConditionField.From,name:"From"},{id:Lt.FilterConditionField.Recipient,name:"Recipient (To or CC)"},{id:Lt.FilterConditionField.To,name:"To"},{id:Lt.FilterConditionField.Subject,name:"Subject"}],this.type=s.observable(Lt.FilterConditionType.EqualTo),this.typeOptions=[{id:Lt.FilterConditionType.EqualTo,name:"Equal To"},{id:Lt.FilterConditionType.NotEqualTo,name:"Not Equal To"},{id:Lt.FilterConditionType.Contains,name:"Contains"},{id:Lt.FilterConditionType.NotContains,name:"Not Contains"}],this.value=s.observable(""),this.template=s.computed(function(){var e="";switch(this.type()){default:e="SettingsFiltersConditionDefault"}return e},this)}function P(){this.new=s.observable(!0),this.enabled=s.observable(!0),this.name=s.observable(""),this.conditionsType=s.observable(Lt.FilterRulesType.And),this.conditions=s.observableArray([]),this.conditions.subscribe(function(){Mt.windowResize()}),this.actionMarkAsRead=s.observable(!1),this.actionSkipOtherFilters=s.observable(!0),this.actionValue=s.observable(""),this.actionType=s.observable(Lt.FiltersAction.Move),this.actionTypeOptions=[{id:Lt.FiltersAction.None,name:"Action - None"},{id:Lt.FiltersAction.Move,name:"Action - Move to"},{id:Lt.FiltersAction.Discard,name:"Action - Discard"}],this.actionMarkAsReadVisiblity=s.computed(function(){return-1<Mt.inArray(this.actionType(),[Lt.FiltersAction.None,Lt.FiltersAction.Forward,Lt.FiltersAction.Move])},this),this.actionTemplate=s.computed(function(){var e="";switch(this.actionType()){default:case Lt.FiltersAction.Move:e="SettingsFiltersActionValueAsFolders";break;case Lt.FiltersAction.Forward:e="SettingsFiltersActionWithValue";break;case Lt.FiltersAction.None:case Lt.FiltersAction.Discard:e="SettingsFiltersActionNoValue"}return e},this)}function M(e,t,i,o,n,a,r){this.index=e,this.id=i,this.guid=t,this.user=o,this.email=n,this.armor=r,this.isPrivate=!!a,this.deleteAccess=s.observable(!1)}function D(){b.call(this,"Popups","PopupsFolderClear"),this.selectedFolder=s.observable(null),this.clearingProcess=s.observable(!1),this.clearingError=s.observable(""),this.folderFullNameForClear=s.computed(function(){var e=this.selectedFolder();return e?e.printableFullName():""},this),this.folderNameForClear=s.computed(function(){var e=this.selectedFolder();return e?e.localName():""},this),this.dangerDescHtml=s.computed(function(){return Mt.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=Mt.createCommand(this,function(){var e=this,t=this.selectedFolder();t&&(jt.data().message(null),jt.data().messageList([]),this.clearingProcess(!0),jt.cache().setFolderHash(t.fullNameRaw,""),jt.remote().folderClear(function(t,s){e.clearingProcess(!1),Lt.StorageResultType.Success===t&&s&&s.Result?(jt.reloadMessageList(!0),e.cancelCommand()):e.clearingError(s&&s.ErrorCode?Mt.getNotification(s.ErrorCode):Mt.getNotification(Lt.Notification.MailServerError))},t.fullNameRaw))},function(){var e=this.selectedFolder(),t=this.clearingProcess();return!t&&null!==e}),S.constructorEnd(this)}function k(){b.call(this,"Popups","PopupsFolderCreate"),Mt.initOnStartOrLangChange(function(){this.sNoParentText=Mt.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=s.observable(""),this.folderName.focused=s.observable(!1),this.selectedParentValue=s.observable(It.Values.UnuseOptionValue),this.parentFolderSelectList=s.computed(function(){var e=jt.data(),t=[],s=null,i=null,o=e.folderList(),n=function(e){return e?e.isSystemFolder()?e.name()+" "+e.manageFolderSystemName():e.name():""};return t.push(["",this.sNoParentText]),""!==e.namespace&&(s=function(t){return e.namespace!==t.fullNameRaw.substr(0,e.namespace.length)}),jt.folderListOptionsBuilder([],o,[],t,null,s,i,n)},this),this.createFolder=Mt.createCommand(this,function(){var e=jt.data(),t=this.selectedParentValue();""===t&&1<e.namespace.length&&(t=e.namespace.substr(0,e.namespace.length-1)),e.foldersCreating(!0),jt.remote().folderCreate(function(e,t){jt.data().foldersCreating(!1),Lt.StorageResultType.Success===e&&t&&t.Result?jt.folders():jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"))},this.folderName(),t),this.cancelCommand()},function(){return this.simpleFolderNameValidation(this.folderName())}),this.defautOptionsAfterRender=Mt.defautOptionsAfterRender,S.constructorEnd(this)}function O(){b.call(this,"Popups","PopupsFolderSystem"),Mt.initOnStartOrLangChange(function(){this.sChooseOnText=Mt.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE"),this.sUnuseText=Mt.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME")},this),this.notification=s.observable(""),this.folderSelectList=s.computed(function(){return jt.folderListOptionsBuilder([],jt.data().folderList(),jt.data().folderListSystemNames(),[["",this.sChooseOnText],[It.Values.UnuseOptionValue,this.sUnuseText]])},this);var e=jt.data(),t=this,i=null,o=null;this.sentFolder=e.sentFolder,this.draftFolder=e.draftFolder,this.spamFolder=e.spamFolder,this.trashFolder=e.trashFolder,this.archiveFolder=e.archiveFolder,i=r.debounce(function(){jt.settingsSet("SentFolder",t.sentFolder()),jt.settingsSet("DraftFolder",t.draftFolder()),jt.settingsSet("SpamFolder",t.spamFolder()),jt.settingsSet("TrashFolder",t.trashFolder()),jt.settingsSet("ArchiveFolder",t.archiveFolder()),jt.remote().saveSystemFolders(Mt.emptyFunction,{SentFolder:t.sentFolder(),DraftFolder:t.draftFolder(),SpamFolder:t.spamFolder(),TrashFolder:t.trashFolder(),ArchiveFolder:t.archiveFolder(),NullFolder:"NullFolder"})},1e3),o=function(){jt.settingsSet("SentFolder",t.sentFolder()),jt.settingsSet("DraftFolder",t.draftFolder()),jt.settingsSet("SpamFolder",t.spamFolder()),jt.settingsSet("TrashFolder",t.trashFolder()),jt.settingsSet("ArchiveFolder",t.archiveFolder()),i()},this.sentFolder.subscribe(o),this.draftFolder.subscribe(o),this.spamFolder.subscribe(o),this.trashFolder.subscribe(o),this.archiveFolder.subscribe(o),this.defautOptionsAfterRender=Mt.defautOptionsAfterRender,S.constructorEnd(this)}function _(){b.call(this,"Popups","PopupsCompose"),this.oEditor=null,this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.bSkipNext=!1,this.sReferences="",this.bCapaAdditionalIdentities=jt.capa(Lt.Capa.AdditionalIdentities);var t=this,i=jt.data(),o=function(e){!1===t.showCcAndBcc()&&0<e.length&&t.showCcAndBcc(!0)};this.capaOpenPGP=i.capaOpenPGP,this.resizer=s.observable(!1).extend({throttle:50}),this.identitiesDropdownTrigger=s.observable(!1),this.to=s.observable(""),this.to.focusTrigger=s.observable(!1),this.cc=s.observable(""),this.bcc=s.observable(""),this.replyTo=s.observable(""),this.subject=s.observable(""),this.isHtml=s.observable(!1),this.requestReadReceipt=s.observable(!1),this.sendError=s.observable(!1),this.sendSuccessButSaveError=s.observable(!1),this.savedError=s.observable(!1),this.savedTime=s.observable(0),this.savedOrSendingText=s.observable(""),this.emptyToError=s.observable(!1),this.attachmentsInProcessError=s.observable(!1),this.showCcAndBcc=s.observable(!1),this.cc.subscribe(o,this),this.bcc.subscribe(o,this),this.draftFolder=s.observable(""),this.draftUid=s.observable(""),this.sending=s.observable(!1),this.saving=s.observable(!1),this.attachments=s.observableArray([]),this.attachmentsInProcess=this.attachments.filter(function(e){return e&&""===e.tempName()}),this.attachmentsInReady=this.attachments.filter(function(e){return e&&""!==e.tempName()}),this.attachments.subscribe(function(){this.triggerForResize()},this),this.isDraftFolderMessage=s.computed(function(){return""!==this.draftFolder()&&""!==this.draftUid()},this),this.composeUploaderButton=s.observable(null),this.composeUploaderDropPlace=s.observable(null),this.dragAndDropEnabled=s.observable(!1),this.dragAndDropOver=s.observable(!1).extend({throttle:1}),this.dragAndDropVisible=s.observable(!1).extend({throttle:1}),this.attacheMultipleAllowed=s.observable(!1),this.addAttachmentEnabled=s.observable(!1),this.composeEditorArea=s.observable(null),this.identities=jt.data().identities,this.defaultIdentityID=jt.data().defaultIdentityID,this.currentIdentityID=s.observable(""),this.currentIdentityString=s.observable(""),this.currentIdentityResultEmail=s.observable(""),this.identitiesOptions=s.computed(function(){var e=[{optValue:i.accountEmail(),optText:this.formattedFrom(!1)}];return r.each(i.identities(),function(t){e.push({optValue:t.id,optText:t.formattedNameForCompose()})}),e},this),s.computed(function(){var e="",t="",s=null,i=this.identities(),o=this.currentIdentityID();return this.bCapaAdditionalIdentities&&o&&o!==jt.data().accountEmail()&&(s=r.find(i,function(e){return e&&o===e.id}),e=s?s.formattedNameForCompose():"",t=s?s.formattedNameForEmail():"",""===e&&i[0])?(this.currentIdentityID(i[0].id),""):(""===e&&(e=this.formattedFrom(!1),t=this.formattedFrom(!0)),this.currentIdentityString(e),this.currentIdentityResultEmail(t),e)},this),this.to.subscribe(function(e){this.emptyToError()&&0<e.length&&this.emptyToError(!1)},this),this.attachmentsInProcess.subscribe(function(e){this.attachmentsInProcessError()&&Mt.isArray(e)&&0===e.length&&this.attachmentsInProcessError(!1)},this),this.editorResizeThrottle=r.throttle(r.bind(this.editorResize,this),100),this.resizer.subscribe(function(){this.editorResizeThrottle()},this),this.canBeSendedOrSaved=s.computed(function(){return!this.sending()&&!this.saving()},this),this.deleteCommand=Mt.createCommand(this,function(){jt.deleteMessagesFromFolderWithoutCheck(this.draftFolder(),[this.draftUid()]),xt.hideScreenPopup(_)},function(){return this.isDraftFolderMessage()}),this.sendMessageResponse=r.bind(this.sendMessageResponse,this),this.saveMessageResponse=r.bind(this.saveMessageResponse,this),this.sendCommand=Mt.createCommand(this,function(){var e=Mt.trim(this.to()),t=jt.data().sentFolder(),s=[];0<this.attachmentsInProcess().length?this.attachmentsInProcessError(!0):0===e.length?this.emptyToError(!0):(jt.data().replySameFolder()&&Mt.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&Mt.isNormal(this.aDraftInfo[2])&&0<this.aDraftInfo[2].length&&(t=this.aDraftInfo[2]),""===t?xt.showScreenPopup(O,[Lt.SetSystemFoldersNotification.Sent]):(this.sendError(!1),this.sending(!0),Mt.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&(s=jt.cache().getMessageFlagsFromCache(this.aDraftInfo[2],this.aDraftInfo[1]),s&&("forward"===this.aDraftInfo[0]?s[3]=!0:s[2]=!0,jt.cache().setMessageFlagsToCache(this.aDraftInfo[2],this.aDraftInfo[1],s),jt.reloadFlagsCurrentMessageListAndMessageFromCache(),jt.cache().setFolderHash(this.aDraftInfo[2],""))),t=It.Values.UnuseOptionValue===t?"":t,jt.cache().setFolderHash(this.draftFolder(),""),jt.cache().setFolderHash(t,""),jt.remote().sendMessage(this.sendMessageResponse,this.draftFolder(),this.draftUid(),t,this.currentIdentityResultEmail(),e,this.cc(),this.bcc(),this.subject(),this.oEditor?this.oEditor.isHtml():!1,this.oEditor?this.oEditor.getData(!0):"",this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences,this.requestReadReceipt())))},this.canBeSendedOrSaved),this.saveCommand=Mt.createCommand(this,function(){jt.data().draftFolderNotEnabled()?xt.showScreenPopup(O,[Lt.SetSystemFoldersNotification.Draft]):(this.savedError(!1),this.saving(!0),this.bSkipNext=!0,jt.cache().setFolderHash(jt.data().draftFolder(),""),jt.remote().saveMessage(this.saveMessageResponse,this.draftFolder(),this.draftUid(),jt.data().draftFolder(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc(),this.subject(),this.oEditor?this.oEditor.isHtml():!1,this.oEditor?this.oEditor.getData(!0):"",this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences))},this.canBeSendedOrSaved),jt.sub("interval.1m",function(){!this.modalVisibility()||jt.data().draftFolderNotEnabled()||this.isEmptyForm(!1)||this.bSkipNext||this.saving()||this.sending()||this.savedError()||(this.bSkipNext=!1,this.saveCommand())},this),this.showCcAndBcc.subscribe(function(){this.triggerForResize()},this),this.dropboxEnabled=s.observable(!!jt.settingsGet("DropboxApiKey")),this.dropboxCommand=Mt.createCommand(this,function(){return e.Dropbox&&e.Dropbox.choose({success:function(e){e&&e[0]&&e[0].link&&t.addDropboxAttachment(e[0])},linkType:"direct",multiselect:!1}),!0},function(){return this.dropboxEnabled()}),this.driveEnabled=s.observable(Ot.bXMLHttpRequestSupported&&!!jt.settingsGet("GoogleClientID")&&!!jt.settingsGet("GoogleApiKey")),this.driveVisible=s.observable(!1),this.driveCommand=Mt.createCommand(this,function(){return this.driveOpenPopup(),!0},function(){return this.driveEnabled()}),this.driveCallback=r.bind(this.driveCallback,this),this.bDisabeCloseOnEsc=!0,this.sDefaultKeyScope=Lt.KeyState.Compose,this.tryToClosePopup=r.debounce(r.bind(this.tryToClosePopup,this),200),S.constructorEnd(this)}function U(){b.call(this,"Popups","PopupsContacts");var t=this,i=function(e){e&&0<e.length&&t.viewProperties.removeAll(e)};this.allowContactsSync=jt.data().allowContactsSync,this.enableContactsSync=jt.data().enableContactsSync,this.allowExport=!Ot.bMobileDevice,this.search=s.observable(""),this.contactsCount=s.observable(0),this.contacts=jt.data().contacts,this.contactTags=jt.data().contactTags,this.currentContact=s.observable(null),this.importUploaderButton=s.observable(null),this.contactsPage=s.observable(1),this.contactsPageCount=s.computed(function(){var e=Math.ceil(this.contactsCount()/It.Defaults.ContactsPerPage);return 0>=e?1:e},this),this.contactsPagenator=s.computed(Mt.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=s.observable(!0),this.viewClearSearch=s.observable(!1),this.viewID=s.observable(""),this.viewReadOnly=s.observable(!1),this.viewProperties=s.observableArray([]),this.viewTags=s.observable(""),this.viewTags.visibility=s.observable(!1),this.viewTags.focusTrigger=s.observable(!1),this.viewTags.focusTrigger.subscribe(function(e){e||""!==this.viewTags()?e&&this.viewTags.visibility(!0):this.viewTags.visibility(!1)},this),this.viewSaveTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(e){return-1<Mt.inArray(e.type(),[Lt.ContactPropertyType.FirstName,Lt.ContactPropertyType.LastName])}),this.viewPropertiesOther=this.viewProperties.filter(function(e){return-1<Mt.inArray(e.type(),[Lt.ContactPropertyType.Note])}),this.viewPropertiesOther=s.computed(function(){var e=r.filter(this.viewProperties(),function(e){return-1<Mt.inArray(e.type(),[Lt.ContactPropertyType.Nick])});return r.sortBy(e,function(e){return e.type()})},this),this.viewPropertiesEmails=this.viewProperties.filter(function(e){return Lt.ContactPropertyType.Email===e.type()}),this.viewPropertiesWeb=this.viewProperties.filter(function(e){return Lt.ContactPropertyType.Web===e.type()}),this.viewHasNonEmptyRequaredProperties=s.computed(function(){var e=this.viewPropertiesNames(),t=this.viewPropertiesEmails(),s=function(e){return""!==Mt.trim(e.value())};return!(!r.find(e,s)&&!r.find(t,s))},this),this.viewPropertiesPhones=this.viewProperties.filter(function(e){return Lt.ContactPropertyType.Phone===e.type()}),this.viewPropertiesEmailsNonEmpty=this.viewPropertiesNames.filter(function(e){return""!==Mt.trim(e.value())}),this.viewPropertiesEmailsEmptyAndOnFocused=this.viewPropertiesEmails.filter(function(e){var t=e.focused();return""===Mt.trim(e.value())&&!t}),this.viewPropertiesPhonesEmptyAndOnFocused=this.viewPropertiesPhones.filter(function(e){var t=e.focused();return""===Mt.trim(e.value())&&!t}),this.viewPropertiesWebEmptyAndOnFocused=this.viewPropertiesWeb.filter(function(e){var t=e.focused();return""===Mt.trim(e.value())&&!t}),this.viewPropertiesOtherEmptyAndOnFocused=s.computed(function(){return r.filter(this.viewPropertiesOther(),function(e){var t=e.focused();return""===Mt.trim(e.value())&&!t})},this),this.viewPropertiesEmailsEmptyAndOnFocused.subscribe(function(e){i(e)}),this.viewPropertiesPhonesEmptyAndOnFocused.subscribe(function(e){i(e)}),this.viewPropertiesWebEmptyAndOnFocused.subscribe(function(e){i(e)}),this.viewPropertiesOtherEmptyAndOnFocused.subscribe(function(e){i(e)}),this.viewSaving=s.observable(!1),this.useCheckboxesInList=jt.data().useCheckboxesInList,this.search.subscribe(function(){this.reloadContactList()},this),this.contacts.subscribe(function(){Mt.windowResize()},this),this.viewProperties.subscribe(function(){Mt.windowResize()},this),this.contactsChecked=s.computed(function(){return r.filter(this.contacts(),function(e){return e.checked()})},this),this.contactsCheckedOrSelected=s.computed(function(){var e=this.contactsChecked(),t=this.currentContact();return r.union(e,t?[t]:[])},this),this.contactsCheckedOrSelectedUids=s.computed(function(){return r.map(this.contactsCheckedOrSelected(),function(e){return e.idContact})},this),this.selector=new h(this.contacts,this.currentContact,".e-contact-item .actionHandle",".e-contact-item.selected",".e-contact-item .checkboxItem",".e-contact-item.focused"),this.selector.on("onItemSelect",r.bind(function(e){this.populateViewContact(e?e:null),e||this.emptySelection(!0)},this)),this.selector.on("onItemGetUid",function(e){return e?e.generateUid():""}),this.newCommand=Mt.createCommand(this,function(){this.populateViewContact(null),this.currentContact(null)}),this.deleteCommand=Mt.createCommand(this,function(){this.deleteSelectedContacts(),this.emptySelection(!0)},function(){return 0<this.contactsCheckedOrSelected().length}),this.newMessageCommand=Mt.createCommand(this,function(){var e=this.contactsCheckedOrSelected(),t=[];Mt.isNonEmptyArray(e)&&(t=r.map(e,function(e){if(e){var t=e.getNameAndEmailHelper(),s=t?new v(t[0],t[1]):null;if(s&&s.validate())return s}return null}),t=r.compact(t)),Mt.isNonEmptyArray(t)&&(xt.hideScreenPopup(U),xt.showScreenPopup(_,[Lt.ComposeType.Empty,null,t]))},function(){return 0<this.contactsCheckedOrSelected().length}),this.clearCommand=Mt.createCommand(this,function(){this.search("")}),this.saveCommand=Mt.createCommand(this,function(){this.viewSaving(!0),this.viewSaveTrigger(Lt.SaveSettingsStep.Animate);var e=Mt.fakeMd5(),s=[];r.each(this.viewProperties(),function(e){e.type()&&""!==Mt.trim(e.value())&&s.push([e.type(),e.value(),e.typeStr()])}),jt.remote().contactSave(function(s,i){var o=!1;t.viewSaving(!1),Lt.StorageResultType.Success===s&&i&&i.Result&&i.Result.RequestUid===e&&0<Mt.pInt(i.Result.ResultID)&&(""===t.viewID()&&t.viewID(Mt.pInt(i.Result.ResultID)),t.reloadContactList(),o=!0),r.delay(function(){t.viewSaveTrigger(o?Lt.SaveSettingsStep.TrueResult:Lt.SaveSettingsStep.FalseResult)},300),o&&(t.watchDirty(!1),r.delay(function(){t.viewSaveTrigger(Lt.SaveSettingsStep.Idle)},1e3))},e,this.viewID(),this.viewTags(),s)},function(){var e=this.viewHasNonEmptyRequaredProperties(),t=this.viewReadOnly();return!this.viewSaving()&&e&&!t}),this.syncCommand=Mt.createCommand(this,function(){var t=this;jt.contactsSync(function(s,i){Lt.StorageResultType.Success===s&&i&&i.Result||e.alert(Mt.getNotification(i&&i.ErrorCode?i.ErrorCode:Lt.Notification.ContactsSyncError)),t.reloadContactList(!0)})},function(){return!this.contacts.syncing()&&!this.contacts.importing()}),this.bDropPageAfterDelete=!1,this.watchDirty=s.observable(!1),this.watchHash=s.observable(!1),this.viewHash=s.computed(function(){return""+t.viewTags()+"|"+r.map(t.viewProperties(),function(e){return e.value()}).join("")}),this.viewHash.subscribe(function(){!this.watchHash()||this.viewReadOnly()||this.watchDirty()||this.watchDirty(!0)},this),this.sDefaultKeyScope=Lt.KeyState.ContactList,S.constructorEnd(this)}function x(){b.call(this,"Popups","PopupsAdvancedSearch"),this.fromFocus=s.observable(!1),this.from=s.observable(""),this.to=s.observable(""),this.subject=s.observable(""),this.text=s.observable(""),this.selectedDateValue=s.observable(-1),this.hasAttachment=s.observable(!1),this.starred=s.observable(!1),this.unseen=s.observable(!1),this.searchCommand=Mt.createCommand(this,function(){var e=this.buildSearchString();""!==e&&jt.data().mainMessageListSearch(e),this.cancelCommand()}),S.constructorEnd(this)}function V(){b.call(this,"Popups","PopupsAddAccount"),this.email=s.observable(""),this.password=s.observable(""),this.emailError=s.observable(!1),this.passwordError=s.observable(!1),this.email.subscribe(function(){this.emailError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=s.observable(!1),this.submitError=s.observable(""),this.emailFocus=s.observable(!1),this.addAccountCommand=Mt.createCommand(this,function(){return this.emailError(""===Mt.trim(this.email())),this.passwordError(""===Mt.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),jt.remote().accountAdd(r.bind(function(e,t){this.submitRequest(!1),Lt.StorageResultType.Success===e&&t&&"AccountAdd"===t.Action?t.Result?(jt.accountsAndIdentities(),this.cancelCommand()):t.ErrorCode&&this.submitError(Mt.getNotification(t.ErrorCode)):this.submitError(Mt.getNotification(Lt.Notification.UnknownError))},this),this.email(),"",this.password()),!0)},function(){return!this.submitRequest()}),S.constructorEnd(this)}function H(){b.call(this,"Popups","PopupsAddOpenPgpKey"),this.key=s.observable(""),this.key.error=s.observable(!1),this.key.focus=s.observable(!1),this.key.subscribe(function(){this.key.error(!1)},this),this.addOpenPgpKeyCommand=Mt.createCommand(this,function(){var e=30,t=null,s=Mt.trim(this.key()),i=/[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi,o=jt.data().openpgpKeyring;if(s=s.replace(/[\r\n]([a-zA-Z0-9]{2,}:[^\r\n]+)[\r\n]+([a-zA-Z0-9\/\\+=]{10,})/g,"\n$1!-!N!-!$2").replace(/[\n\r]+/g,"\n").replace(/!-!N!-!/g,"\n\n"),this.key.error(""===s),!o||this.key.error())return!1;for(;;){if(t=i.exec(s),!t||0>e)break;t[0]&&t[1]&&t[2]&&t[1]===t[2]&&("PRIVATE"===t[1]?o.privateKeys.importKey(t[0]):"PUBLIC"===t[1]&&o.publicKeys.importKey(t[0])),e--}return o.store(),jt.reloadOpenPgpKeys(),Mt.delegateRun(this,"cancelCommand"),!0}),S.constructorEnd(this)}function B(){b.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=s.observable(""),this.keyDom=s.observable(null),S.constructorEnd(this)}function G(){b.call(this,"Popups","PopupsGenerateNewOpenPgpKey"),this.email=s.observable(""),this.email.focus=s.observable(""),this.email.error=s.observable(!1),this.name=s.observable(""),this.password=s.observable(""),this.keyBitLength=s.observable(2048),this.submitRequest=s.observable(!1),this.email.subscribe(function(){this.email.error(!1)},this),this.generateOpenPgpKeyCommand=Mt.createCommand(this,function(){var t=this,s="",i=null,o=jt.data().openpgpKeyring;return this.email.error(""===Mt.trim(this.email())),!o||this.email.error()?!1:(s=this.email(),""!==this.name()&&(s=this.name()+" <"+s+">"),this.submitRequest(!0),r.delay(function(){i=e.openpgp.generateKeyPair({userId:s,numBits:Mt.pInt(t.keyBitLength()),passphrase:Mt.trim(t.password())}),i&&i.privateKeyArmored&&(o.privateKeys.importKey(i.privateKeyArmored),o.publicKeys.importKey(i.publicKeyArmored),o.store(),jt.reloadOpenPgpKeys(),Mt.delegateRun(t,"cancelCommand")),t.submitRequest(!1)
|
||
},100),!0)}),S.constructorEnd(this)}function K(){b.call(this,"Popups","PopupsComposeOpenPgp"),this.notification=s.observable(""),this.sign=s.observable(!0),this.encrypt=s.observable(!0),this.password=s.observable(""),this.password.focus=s.observable(!1),this.buttonFocus=s.observable(!1),this.from=s.observable(""),this.to=s.observableArray([]),this.text=s.observable(""),this.resultCallback=null,this.submitRequest=s.observable(!1),this.doCommand=Mt.createCommand(this,function(){var t=this,s=!0,i=jt.data(),o=null,n=[];this.submitRequest(!0),s&&this.sign()&&""===this.from()&&(this.notification(Mt.i18n("PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL")),s=!1),s&&this.sign()&&(o=i.findPrivateKeyByEmail(this.from(),this.password()),o||(this.notification(Mt.i18n("PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR",{EMAIL:this.from()})),s=!1)),s&&this.encrypt()&&0===this.to().length&&(this.notification(Mt.i18n("PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT")),s=!1),s&&this.encrypt()&&(n=[],r.each(this.to(),function(e){var o=i.findPublicKeysByEmail(e);0===o.length&&s&&(t.notification(Mt.i18n("PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR",{EMAIL:e})),s=!1),n=n.concat(o)}),!s||0!==n.length&&this.to().length===n.length||(s=!1)),r.delay(function(){if(t.resultCallback&&s)try{o&&0===n.length?t.resultCallback(e.openpgp.signClearMessage([o],t.text())):o&&0<n.length?t.resultCallback(e.openpgp.signAndEncryptMessage(n,o,t.text())):!o&&0<n.length&&t.resultCallback(e.openpgp.encryptMessage(n,t.text()))}catch(i){t.notification(Mt.i18n("PGP_NOTIFICATIONS/PGP_ERROR",{ERROR:""+i})),s=!1}s&&t.cancelCommand(),t.submitRequest(!1)},10)},function(){return!this.submitRequest()&&(this.sign()||this.encrypt())}),this.sDefaultKeyScope=Lt.KeyState.PopupComposeOpenPGP,S.constructorEnd(this)}function q(){b.call(this,"Popups","PopupsIdentity"),this.id="",this.edit=s.observable(!1),this.owner=s.observable(!1),this.email=s.observable("").validateEmail(),this.email.focused=s.observable(!1),this.name=s.observable(""),this.name.focused=s.observable(!1),this.replyTo=s.observable("").validateSimpleEmail(),this.replyTo.focused=s.observable(!1),this.bcc=s.observable("").validateSimpleEmail(),this.bcc.focused=s.observable(!1),this.submitRequest=s.observable(!1),this.submitError=s.observable(""),this.addOrEditIdentityCommand=Mt.createCommand(this,function(){return this.email.hasError()||this.email.hasError(""===Mt.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),jt.remote().identityUpdate(r.bind(function(e,t){this.submitRequest(!1),Lt.StorageResultType.Success===e&&t?t.Result?(jt.accountsAndIdentities(),this.cancelCommand()):t.ErrorCode&&this.submitError(Mt.getNotification(t.ErrorCode)):this.submitError(Mt.getNotification(Lt.Notification.UnknownError))},this),this.id,this.email(),this.name(),this.replyTo(),this.bcc()),!0)},function(){return!this.submitRequest()}),this.label=s.computed(function(){return Mt.i18n("POPUPS_IDENTITIES/"+(this.edit()?"TITLE_UPDATE_IDENTITY":"TITLE_ADD_IDENTITY"))},this),this.button=s.computed(function(){return Mt.i18n("POPUPS_IDENTITIES/"+(this.edit()?"BUTTON_UPDATE_IDENTITY":"BUTTON_ADD_IDENTITY"))},this),S.constructorEnd(this)}function j(){b.call(this,"Popups","PopupsLanguages"),this.exp=s.observable(!1),this.languages=s.computed(function(){return r.map(jt.data().languages(),function(e){return{key:e,selected:s.observable(!1),fullName:Mt.convertLangName(e)}})}),jt.data().mainLanguage.subscribe(function(){this.resetMainLanguage()},this),S.constructorEnd(this)}function z(){b.call(this,"Popups","PopupsTwoFactorTest");var e=this;this.code=s.observable(""),this.code.focused=s.observable(!1),this.code.status=s.observable(null),this.testing=s.observable(!1),this.testCode=Mt.createCommand(this,function(){this.testing(!0),jt.remote().testTwoFactor(function(t,s){e.testing(!1),e.code.status(Lt.StorageResultType.Success===t&&s&&s.Result?!0:!1)},this.code())},function(){return""!==this.code()&&!this.testing()}),S.constructorEnd(this)}function W(){b.call(this,"Popups","PopupsAsk"),this.askDesc=s.observable(""),this.yesButton=s.observable(""),this.noButton=s.observable(""),this.yesFocus=s.observable(!1),this.noFocus=s.observable(!1),this.fYesAction=null,this.fNoAction=null,this.bDisabeCloseOnEsc=!0,this.sDefaultKeyScope=Lt.KeyState.PopupAsk,S.constructorEnd(this)}function J(){b.call(this,"Popups","PopupsKeyboardShortcutsHelp"),this.sDefaultKeyScope=Lt.KeyState.PopupKeyboardShortcutsHelp,S.constructorEnd(this)}function Y(){b.call(this,"Popups","PopupsFilter"),this.filter=s.observable(null),this.selectedFolderValue=s.observable(It.Values.UnuseOptionValue),this.folderSelectList=jt.data().folderMenuForMove,this.defautOptionsAfterRender=Mt.defautOptionsAfterRender,S.constructorEnd(this)}function $(){b.call(this,"Center","Login");var t=jt.data();this.email=s.observable(""),this.password=s.observable(""),this.signMe=s.observable(!1),this.additionalCode=s.observable(""),this.additionalCode.error=s.observable(!1),this.additionalCode.focused=s.observable(!1),this.additionalCode.visibility=s.observable(!1),this.additionalCodeSignMe=s.observable(!1),this.logoImg=Mt.trim(jt.settingsGet("LoginLogo")),this.loginDescription=Mt.trim(jt.settingsGet("LoginDescription")),this.logoCss=Mt.trim(jt.settingsGet("LoginCss")),this.emailError=s.observable(!1),this.passwordError=s.observable(!1),this.emailFocus=s.observable(!1),this.submitFocus=s.observable(!1),this.email.subscribe(function(){this.emailError(!1),this.additionalCode(""),this.additionalCode.visibility(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.additionalCode.subscribe(function(){this.additionalCode.error(!1)},this),this.additionalCode.visibility.subscribe(function(){this.additionalCode.error(!1)},this),this.submitRequest=s.observable(!1),this.submitError=s.observable(""),this.allowLanguagesOnLogin=t.allowLanguagesOnLogin,this.langRequest=s.observable(!1),this.mainLanguage=t.mainLanguage,this.bSendLanguage=!1,this.mainLanguageFullName=s.computed(function(){return Mt.convertLangName(this.mainLanguage())},this),this.signMeType=s.observable(Lt.LoginSignMeType.Unused),this.signMeType.subscribe(function(e){this.signMe(Lt.LoginSignMeType.DefaultOn===e)},this),this.signMeVisibility=s.computed(function(){return Lt.LoginSignMeType.Unused!==this.signMeType()},this),this.submitCommand=Mt.createCommand(this,function(){if(Mt.triggerAutocompleteInputChange(),this.emailError(""===Mt.trim(this.email())),this.passwordError(""===Mt.trim(this.password())),this.additionalCode.visibility()&&this.additionalCode.error(""===Mt.trim(this.additionalCode())),this.emailError()||this.passwordError()||this.additionalCode.error())return!1;this.submitRequest(!0);var e=this.password(),t=r.bind(function(e){jt.remote().login(r.bind(function(e,t){Lt.StorageResultType.Success===e&&t&&"Login"===t.Action?t.Result?t.TwoFactorAuth?(this.additionalCode(""),this.additionalCode.visibility(!0),this.additionalCode.focused(!0),this.submitRequest(!1)):jt.loginAndLogoutReload():t.ErrorCode?(this.submitRequest(!1),this.submitError(Mt.getNotification(t.ErrorCode)),""===this.submitError()&&this.submitError(Mt.getNotification(Lt.Notification.UnknownError))):this.submitRequest(!1):(this.submitRequest(!1),this.submitError(Mt.getNotification(Lt.Notification.UnknownError)))},this),this.email(),"",e,!!this.signMe(),this.bSendLanguage?this.mainLanguage():"",this.additionalCode.visibility()?this.additionalCode():"",this.additionalCode.visibility()?!!this.additionalCodeSignMe():!1)},this);return jt.settingsGet("UseRsaEncryption")&&Mt.rsaEncode.supported?jt.remote().getPublicKey(r.bind(function(s,i){var o=!1;if(Lt.StorageResultType.Success===s&&i&&i.Result&&Mt.isArray(i.Result)&&i.Result[0]&&i.Result[1]&&i.Result[2]){var n=Mt.rsaEncode(e,i.Result[0],i.Result[1],i.Result[2]);n&&(t(n),o=!0)}o||(this.submitRequest(!1),this.submitError(Mt.getNotification(Lt.Notification.UnknownError)))},this)):t(e),!0},function(){return!this.submitRequest()}),this.facebookLoginEnabled=s.observable(!1),this.facebookCommand=Mt.createCommand(this,function(){return e.open(jt.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=s.observable(!1),this.googleCommand=Mt.createCommand(this,function(){return e.open(jt.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=s.observable(!1),this.twitterCommand=Mt.createCommand(this,function(){return e.open(jt.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.socialLoginEnabled=s.computed(function(){var e=this.facebookLoginEnabled(),t=this.googleLoginEnabled(),s=this.twitterLoginEnabled();return e||t||s},this),S.constructorEnd(this)}function X(){b.call(this,"Right","SystemDropDown");var e=jt.data();this.accounts=e.accounts,this.accountEmail=e.accountEmail,this.accountsLoading=e.accountsLoading,this.accountMenuDropdownTrigger=s.observable(!1),this.capaAdditionalAccounts=jt.capa(Lt.Capa.AdditionalAccounts),this.loading=s.computed(function(){return this.accountsLoading()},this),this.accountClick=r.bind(this.accountClick,this)}function Q(){X.call(this),S.constructorEnd(this)}function Z(){X.call(this),S.constructorEnd(this)}function et(){b.call(this,"Left","MailFolderList");var e=jt.data();this.oContentVisible=null,this.oContentScrollable=null,this.messageList=e.messageList,this.folderList=e.folderList,this.folderListSystem=e.folderListSystem,this.foldersChanging=e.foldersChanging,this.leftPanelDisabled=e.leftPanelDisabled,this.iDropOverTimer=0,this.allowContacts=!!jt.settingsGet("ContactsIsAllowed"),S.constructorEnd(this)}function tt(){b.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="",this.hideDangerousActions=!!jt.settingsGet("HideDangerousActions");var e=jt.data();this.popupVisibility=jt.popupVisibility,this.message=e.message,this.messageList=e.messageList,this.folderList=e.folderList,this.currentMessage=e.currentMessage,this.isMessageSelected=e.isMessageSelected,this.messageListSearch=e.messageListSearch,this.messageListError=e.messageListError,this.folderMenuForMove=e.folderMenuForMove,this.useCheckboxesInList=e.useCheckboxesInList,this.mainMessageListSearch=e.mainMessageListSearch,this.messageListEndFolder=e.messageListEndFolder,this.messageListChecked=e.messageListChecked,this.messageListCheckedOrSelected=e.messageListCheckedOrSelected,this.messageListCheckedOrSelectedUidsWithSubMails=e.messageListCheckedOrSelectedUidsWithSubMails,this.messageListCompleteLoadingThrottle=e.messageListCompleteLoadingThrottle,Mt.initOnStartOrLangChange(function(){this.emptySubjectValue=Mt.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this),this.userQuota=e.userQuota,this.userUsageSize=e.userUsageSize,this.userUsageProc=e.userUsageProc,this.moveDropdownTrigger=s.observable(!1),this.moreDropdownTrigger=s.observable(!1),this.dragOver=s.observable(!1).extend({throttle:1}),this.dragOverEnter=s.observable(!1).extend({throttle:1}),this.dragOverArea=s.observable(null),this.dragOverBodyArea=s.observable(null),this.messageListItemTemplate=s.computed(function(){return Lt.Layout.NoPreview!==e.layout()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=s.computed(function(){var t=e.messageListEndSearch();return""===t?"":Mt.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:t})}),this.messageListPagenator=s.computed(Mt.computedPagenatorHelper(e.messageListPage,e.messageListPageCount)),this.checkAll=s.computed({read:function(){return 0<jt.data().messageListChecked().length},write:function(e){e=!!e,r.each(jt.data().messageList(),function(t){t.checked(e)})}}),this.inputMessageListSearchFocus=s.observable(!1),this.sLastSearchValue="",this.inputProxyMessageListSearch=s.computed({read:this.mainMessageListSearch,write:function(e){this.sLastSearchValue=e},owner:this}),this.isIncompleteChecked=s.computed(function(){var e=jt.data().messageList().length,t=jt.data().messageListChecked().length;return e>0&&t>0&&e>t},this),this.hasMessages=s.computed(function(){return 0<this.messageList().length},this),this.hasCheckedOrSelectedLines=s.computed(function(){return 0<this.messageListCheckedOrSelected().length},this),this.isSpamFolder=s.computed(function(){return e.spamFolder()===this.messageListEndFolder()&&""!==e.spamFolder()},this),this.isSpamDisabled=s.computed(function(){return It.Values.UnuseOptionValue===e.spamFolder()},this),this.isTrashFolder=s.computed(function(){return e.trashFolder()===this.messageListEndFolder()&&""!==e.trashFolder()},this),this.isDraftFolder=s.computed(function(){return e.draftFolder()===this.messageListEndFolder()&&""!==e.draftFolder()},this),this.isSentFolder=s.computed(function(){return e.sentFolder()===this.messageListEndFolder()&&""!==e.sentFolder()},this),this.isArchiveFolder=s.computed(function(){return e.archiveFolder()===this.messageListEndFolder()&&""!==e.archiveFolder()},this),this.isArchiveDisabled=s.computed(function(){return It.Values.UnuseOptionValue===jt.data().archiveFolder()},this),this.canBeMoved=this.hasCheckedOrSelectedLines,this.clearCommand=Mt.createCommand(this,function(){xt.showScreenPopup(D,[jt.data().currentFolder()])}),this.multyForwardCommand=Mt.createCommand(this,function(){xt.showScreenPopup(_,[Lt.ComposeType.ForwardAsAttachment,jt.data().messageListCheckedOrSelected()])},this.canBeMoved),this.deleteWithoutMoveCommand=Mt.createCommand(this,function(){jt.deleteMessagesFromFolder(Lt.FolderType.Trash,jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),!1)},this.canBeMoved),this.deleteCommand=Mt.createCommand(this,function(){jt.deleteMessagesFromFolder(Lt.FolderType.Trash,jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),!0)},this.canBeMoved),this.archiveCommand=Mt.createCommand(this,function(){jt.deleteMessagesFromFolder(Lt.FolderType.Archive,jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),!0)},this.canBeMoved),this.spamCommand=Mt.createCommand(this,function(){jt.deleteMessagesFromFolder(Lt.FolderType.Spam,jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),!0)},this.canBeMoved),this.notSpamCommand=Mt.createCommand(this,function(){jt.deleteMessagesFromFolder(Lt.FolderType.NotSpam,jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),!0)},this.canBeMoved),this.moveCommand=Mt.createCommand(this,Mt.emptyFunction,this.canBeMoved),this.reloadCommand=Mt.createCommand(this,function(){jt.data().messageListCompleteLoadingThrottle()||jt.reloadMessageList(!1,!0)}),this.quotaTooltip=r.bind(this.quotaTooltip,this),this.selector=new h(this.messageList,this.currentMessage,".messageListItem .actionHandle",".messageListItem.selected",".messageListItem .checkboxMessage",".messageListItem.focused"),this.selector.on("onItemSelect",r.bind(function(t){t?(e.message(e.staticMessageList.populateByMessageListItem(t)),this.populateMessageBody(e.message()),Lt.Layout.NoPreview===e.layout()&&(xt.setHash(jt.link().messagePreview(),!0),e.message.focused(!0))):e.message(null)},this)),this.selector.on("onItemGetUid",function(e){return e?e.generateUid():""}),e.messageListEndHash.subscribe(function(){this.selector.scrollToTop()},this),e.layout.subscribe(function(e){this.selector.autoSelect(Lt.Layout.NoPreview!==e)},this),e.layout.valueHasMutated(),jt.sub("mailbox.message-list.selector.go-down",function(){this.selector.goDown(!0)},this).sub("mailbox.message-list.selector.go-up",function(){this.selector.goUp(!0)},this),S.constructorEnd(this)}function st(){b.call(this,"Right","MailMessageView");var e=this,t="",i=jt.data(),o=function(t){return Mt.createCommand(e,function(){this.replyOrforward(t)},e.canBeRepliedOrForwarded)};this.oMessageScrollerDom=null,this.keyScope=i.keyScope,this.message=i.message,this.currentMessage=i.currentMessage,this.messageListChecked=i.messageListChecked,this.hasCheckedMessages=i.hasCheckedMessages,this.messageListCheckedOrSelectedUidsWithSubMails=i.messageListCheckedOrSelectedUidsWithSubMails,this.messageLoading=i.messageLoading,this.messageLoadingThrottle=i.messageLoadingThrottle,this.messagesBodiesDom=i.messagesBodiesDom,this.useThreads=i.useThreads,this.replySameFolder=i.replySameFolder,this.layout=i.layout,this.usePreviewPane=i.usePreviewPane,this.isMessageSelected=i.isMessageSelected,this.messageActiveDom=i.messageActiveDom,this.messageError=i.messageError,this.fullScreenMode=i.messageFullScreenMode,this.showFullInfo=s.observable(!1),this.moreDropdownTrigger=s.observable(!1),this.messageDomFocused=s.observable(!1).extend({rateLimit:0}),this.messageVisibility=s.computed(function(){return!this.messageLoadingThrottle()&&!!this.message()},this),this.message.subscribe(function(e){e||this.currentMessage(null)},this),this.canBeRepliedOrForwarded=this.messageVisibility,this.closeMessage=Mt.createCommand(this,function(){i.message(null)}),this.replyCommand=o(Lt.ComposeType.Reply),this.replyAllCommand=o(Lt.ComposeType.ReplyAll),this.forwardCommand=o(Lt.ComposeType.Forward),this.forwardAsAttachmentCommand=o(Lt.ComposeType.ForwardAsAttachment),this.editAsNewCommand=o(Lt.ComposeType.EditAsNew),this.messageVisibilityCommand=Mt.createCommand(this,Mt.emptyFunction,this.messageVisibility),this.messageEditCommand=Mt.createCommand(this,function(){this.editMessage()},this.messageVisibility),this.deleteCommand=Mt.createCommand(this,function(){this.message()&&jt.deleteMessagesFromFolder(Lt.FolderType.Trash,this.message().folderFullNameRaw,[this.message().uid],!0)},this.messageVisibility),this.deleteWithoutMoveCommand=Mt.createCommand(this,function(){this.message()&&jt.deleteMessagesFromFolder(Lt.FolderType.Trash,jt.data().currentFolderFullNameRaw(),[this.message().uid],!1)},this.messageVisibility),this.archiveCommand=Mt.createCommand(this,function(){this.message()&&jt.deleteMessagesFromFolder(Lt.FolderType.Archive,this.message().folderFullNameRaw,[this.message().uid],!0)},this.messageVisibility),this.spamCommand=Mt.createCommand(this,function(){this.message()&&jt.deleteMessagesFromFolder(Lt.FolderType.Spam,this.message().folderFullNameRaw,[this.message().uid],!0)},this.messageVisibility),this.notSpamCommand=Mt.createCommand(this,function(){this.message()&&jt.deleteMessagesFromFolder(Lt.FolderType.NotSpam,this.message().folderFullNameRaw,[this.message().uid],!0)},this.messageVisibility),this.viewHash="",this.viewSubject=s.observable(""),this.viewFromShort=s.observable(""),this.viewToShort=s.observable(""),this.viewFrom=s.observable(""),this.viewTo=s.observable(""),this.viewCc=s.observable(""),this.viewBcc=s.observable(""),this.viewDate=s.observable(""),this.viewMoment=s.observable(""),this.viewLineAsCcc=s.observable(""),this.viewViewLink=s.observable(""),this.viewDownloadLink=s.observable(""),this.viewUserPic=s.observable(It.DataImages.UserDotPic),this.viewUserPicVisible=s.observable(!1),this.viewPgpPassword=s.observable(""),this.viewPgpSignedVerifyStatus=s.computed(function(){return this.message()?this.message().pgpSignedVerifyStatus():Lt.SignedVerifyStatus.None},this),this.viewPgpSignedVerifyUser=s.computed(function(){return this.message()?this.message().pgpSignedVerifyUser():""},this),this.message.subscribe(function(s){this.messageActiveDom(null),this.viewPgpPassword(""),s?(this.viewHash!==s.hash&&this.scrollMessageToTop(),this.viewHash=s.hash,this.viewSubject(s.subject()),this.viewFromShort(s.fromToLine(!0,!0)),this.viewToShort(s.toToLine(!0,!0)),this.viewFrom(s.fromToLine(!1)),this.viewTo(s.toToLine(!1)),this.viewCc(s.ccToLine(!1)),this.viewBcc(s.bccToLine(!1)),this.viewDate(s.fullFormatDateValue()),this.viewMoment(s.momentDate()),this.viewLineAsCcc(s.lineAsCcc()),this.viewViewLink(s.viewLink()),this.viewDownloadLink(s.downloadLink()),t=s.fromAsSingleEmail(),jt.cache().getUserPic(t,function(s,i){s!==e.viewUserPic()&&t===i&&(e.viewUserPicVisible(!1),e.viewUserPic(It.DataImages.UserDotPic),""!==s&&(e.viewUserPicVisible(!0),e.viewUserPic(s)))})):(this.viewHash="",this.scrollMessageToTop())},this),this.fullScreenMode.subscribe(function(e){e?Bt.addClass("rl-message-fullscreen"):Bt.removeClass("rl-message-fullscreen"),Mt.windowResize()}),this.messageLoadingThrottle.subscribe(function(e){e&&Mt.windowResize()}),this.goUpCommand=Mt.createCommand(this,function(){jt.pub("mailbox.message-list.selector.go-up")}),this.goDownCommand=Mt.createCommand(this,function(){jt.pub("mailbox.message-list.selector.go-down")}),S.constructorEnd(this)}function it(e){b.call(this,"Left","SettingsMenu"),this.leftPanelDisabled=jt.data().leftPanelDisabled,this.menu=e.menu,S.constructorEnd(this)}function ot(){b.call(this,"Right","SettingsPane"),S.constructorEnd(this)}function nt(){var e=jt.data();this.mainLanguage=e.mainLanguage,this.mainMessagesPerPage=e.mainMessagesPerPage,this.mainMessagesPerPageArray=It.Defaults.MessagesPerPageArray,this.editorDefaultType=e.editorDefaultType,this.showImages=e.showImages,this.interfaceAnimation=e.interfaceAnimation,this.useDesktopNotifications=e.useDesktopNotifications,this.threading=e.threading,this.useThreads=e.useThreads,this.replySameFolder=e.replySameFolder,this.layout=e.layout,this.usePreviewPane=e.usePreviewPane,this.useCheckboxesInList=e.useCheckboxesInList,this.allowLanguagesOnSettings=e.allowLanguagesOnSettings,this.isDesktopNotificationsSupported=s.computed(function(){return Lt.DesktopNotifications.NotSupported!==e.desktopNotificationsPermisions()}),this.isDesktopNotificationsDenied=s.computed(function(){return Lt.DesktopNotifications.NotSupported===e.desktopNotificationsPermisions()||Lt.DesktopNotifications.Denied===e.desktopNotificationsPermisions()}),this.mainLanguageFullName=s.computed(function(){return Mt.convertLangName(this.mainLanguage())},this),this.languageTrigger=s.observable(Lt.SaveSettingsStep.Idle).extend({throttle:100}),this.mppTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.isAnimationSupported=Ot.bAnimationSupported}function at(){var e=jt.data();this.contactsAutosave=e.contactsAutosave,this.allowContactsSync=e.allowContactsSync,this.enableContactsSync=e.enableContactsSync,this.contactsSyncUrl=e.contactsSyncUrl,this.contactsSyncUser=e.contactsSyncUser,this.contactsSyncPass=e.contactsSyncPass,this.saveTrigger=s.computed(function(){return[this.enableContactsSync()?"1":"0",this.contactsSyncUrl(),this.contactsSyncUser(),this.contactsSyncPass()].join("|")},this).extend({throttle:500}),this.saveTrigger.subscribe(function(){jt.remote().saveContactsSyncData(null,this.enableContactsSync(),this.contactsSyncUrl(),this.contactsSyncUser(),this.contactsSyncPass())},this)}function rt(){var e=jt.data();this.accounts=e.accounts,this.processText=s.computed(function(){return e.accountsLoading()?Mt.i18n("SETTINGS_ACCOUNTS/LOADING_PROCESS"):""},this),this.visibility=s.computed(function(){return""===this.processText()?"hidden":"visible"},this),this.accountForDeletion=s.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}function lt(){var e=jt.data();this.editor=null,this.displayName=e.displayName,this.signature=e.signature,this.signatureToAll=e.signatureToAll,this.replyTo=e.replyTo,this.signatureDom=s.observable(null),this.displayNameTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.replyTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.signatureTrigger=s.observable(Lt.SaveSettingsStep.Idle)}function ct(){var e=jt.data();this.editor=null,this.defautOptionsAfterRender=Mt.defautOptionsAfterRender,this.accountEmail=e.accountEmail,this.displayName=e.displayName,this.signature=e.signature,this.signatureToAll=e.signatureToAll,this.replyTo=e.replyTo,this.signatureDom=s.observable(null),this.defaultIdentityIDTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.displayNameTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.replyTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.signatureTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.identities=e.identities,this.defaultIdentityID=e.defaultIdentityID,this.identitiesOptions=s.computed(function(){var e=this.identities(),t=[];return 0<e.length&&(t.push({id:this.accountEmail.peek(),name:this.formattedAccountIdentity(),seporator:!1}),t.push({id:"---",name:"---",seporator:!0,disabled:!0}),r.each(e,function(e){t.push({id:e.id,name:e.formattedNameForEmail(),seporator:!1})})),t},this),this.processText=s.computed(function(){return e.identitiesLoading()?Mt.i18n("SETTINGS_IDENTITIES/LOADING_PROCESS"):""},this),this.visibility=s.computed(function(){return""===this.processText()?"hidden":"visible"},this),this.identityForDeletion=s.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}function ut(){this.filters=s.observableArray([]),this.filters.loading=s.observable(!1),this.filters.subscribe(function(){Mt.windowResize()})}function dt(){this.processing=s.observable(!1),this.clearing=s.observable(!1),this.secreting=s.observable(!1),this.viewUser=s.observable(""),this.viewEnable=s.observable(!1),this.viewEnable.subs=!0,this.twoFactorStatus=s.observable(!1),this.viewSecret=s.observable(""),this.viewBackupCodes=s.observable(""),this.viewUrl=s.observable(""),this.bFirst=!0,this.viewTwoFactorStatus=s.computed(function(){return Ot.langChangeTrigger(),Mt.i18n(this.twoFactorStatus()?"SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC":"SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC")},this),this.onResult=r.bind(this.onResult,this),this.onSecretResult=r.bind(this.onSecretResult,this)}function ht(){var e=jt.data();this.googleEnable=e.googleEnable,this.googleActions=e.googleActions,this.googleLoggined=e.googleLoggined,this.googleUserName=e.googleUserName,this.facebookEnable=e.facebookEnable,this.facebookActions=e.facebookActions,this.facebookLoggined=e.facebookLoggined,this.facebookUserName=e.facebookUserName,this.twitterEnable=e.twitterEnable,this.twitterActions=e.twitterActions,this.twitterLoggined=e.twitterLoggined,this.twitterUserName=e.twitterUserName,this.connectGoogle=Mt.createCommand(this,function(){this.googleLoggined()||jt.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=Mt.createCommand(this,function(){jt.googleDisconnect()}),this.connectFacebook=Mt.createCommand(this,function(){this.facebookLoggined()||jt.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=Mt.createCommand(this,function(){jt.facebookDisconnect()}),this.connectTwitter=Mt.createCommand(this,function(){this.twitterLoggined()||jt.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=Mt.createCommand(this,function(){jt.twitterDisconnect()})}function pt(){this.changeProcess=s.observable(!1),this.errorDescription=s.observable(""),this.passwordMismatch=s.observable(!1),this.passwordUpdateError=s.observable(!1),this.passwordUpdateSuccess=s.observable(!1),this.currentPassword=s.observable(""),this.currentPassword.error=s.observable(!1),this.newPassword=s.observable(""),this.newPassword2=s.observable(""),this.currentPassword.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.currentPassword.error(!1)},this),this.newPassword.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.passwordMismatch(!1)},this),this.newPassword2.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.passwordMismatch(!1)},this),this.saveNewPasswordCommand=Mt.createCommand(this,function(){this.newPassword()!==this.newPassword2()?(this.passwordMismatch(!0),this.errorDescription(Mt.i18n("SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH"))):(this.changeProcess(!0),this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.currentPassword.error(!1),this.passwordMismatch(!1),this.errorDescription(""),jt.remote().changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword()))},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()&&""!==this.newPassword2()}),this.onChangePasswordResponse=r.bind(this.onChangePasswordResponse,this)}function mt(){var e=jt.data();this.foldersListError=e.foldersListError,this.folderList=e.folderList,this.processText=s.computed(function(){var e=jt.data(),t=e.foldersLoading(),s=e.foldersCreating(),i=e.foldersDeleting(),o=e.foldersRenaming();return s?Mt.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):i?Mt.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):o?Mt.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):t?Mt.i18n("SETTINGS_FOLDERS/LOADING_PROCESS"):""},this),this.visibility=s.computed(function(){return""===this.processText()?"hidden":"visible"},this),this.folderForDeletion=s.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]}),this.folderForEdit=s.observable(null).extend({toggleSubscribe:[this,function(e){e&&e.edited(!1)},function(e){e&&e.canBeEdited()&&e.edited(!0)}]}),this.useImapSubscribe=!!jt.settingsGet("UseImapSubscribe")}function gt(){var i=this,o=jt.data();this.mainTheme=o.mainTheme,this.themesObjects=s.observableArray([]),this.themeTrigger=s.observable(Lt.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,jt.data().theme.subscribe(function(s){r.each(this.themesObjects(),function(e){e.selected(s===e.name)});var o=t("#rlThemeLink"),n=t("#rlThemeStyle"),a=o.attr("href");a||(a=n.attr("data-href")),a&&(a=a.toString().replace(/\/-\/[^\/]+\/\-\//,"/-/"+s+"/-/"),a=a.toString().replace(/\/Css\/[^\/]+\/User\//,"/Css/0/User/"),"Json/"!==a.substring(a.length-5,a.length)&&(a+="Json/"),e.clearTimeout(i.iTimer),i.themeTrigger(Lt.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=t.ajax({url:a,dataType:"json"}).done(function(e){e&&Mt.isArray(e)&&2===e.length&&(!o||!o[0]||n&&n[0]||(n=t('<style id="rlThemeStyle"></style>'),o.after(n),o.remove()),n&&n[0]&&(n.attr("data-href",a).attr("data-theme",e[0]),n&&n[0]&&n[0].styleSheet&&!Mt.isUnd(n[0].styleSheet.cssText)?n[0].styleSheet.cssText=e[1]:n.text(e[1])),i.themeTrigger(Lt.SaveSettingsStep.TrueResult))}).always(function(){i.iTimer=e.setTimeout(function(){i.themeTrigger(Lt.SaveSettingsStep.Idle)},1e3),i.oLastAjax=null})),jt.remote().saveSettings(null,{Theme:s})},this)}function ft(){this.openpgpkeys=jt.data().openpgpkeys,this.openpgpkeysPublic=jt.data().openpgpkeysPublic,this.openpgpkeysPrivate=jt.data().openpgpkeysPrivate,this.openPgpKeyForDeletion=s.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}function bt(){this.leftPanelDisabled=s.observable(!1),this.useKeyboardShortcuts=s.observable(!0),this.keyScopeReal=s.observable(Lt.KeyState.All),this.keyScopeFake=s.observable(Lt.KeyState.All),this.keyScope=s.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(e){Lt.KeyState.Menu!==e&&(Lt.KeyState.Compose===e?Mt.disableKeyFilter():Mt.restoreKeyFilter(),this.keyScopeFake(e),Ot.dropdownVisibility()&&(e=Lt.KeyState.Menu)),this.keyScopeReal(e)}}),this.keyScopeReal.subscribe(function(e){c.setScope(e)}),this.leftPanelDisabled.subscribe(function(e){jt.pub("left-panel."+(e?"off":"on"))}),Ot.dropdownVisibility.subscribe(function(e){e?(Ot.tooltipTrigger(!Ot.tooltipTrigger()),this.keyScope(Lt.KeyState.Menu)):Lt.KeyState.Menu===c.getScope()&&this.keyScope(this.keyScopeFake())
|
||
},this),Mt.initDataConstructorBySettings(this)}function yt(){bt.call(this);var i=function(e){return function(){var t=jt.cache().getFolderFromCacheList(e());t&&t.type(Lt.FolderType.User)}},o=function(e){return function(t){var s=jt.cache().getFolderFromCacheList(t);s&&s.type(e)}};this.devEmail="",this.devPassword="",this.accountEmail=s.observable(""),this.accountIncLogin=s.observable(""),this.accountOutLogin=s.observable(""),this.projectHash=s.observable(""),this.threading=s.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=s.observable(""),this.draftFolder=s.observable(""),this.spamFolder=s.observable(""),this.trashFolder=s.observable(""),this.archiveFolder=s.observable(""),this.sentFolder.subscribe(i(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(i(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(i(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(i(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(i(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(o(Lt.FolderType.SentItems),this),this.draftFolder.subscribe(o(Lt.FolderType.Draft),this),this.spamFolder.subscribe(o(Lt.FolderType.Spam),this),this.trashFolder.subscribe(o(Lt.FolderType.Trash),this),this.archiveFolder.subscribe(o(Lt.FolderType.Archive),this),this.draftFolderNotEnabled=s.computed(function(){return""===this.draftFolder()||It.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=s.observable(""),this.signature=s.observable(""),this.signatureToAll=s.observable(!1),this.replyTo=s.observable(""),this.enableTwoFactor=s.observable(!1),this.accounts=s.observableArray([]),this.accountsLoading=s.observable(!1).extend({throttle:100}),this.defaultIdentityID=s.observable(""),this.identities=s.observableArray([]),this.identitiesLoading=s.observable(!1).extend({throttle:100}),this.contactTags=s.observableArray([]),this.contacts=s.observableArray([]),this.contacts.loading=s.observable(!1).extend({throttle:200}),this.contacts.importing=s.observable(!1).extend({throttle:200}),this.contacts.syncing=s.observable(!1).extend({throttle:200}),this.contacts.exportingVcf=s.observable(!1).extend({throttle:200}),this.contacts.exportingCsv=s.observable(!1).extend({throttle:200}),this.allowContactsSync=s.observable(!1),this.enableContactsSync=s.observable(!1),this.contactsSyncUrl=s.observable(""),this.contactsSyncUser=s.observable(""),this.contactsSyncPass=s.observable(""),this.allowContactsSync=s.observable(!!jt.settingsGet("ContactsSyncIsAllowed")),this.enableContactsSync=s.observable(!!jt.settingsGet("EnableContactsSync")),this.contactsSyncUrl=s.observable(jt.settingsGet("ContactsSyncUrl")),this.contactsSyncUser=s.observable(jt.settingsGet("ContactsSyncUser")),this.contactsSyncPass=s.observable(jt.settingsGet("ContactsSyncPassword")),this.namespace="",this.folderList=s.observableArray([]),this.folderList.focused=s.observable(!1),this.foldersListError=s.observable(""),this.foldersLoading=s.observable(!1),this.foldersCreating=s.observable(!1),this.foldersDeleting=s.observable(!1),this.foldersRenaming=s.observable(!1),this.foldersChanging=s.computed(function(){var e=this.foldersLoading(),t=this.foldersCreating(),s=this.foldersDeleting(),i=this.foldersRenaming();return e||t||s||i},this),this.foldersInboxUnreadCount=s.observable(0),this.currentFolder=s.observable(null).extend({toggleSubscribe:[null,function(e){e&&e.selected(!1)},function(e){e&&e.selected(!0)}]}),this.currentFolderFullNameRaw=s.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=s.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=s.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=s.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=s.computed(function(){var e=["INBOX"],t=this.folderList(),s=this.sentFolder(),i=this.draftFolder(),o=this.spamFolder(),n=this.trashFolder(),a=this.archiveFolder();return Mt.isArray(t)&&0<t.length&&(""!==s&&It.Values.UnuseOptionValue!==s&&e.push(s),""!==i&&It.Values.UnuseOptionValue!==i&&e.push(i),""!==o&&It.Values.UnuseOptionValue!==o&&e.push(o),""!==n&&It.Values.UnuseOptionValue!==n&&e.push(n),""!==a&&It.Values.UnuseOptionValue!==a&&e.push(a)),e},this),this.folderListSystem=s.computed(function(){return r.compact(r.map(this.folderListSystemNames(),function(e){return jt.cache().getFolderFromCacheList(e)}))},this),this.folderMenuForMove=s.computed(function(){return jt.folderListOptionsBuilder(this.folderListSystem(),this.folderList(),[this.currentFolderFullNameRaw()],null,null,null,null,function(e){return e?e.localName():""})},this),this.staticMessageList=[],this.messageList=s.observableArray([]).extend({rateLimit:0}),this.messageListCount=s.observable(0),this.messageListSearch=s.observable(""),this.messageListPage=s.observable(1),this.messageListThreadFolder=s.observable(""),this.messageListThreadUids=s.observableArray([]),this.messageListThreadFolder.subscribe(function(){this.messageListThreadUids([])},this),this.messageListEndFolder=s.observable(""),this.messageListEndSearch=s.observable(""),this.messageListEndPage=s.observable(1),this.messageListEndHash=s.computed(function(){return this.messageListEndFolder()+"|"+this.messageListEndSearch()+"|"+this.messageListEndPage()},this),this.messageListPageCount=s.computed(function(){var e=Math.ceil(this.messageListCount()/this.messagesPerPage());return 0>=e?1:e},this),this.mainMessageListSearch=s.computed({read:this.messageListSearch,write:function(e){xt.setHash(jt.link().mailBox(this.currentFolderFullNameHash(),1,Mt.trim(e.toString())))},owner:this}),this.messageListError=s.observable(""),this.messageListLoading=s.observable(!1),this.messageListIsNotCompleted=s.observable(!1),this.messageListCompleteLoadingThrottle=s.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=s.computed(function(){var e=this.messageListLoading(),t=this.messageListIsNotCompleted();return e||t},this),this.messageListCompleteLoading.subscribe(function(e){this.messageListCompleteLoadingThrottle(e)},this),this.messageList.subscribe(r.debounce(function(e){r.each(e,function(e){e.newForAnimation()&&e.newForAnimation(!1)})},500)),this.staticMessageList=new E,this.message=s.observable(null),this.messageLoading=s.observable(!1),this.messageLoadingThrottle=s.observable(!1).extend({throttle:50}),this.message.focused=s.observable(!1),this.message.subscribe(function(t){t?Lt.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.messageFullScreenMode(!1),this.hideMessageBodies(),Lt.Layout.NoPreview===jt.data().layout()&&-1<e.location.hash.indexOf("message-preview")&&jt.historyBack())},this),this.message.focused.subscribe(function(e){e?(this.folderList.focused(!1),this.keyScope(Lt.KeyState.MessageView)):Lt.KeyState.MessageView===jt.data().keyScope()&&this.keyScope(Lt.Layout.NoPreview===jt.data().layout()&&this.message()?Lt.KeyState.MessageView:Lt.KeyState.MessageList)},this),this.folderList.focused.subscribe(function(e){e?jt.data().keyScope(Lt.KeyState.FolderList):Lt.KeyState.FolderList===jt.data().keyScope()&&jt.data().keyScope(Lt.KeyState.MessageList)}),this.messageLoading.subscribe(function(e){this.messageLoadingThrottle(e)},this),this.messageFullScreenMode=s.observable(!1),this.messageError=s.observable(""),this.messagesBodiesDom=s.observable(null),this.messagesBodiesDom.subscribe(function(e){!e||e instanceof jQuery||this.messagesBodiesDom(t(e))},this),this.messageActiveDom=s.observable(null),this.isMessageSelected=s.computed(function(){return null!==this.message()},this),this.currentMessage=s.observable(null),this.messageListChecked=s.computed(function(){return r.filter(this.messageList(),function(e){return e.checked()})},this).extend({rateLimit:0}),this.hasCheckedMessages=s.computed(function(){return 0<this.messageListChecked().length},this).extend({rateLimit:0}),this.messageListCheckedOrSelected=s.computed(function(){var e=this.messageListChecked(),t=this.currentMessage();return r.union(e,t?[t]:[])},this),this.messageListCheckedOrSelectedUidsWithSubMails=s.computed(function(){var e=[];return r.each(this.messageListCheckedOrSelected(),function(t){t&&(e.push(t.uid),0<t.threadsLen()&&0===t.parentUid()&&t.lastInCollapsedThread()&&(e=r.union(e,t.threads())))}),e},this),this.userQuota=s.observable(0),this.userUsageSize=s.observable(0),this.userUsageProc=s.computed(function(){var e=this.userQuota(),t=this.userUsageSize();return e>0?Math.ceil(t/e*100):0},this),this.capaOpenPGP=s.observable(!1),this.openpgpkeys=s.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(e){return!(!e||e.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(e){return!(!e||!e.isPrivate)}),this.googleActions=s.observable(!1),this.googleLoggined=s.observable(!1),this.googleUserName=s.observable(""),this.facebookActions=s.observable(!1),this.facebookLoggined=s.observable(!1),this.facebookUserName=s.observable(""),this.twitterActions=s.observable(!1),this.twitterLoggined=s.observable(!1),this.twitterUserName=s.observable(""),this.customThemeType=s.observable(Lt.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=r.throttle(this.purgeMessageBodyCache,3e4)}function St(){this.oRequests={}}function vt(){St.call(this),this.oRequests={}}function Ct(){this.bCapaGravatar=jt.capa(Lt.Capa.Gravatar)}function wt(){Ct.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function Tt(e){y.call(this,"settings",e),this.menu=s.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function Ft(){y.call(this,"login",[$])}function At(){y.call(this,"mailbox",[Q,et,tt,st]),this.oLastRoute={}}function Et(){Tt.call(this,[Z,it,ot]),Mt.initOnStartOrLangChange(function(){this.sSettingsTitle=Mt.i18n("TITLES/SETTINGS")},this,function(){jt.setTitle(this.sSettingsTitle)})}function Nt(){f.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=s.observableArray([]),this.popupVisibility=s.computed(function(){return 0<this.popupVisibilityNames().length},this),this.iframe=t('<iframe style="display:none" src="javascript:;" />').appendTo("body"),Gt.on("error",function(e){jt&&e&&e.originalEvent&&e.originalEvent.message&&-1===Mt.inArray(e.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&jt.remote().jsError(Mt.emptyFunction,e.originalEvent.message,e.originalEvent.filename,e.originalEvent.lineno,location&&location.toString?location.toString():"",Bt.attr("class"),Mt.microtime()-Ot.now)}),Kt.on("keydown",function(e){e&&e.ctrlKey&&Bt.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&Bt.removeClass("rl-ctrl-key-pressed")})}function Rt(){Nt.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=r.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=r.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=r.debounce(this.messagesMoveTrigger,500),e.setInterval(function(){jt.pub("interval.30s")},3e4),e.setInterval(function(){jt.pub("interval.1m")},6e4),e.setInterval(function(){jt.pub("interval.2m")},12e4),e.setInterval(function(){jt.pub("interval.3m")},18e4),e.setInterval(function(){jt.pub("interval.5m")},3e5),e.setInterval(function(){jt.pub("interval.10m")},6e5),e.setTimeout(function(){e.setInterval(function(){jt.pub("interval.10m-after5m")},6e5)},3e5),t.wakeUp(function(){jt.remote().jsVersion(function(t,s){Lt.StorageResultType.Success===t&&s&&!s.Result&&(e.parent&&jt.settingsGet("InIframe")?e.parent.location.reload():e.location.reload())},jt.settingsGet("Version"))},{},36e5)}var It={},Lt={},Pt={},Mt={},Dt={},kt={},Ot={},_t={settings:[],"settings-removed":[],"settings-disabled":[]},Ut=[],xt=null,Vt=e.rainloopAppData||{},Ht=e.rainloopI18N||{},Bt=t("html"),Gt=t(e),Kt=t(e.document),qt=e.Notification&&e.Notification.requestPermission?e.Notification:null,jt=null,zt=t("<div></div>");Ot.now=(new Date).getTime(),Ot.momentTrigger=s.observable(!0),Ot.dropdownVisibility=s.observable(!1).extend({rateLimit:0}),Ot.tooltipTrigger=s.observable(!1).extend({rateLimit:0}),Ot.langChangeTrigger=s.observable(!0),Ot.iAjaxErrorCount=0,Ot.iTokenErrorCount=0,Ot.iMessageBodyCacheCount=0,Ot.bUnload=!1,Ot.sUserAgent=(navigator.userAgent||"").toLowerCase(),Ot.bIsiOSDevice=-1<Ot.sUserAgent.indexOf("iphone")||-1<Ot.sUserAgent.indexOf("ipod")||-1<Ot.sUserAgent.indexOf("ipad"),Ot.bIsAndroidDevice=-1<Ot.sUserAgent.indexOf("android"),Ot.bMobileDevice=Ot.bIsiOSDevice||Ot.bIsAndroidDevice,Ot.bDisableNanoScroll=Ot.bMobileDevice,Ot.bAllowPdfPreview=!Ot.bMobileDevice,Ot.bAnimationSupported=!Ot.bMobileDevice&&Bt.hasClass("csstransitions"),Ot.bXMLHttpRequestSupported=!!e.XMLHttpRequest,Ot.sAnimationType="",Ot.oHtmlEditorDefaultConfig={title:!1,stylesSet:!1,customConfig:"",contentsCss:"",toolbarGroups:[{name:"spec"},{name:"styles"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"colors"},{name:"paragraph",groups:["list","indent","blocks","align"]},{name:"links"},{name:"insert"},{name:"others"}],removePlugins:"contextmenu",removeButtons:"Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll",removeDialogTabs:"link:advanced;link:target;image:advanced;images:advanced",extraPlugins:"plain",allowedContent:!0,autoParagraph:!1,font_defaultLabel:"Arial",fontSize_defaultLabel:"13",fontSize_sizes:"10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px"},Ot.oHtmlEditorLangsMap={de:"de",es:"es",fr:"fr",hu:"hu",is:"is",it:"it",ko:"ko","ko-kr":"ko",lv:"lv",nl:"nl",no:"no",pl:"pl",pt:"pt","pt-pt":"pt","pt-br":"pt-br",ru:"ru",ro:"ro",zh:"zh","zh-cn":"zh-cn"},Ot.bAllowPdfPreview&&navigator&&navigator.mimeTypes&&(Ot.bAllowPdfPreview=!!r.find(navigator.mimeTypes,function(e){return e&&"application/pdf"===e.type})),It.Defaults={},It.Values={},It.DataImages={},It.Defaults.MessagesPerPage=20,It.Defaults.ContactsPerPage=50,It.Defaults.MessagesPerPageArray=[10,20,30,50,100],It.Defaults.DefaultAjaxTimeout=3e4,It.Defaults.SearchAjaxTimeout=3e5,It.Defaults.SendMessageAjaxTimeout=3e5,It.Defaults.SaveMessageAjaxTimeout=2e5,It.Defaults.ContactsSyncAjaxTimeout=2e5,It.Values.UnuseOptionValue="__UNUSE__",It.Values.ClientSideCookieIndexName="rlcsc",It.Values.ImapDefaulPort=143,It.Values.ImapDefaulSecurePort=993,It.Values.SmtpDefaulPort=25,It.Values.SmtpDefaulSecurePort=465,It.Values.MessageBodyCacheLimit=15,It.Values.AjaxErrorLimit=7,It.Values.TokenErrorLimit=10,It.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",It.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",Lt.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},Lt.State={Empty:10,Login:20,Auth:30},Lt.StateType={Webmail:0,Admin:1},Lt.Capa={Prem:"PREM",TwoFactor:"TWO_FACTOR",OpenPGP:"OPEN_PGP",Prefetch:"PREFETCH",Gravatar:"GRAVATAR",Themes:"THEMES",Filters:"FILTERS",AdditionalAccounts:"ADDITIONAL_ACCOUNTS",AdditionalIdentities:"ADDITIONAL_IDENTITIES"},Lt.KeyState={All:"all",None:"none",ContactList:"contact-list",MessageList:"message-list",FolderList:"folder-list",MessageView:"message-view",Compose:"compose",Settings:"settings",Menu:"menu",PopupComposeOpenPGP:"compose-open-pgp",PopupKeyboardShortcutsHelp:"popup-keyboard-shortcuts-help",PopupAsk:"popup-ask"},Lt.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,Archive:15,NotSpam:80,User:99},Lt.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},Lt.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},Lt.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},Lt.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},Lt.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4,Archive:5},Lt.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},Lt.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,Space:32,Insert:45,Delete:46,A:65,S:83},Lt.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},Lt.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},Lt.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},Lt.MessagePriority={Low:5,Normal:3,High:1},Lt.EditorDefaultType={Html:"Html",Plain:"Plain"},Lt.CustomThemeType={Light:"Light",Dark:"Dark"},Lt.ServerSecure={None:0,SSL:1,TLS:2},Lt.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},Lt.EmailType={Defailt:0,Facebook:1,Google:2},Lt.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},Lt.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},Lt.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},Lt.FilterConditionField={From:"From",To:"To",Recipient:"Recipient",Subject:"Subject"},Lt.FilterConditionType={Contains:"Contains",NotContains:"NotContains",EqualTo:"EqualTo",NotEqualTo:"NotEqualTo"},Lt.FiltersAction={None:"None",Move:"Move",Discard:"Discard",Forward:"Forward"},Lt.FilterRulesType={And:"And",Or:"Or"},Lt.SignedVerifyStatus={UnknownPublicKeys:-4,UnknownPrivateKey:-3,Unverified:-2,Error:-1,None:0,Success:1},Lt.ContactPropertyType={Unknown:0,FullName:10,FirstName:15,LastName:16,MiddleName:16,Nick:18,NamePrefix:20,NameSuffix:21,Email:30,Phone:31,Web:32,Birthday:40,Facebook:90,Skype:91,GitHub:92,Note:110,Custom:250},Lt.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,AccountTwoFactorAuthRequired:120,AccountTwoFactorAuthError:121,CouldNotSaveNewPassword:130,CurrentPasswordIncorrect:131,NewPasswordShort:132,NewPasswordWeak:133,NewPasswordForbidden:134,ContactsSyncError:140,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,CantCopyMessage:205,CantSaveMessage:301,CantSendMessage:302,InvalidRecipients:303,CantCreateFolder:400,CantRenameFolder:401,CantDeleteFolder:402,CantSubscribeFolder:403,CantUnsubscribeFolder:404,CantDeleteNonEmptyFolder:405,CantSaveSettings:501,CantSavePluginSettings:502,DomainAlreadyExists:601,CantInstallPackage:701,CantDeletePackage:702,InvalidPluginPackage:703,UnsupportedPluginPackage:704,LicensingServerIsUnavailable:710,LicensingExpired:711,LicensingBanned:712,DemoSendMessageError:750,AccountAlreadyExists:801,MailServerError:901,ClientViewError:902,InvalidInputArgument:903,UnknownNotification:999,UnknownError:999},Mt.trim=t.trim,Mt.inArray=t.inArray,Mt.isArray=r.isArray,Mt.isFunc=r.isFunction,Mt.isUnd=r.isUndefined,Mt.isNull=r.isNull,Mt.emptyFunction=function(){},Mt.isNormal=function(e){return!Mt.isUnd(e)&&!Mt.isNull(e)},Mt.windowResize=r.debounce(function(t){Mt.isUnd(t)?Gt.resize():e.setTimeout(function(){Gt.resize()},t)},50),Mt.isPosNumeric=function(e,t){return Mt.isNormal(e)?(Mt.isUnd(t)?0:!t)?/^[1-9]+[0-9]*$/.test(e.toString()):/^[0-9]*$/.test(e.toString()):!1},Mt.pInt=function(t,s){var i=Mt.isNormal(t)&&""!==t?e.parseInt(t,10):s||0;return e.isNaN(i)?s||0:i},Mt.pString=function(e){return Mt.isNormal(e)?""+e:""},Mt.isNonEmptyArray=function(e){return Mt.isArray(e)&&0<e.length},Mt.simpleQueryParser=function(t){var s={},i=[],o=[],n=0,a=0;for(i=t.split("&"),n=0,a=i.length;a>n;n++)o=i[n].split("="),s[e.decodeURIComponent(o[0])]=e.decodeURIComponent(o[1]);return s},Mt.rsaEncode=function(t,s,i,o){if(e.crypto&&e.crypto.getRandomValues&&e.RSAKey&&s&&i&&o){var n=new e.RSAKey;if(n.setPublic(o,i),t=n.encrypt(Mt.fakeMd5()+":"+t+":"+Mt.fakeMd5()),!1!==t)return"rsa:"+s+":"+t}return!1},Mt.rsaEncode.supported=!!(e.crypto&&e.crypto.getRandomValues&&e.RSAKey),Mt.exportPath=function(t,s,i){for(var o=null,n=t.split("."),a=i||e;n.length&&(o=n.shift());)n.length||Mt.isUnd(s)?a=a[o]?a[o]:a[o]={}:a[o]=s},Mt.pImport=function(e,t,s){e[t]=s},Mt.pExport=function(e,t,s){return Mt.isUnd(e[t])?s:e[t]},Mt.encodeHtml=function(e){return Mt.isNormal(e)?e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},Mt.splitPlainText=function(e,t){var s="",i="",o=e,n=0,a=0;for(t=Mt.isUnd(t)?100:t;o.length>t;)i=o.substring(0,t),n=i.lastIndexOf(" "),a=i.lastIndexOf("\n"),-1!==a&&(n=a),-1===n&&(n=t),s+=i.substring(0,n)+"\n",o=o.substring(n+1);return s+o},Mt.timeOutAction=function(){var t={};return function(s,i,o){Mt.isUnd(t[s])&&(t[s]=0),e.clearTimeout(t[s]),t[s]=e.setTimeout(i,o)}}(),Mt.timeOutActionSecond=function(){var t={};return function(s,i,o){t[s]||(t[s]=e.setTimeout(function(){i(),t[s]=0},o))}}(),Mt.audio=function(){var t=!1;return function(s,i){if(!1===t)if(Ot.bIsiOSDevice)t=null;else{var o=!1,n=!1,a=e.Audio?new e.Audio:null;a&&a.canPlayType&&a.play?(o=""!==a.canPlayType('audio/mpeg; codecs="mp3"'),o||(n=""!==a.canPlayType('audio/ogg; codecs="vorbis"')),o||n?(t=a,t.preload="none",t.loop=!1,t.autoplay=!1,t.muted=!1,t.src=o?s:i):t=null):t=null}return t}}(),Mt.hos=function(e,t){return e&&Object.hasOwnProperty?Object.hasOwnProperty.call(e,t):!1},Mt.i18n=function(e,t,s){var i="",o=Mt.isUnd(Ht[e])?Mt.isUnd(s)?e:s:Ht[e];if(!Mt.isUnd(t)&&!Mt.isNull(t))for(i in t)Mt.hos(t,i)&&(o=o.replace("%"+i+"%",t[i]));return o},Mt.i18nToNode=function(e){r.defer(function(){t(".i18n",e).each(function(){var e=t(this),s="";s=e.data("i18n-text"),s?e.text(Mt.i18n(s)):(s=e.data("i18n-html"),s&&e.html(Mt.i18n(s)),s=e.data("i18n-placeholder"),s&&e.attr("placeholder",Mt.i18n(s)),s=e.data("i18n-title"),s&&e.attr("title",Mt.i18n(s)))})})},Mt.i18nToDoc=function(){e.rainloopI18N&&(Ht=e.rainloopI18N||{},Mt.i18nToNode(Kt),Ot.langChangeTrigger(!Ot.langChangeTrigger())),e.rainloopI18N={}},Mt.initOnStartOrLangChange=function(e,t,s){e&&e.call(t),s?Ot.langChangeTrigger.subscribe(function(){e&&e.call(t),s.call(t)}):e&&Ot.langChangeTrigger.subscribe(e,t)},Mt.inFocus=function(){return document.activeElement?(Mt.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=t(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},Mt.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var e=t(document.activeElement);e.is("input,textarea")&&document.activeElement.blur()}},Mt.removeSelection=function(){if(e&&e.getSelection){var t=e.getSelection();t&&t.removeAllRanges&&t.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},Mt.replySubjectAdd=function(e,t){e=Mt.trim(e.toUpperCase()),t=Mt.trim(t.replace(/[\s]+/," "));var s=0,i="",o=!1,n="",a=[],r=[],l="RE"===e,c="FWD"===e,u=!c;if(""!==t){for(o=!1,r=t.split(":"),s=0;s<r.length;s++)n=Mt.trim(r[s]),o||!/^(RE|FWD)$/i.test(n)&&!/^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(n)?(a.push(r[s]),o=!0):(l||(l=!!/^RE/i.test(n)),c||(c=!!/^FWD/i.test(n)));0<a.length&&(i=Mt.trim(a.join(":")))}return u?l=!1:c=!1,Mt.trim((u?"Re: ":"Fwd: ")+(l?"Re: ":"")+(c?"Fwd: ":"")+i)},Mt.fixLongSubject=function(e){var t=30,s=/^Re([\[\(]([\d]+)[\]\)]|):[\s]{0,3}Re([\[\(]([\d]+)[\]\)]|):/gi,i=null;e=Mt.trim(e.replace(/[\s]+/," "));do t--,i=s.exec(e),(!i||Mt.isUnd(i[0]))&&(i=null),i&&(e=e.replace(s,"Re:"));while(i||t>0);return e.replace(/[\s]+/," ")},Mt._replySubjectAdd_=function(t,s,i){var o=null,n=Mt.trim(s);return n=null===(o=new e.RegExp("^"+t+"[\\s]?\\:(.*)$","gi").exec(s))||Mt.isUnd(o[1])?null===(o=new e.RegExp("^("+t+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(s))||Mt.isUnd(o[1])||Mt.isUnd(o[2])||Mt.isUnd(o[3])?t+": "+s:o[1]+(Mt.pInt(o[2])+1)+o[3]:t+"[2]: "+o[1],n=n.replace(/[\s]+/g," "),n=(Mt.isUnd(i)?!0:i)?Mt.fixLongSubject(n):n},Mt._fixLongSubject_=function(e){var t=0,s=null;e=Mt.trim(e.replace(/[\s]+/," "));do s=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!s||Mt.isUnd(s[0]))&&(s=null),s&&(t=0,t+=Mt.isUnd(s[2])?1:0+Mt.pInt(s[2]),t+=Mt.isUnd(s[4])?1:0+Mt.pInt(s[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(s);return e=e.replace(/[\s]+/," ")},Mt.roundNumber=function(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)},Mt.friendlySize=function(e){return e=Mt.pInt(e),e>=1073741824?Mt.roundNumber(e/1073741824,1)+"GB":e>=1048576?Mt.roundNumber(e/1048576,1)+"MB":e>=1024?Mt.roundNumber(e/1024,0)+"KB":e+"B"},Mt.log=function(t){e.console&&e.console.log&&e.console.log(t)},Mt.getNotification=function(e,t){return e=Mt.pInt(e),Lt.Notification.ClientViewError===e&&t?t:Mt.isUnd(Pt[e])?"":Pt[e]},Mt.initNotificationLanguage=function(){Pt[Lt.Notification.InvalidToken]=Mt.i18n("NOTIFICATIONS/INVALID_TOKEN"),Pt[Lt.Notification.AuthError]=Mt.i18n("NOTIFICATIONS/AUTH_ERROR"),Pt[Lt.Notification.AccessError]=Mt.i18n("NOTIFICATIONS/ACCESS_ERROR"),Pt[Lt.Notification.ConnectionError]=Mt.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Pt[Lt.Notification.CaptchaError]=Mt.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Pt[Lt.Notification.SocialFacebookLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Pt[Lt.Notification.SocialTwitterLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Pt[Lt.Notification.SocialGoogleLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Pt[Lt.Notification.DomainNotAllowed]=Mt.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Pt[Lt.Notification.AccountNotAllowed]=Mt.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Pt[Lt.Notification.AccountTwoFactorAuthRequired]=Mt.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Pt[Lt.Notification.AccountTwoFactorAuthError]=Mt.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Pt[Lt.Notification.CouldNotSaveNewPassword]=Mt.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Pt[Lt.Notification.CurrentPasswordIncorrect]=Mt.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Pt[Lt.Notification.NewPasswordShort]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Pt[Lt.Notification.NewPasswordWeak]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Pt[Lt.Notification.NewPasswordForbidden]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Pt[Lt.Notification.ContactsSyncError]=Mt.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Pt[Lt.Notification.CantGetMessageList]=Mt.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Pt[Lt.Notification.CantGetMessage]=Mt.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Pt[Lt.Notification.CantDeleteMessage]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Pt[Lt.Notification.CantMoveMessage]=Mt.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Pt[Lt.Notification.CantCopyMessage]=Mt.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Pt[Lt.Notification.CantSaveMessage]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Pt[Lt.Notification.CantSendMessage]=Mt.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Pt[Lt.Notification.InvalidRecipients]=Mt.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Pt[Lt.Notification.CantCreateFolder]=Mt.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Pt[Lt.Notification.CantRenameFolder]=Mt.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Pt[Lt.Notification.CantDeleteFolder]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Pt[Lt.Notification.CantDeleteNonEmptyFolder]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Pt[Lt.Notification.CantSubscribeFolder]=Mt.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Pt[Lt.Notification.CantUnsubscribeFolder]=Mt.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Pt[Lt.Notification.CantSaveSettings]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Pt[Lt.Notification.CantSavePluginSettings]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Pt[Lt.Notification.DomainAlreadyExists]=Mt.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Pt[Lt.Notification.CantInstallPackage]=Mt.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Pt[Lt.Notification.CantDeletePackage]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Pt[Lt.Notification.InvalidPluginPackage]=Mt.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Pt[Lt.Notification.UnsupportedPluginPackage]=Mt.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Pt[Lt.Notification.LicensingServerIsUnavailable]=Mt.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Pt[Lt.Notification.LicensingExpired]=Mt.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Pt[Lt.Notification.LicensingBanned]=Mt.i18n("NOTIFICATIONS/LICENSING_BANNED"),Pt[Lt.Notification.DemoSendMessageError]=Mt.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Pt[Lt.Notification.AccountAlreadyExists]=Mt.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Pt[Lt.Notification.MailServerError]=Mt.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Pt[Lt.Notification.InvalidInputArgument]=Mt.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),Pt[Lt.Notification.UnknownNotification]=Mt.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Pt[Lt.Notification.UnknownError]=Mt.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Mt.getUploadErrorDescByCode=function(e){var t="";switch(Mt.pInt(e)){case Lt.UploadErrorCode.FileIsTooBig:t=Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Lt.UploadErrorCode.FilePartiallyUploaded:t=Mt.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Lt.UploadErrorCode.FileNoUploaded:t=Mt.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Lt.UploadErrorCode.MissingTempFolder:t=Mt.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Lt.UploadErrorCode.FileOnSaveingError:t=Mt.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Lt.UploadErrorCode.FileType:t=Mt.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=Mt.i18n("UPLOAD/ERROR_UNKNOWN")}return t},Mt.delegateRun=function(e,t,s,i){e&&e[t]&&(i=Mt.pInt(i),0>=i?e[t].apply(e,Mt.isArray(s)?s:[]):r.delay(function(){e[t].apply(e,Mt.isArray(s)?s:[])},i))},Mt.killCtrlAandS=function(t){if(t=t||e.event,t&&t.ctrlKey&&!t.shiftKey&&!t.altKey){var s=t.target||t.srcElement,i=t.keyCode||t.which;if(i===Lt.EventKeyCode.S)return void t.preventDefault();if(s&&s.tagName&&s.tagName.match(/INPUT|TEXTAREA/i))return;i===Lt.EventKeyCode.A&&(e.getSelection?e.getSelection().removeAllRanges():e.document.selection&&e.document.selection.clear&&e.document.selection.clear(),t.preventDefault())}},Mt.createCommand=function(e,t,i){var o=t?function(){return o.canExecute&&o.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=s.observable(!0),i=Mt.isUnd(i)?!0:i,o.canExecute=s.computed(Mt.isFunc(i)?function(){return o.enabled()&&i.call(e)}:function(){return o.enabled()&&!!i}),o},Mt.initDataConstructorBySettings=function(t){t.editorDefaultType=s.observable(Lt.EditorDefaultType.Html),t.showImages=s.observable(!1),t.interfaceAnimation=s.observable(Lt.InterfaceAnimation.Full),t.contactsAutosave=s.observable(!1),Ot.sAnimationType=Lt.InterfaceAnimation.Full,t.capaThemes=s.observable(!1),t.allowLanguagesOnSettings=s.observable(!0),t.allowLanguagesOnLogin=s.observable(!0),t.useLocalProxyForExternalImages=s.observable(!1),t.desktopNotifications=s.observable(!1),t.useThreads=s.observable(!0),t.replySameFolder=s.observable(!0),t.useCheckboxesInList=s.observable(!0),t.layout=s.observable(Lt.Layout.SidePreview),t.usePreviewPane=s.computed(function(){return Lt.Layout.NoPreview!==t.layout()}),t.interfaceAnimation.subscribe(function(e){if(Ot.bMobileDevice||e===Lt.InterfaceAnimation.None)Bt.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Ot.sAnimationType=Lt.InterfaceAnimation.None;else switch(e){case Lt.InterfaceAnimation.Full:Bt.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Ot.sAnimationType=e;break;case Lt.InterfaceAnimation.Normal:Bt.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Ot.sAnimationType=e
|
||
}}),t.interfaceAnimation.valueHasMutated(),t.desktopNotificationsPermisions=s.computed(function(){t.desktopNotifications();var s=Lt.DesktopNotifications.NotSupported;if(qt&&qt.permission)switch(qt.permission.toLowerCase()){case"granted":s=Lt.DesktopNotifications.Allowed;break;case"denied":s=Lt.DesktopNotifications.Denied;break;case"default":s=Lt.DesktopNotifications.NotAllowed}else e.webkitNotifications&&e.webkitNotifications.checkPermission&&(s=e.webkitNotifications.checkPermission());return s}),t.useDesktopNotifications=s.computed({read:function(){return t.desktopNotifications()&&Lt.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()},write:function(e){if(e){var s=t.desktopNotificationsPermisions();Lt.DesktopNotifications.Allowed===s?t.desktopNotifications(!0):Lt.DesktopNotifications.NotAllowed===s?qt.requestPermission(function(){t.desktopNotifications.valueHasMutated(),Lt.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()?t.desktopNotifications()?t.desktopNotifications.valueHasMutated():t.desktopNotifications(!0):t.desktopNotifications()?t.desktopNotifications(!1):t.desktopNotifications.valueHasMutated()}):t.desktopNotifications(!1)}else t.desktopNotifications(!1)}}),t.language=s.observable(""),t.languages=s.observableArray([]),t.mainLanguage=s.computed({read:t.language,write:function(e){e!==t.language()?-1<Mt.inArray(e,t.languages())?t.language(e):0<t.languages().length&&t.language(t.languages()[0]):t.language.valueHasMutated()}}),t.theme=s.observable(""),t.themes=s.observableArray([]),t.mainTheme=s.computed({read:t.theme,write:function(e){if(e!==t.theme()){var s=t.themes();-1<Mt.inArray(e,s)?t.theme(e):0<s.length&&t.theme(s[0])}else t.theme.valueHasMutated()}}),t.capaAdditionalAccounts=s.observable(!1),t.capaAdditionalIdentities=s.observable(!1),t.capaGravatar=s.observable(!1),t.determineUserLanguage=s.observable(!1),t.determineUserDomain=s.observable(!1),t.messagesPerPage=s.observable(It.Defaults.MessagesPerPage),t.mainMessagesPerPage=t.messagesPerPage,t.mainMessagesPerPage=s.computed({read:t.messagesPerPage,write:function(e){-1<Mt.inArray(Mt.pInt(e),It.Defaults.MessagesPerPageArray)?e!==t.messagesPerPage()&&t.messagesPerPage(e):t.messagesPerPage.valueHasMutated()}}),t.facebookSupported=s.observable(!1),t.facebookEnable=s.observable(!1),t.facebookAppID=s.observable(""),t.facebookAppSecret=s.observable(""),t.twitterEnable=s.observable(!1),t.twitterConsumerKey=s.observable(""),t.twitterConsumerSecret=s.observable(""),t.googleEnable=s.observable(!1),t.googleClientID=s.observable(""),t.googleClientSecret=s.observable(""),t.googleApiKey=s.observable(""),t.dropboxEnable=s.observable(!1),t.dropboxApiKey=s.observable(""),t.contactsIsAllowed=s.observable(!1)},Mt.createMomentDate=function(e){return Mt.isUnd(e.moment)&&(e.moment=s.observable(n())),s.computed(function(){Ot.momentTrigger();var e=this.moment();return 1970===e.year()?"":e.fromNow()},e)},Mt.createMomentShortDate=function(e){return s.computed(function(){var e="",t=n(),s=this.moment(),i=this.momentDate();return e=1970===s.year()?"":4>=t.diff(s,"hours")?i:t.format("L")===s.format("L")?Mt.i18n("MESSAGE_LIST/TODAY_AT",{TIME:s.format("LT")}):t.clone().subtract("days",1).format("L")===s.format("L")?Mt.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:s.format("LT")}):s.format(t.year()===s.year()?"D MMM.":"LL")},e)},Mt.isFolderExpanded=function(e){var t=jt.local().get(Lt.ClientSideKeyName.ExpandedFolders);return r.isArray(t)&&-1!==r.indexOf(t,e)},Mt.setExpandedFolder=function(e,t){var s=jt.local().get(Lt.ClientSideKeyName.ExpandedFolders);r.isArray(s)||(s=[]),t?(s.push(e),s=r.uniq(s)):s=r.without(s,e),jt.local().set(Lt.ClientSideKeyName.ExpandedFolders,s)},Mt.initLayoutResizer=function(e,s,i){var o=60,n=155,a=t(e),r=t(s),l=jt.local().get(i)||null,c=function(e){e&&(a.css({width:""+e+"px"}),r.css({left:""+e+"px"}))},u=function(e){if(e)a.resizable("disable"),c(o);else{a.resizable("enable");var t=Mt.pInt(jt.local().get(i))||n;c(t>n?t:n)}},d=function(e,t){t&&t.size&&t.size.width&&(jt.local().set(i,t.size.width),r.css({left:""+t.size.width+"px"}))};null!==l&&c(l>n?l:n),a.resizable({helper:"ui-resizable-helper",minWidth:n,maxWidth:350,handles:"e",stop:d}),jt.sub("left-panel.off",function(){u(!0)}),jt.sub("left-panel.on",function(){u(!1)})},Mt.initBlockquoteSwitcher=function(e){if(e){var s=t("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===t(this).parent().closest("blockquote",e).length});s&&0<s.length&&s.each(function(){var e=t(this),s=e.height();(0===s||s>100)&&(e.addClass("rl-bq-switcher hidden-bq"),t('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),Mt.windowResize()}).after("<br />").before("<br />"))})}},Mt.removeBlockquoteSwitcher=function(e){e&&(t(e).find("blockquote.rl-bq-switcher").each(function(){t(this).removeClass("rl-bq-switcher hidden-bq")}),t(e).find(".rlBlockquoteSwitcher").each(function(){t(this).remove()}))},Mt.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},Mt.extendAsViewModel=function(e,t,s){t&&(s||(s=b),t.__name=e,Dt.regViewModelHook(e,t),r.extend(t.prototype,s.prototype))},Mt.addSettingsViewModel=function(e,t,s,i,o){e.__rlSettingsData={Label:s,Template:t,Route:i,IsDefault:!!o},_t.settings.push(e)},Mt.removeSettingsViewModel=function(e){_t["settings-removed"].push(e)},Mt.disableSettingsViewModel=function(e){_t["settings-disabled"].push(e)},Mt.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=Mt.trim(e.substring(0,e.length-7))),Mt.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Mt.quoteName=function(e){return e.replace(/["]/g,'\\"')},Mt.microtime=function(){return(new Date).getTime()},Mt.convertLangName=function(e,t){return Mt.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},Mt.fakeMd5=function(e){var t="",s="0123456789abcdefghijklmnopqrstuvwxyz";for(e=Mt.isUnd(e)?32:Mt.pInt(e);t.length<e;)t+=s.substr(Math.round(Math.random()*s.length),1);return t},Mt.md5=function(e){function t(e,t){return e<<t|e>>>32-t}function s(e,t){var s,i,o,n,a;return o=2147483648&e,n=2147483648&t,s=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t),s&i?2147483648^a^o^n:s|i?1073741824&a?3221225472^a^o^n:1073741824^a^o^n:a^o^n}function i(e,t,s){return e&t|~e&s}function o(e,t,s){return e&s|t&~s}function n(e,t,s){return e^t^s}function a(e,t,s){return t^(e|~s)}function r(e,o,n,a,r,l,c){return e=s(e,s(s(i(o,n,a),r),c)),s(t(e,l),o)}function l(e,i,n,a,r,l,c){return e=s(e,s(s(o(i,n,a),r),c)),s(t(e,l),i)}function c(e,i,o,a,r,l,c){return e=s(e,s(s(n(i,o,a),r),c)),s(t(e,l),i)}function u(e,i,o,n,r,l,c){return e=s(e,s(s(a(i,o,n),r),c)),s(t(e,l),i)}function d(e){for(var t,s=e.length,i=s+8,o=(i-i%64)/64,n=16*(o+1),a=Array(n-1),r=0,l=0;s>l;)t=(l-l%4)/4,r=l%4*8,a[t]=a[t]|e.charCodeAt(l)<<r,l++;return t=(l-l%4)/4,r=l%4*8,a[t]=a[t]|128<<r,a[n-2]=s<<3,a[n-1]=s>>>29,a}function h(e){var t,s,i="",o="";for(s=0;3>=s;s++)t=e>>>8*s&255,o="0"+t.toString(16),i+=o.substr(o.length-2,2);return i}function p(e){e=e.replace(/rn/g,"n");for(var t="",s=0;s<e.length;s++){var i=e.charCodeAt(s);128>i?t+=String.fromCharCode(i):i>127&&2048>i?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t}var m,g,f,b,y,S,v,C,w,T=Array(),F=7,A=12,E=17,N=22,R=5,I=9,L=14,P=20,M=4,D=11,k=16,O=23,_=6,U=10,x=15,V=21;for(e=p(e),T=d(e),S=1732584193,v=4023233417,C=2562383102,w=271733878,m=0;m<T.length;m+=16)g=S,f=v,b=C,y=w,S=r(S,v,C,w,T[m+0],F,3614090360),w=r(w,S,v,C,T[m+1],A,3905402710),C=r(C,w,S,v,T[m+2],E,606105819),v=r(v,C,w,S,T[m+3],N,3250441966),S=r(S,v,C,w,T[m+4],F,4118548399),w=r(w,S,v,C,T[m+5],A,1200080426),C=r(C,w,S,v,T[m+6],E,2821735955),v=r(v,C,w,S,T[m+7],N,4249261313),S=r(S,v,C,w,T[m+8],F,1770035416),w=r(w,S,v,C,T[m+9],A,2336552879),C=r(C,w,S,v,T[m+10],E,4294925233),v=r(v,C,w,S,T[m+11],N,2304563134),S=r(S,v,C,w,T[m+12],F,1804603682),w=r(w,S,v,C,T[m+13],A,4254626195),C=r(C,w,S,v,T[m+14],E,2792965006),v=r(v,C,w,S,T[m+15],N,1236535329),S=l(S,v,C,w,T[m+1],R,4129170786),w=l(w,S,v,C,T[m+6],I,3225465664),C=l(C,w,S,v,T[m+11],L,643717713),v=l(v,C,w,S,T[m+0],P,3921069994),S=l(S,v,C,w,T[m+5],R,3593408605),w=l(w,S,v,C,T[m+10],I,38016083),C=l(C,w,S,v,T[m+15],L,3634488961),v=l(v,C,w,S,T[m+4],P,3889429448),S=l(S,v,C,w,T[m+9],R,568446438),w=l(w,S,v,C,T[m+14],I,3275163606),C=l(C,w,S,v,T[m+3],L,4107603335),v=l(v,C,w,S,T[m+8],P,1163531501),S=l(S,v,C,w,T[m+13],R,2850285829),w=l(w,S,v,C,T[m+2],I,4243563512),C=l(C,w,S,v,T[m+7],L,1735328473),v=l(v,C,w,S,T[m+12],P,2368359562),S=c(S,v,C,w,T[m+5],M,4294588738),w=c(w,S,v,C,T[m+8],D,2272392833),C=c(C,w,S,v,T[m+11],k,1839030562),v=c(v,C,w,S,T[m+14],O,4259657740),S=c(S,v,C,w,T[m+1],M,2763975236),w=c(w,S,v,C,T[m+4],D,1272893353),C=c(C,w,S,v,T[m+7],k,4139469664),v=c(v,C,w,S,T[m+10],O,3200236656),S=c(S,v,C,w,T[m+13],M,681279174),w=c(w,S,v,C,T[m+0],D,3936430074),C=c(C,w,S,v,T[m+3],k,3572445317),v=c(v,C,w,S,T[m+6],O,76029189),S=c(S,v,C,w,T[m+9],M,3654602809),w=c(w,S,v,C,T[m+12],D,3873151461),C=c(C,w,S,v,T[m+15],k,530742520),v=c(v,C,w,S,T[m+2],O,3299628645),S=u(S,v,C,w,T[m+0],_,4096336452),w=u(w,S,v,C,T[m+7],U,1126891415),C=u(C,w,S,v,T[m+14],x,2878612391),v=u(v,C,w,S,T[m+5],V,4237533241),S=u(S,v,C,w,T[m+12],_,1700485571),w=u(w,S,v,C,T[m+3],U,2399980690),C=u(C,w,S,v,T[m+10],x,4293915773),v=u(v,C,w,S,T[m+1],V,2240044497),S=u(S,v,C,w,T[m+8],_,1873313359),w=u(w,S,v,C,T[m+15],U,4264355552),C=u(C,w,S,v,T[m+6],x,2734768916),v=u(v,C,w,S,T[m+13],V,1309151649),S=u(S,v,C,w,T[m+4],_,4149444226),w=u(w,S,v,C,T[m+11],U,3174756917),C=u(C,w,S,v,T[m+2],x,718787259),v=u(v,C,w,S,T[m+9],V,3951481745),S=s(S,g),v=s(v,f),C=s(C,b),w=s(w,y);var H=h(S)+h(v)+h(C)+h(w);return H.toLowerCase()},Mt.convertPlainTextToHtml=function(e){return e.toString().replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\r/g,"").replace(/\n/g,"<br />")},Mt.draggeblePlace=function(){return t('<div class="draggablePlace"><span class="text"></span> <i class="icon-copy icon-white visible-on-ctrl"></i><i class="icon-mail icon-white hidden-on-ctrl"></i></div>').appendTo("#rl-hidden")},Mt.defautOptionsAfterRender=function(e,s){s&&!Mt.isUnd(s.disabled)&&e&&t(e).toggleClass("disabled",s.disabled).prop("disabled",s.disabled)},Mt.windowPopupKnockout=function(s,i,o,n){var a=null,r=e.open(""),l="__OpenerApplyBindingsUid"+Mt.fakeMd5()+"__",c=t("#"+i);e[l]=function(){if(r&&r.document.body&&c&&c[0]){var i=t(r.document.body);t("#rl-content",i).html(c.html()),t("html",r.document).addClass("external "+t("html").attr("class")),Mt.i18nToNode(i),S.prototype.applyExternal(s,t("#rl-content",i)[0]),e[l]=null,n(r)}},r.document.open(),r.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>'+Mt.encodeHtml(o)+'</title></head><body><div id="rl-content"></div></body></html>'),r.document.close(),a=r.document.createElement("script"),a.type="text/javascript",a.innerHTML="if(window&&window.opener&&window.opener['"+l+"']){window.opener['"+l+"']();window.opener['"+l+"']=null}",r.document.getElementsByTagName("head")[0].appendChild(a)},Mt.settingsSaveHelperFunction=function(e,t,s,i){return s=s||null,i=Mt.isUnd(i)?1e3:Mt.pInt(i),function(o,n,a,l,c){t.call(s,n&&n.Result?Lt.SaveSettingsStep.TrueResult:Lt.SaveSettingsStep.FalseResult),e&&e.call(s,o,n,a,l,c),r.delay(function(){t.call(s,Lt.SaveSettingsStep.Idle)},i)}},Mt.settingsSaveHelperSimpleFunction=function(e,t){return Mt.settingsSaveHelperFunction(null,e,t,1e3)},Mt.$div=t("<div></div>"),Mt.htmlToPlain=function(e){var s=0,i=0,o=0,n=0,a=0,r="",l=function(e){for(var t=100,s="",i="",o=e,n=0,a=0;o.length>t;)i=o.substring(0,t),n=i.lastIndexOf(" "),a=i.lastIndexOf("\n"),-1!==a&&(n=a),-1===n&&(n=t),s+=i.substring(0,n)+"\n",o=o.substring(n+1);return s+o},c=function(e){return e=l(t.trim(e)),e="> "+e.replace(/\n/gm,"\n> "),e.replace(/(^|\n)([> ]+)/gm,function(){return arguments&&2<arguments.length?arguments[1]+t.trim(arguments[2].replace(/[\s]/,""))+" ":""})},u=function(){if(arguments&&1<arguments.length){var e=t.trim(arguments[1]);return 0<e.length&&(e=e.replace(/<div[^>]*>([\s\S\r\n]*)<\/div>/gim,u),e="\n"+t.trim(e)+"\n"),e}return""},d=function(){return arguments&&1<arguments.length?arguments[1].toString().replace(/[\n]/gm,"<br />"):""},h=function(){return arguments&&1<arguments.length?""+arguments[1]+arguments[2].replace(/</g,"<").replace(/>/g,">"):""},p=function(){return arguments&&1<arguments.length?t.trim(arguments[1]):""};for(r=e.replace(/<pre[^>]*>([\s\S\r\n]*)<\/pre>/gim,d).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,h).replace(/<br[^>]*>/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(/<div[^>]*>([\s\S\r\n]*)<\/div>/gim,u).replace(/<blockquote[^>]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/<a [^>]*>([\s\S\r\n]*?)<\/a>/gim,p).replace(/<\/div>/gi,"\n").replace(/ /gi," ").replace(/"/gi,'"').replace(/<[^>]*>/gm,""),r=Mt.$div.html(r).text(),r=r.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&"),s=0,a=100;a>0&&(a--,i=r.indexOf("__bq__start__",s),i>-1);)o=r.indexOf("__bq__start__",i+5),n=r.indexOf("__bq__end__",i+5),(-1===o||o>n)&&n>i?(r=r.substring(0,i)+c(r.substring(i+13,n))+r.substring(n+11),s=0):s=o>-1&&n>o?o-1:0;return r=r.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Mt.plainToHtml=function(e,t){e=e.toString().replace(/\r/g,"");var s=!1,i=!0,o=!0,n=[],a="",r=0,l=e.split("\n");do{for(i=!1,n=[],r=0;r<l.length;r++)a=l[r],o=">"===a.substr(0,1),o&&!s?(i=!0,s=!0,n.push("~~~blockquote~~~"),n.push(a.substr(1))):!o&&s?(s=!1,n.push("~~~/blockquote~~~"),n.push(a)):n.push(o&&s?a.substr(1):a);s&&(s=!1,n.push("~~~/blockquote~~~")),l=n}while(i);return e=l.join("\n"),e=e.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/~~~blockquote~~~[\s]*/g,"<blockquote>").replace(/[\s]*~~~\/blockquote~~~/g,"</blockquote>").replace(/[\-_~]{10,}/g,"<hr />").replace(/\n/g,"<br />"),t?Mt.linkify(e):e},e.rainloop_Utils_htmlToPlain=Mt.htmlToPlain,e.rainloop_Utils_plainToHtml=Mt.plainToHtml,Mt.linkify=function(e){return t.fn&&t.fn.linkify&&(e=Mt.$div.html(e.replace(/&/gi,"amp_amp_12345_amp_amp")).linkify().find(".linkified").removeClass("linkified").end().html().replace(/amp_amp_12345_amp_amp/g,"&")),e},Mt.resizeAndCrop=function(t,s,i){var o=new e.Image;o.onload=function(){var e=[0,0],t=document.createElement("canvas"),o=t.getContext("2d");t.width=s,t.height=s,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],o.fillStyle="#fff",o.fillRect(0,0,s,s),o.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,s,s),i(t.toDataURL("image/jpeg"))},o.src=t},Mt.computedPagenatorHelper=function(e,t){return function(){var s=0,i=0,o=2,n=[],a=e(),r=t(),l=function(e,t,s){var i={current:e===a,name:Mt.isUnd(s)?e.toString():s.toString(),custom:Mt.isUnd(s)?!1:!0,title:Mt.isUnd(s)?"":e.toString(),value:e.toString()};(Mt.isUnd(t)?0:!t)?n.unshift(i):n.push(i)};if(r>1||r>0&&a>r){for(a>r?(l(r),s=r,i=r):((3>=a||a>=r-2)&&(o+=2),l(a),s=a,i=a);o>0;)if(s-=1,i+=1,s>0&&(l(s,!1),o--),r>=i)l(i,!0),o--;else if(0>=s)break;3===s?l(2,!1):s>3&&l(Math.round((s-1)/2),!1,"..."),r-2===i?l(r-1,!0):r-2>i&&l(Math.round((r+i)/2),!0,"..."),s>1&&l(1,!1),r>i&&l(r,!0)}return n}},Mt.selectElement=function(t){if(e.getSelection){var s=e.getSelection();s.removeAllRanges();var i=document.createRange();i.selectNodeContents(t),s.addRange(i)}else if(document.selection){var o=document.body.createTextRange();o.moveToElementText(t),o.select()}},Mt.disableKeyFilter=function(){e.key&&(c.filter=function(){return jt.data().useKeyboardShortcuts()})},Mt.restoreKeyFilter=function(){e.key&&(c.filter=function(e){if(jt.data().useKeyboardShortcuts()){var t=e.target||e.srcElement,s=t?t.tagName:"";return s=s.toUpperCase(),!("INPUT"===s||"SELECT"===s||"TEXTAREA"===s||t&&"DIV"===s&&"editorHtmlArea"===t.className&&t.contentEditable)}return!1})},Mt.detectDropdownVisibility=r.debounce(function(){Ot.dropdownVisibility(!!r.find(Ut,function(e){return e.hasClass("open")}))},50),Mt.triggerAutocompleteInputChange=function(e){var s=function(){t(".checkAutocomplete").trigger("change")};e?r.delay(s,100):s()},kt={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return kt.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=kt._utf8_encode(e);c<e.length;)t=e.charCodeAt(c++),s=e.charCodeAt(c++),i=e.charCodeAt(c++),o=t>>2,n=(3&t)<<4|s>>4,a=(15&s)<<2|i>>6,r=63&i,isNaN(s)?a=r=64:isNaN(i)&&(r=64),l=l+this._keyStr.charAt(o)+this._keyStr.charAt(n)+this._keyStr.charAt(a)+this._keyStr.charAt(r);return l},decode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<e.length;)o=this._keyStr.indexOf(e.charAt(c++)),n=this._keyStr.indexOf(e.charAt(c++)),a=this._keyStr.indexOf(e.charAt(c++)),r=this._keyStr.indexOf(e.charAt(c++)),t=o<<2|n>>4,s=(15&n)<<4|a>>2,i=(3&a)<<6|r,l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(s)),64!==r&&(l+=String.fromCharCode(i));return kt._utf8_decode(l)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",s=0,i=e.length,o=0;i>s;s++)o=e.charCodeAt(s),128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128));return t},_utf8_decode:function(e){for(var t="",s=0,i=0,o=0,n=0;s<e.length;)i=e.charCodeAt(s),128>i?(t+=String.fromCharCode(i),s++):i>191&&224>i?(o=e.charCodeAt(s+1),t+=String.fromCharCode((31&i)<<6|63&o),s+=2):(o=e.charCodeAt(s+1),n=e.charCodeAt(s+2),t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&n),s+=3);return t}},s.bindingHandlers.tooltip={init:function(e,i){if(!Ot.bMobileDevice){var o=t(e),n=o.data("tooltip-class")||"",a=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:a,trigger:"hover",title:function(){return o.is(".disabled")||Ot.dropdownVisibility()?"":'<span class="tooltip-class '+n+'">'+Mt.i18n(s.utils.unwrapObservable(i()))+"</span>"}}).click(function(){o.tooltip("hide")}),Ot.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}}},s.bindingHandlers.tooltip2={init:function(e,s){var i=t(e),o=i.data("tooltip-class")||"",n=i.data("tooltip-placement")||"top";i.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:n,title:function(){return i.is(".disabled")||Ot.dropdownVisibility()?"":'<span class="tooltip-class '+o+'">'+s()()+"</span>"}}).click(function(){i.tooltip("hide")}),Ot.tooltipTrigger.subscribe(function(){i.tooltip("hide")})}},s.bindingHandlers.tooltip3={init:function(e){var s=t(e);s.tooltip({container:"body",trigger:"hover manual",title:function(){return s.data("tooltip3-data")||""}}),Kt.click(function(){s.tooltip("hide")}),Ot.tooltipTrigger.subscribe(function(){s.tooltip("hide")})},update:function(e,i){var o=s.utils.unwrapObservable(i());""===o?t(e).data("tooltip3-data","").tooltip("hide"):t(e).data("tooltip3-data",o).tooltip("show")}},s.bindingHandlers.registrateBootstrapDropdown={init:function(e){Ut.push(t(e))}},s.bindingHandlers.openDropdownTrigger={update:function(e,i){if(s.utils.unwrapObservable(i())){var o=t(e);o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),Mt.detectDropdownVisibility()),i()(!1)}}},s.bindingHandlers.dropdownCloser={init:function(e){t(e).closest(".dropdown").on("click",".e-item",function(){t(e).dropdown("toggle")})}},s.bindingHandlers.popover={init:function(e,i){t(e).popover(s.utils.unwrapObservable(i()))}},s.bindingHandlers.csstext={init:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))},update:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.resizecrop={init:function(e){t(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,s){s()(),t(e).resizecrop({width:"100",height:"100"})}},s.bindingHandlers.onEnter={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&13===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.onEsc={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&27===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.clickOnTrue={update:function(e,i){s.utils.unwrapObservable(i())&&t(e).click()}},s.bindingHandlers.modal={init:function(e,i){t(e).toggleClass("fade",!Ot.bMobileDevice).modal({keyboard:!1,show:s.utils.unwrapObservable(i())}).on("shown",function(){Mt.windowResize()}).find(".close").click(function(){i()(!1)})},update:function(e,i){t(e).modal(s.utils.unwrapObservable(i())?"show":"hide")}},s.bindingHandlers.i18nInit={init:function(e){Mt.i18nToNode(e)}},s.bindingHandlers.i18nUpdate={update:function(e,t){s.utils.unwrapObservable(t()),Mt.i18nToNode(e)}},s.bindingHandlers.link={update:function(e,i){t(e).attr("href",s.utils.unwrapObservable(i()))}},s.bindingHandlers.title={update:function(e,i){t(e).attr("title",s.utils.unwrapObservable(i()))}},s.bindingHandlers.textF={init:function(e,i){t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.initDom={init:function(e,t){t()(e)}},s.bindingHandlers.initResizeTrigger={init:function(e,i){var o=s.utils.unwrapObservable(i());t(e).css({height:o[1],"min-height":o[1]})},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=Mt.pInt(o[1]),a=0,r=t(e).offset().top;r>0&&(r+=Mt.pInt(o[2]),a=Gt.height()-r,a>n&&(n=a),t(e).css({height:n,"min-height":n}))}},s.bindingHandlers.appendDom={update:function(e,i){t(e).hide().empty().append(s.utils.unwrapObservable(i())).show()}},s.bindingHandlers.draggable={init:function(i,o,n){if(!Ot.bMobileDevice){var a=100,r=3,l=n(),c=l&&l.droppableSelector?l.droppableSelector:"",u={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};c&&(u.drag=function(s){t(c).each(function(){var i=null,o=null,n=t(this),l=n.offset(),c=l.top+n.height();e.clearInterval(n.data("timerScroll")),n.data("timerScroll",!1),s.pageX>=l.left&&s.pageX<=l.left+n.width()&&(s.pageY>=c-a&&s.pageY<=c&&(i=function(){n.scrollTop(n.scrollTop()+r),Mt.windowResize()},n.data("timerScroll",e.setInterval(i,10)),i()),s.pageY>=l.top&&s.pageY<=l.top+a&&(o=function(){n.scrollTop(n.scrollTop()-r),Mt.windowResize()},n.data("timerScroll",e.setInterval(o,10)),o()))})},u.stop=function(){t(c).each(function(){e.clearInterval(t(this).data("timerScroll")),t(this).data("timerScroll",!1)})}),u.helper=function(e){return o()(e&&e.target?s.dataFor(e.target):null)},t(i).draggable(u).on("mousedown",function(){Mt.removeInFocus()})}}},s.bindingHandlers.droppable={init:function(e,s,i){if(!Ot.bMobileDevice){var o=s(),n=i(),a=n&&n.droppableOver?n.droppableOver:null,r=n&&n.droppableOut?n.droppableOut:null,l={tolerance:"pointer",hoverClass:"droppableHover"};o&&(l.drop=function(e,t){o(e,t)},a&&(l.over=function(e,t){a(e,t)}),r&&(l.out=function(e,t){r(e,t)}),t(e).droppable(l))}}},s.bindingHandlers.nano={init:function(e){Ot.bDisableNanoScroll||t(e).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},s.bindingHandlers.saveTrigger={init:function(e){var s=t(e);s.data("save-trigger-type",s.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===s.data("save-trigger-type")?s.append(' <i class="icon-spinner animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>').addClass("settings-saved-trigger"):s.addClass("settings-saved-trigger-input")},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=t(e);if("custom"===n.data("save-trigger-type"))switch(o.toString()){case"1":n.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":n.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":n.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:n.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(o.toString()){case"1":n.addClass("success").removeClass("error");break;case"0":n.addClass("error").removeClass("success");break;case"-2":break;default:n.removeClass("error success")}}},s.bindingHandlers.emailsTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:n,inputDelimiters:[",",";"],autoCompleteSource:function(e,t){jt.getAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new v,s.mailsoParse(t),s.clearDuplicateName(),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("EmailsTagsValue",e.target.value),o(e.target.value)},this)})},update:function(e,i,o){var n=t(e),a=o(),r=a.emailsTagsFilter||null,l=s.utils.unwrapObservable(i());n.data("EmailsTagsValue")!==l&&(n.val(l),n.data("EmailsTagsValue",l),n.inputosaurus("refresh")),r&&s.utils.unwrapObservable(r)&&n.inputosaurus("focus")}},s.bindingHandlers.contactTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:n,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(e,t){jt.getContactTagsAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new T,s.name(t),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("ContactTagsValue",e.target.value),o(e.target.value)},this)})},update:function(e,i,o){var n=t(e),a=o(),r=a.contactTagsFilter||null,l=s.utils.unwrapObservable(i());n.data("ContactTagsValue")!==l&&(n.val(l),n.data("ContactTagsValue",l),n.inputosaurus("refresh")),r&&s.utils.unwrapObservable(r)&&n.inputosaurus("focus")}},s.bindingHandlers.command={init:function(e,i,o,n){var a=t(e),r=i();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");a.addClass("command"),s.bindingHandlers[a.is("form")?"submit":"click"].init.apply(n,arguments)},update:function(e,s){var i=!0,o=t(e),n=s();i=n.enabled(),o.toggleClass("command-not-enabled",!i),i&&(i=n.canExecute(),o.toggleClass("command-can-not-be-execute",!i)),o.toggleClass("command-disabled disable disabled",!i).toggleClass("no-disabled",!!i),(o.is("input")||o.is("button"))&&o.prop("disabled",!i)}},s.extenders.trimmer=function(e){var t=s.computed({read:e,write:function(t){e(Mt.trim(t.toString()))},owner:this});return t(e()),t},s.extenders.posInterer=function(e,t){var i=s.computed({read:e,write:function(s){var i=Mt.pInt(s.toString(),t);0>=i&&(i=t),i===e()&&""+i!=""+s&&e(i+1),e(i)}});return i(e()),i},s.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},s.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},s.extenders.falseTimeout=function(t,s){return t.iTimeout=0,t.subscribe(function(i){i&&(e.clearTimeout(t.iTimeout),t.iTimeout=e.setTimeout(function(){t(!1),t.iTimeout=0},Mt.pInt(s)))}),t},s.observable.fn.validateNone=function(){return this.hasError=s.observable(!1),this},s.observable.fn.validateEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateSimpleEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateFunc=function(e){return this.hasFuncError=s.observable(!1),Mt.isFunc(e)&&(this.subscribe(function(t){this.hasFuncError(!e(t))},this),this.valueHasMutated()),this},u.prototype.root=function(){return this.sBase},u.prototype.attachmentDownload=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.attachmentPreview=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+e},u.prototype.attachmentPreviewAsPlain=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},u.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},u.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},u.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},u.prototype.change=function(t){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+e.encodeURIComponent(t)+"/"},u.prototype.ajax=function(e){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+e},u.prototype.messageViewLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.messageDownloadLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.avatarLink=function(t){return this.sServer+"/Raw/0/Avatar/"+e.encodeURIComponent(t)+"/"},u.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},u.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},u.prototype.settings=function(e){var t=this.sBase+"settings";return Mt.isUnd(e)||""===e||(t+="/"+e),t},u.prototype.admin=function(e){var t=this.sBase;switch(e){case"AdminDomains":t+="domains";break;case"AdminSecurity":t+="security";break;case"AdminLicensing":t+="licensing"}return t},u.prototype.mailBox=function(e,t,s){t=Mt.isNormal(t)?Mt.pInt(t):1,s=Mt.pString(s);var i=this.sBase+"mailbox/";return""!==e&&(i+=encodeURI(e)),t>1&&(i=i.replace(/[\/]+$/,""),i+="/p"+t),""!==s&&(i=i.replace(/[\/]+$/,""),i+="/"+encodeURI(s)),i},u.prototype.phpInfo=function(){return this.sServer+"Info"},u.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},u.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},u.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},u.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},u.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},u.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=Mt.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},u.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},u.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/openpgp.min.js"},u.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Dt.oViewModelsHooks={},Dt.oSimpleHooks={},Dt.regViewModelHook=function(e,t){t&&(t.__hookName=e)
|
||
},Dt.addHook=function(e,t){Mt.isFunc(t)&&(Mt.isArray(Dt.oSimpleHooks[e])||(Dt.oSimpleHooks[e]=[]),Dt.oSimpleHooks[e].push(t))},Dt.runHook=function(e,t){Mt.isArray(Dt.oSimpleHooks[e])&&(t=t||[],r.each(Dt.oSimpleHooks[e],function(e){e.apply(null,t)}))},Dt.mainSettingsGet=function(e){return jt?jt.settingsGet(e):null},Dt.remoteRequest=function(e,t,s,i,o,n){jt&&jt.remote().defaultRequest(e,t,s,i,o,n)},Dt.settingsGet=function(e,t){var s=Dt.mainSettingsGet("Plugins");return s=s&&Mt.isUnd(s[e])?null:s[e],s?Mt.isUnd(s[t])?null:s[t]:null},d.prototype.blurTrigger=function(){if(this.fOnBlur){var t=this;e.clearTimeout(t.iBlurTimer),t.iBlurTimer=e.setTimeout(function(){t.fOnBlur()},200)}},d.prototype.focusTrigger=function(){this.fOnBlur&&e.clearTimeout(this.iBlurTimer)},d.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},d.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},d.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},d.prototype.getData=function(e){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():e?'<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">'+this.editor.getData()+"</div>":this.editor.getData():""},d.prototype.modeToggle=function(e){this.editor&&(e?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"),this.resize())},d.prototype.setHtml=function(e,t){this.editor&&(this.modeToggle(!0),this.editor.setData(e),t&&this.focus())},d.prototype.setPlain=function(e,t){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(e);this.editor.setData(e),t&&this.focus()}},d.prototype.init=function(){if(this.$element&&this.$element[0]){var t=this,s=function(){var s=Ot.oHtmlEditorDefaultConfig,i=jt.settingsGet("Language"),o=!!jt.settingsGet("AllowHtmlEditorSourceButton");o&&s.toolbarGroups&&!s.toolbarGroups.__SourceInited&&(s.toolbarGroups.__SourceInited=!0,s.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),s.enterMode=e.CKEDITOR.ENTER_BR,s.shiftEnterMode=e.CKEDITOR.ENTER_BR,s.language=Ot.oHtmlEditorLangsMap[i]||"en",e.CKEDITOR.env&&(e.CKEDITOR.env.isCompatible=!0),t.editor=e.CKEDITOR.appendTo(t.$element[0],s),t.editor.on("key",function(e){return e&&e.data&&9===e.data.keyCode?!1:void 0}),t.editor.on("blur",function(){t.blurTrigger()}),t.editor.on("mode",function(){t.blurTrigger(),t.fOnModeChange&&t.fOnModeChange("plain"!==t.editor.mode)}),t.editor.on("focus",function(){t.focusTrigger()}),t.fOnReady&&t.editor.on("instanceReady",function(){t.editor.setKeystroke(e.CKEDITOR.CTRL+65,"selectAll"),t.fOnReady(),t.__resizable=!0,t.resize()})};e.CKEDITOR?s():e.__initEditor=s}},d.prototype.focus=function(){this.editor&&this.editor.focus()},d.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},d.prototype.resize=function(){if(this.editor&&this.__resizable)try{this.editor.resize(this.$element.width(),this.$element.innerHeight())}catch(e){}},d.prototype.clear=function(e){this.setHtml("",e)},h.prototype.itemSelected=function(e){this.isListChecked()?e||(this.oCallbacks.onItemSelect||this.emptyFunction)(e||null):e&&(this.oCallbacks.onItemSelect||this.emptyFunction)(e)},h.prototype.goDown=function(e){this.newSelectPosition(Lt.EventKeyCode.Down,!1,e)},h.prototype.goUp=function(e){this.newSelectPosition(Lt.EventKeyCode.Up,!1,e)},h.prototype.init=function(e,i,o){if(this.oContentVisible=e,this.oContentScrollable=i,o=o||"all",this.oContentVisible&&this.oContentScrollable){var n=this;t(this.oContentVisible).on("selectstart",function(e){e&&e.preventDefault&&e.preventDefault()}).on("click",this.sItemSelector,function(e){n.actionClick(s.dataFor(this),e)}).on("click",this.sItemCheckedSelector,function(e){var t=s.dataFor(this);t&&(e&&e.shiftKey?n.actionClick(t,e):(n.focusedItem(t),t.checked(!t.checked())))}),c("enter",o,function(){return n.focusedItem()&&!n.focusedItem().selected()?(n.actionClick(n.focusedItem()),!1):!0}),c("ctrl+up, command+up, ctrl+down, command+down",o,function(){return!1}),c("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",o,function(e,t){if(e&&t&&t.shortcut){var s=0;switch(t.shortcut){case"up":case"shift+up":s=Lt.EventKeyCode.Up;break;case"down":case"shift+down":s=Lt.EventKeyCode.Down;break;case"insert":s=Lt.EventKeyCode.Insert;break;case"space":s=Lt.EventKeyCode.Space;break;case"home":s=Lt.EventKeyCode.Home;break;case"end":s=Lt.EventKeyCode.End;break;case"pageup":s=Lt.EventKeyCode.PageUp;break;case"pagedown":s=Lt.EventKeyCode.PageDown}if(s>0)return n.newSelectPosition(s,c.shift),!1}})}},h.prototype.autoSelect=function(e){this.bAutoSelect=!!e},h.prototype.getItemUid=function(e){var t="",s=this.oCallbacks.onItemGetUid||null;return s&&e&&(t=s(e)),t.toString()},h.prototype.newSelectPosition=function(e,t,s){var i=0,o=10,n=!1,a=!1,l=null,c=this.list(),u=c?c.length:0,d=this.focusedItem();if(u>0)if(d){if(d)if(Lt.EventKeyCode.Down===e||Lt.EventKeyCode.Up===e||Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e)r.each(c,function(t){if(!a)switch(e){case Lt.EventKeyCode.Up:d===t?a=!0:l=t;break;case Lt.EventKeyCode.Down:case Lt.EventKeyCode.Insert:n?(l=t,a=!0):d===t&&(n=!0)}});else if(Lt.EventKeyCode.Home===e||Lt.EventKeyCode.End===e)Lt.EventKeyCode.Home===e?l=c[0]:Lt.EventKeyCode.End===e&&(l=c[c.length-1]);else if(Lt.EventKeyCode.PageDown===e){for(;u>i;i++)if(d===c[i]){i+=o,i=i>u-1?u-1:i,l=c[i];break}}else if(Lt.EventKeyCode.PageUp===e)for(i=u;i>=0;i--)if(d===c[i]){i-=o,i=0>i?0:i,l=c[i];break}}else Lt.EventKeyCode.Down===e||Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e||Lt.EventKeyCode.Home===e||Lt.EventKeyCode.PageUp===e?l=c[0]:(Lt.EventKeyCode.Up===e||Lt.EventKeyCode.End===e||Lt.EventKeyCode.PageDown===e)&&(l=c[c.length-1]);l?(this.focusedItem(l),d&&(t?(Lt.EventKeyCode.Up===e||Lt.EventKeyCode.Down===e)&&d.checked(!d.checked()):(Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e)&&d.checked(!d.checked())),!this.bAutoSelect&&!s||this.isListChecked()||Lt.EventKeyCode.Space===e||this.selectedItem(l),this.scrollToFocused()):d&&(!t||Lt.EventKeyCode.Up!==e&&Lt.EventKeyCode.Down!==e?(Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e)&&d.checked(!d.checked()):d.checked(!d.checked()),this.focusedItem(d))},h.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var e=20,s=t(this.sItemFocusedSelector,this.oContentScrollable),i=s.position(),o=this.oContentVisible.height(),n=s.outerHeight();return i&&(i.top<0||i.top+n>o)?(this.oContentScrollable.scrollTop(i.top<0?this.oContentScrollable.scrollTop()+i.top-e:this.oContentScrollable.scrollTop()+i.top-o+n+e),!0):!1},h.prototype.scrollToTop=function(e){return this.oContentVisible&&this.oContentScrollable?(e?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},h.prototype.eventClickFunction=function(e,t){var s=this.getItemUid(e),i=0,o=0,n=null,a="",r=!1,l=!1,c=[],u=!1;if(t&&t.shiftKey&&""!==s&&""!==this.sLastUid&&s!==this.sLastUid)for(c=this.list(),u=e.checked(),i=0,o=c.length;o>i;i++)n=c[i],a=this.getItemUid(n),r=!1,(a===this.sLastUid||a===s)&&(r=!0),r&&(l=!l),(l||r)&&n.checked(u);this.sLastUid=""===s?"":s},h.prototype.actionClick=function(e,t){if(e){var s=!0,i=this.getItemUid(e);t&&(!t.shiftKey||t.ctrlKey||t.altKey?!t.ctrlKey||t.shiftKey||t.altKey||(s=!1,this.focusedItem(e),this.selectedItem()&&e!==this.selectedItem()&&this.selectedItem().checked(!0),e.checked(!e.checked())):(s=!1,""===this.sLastUid&&(this.sLastUid=i),e.checked(!e.checked()),this.eventClickFunction(e,t),this.focusedItem(e))),s&&(this.focusedItem(e),this.selectedItem(e),this.scrollToFocused())}},h.prototype.on=function(e,t){this.oCallbacks[e]=t},p.supported=function(){return!0},p.prototype.set=function(e,s){var i=t.cookie(It.Values.ClientSideCookieIndexName),o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[e]=s,t.cookie(It.Values.ClientSideCookieIndexName,JSON.stringify(n),{expires:30}),o=!0}catch(a){}return o},p.prototype.get=function(e){var s=t.cookie(It.Values.ClientSideCookieIndexName),i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[e])?i[e]:null}catch(o){}return i},m.supported=function(){return!!e.localStorage},m.prototype.set=function(t,s){var i=e.localStorage[It.Values.ClientSideCookieIndexName]||null,o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[t]=s,e.localStorage[It.Values.ClientSideCookieIndexName]=JSON.stringify(n),o=!0}catch(a){}return o},m.prototype.get=function(t){var s=e.localStorage[It.Values.ClientSideCookieIndexName]||null,i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[t])?i[t]:null}catch(o){}return i},g.prototype.oDriver=null,g.prototype.set=function(e,t){return this.oDriver?this.oDriver.set("p"+e,t):!1},g.prototype.get=function(e){return this.oDriver?this.oDriver.get("p"+e):null},f.prototype.bootstart=function(){},b.prototype.sPosition="",b.prototype.sTemplate="",b.prototype.viewModelName="",b.prototype.viewModelDom=null,b.prototype.viewModelTemplate=function(){return this.sTemplate},b.prototype.viewModelPosition=function(){return this.sPosition},b.prototype.cancelCommand=b.prototype.closeCommand=function(){},b.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=jt.data().keyScope(),jt.data().keyScope(this.sDefaultKeyScope)},b.prototype.restoreKeyScope=function(){jt.data().keyScope(this.sCurrentKeyScope)},b.prototype.registerPopupKeyDown=function(){var e=this;Gt.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&Lt.EventKeyCode.Esc===t.keyCode)return Mt.delegateRun(e,"cancelCommand"),!1;if(Lt.EventKeyCode.Backspace===t.keyCode&&!Mt.inFocus())return!1}return!0})},y.prototype.oCross=null,y.prototype.sScreenName="",y.prototype.aViewModels=[],y.prototype.viewModels=function(){return this.aViewModels},y.prototype.screenName=function(){return this.sScreenName},y.prototype.routes=function(){return null},y.prototype.__cross=function(){return this.oCross},y.prototype.__start=function(){var e=this.routes(),t=null,s=null;Mt.isNonEmptyArray(e)&&(s=r.bind(this.onRoute||Mt.emptyFunction,this),t=i.create(),r.each(e,function(e){t.addRoute(e[0],s).rules=e[1]}),this.oCross=t)},S.constructorEnd=function(e){Mt.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},S.prototype.sDefaultScreenName="",S.prototype.oScreens={},S.prototype.oBoot=null,S.prototype.oCurrentScreen=null,S.prototype.hideLoading=function(){t("#rl-loading").hide()},S.prototype.routeOff=function(){o.changed.active=!1},S.prototype.routeOn=function(){o.changed.active=!0},S.prototype.setBoot=function(e){return Mt.isNormal(e)&&(this.oBoot=e),this},S.prototype.screen=function(e){return""===e||Mt.isUnd(this.oScreens[e])?null:this.oScreens[e]},S.prototype.buildViewModel=function(e,i){if(e&&!e.__builded){var o=new e(i),n=o.viewModelPosition(),a=t("#rl-content #rl-"+n.toLowerCase()),l=null;e.__builded=!0,e.__vm=o,o.data=jt.data(),o.viewModelName=e.__name,a&&1===a.length?(l=t("<div></div>").addClass("rl-view-model").addClass("RL-"+o.viewModelTemplate()).hide(),l.appendTo(a),o.viewModelDom=l,e.__dom=l,"Popups"===n&&(o.cancelCommand=o.closeCommand=Mt.createCommand(o,function(){xt.hideScreenPopup(e)}),o.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),jt.popupVisibilityNames.push(this.viewModelName),o.viewModelDom.css("z-index",3e3+jt.popupVisibilityNames().length+10),Mt.delegateRun(this,"onFocus",[],500)):(Mt.delegateRun(this,"onHide"),this.restoreKeyScope(),jt.popupVisibilityNames.remove(this.viewModelName),o.viewModelDom.css("z-index",2e3),Ot.tooltipTrigger(!Ot.tooltipTrigger()),r.delay(function(){t.viewModelDom.hide()},300))},o)),Dt.runHook("view-model-pre-build",[e.__name,o,l]),s.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:o.viewModelTemplate()}}},o),Mt.delegateRun(o,"onBuild",[l]),o&&"Popups"===n&&o.registerPopupKeyDown(),Dt.runHook("view-model-post-build",[e.__name,o,l])):Mt.log("Cannot find view model position: "+n)}return e?e.__vm:null},S.prototype.applyExternal=function(e,t){e&&t&&s.applyBindings(e,t)},S.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),Dt.runHook("view-model-on-hide",[e.__name,e.__vm]))},S.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),Mt.delegateRun(e.__vm,"onShow",t||[]),Dt.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},S.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},S.prototype.screenOnRoute=function(e,t){var s=this,i=null,o=null;""===Mt.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(i=this.screen(e),i||(i=this.screen(this.sDefaultScreenName),i&&(t=e+"/"+t,e=this.sDefaultScreenName)),i&&i.__started&&(i.__builded||(i.__builded=!0,Mt.isNonEmptyArray(i.viewModels())&&r.each(i.viewModels(),function(e){this.buildViewModel(e,i)},this),Mt.delegateRun(i,"onBuild")),r.defer(function(){s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onHide"),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),Mt.delegateRun(e.__vm,"onHide"))})),s.oCurrentScreen=i,s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onShow"),Dt.runHook("screen-on-show",[s.oCurrentScreen.screenName(),s.oCurrentScreen]),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),Mt.delegateRun(e.__vm,"onShow"),Mt.delegateRun(e.__vm,"onFocus",[],200),Dt.runHook("view-model-on-show",[e.__name,e.__vm]))},s)),o=i.__cross(),o&&o.parse(t)})))},S.prototype.startScreens=function(e){t("#rl-content").css({visibility:"hidden"}),r.each(e,function(e){var t=new e,s=t?t.screenName():"";t&&""!==s&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=s),this.oScreens[s]=t)},this),r.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),Dt.runHook("screen-pre-start",[e.screenName(),e]),Mt.delegateRun(e,"onStart"),Dt.runHook("screen-post-start",[e.screenName(),e]))},this);var s=i.create();s.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,r.bind(this.screenOnRoute,this)),o.initialized.add(s.parse,s),o.changed.add(s.parse,s),o.init(),t("#rl-content").css({visibility:"visible"}),r.delay(function(){Bt.removeClass("rl-started-trigger").addClass("rl-started")},50)},S.prototype.setHash=function(e,t,s){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,s=Mt.isUnd(s)?!1:!!s,(Mt.isUnd(t)?1:!t)?(o.changed.active=!0,o[s?"replaceHash":"setHash"](e),o.setHash(e)):(o.changed.active=!1,o[s?"replaceHash":"setHash"](e),o.changed.active=!0)},S.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},xt=new S,v.newInstanceFromJson=function(e){var t=new v;return t.initByJson(e)?t:null},v.prototype.name="",v.prototype.email="",v.prototype.privateType=null,v.prototype.clear=function(){this.email="",this.name="",this.privateType=null},v.prototype.validate=function(){return""!==this.name||""!==this.email},v.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},v.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},v.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=Lt.EmailType.Facebook),null===this.privateType&&(this.privateType=Lt.EmailType.Default)),this.privateType},v.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},v.prototype.parse=function(e){this.clear(),e=Mt.trim(e);var t=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g,s=t.exec(e);s?(this.name=s[1]||"",this.email=s[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},v.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=Mt.trim(e.Name),this.email=Mt.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},v.prototype.toLine=function(e,t,s){var i="";return""!==this.email&&(t=Mt.isUnd(t)?!1:!!t,s=Mt.isUnd(s)?!1:!!s,e&&""!==this.name?i=t?'<a href="mailto:'+Mt.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(this.name)+"</a>":s?Mt.encodeHtml(this.name):this.name:(i=this.email,""!==this.name?t?i=Mt.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+Mt.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(i)+"</a>"+Mt.encodeHtml(">"):(i='"'+this.name+'" <'+i+">",s&&(i=Mt.encodeHtml(i))):t&&(i='<a href="mailto:'+Mt.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(this.email)+"</a>"))),i},v.prototype.mailsoParse=function(e){if(e=Mt.trim(e),""===e)return!1;for(var t=function(e,t,s){e+="";var i=e.length;return 0>t&&(t+=i),i="undefined"==typeof s?i:0>s?s+i:s+t,t>=e.length||0>t||t>i?!1:e.slice(t,i)},s=function(e,t,s,i){return 0>s&&(s+=e.length),i=void 0!==i?i:e.length,0>i&&(i=i+e.length-s),e.slice(0,s)+t.substr(0,i)+t.slice(i)+e.slice(s+i)},i="",o="",n="",a=!1,r=!1,l=!1,c=null,u=0,d=0,h=0;h<e.length;){switch(e.substr(h,1)){case'"':a||r||l?r||l||(d=h,i=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,a=!1):(a=!0,u=h);break;case"<":a||r||l||(h>0&&0===i.length&&(i=t(e,0,h)),r=!0,u=h);break;case">":r&&(d=h,o=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,r=!1);break;case"(":a||r||l||(l=!0,u=h);break;case")":l&&(d=h,n=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,l=!1);break;case"\\":h++}h++}return 0===o.length&&(c=e.match(/[^@\s]+@\S+/i),c&&c[0]?o=c[0]:i=e),o.length>0&&0===i.length&&0===n.length&&(i=e.replace(o,"")),o=Mt.trim(o).replace(/^[<]+/,"").replace(/[>]+$/,""),i=Mt.trim(i).replace(/^["']+/,"").replace(/["']+$/,""),n=Mt.trim(n).replace(/^[(]+/,"").replace(/[)]+$/,""),i=i.replace(/\\\\(.)/,"$1"),n=n.replace(/\\\\(.)/,"$1"),this.name=i,this.email=o,this.clearDuplicateName(),!0},v.prototype.inputoTagLine=function(){return 0<this.name.length?this.name+" ("+this.email+")":this.email},C.prototype.getNameAndEmailHelper=function(){var e="",t="";return Mt.isNonEmptyArray(this.properties)&&r.each(this.properties,function(s){s&&(Lt.ContactPropertyType.FirstName===s[0]?e=Mt.trim(s[1]+" "+e):Lt.ContactPropertyType.LastName===s[0]?e=Mt.trim(e+" "+s[1]):""===t&&Lt.ContactPropertyType.Email===s[0]&&(t=s[1]))},this),""===t?null:[t,e]},C.prototype.parse=function(e){var t=!1;return e&&"Object/Contact"===e["@Object"]&&(this.idContact=Mt.pInt(e.IdContact),this.display=Mt.pString(e.Display),this.readOnly=!!e.ReadOnly,this.tags="",Mt.isNonEmptyArray(e.Properties)&&r.each(e.Properties,function(e){e&&e.Type&&Mt.isNormal(e.Value)&&Mt.isNormal(e.TypeStr)&&this.properties.push([Mt.pInt(e.Type),Mt.pString(e.Value),Mt.pString(e.TypeStr)])},this),Mt.isNonEmptyArray(e.Tags)&&(this.tags=e.Tags.join(",")),t=!0),t},C.prototype.srcAttr=function(){return jt.link().emptyContactPic()},C.prototype.generateUid=function(){return""+this.idContact},C.prototype.lineAsCcc=function(){var e=[];return this.deleted()&&e.push("deleted"),this.selected()&&e.push("selected"),this.checked()&&e.push("checked"),this.focused()&&e.push("focused"),e.join(" ")},T.prototype.parse=function(e){var t=!1;return e&&"Object/Tag"===e["@Object"]&&(this.idContact=Mt.pInt(e.IdContactTag),this.name(Mt.pString(e.Name)),this.readOnly=!!e.ReadOnly,t=!0),t},T.prototype.filterHelper=function(e){return-1!==this.name().toLowerCase().indexOf(e.toLowerCase())},T.prototype.toLine=function(e){return(Mt.isUnd(e)?1:!e)?this.name():Mt.encodeHtml(this.name())},F.newInstanceFromJson=function(e){var t=new F;return t.initByJson(e)?t:null},F.prototype.mimeType="",F.prototype.fileName="",F.prototype.estimatedSize=0,F.prototype.friendlySize="",F.prototype.isInline=!1,F.prototype.isLinked=!1,F.prototype.cid="",F.prototype.cidWithOutTags="",F.prototype.contentLocation="",F.prototype.download="",F.prototype.folder="",F.prototype.uid="",F.prototype.mimeIndex="",F.prototype.initByJson=function(e){var t=!1;return e&&"Object/Attachment"===e["@Object"]&&(this.mimeType=(e.MimeType||"").toLowerCase(),this.fileName=e.FileName,this.estimatedSize=Mt.pInt(e.EstimatedSize),this.isInline=!!e.IsInline,this.isLinked=!!e.IsLinked,this.cid=e.CID,this.contentLocation=e.ContentLocation,this.download=e.Download,this.folder=e.Folder,this.uid=e.Uid,this.mimeIndex=e.MimeIndex,this.friendlySize=Mt.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),t=!0),t},F.prototype.isImage=function(){return-1<Mt.inArray(this.mimeType.toLowerCase(),["image/png","image/jpg","image/jpeg","image/gif"])},F.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)&&-1===Mt.inArray(this.mimeType,["text/html"])},F.prototype.isPdf=function(){return Ot.bAllowPdfPreview&&"application/pdf"===this.mimeType},F.prototype.linkDownload=function(){return jt.link().attachmentDownload(this.download)},F.prototype.linkPreview=function(){return jt.link().attachmentPreview(this.download)},F.prototype.linkPreviewAsPlain=function(){return jt.link().attachmentPreviewAsPlain(this.download)},F.prototype.generateTransferDownloadUrl=function(){var t=this.linkDownload();return"http"!==t.substr(0,4)&&(t=e.location.protocol+"//"+e.location.host+e.location.pathname+t),this.mimeType+":"+this.fileName+":"+t},F.prototype.eventDragStart=function(e,t){var s=t.originalEvent||t;return e&&s&&s.dataTransfer&&s.dataTransfer.setData&&s.dataTransfer.setData("DownloadURL",this.generateTransferDownloadUrl()),!0},F.prototype.iconClass=function(){var e=this.mimeType.toLocaleString().split("/"),t="icon-file";return e&&e[1]&&("image"===e[0]?t="icon-file-image":"text"===e[0]?t="icon-file-text":"audio"===e[0]?t="icon-file-music":"video"===e[0]?t="icon-file-movie":-1<Mt.inArray(e[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"])?t="icon-file-zip":-1<Mt.inArray(e[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"])?t="icon-file-text":-1<Mt.inArray(e[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"])?t="icon-file-excel":-1<Mt.inArray(e[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"])&&(t="icon-file-chart-graph")),t},A.prototype.id="",A.prototype.isInline=!1,A.prototype.isLinked=!1,A.prototype.CID="",A.prototype.contentLocation="",A.prototype.fromMessage=!1,A.prototype.cancel=Mt.emptyFunction,A.prototype.initByUploadJson=function(e){var t=!1;return e&&(this.fileName(e.Name),this.size(Mt.isUnd(e.Size)?0:Mt.pInt(e.Size)),this.tempName(Mt.isUnd(e.TempName)?"":e.TempName),this.isInline=!1,t=!0),t},E.newInstanceFromJson=function(e){var t=new E;return t.initByJson(e)?t:null},E.calculateFullFromatDateValue=function(e){return e>0?n.unix(e).format("LLL"):""},E.emailsToLine=function(e,t,s){var i=[],o=0,n=0;if(Mt.isNonEmptyArray(e))for(o=0,n=e.length;n>o;o++)i.push(e[o].toLine(t,s));return i.join(", ")},E.emailsToLineClear=function(e){var t=[],s=0,i=0;if(Mt.isNonEmptyArray(e))for(s=0,i=e.length;i>s;s++)e[s]&&e[s].email&&""!==e[s].name&&t.push(e[s].email);return t.join(", ")},E.initEmailsFromJson=function(e){var t=0,s=0,i=null,o=[];if(Mt.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)i=v.newInstanceFromJson(e[t]),i&&o.push(i);return o},E.replyHelper=function(e,t,s){if(e&&0<e.length)for(var i=0,o=e.length;o>i;i++)Mt.isUnd(t[e[i].email])&&(t[e[i].email]=!0,s.push(e[i]))},E.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.subjectPrefix(""),this.subjectSuffix(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(Lt.MessagePriority.Normal),this.proxy=!1,this.fromEmailString(""),this.fromClearEmailString(""),this.toEmailsString(""),this.toClearEmailsString(""),this.senderEmailsString(""),this.senderClearEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(Lt.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},E.prototype.computeSenderEmail=function(){var e=jt.data().sentFolder(),t=jt.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===e||this.folderFullNameRaw===t?this.toEmailsString():this.fromEmailString()),this.senderClearEmailsString(this.folderFullNameRaw===e||this.folderFullNameRaw===t?this.toClearEmailsString():this.fromClearEmailString())},E.prototype.initByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.folderFullNameRaw=e.Folder,this.uid=e.Uid,this.hash=e.Hash,this.requestHash=e.RequestHash,this.proxy=!!e.ExternalProxy,this.size(Mt.pInt(e.Size)),this.from=E.initEmailsFromJson(e.From),this.to=E.initEmailsFromJson(e.To),this.cc=E.initEmailsFromJson(e.Cc),this.bcc=E.initEmailsFromJson(e.Bcc),this.replyTo=E.initEmailsFromJson(e.ReplyTo),this.deliveredTo=E.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),Mt.isArray(e.SubjectParts)?(this.subjectPrefix(e.SubjectParts[0]),this.subjectSuffix(e.SubjectParts[1])):(this.subjectPrefix(""),this.subjectSuffix(this.subject())),this.dateTimeStampInUTC(Mt.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(E.emailsToLine(this.from,!0)),this.fromClearEmailString(E.emailsToLineClear(this.from)),this.toEmailsString(E.emailsToLine(this.to,!0)),this.toClearEmailsString(E.emailsToLineClear(this.to)),this.parentUid(Mt.pInt(e.ParentThread)),this.threads(Mt.isArray(e.Threads)?e.Threads:[]),this.threadsLen(Mt.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},E.prototype.initUpdateByMessageJson=function(e){var t=!1,s=Lt.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(s=Mt.pInt(e.Priority),this.priority(-1<Mt.inArray(s,[Lt.MessagePriority.High,Lt.MessagePriority.Low])?s:Lt.MessagePriority.Normal),this.aDraftInfo=e.DraftInfo,this.sMessageId=e.MessageId,this.sInReplyTo=e.InReplyTo,this.sReferences=e.References,this.proxy=!!e.ExternalProxy,jt.data().capaOpenPGP()&&(this.isPgpSigned(!!e.PgpSigned),this.isPgpEncrypted(!!e.PgpEncrypted)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.foundedCIDs=Mt.isArray(e.FoundedCIDs)?e.FoundedCIDs:[],this.attachments(this.initAttachmentsFromJson(e.Attachments)),this.readReceipt(e.ReadReceipt||""),this.computeSenderEmail(),t=!0),t},E.prototype.initAttachmentsFromJson=function(e){var t=0,s=0,i=null,o=[];if(e&&"Collection/AttachmentCollection"===e["@Object"]&&Mt.isNonEmptyArray(e["@Collection"]))for(t=0,s=e["@Collection"].length;s>t;t++)i=F.newInstanceFromJson(e["@Collection"][t]),i&&(""!==i.cidWithOutTags&&0<this.foundedCIDs.length&&0<=Mt.inArray(i.cidWithOutTags,this.foundedCIDs)&&(i.isLinked=!0),o.push(i));return o},E.prototype.initFlagsByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.unseen(!e.IsSeen),this.flagged(!!e.IsFlagged),this.answered(!!e.IsAnswered),this.forwarded(!!e.IsForwarded),this.isReadReceipt(!!e.IsReadReceipt),t=!0),t},E.prototype.fromToLine=function(e,t){return E.emailsToLine(this.from,e,t)},E.prototype.toToLine=function(e,t){return E.emailsToLine(this.to,e,t)},E.prototype.ccToLine=function(e,t){return E.emailsToLine(this.cc,e,t)},E.prototype.bccToLine=function(e,t){return E.emailsToLine(this.bcc,e,t)},E.prototype.lineAsCcc=function(){var e=[];if(this.deleted()&&e.push("deleted"),this.selected()&&e.push("selected"),this.checked()&&e.push("checked"),this.flagged()&&e.push("flagged"),this.unseen()&&e.push("unseen"),this.answered()&&e.push("answered"),this.forwarded()&&e.push("forwarded"),this.focused()&&e.push("focused"),this.hasAttachments())switch(e.push("withAttachments"),this.attachmentsMainType()){case"image":e.push("imageOnlyAttachments");break;case"archive":e.push("archiveOnlyAttachments")}return this.newForAnimation()&&e.push("new"),""===this.subject()&&e.push("emptySubject"),0<this.parentUid()&&e.push("hasParentMessage"),0<this.threadsLen()&&0===this.parentUid()&&e.push("hasChildrenMessage"),this.hasUnseenSubMessage()&&e.push("hasUnseenSubMessage"),this.hasFlaggedSubMessage()&&e.push("hasFlaggedSubMessage"),e.join(" ")},E.prototype.hasVisibleAttachments=function(){return!!r.find(this.attachments(),function(e){return!e.isLinked})},E.prototype.findAttachmentByCid=function(e){var t=null,s=this.attachments();return Mt.isNonEmptyArray(s)&&(e=e.replace(/^<+/,"").replace(/>+$/,""),t=r.find(s,function(t){return e===t.cidWithOutTags})),t||null},E.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return Mt.isNonEmptyArray(s)&&(t=r.find(s,function(t){return e===t.contentLocation})),t||null},E.prototype.messageId=function(){return this.sMessageId},E.prototype.inReplyTo=function(){return this.sInReplyTo},E.prototype.references=function(){return this.sReferences},E.prototype.fromAsSingleEmail=function(){return Mt.isArray(this.from)&&this.from[0]?this.from[0].email:""},E.prototype.viewLink=function(){return jt.link().messageViewLink(this.requestHash)},E.prototype.downloadLink=function(){return jt.link().messageDownloadLink(this.requestHash)},E.prototype.replyEmails=function(e){var t=[],s=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,s,t),0===t.length&&E.replyHelper(this.from,s,t),t},E.prototype.replyAllEmails=function(e){var t=[],s=[],i=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,i,t),0===t.length&&E.replyHelper(this.from,i,t),E.replyHelper(this.to,i,t),E.replyHelper(this.cc,i,s),[t,s]},E.prototype.textBodyToString=function(){return this.body?this.body.html():""},E.prototype.attachmentsToStringLine=function(){var e=r.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0<e.length?e.join(", "):""},E.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()}},E.prototype.viewPopupMessage=function(s){Mt.windowPopupKnockout(this.getDataForWindowPopup(),"PopupsWindowSimpleMessage",this.subject(),function(i){i&&i.document&&i.document.body&&(t("img.lazy",i.document.body).each(function(e,s){var i=t(s),o=i.data("original"),n=i.attr("src");
|
||
e>=0&&o&&!n&&i.attr("src",o)}),s&&e.setTimeout(function(){i.print()},100))})},E.prototype.printMessage=function(){this.viewPopupMessage(!0)},E.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},E.prototype.populateByMessageListItem=function(e){return this.folderFullNameRaw=e.folderFullNameRaw,this.uid=e.uid,this.hash=e.hash,this.requestHash=e.requestHash,this.subject(e.subject()),this.subjectPrefix(this.subjectPrefix()),this.subjectSuffix(this.subjectSuffix()),this.size(e.size()),this.dateTimeStampInUTC(e.dateTimeStampInUTC()),this.priority(e.priority()),this.proxy=e.proxy,this.fromEmailString(e.fromEmailString()),this.fromClearEmailString(e.fromClearEmailString()),this.toEmailsString(e.toEmailsString()),this.toClearEmailsString(e.toClearEmailsString()),this.emails=e.emails,this.from=e.from,this.to=e.to,this.cc=e.cc,this.bcc=e.bcc,this.replyTo=e.replyTo,this.deliveredTo=e.deliveredTo,this.unseen(e.unseen()),this.flagged(e.flagged()),this.answered(e.answered()),this.forwarded(e.forwarded()),this.isReadReceipt(e.isReadReceipt()),this.selected(e.selected()),this.checked(e.checked()),this.hasAttachments(e.hasAttachments()),this.attachmentsMainType(e.attachmentsMainType()),this.moment(e.moment()),this.body=null,this.priority(Lt.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(e.parentUid()),this.threads(e.threads()),this.threadsLen(e.threadsLen()),this.computeSenderEmail(),this},E.prototype.showExternalImages=function(e){if(this.body&&this.body.data("rl-has-images")){var s="";e=Mt.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),s=this.proxy?"data-x-additional-src":"data-x-src",t("["+s+"]",this.body).each(function(){e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",t(this).attr(s)).removeAttr(s):t(this).attr("src",t(this).attr(s)).removeAttr(s)}),s=this.proxy?"data-x-additional-style-url":"data-x-style-url",t("["+s+"]",this.body).each(function(){var e=Mt.trim(t(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+t(this).attr(s)).removeAttr(s)}),e&&(t("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t(".RL-MailMessageView .messageView .messageItem .content")[0]}),Gt.resize()),Mt.windowResize(500)}},E.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=Mt.isUnd(e)?!1:e;var s=this;t("[data-x-src-cid]",this.body).each(function(){var i=s.findAttachmentByCid(t(this).attr("data-x-src-cid"));i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-src-location]",this.body).each(function(){var i=s.findAttachmentByContentLocation(t(this).attr("data-x-src-location"));i||(i=s.findAttachmentByCid(t(this).attr("data-x-src-location"))),i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-style-cid]",this.body).each(function(){var e="",i="",o=s.findAttachmentByCid(t(this).attr("data-x-style-cid"));o&&o.linkPreview&&(i=t(this).attr("data-x-style-cid-name"),""!==i&&(e=Mt.trim(t(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+i+": url('"+o.linkPreview()+"')")))}),e&&!function(e,t){r.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(t("img.lazy",s.body),t(".RL-MailMessageView .messageView .messageItem .content")[0]),Mt.windowResize(500)}},E.prototype.storeDataToDom=function(){this.body&&(this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw),jt.data().capaOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser())))},E.prototype.storePgpVerifyDataToDom=function(){this.body&&jt.data().capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},E.prototype.fetchDataToDom=function(){this.body&&(this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=Mt.pString(this.body.data("rl-plain-raw")),jt.data().capaOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},E.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var s=[],i=null,o=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",n=jt.data().findPublicKeysByEmail(o),a=null,l=null,c="";this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{i=e.openpgp.cleartext.readArmored(this.plainRaw),i&&i.getText&&(this.pgpSignedVerifyStatus(n.length?Lt.SignedVerifyStatus.Unverified:Lt.SignedVerifyStatus.UnknownPublicKeys),s=i.verify(n),s&&0<s.length&&(a=r.find(s,function(e){return e&&e.keyid&&e.valid}),a&&(l=jt.data().findPublicKeyByHex(a.keyid.toHex()),l&&(c=i.getText(),this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Success),this.pgpSignedVerifyUser(l.user),c=zt.empty().append(t('<pre class="b-plain-openpgp signed verified"></pre>').text(c)).html(),zt.empty(),this.replacePlaneTextBody(c)))))}catch(u){}this.storePgpVerifyDataToDom()}},E.prototype.decryptPgpEncryptedMessage=function(s){if(this.isPgpEncrypted()){var i=[],o=null,n=null,a=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",l=jt.data().findPublicKeysByEmail(a),c=jt.data().findSelfPrivateKey(s),u=null,d=null,h="";this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),c||this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.UnknownPrivateKey);try{o=e.openpgp.message.readArmored(this.plainRaw),o&&c&&o.decrypt&&(this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Unverified),n=o.decrypt(c),n&&(i=n.verify(l),i&&0<i.length&&(u=r.find(i,function(e){return e&&e.keyid&&e.valid}),u&&(d=jt.data().findPublicKeyByHex(u.keyid.toHex()),d&&(this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Success),this.pgpSignedVerifyUser(d.user)))),h=n.getText(),h=zt.empty().append(t('<pre class="b-plain-openpgp signed verified"></pre>').text(h)).html(),zt.empty(),this.replacePlaneTextBody(h)))}catch(p){}this.storePgpVerifyDataToDom()}},E.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},E.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},N.newInstanceFromJson=function(e){var t=new N;return t.initByJson(e)?t.initComputed():null},N.prototype.initComputed=function(){return this.hasSubScribedSubfolders=s.computed(function(){return!!r.find(this.subFolders(),function(e){return e.subScribed()&&!e.isSystemFolder()})},this),this.canBeEdited=s.computed(function(){return Lt.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=s.computed(function(){var e=this.subScribed(),t=this.hasSubScribedSubfolders();return e||t&&(!this.existen||!this.selectable)},this),this.isSystemFolder=s.computed(function(){return Lt.FolderType.User!==this.type()},this),this.hidden=s.computed(function(){var e=this.isSystemFolder(),t=this.hasSubScribedSubfolders();return e&&!t||!this.selectable&&!t},this),this.selectableForFolderList=s.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=s.computed({read:this.privateMessageCountAll,write:function(e){Mt.isPosNumeric(e,!0)?this.privateMessageCountAll(e):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=s.computed({read:this.privateMessageCountUnread,write:function(e){Mt.isPosNumeric(e,!0)?this.privateMessageCountUnread(e):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=s.computed(function(){var e=this.messageCountAll(),t=this.messageCountUnread(),s=this.type();if(Lt.FolderType.Inbox===s&&jt.data().foldersInboxUnreadCount(t),e>0){if(Lt.FolderType.Draft===s)return""+e;if(t>0&&Lt.FolderType.Trash!==s&&Lt.FolderType.Archive!==s&&Lt.FolderType.SentItems!==s)return""+t}return""},this),this.canBeDeleted=s.computed(function(){var e=this.isSystemFolder();return!e&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=s.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){Mt.timeOutAction("folder-list-folder-visibility-change",function(){Gt.trigger("folder-list-folder-visibility-change")},100)}),this.localName=s.computed(function(){Ot.langChangeTrigger();var e=this.type(),t=this.name();if(this.isSystemFolder())switch(e){case Lt.FolderType.Inbox:t=Mt.i18n("FOLDER_LIST/INBOX_NAME");break;case Lt.FolderType.SentItems:t=Mt.i18n("FOLDER_LIST/SENT_NAME");break;case Lt.FolderType.Draft:t=Mt.i18n("FOLDER_LIST/DRAFTS_NAME");break;case Lt.FolderType.Spam:t=Mt.i18n("FOLDER_LIST/SPAM_NAME");break;case Lt.FolderType.Trash:t=Mt.i18n("FOLDER_LIST/TRASH_NAME");break;case Lt.FolderType.Archive:t=Mt.i18n("FOLDER_LIST/ARCHIVE_NAME")}return t},this),this.manageFolderSystemName=s.computed(function(){Ot.langChangeTrigger();var e="",t=this.type(),s=this.name();if(this.isSystemFolder())switch(t){case Lt.FolderType.Inbox:e="("+Mt.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case Lt.FolderType.SentItems:e="("+Mt.i18n("FOLDER_LIST/SENT_NAME")+")";break;case Lt.FolderType.Draft:e="("+Mt.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case Lt.FolderType.Spam:e="("+Mt.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case Lt.FolderType.Trash:e="("+Mt.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case Lt.FolderType.Archive:e="("+Mt.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==e&&"("+s+")"===e||"(inbox)"===e.toLowerCase())&&(e=""),e},this),this.collapsed=s.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(e){this.collapsedPrivate(e)},owner:this}),this.hasUnreadMessages=s.computed(function(){return 0<this.messageCountUnread()},this),this.hasSubScribedUnreadMessagesSubfolders=s.computed(function(){return!!r.find(this.subFolders(),function(e){return e.hasUnreadMessages()||e.hasSubScribedUnreadMessagesSubfolders()})},this),this},N.prototype.fullName="",N.prototype.fullNameRaw="",N.prototype.fullNameHash="",N.prototype.delimiter="",N.prototype.namespace="",N.prototype.deep=0,N.prototype.interval=0,N.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"},N.prototype.initByJson=function(e){var t=!1;return e&&"Object/Folder"===e["@Object"]&&(this.name(e.Name),this.delimiter=e.Delimiter,this.fullName=e.FullName,this.fullNameRaw=e.FullNameRaw,this.fullNameHash=e.FullNameHash,this.deep=e.FullNameRaw.split(this.delimiter).length-1,this.selectable=!!e.IsSelectable,this.existen=!!e.IsExists,this.subScribed(!!e.IsSubscribed),this.type("INBOX"===this.fullNameRaw?Lt.FolderType.Inbox:Lt.FolderType.User),t=!0),t},N.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},R.prototype.email="",R.prototype.changeAccountLink=function(){return jt.link().change(this.email)},I.prototype.formattedName=function(){var e=this.name();return""===e?this.email():e+" <"+this.email()+">"},I.prototype.formattedNameForCompose=function(){var e=this.name();return""===e?this.email():e+" ("+this.email()+")"},I.prototype.formattedNameForEmail=function(){var e=this.name();return""===e?this.email():'"'+Mt.quoteName(e)+'" <'+this.email()+">"},L.prototype.removeSelf=function(){this.parentList.remove(this)},P.prototype.addCondition=function(){this.conditions.push(new L(this.conditions))},P.prototype.parse=function(e){var t=!1;return e&&"Object/Filter"===e["@Object"]&&(this.name(Mt.pString(e.Name)),t=!0),t},M.prototype.index=0,M.prototype.id="",M.prototype.guid="",M.prototype.user="",M.prototype.email="",M.prototype.armor="",M.prototype.isPrivate=!1,Mt.extendAsViewModel("PopupsFolderClearViewModel",D),D.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},D.prototype.onShow=function(e){this.clearPopup(),e&&this.selectedFolder(e)},Mt.extendAsViewModel("PopupsFolderCreateViewModel",k),k.prototype.sNoParentText="",k.prototype.simpleFolderNameValidation=function(e){return/^[^\\\/]+$/g.test(Mt.trim(e))},k.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},k.prototype.onShow=function(){this.clearPopup()},k.prototype.onFocus=function(){this.folderName.focused(!0)},Mt.extendAsViewModel("PopupsFolderSystemViewModel",O),O.prototype.sChooseOnText="",O.prototype.sUnuseText="",O.prototype.onShow=function(e){var t="";switch(e=Mt.isUnd(e)?Lt.SetSystemFoldersNotification.None:e){case Lt.SetSystemFoldersNotification.Sent:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case Lt.SetSystemFoldersNotification.Draft:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case Lt.SetSystemFoldersNotification.Spam:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case Lt.SetSystemFoldersNotification.Trash:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case Lt.SetSystemFoldersNotification.Archive:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(t)},Mt.extendAsViewModel("PopupsComposeViewModel",_),_.prototype.openOpenPgpPopup=function(){if(this.capaOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var e=this;xt.showScreenPopup(K,[function(t){e.editor(function(e){e.setPlain(t)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},_.prototype.reloadDraftFolder=function(){var e=jt.data().draftFolder();""!==e&&(jt.cache().setFolderHash(e,""),jt.data().currentFolderFullNameRaw()===e?jt.reloadMessageList(!0):jt.folderInformation(e))},_.prototype.findIdentityIdByMessage=function(e,t){var s={},i="",o=function(e){return e&&e.email&&s[e.email]?(i=s[e.email],!0):!1};if(this.bCapaAdditionalIdentities&&r.each(this.identities(),function(e){s[e.email()]=e.id}),s[jt.data().accountEmail()]=jt.data().accountEmail(),t)switch(e){case Lt.ComposeType.Empty:break;case Lt.ComposeType.Reply:case Lt.ComposeType.ReplyAll:case Lt.ComposeType.Forward:case Lt.ComposeType.ForwardAsAttachment:r.find(r.union(t.to,t.cc,t.bcc,t.deliveredTo),o);break;case Lt.ComposeType.Draft:r.find(r.union(t.from,t.replyTo),o)}return""===i&&(i=this.defaultIdentityID()),""===i&&(i=jt.data().accountEmail()),i},_.prototype.selectIdentity=function(e){e&&this.currentIdentityID(e.optValue)},_.prototype.formattedFrom=function(e){var t=jt.data().displayName(),s=jt.data().accountEmail();return""===t?s:(Mt.isUnd(e)?1:!e)?t+" ("+s+")":'"'+Mt.quoteName(t)+'" <'+s+">"},_.prototype.sendMessageResponse=function(t,s){var i=!1,o="";this.sending(!1),Lt.StorageResultType.Success===t&&s&&s.Result&&(i=!0,this.modalVisibility()&&Mt.delegateRun(this,"closeCommand")),this.modalVisibility()&&!i&&(s&&Lt.Notification.CantSaveMessage===s.ErrorCode?(this.sendSuccessButSaveError(!0),e.alert(Mt.trim(Mt.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(o=Mt.getNotification(s&&s.ErrorCode?s.ErrorCode:Lt.Notification.CantSendMessage,s&&s.ErrorMessage?s.ErrorMessage:""),this.sendError(!0),e.alert(o||Mt.getNotification(Lt.Notification.CantSendMessage)))),this.reloadDraftFolder()},_.prototype.saveMessageResponse=function(t,s){var i=!1,o=null;this.saving(!1),Lt.StorageResultType.Success===t&&s&&s.Result&&s.Result.NewFolder&&s.Result.NewUid&&(this.bFromDraft&&(o=jt.data().message(),o&&this.draftFolder()===o.folderFullNameRaw&&this.draftUid()===o.uid&&jt.data().message(null)),this.draftFolder(s.Result.NewFolder),this.draftUid(s.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new e.Date).getTime()/1e3)),this.savedOrSendingText(0<this.savedTime()?Mt.i18n("COMPOSE/SAVED_TIME",{TIME:n.unix(this.savedTime()-1).format("LT")}):""),i=!0,this.bFromDraft&&jt.cache().setFolderHash(this.draftFolder(),""))),this.modalVisibility()||i||(this.savedError(!0),this.savedOrSendingText(Mt.getNotification(Lt.Notification.CantSaveMessage))),this.reloadDraftFolder()},_.prototype.onHide=function(){this.reset(),xt.routeOn()},_.prototype.convertSignature=function(e,t,s,i){var o=!1,a=!1;if(""!==e&&(":HTML:"===e.substr(0,6)&&(o=!0,e=e.substr(6)),e=e.replace(/[\r]/,""),t=Mt.pString(t),""!==t&&(e=e.replace(/{{FROM}}/,t)),e=e.replace(/[\s]{1,2}{{FROM}}/,"{{FROM}}"),e=e.replace(/{{FROM}}/,""),e=e.replace(/{{DATE}}/,n().format("llll")),s&&Lt.ComposeType.Empty===i&&-1<e.indexOf("{{DATA}}")&&(a=!0,e=e.replace("{{DATA}}",s)),e=e.replace(/{{DATA}}/,""),o||(e=Mt.convertPlainTextToHtml(e))),s&&!a)switch(i){case Lt.ComposeType.Empty:e=s+"<br />"+e;break;default:e=e+"<br />"+s}return e},_.prototype.editor=function(e){if(e){var t=this;!this.oEditor&&this.composeEditorArea()?r.delay(function(){t.oEditor=new d(t.composeEditorArea(),null,function(){e(t.oEditor)},function(e){t.isHtml(!!e)})},300):this.oEditor&&e(this.oEditor)}},_.prototype.onShow=function(e,s,i,o,n){xt.routeOff();var a=this,l="",c="",u="",d="",h="",p=null,m=null,g="",f="",b=[],y={},S=jt.data().accountEmail(),v=jt.data().signature(),C=jt.data().signatureToAll(),w=[],T=null,F=null,A=e||Lt.ComposeType.Empty,E=function(e,t){for(var s=0,i=e.length,o=[];i>s;s++)o.push(e[s].toLine(!!t));return o.join(", ")};if(s=s||null,s&&Mt.isNormal(s)&&(F=Mt.isArray(s)&&1===s.length?s[0]:Mt.isArray(s)?null:s),null!==S&&(y[S]=!0),this.currentIdentityID(this.findIdentityIdByMessage(A,F)),this.reset(),Mt.isNonEmptyArray(i)&&this.to(E(i)),""!==A&&F){switch(d=F.fullFormatDateValue(),h=F.subject(),T=F.aDraftInfo,p=t(F.body).clone(),Mt.removeBlockquoteSwitcher(p),m=p.find("[data-html-editor-font-wrapper=true]"),g=m&&m[0]?m.html():p.html(),A){case Lt.ComposeType.Empty:break;case Lt.ComposeType.Reply:this.to(E(F.replyEmails(y))),this.subject(Mt.replySubjectAdd("Re",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["reply",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.sReferences);break;case Lt.ComposeType.ReplyAll:b=F.replyAllEmails(y),this.to(E(b[0])),this.cc(E(b[1])),this.subject(Mt.replySubjectAdd("Re",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["reply",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.references());break;case Lt.ComposeType.Forward:this.subject(Mt.replySubjectAdd("Fwd",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["forward",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.sReferences);break;case Lt.ComposeType.ForwardAsAttachment:this.subject(Mt.replySubjectAdd("Fwd",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["forward",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.sReferences);break;case Lt.ComposeType.Draft:this.to(E(F.to)),this.cc(E(F.cc)),this.bcc(E(F.bcc)),this.bFromDraft=!0,this.draftFolder(F.folderFullNameRaw),this.draftUid(F.uid),this.subject(h),this.prepearMessageAttachments(F,A),this.aDraftInfo=Mt.isNonEmptyArray(T)&&3===T.length?T:null,this.sInReplyTo=F.sInReplyTo,this.sReferences=F.sReferences;break;case Lt.ComposeType.EditAsNew:this.to(E(F.to)),this.cc(E(F.cc)),this.bcc(E(F.bcc)),this.subject(h),this.prepearMessageAttachments(F,A),this.aDraftInfo=Mt.isNonEmptyArray(T)&&3===T.length?T:null,this.sInReplyTo=F.sInReplyTo,this.sReferences=F.sReferences}switch(A){case Lt.ComposeType.Reply:case Lt.ComposeType.ReplyAll:l=F.fromToLine(!1,!0),f=Mt.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:d,EMAIL:l}),g="<br /><br />"+f+":<blockquote><p>"+g+"</p></blockquote>";break;case Lt.ComposeType.Forward:l=F.fromToLine(!1,!0),c=F.toToLine(!1,!0),u=F.ccToLine(!1,!0),g="<br /><br /><br />"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"<br />"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+l+"<br />"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+c+(0<u.length?"<br />"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+u:"")+"<br />"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Mt.encodeHtml(d)+"<br />"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Mt.encodeHtml(h)+"<br /><br />"+g;break;case Lt.ComposeType.ForwardAsAttachment:g=""}C&&""!==v&&Lt.ComposeType.EditAsNew!==A&&Lt.ComposeType.Draft!==A&&(g=this.convertSignature(v,E(F.from,!0),g,A)),this.editor(function(e){e.setHtml(g,!1),F.isHtml()||e.modeToggle(!1)})}else Lt.ComposeType.Empty===A?(this.subject(Mt.isNormal(o)?""+o:""),g=Mt.isNormal(n)?""+n:"",C&&""!==v&&(g=this.convertSignature(v,"",Mt.convertPlainTextToHtml(g),A)),this.editor(function(e){e.setHtml(g,!1),Lt.EditorDefaultType.Html!==jt.data().editorDefaultType()&&e.modeToggle(!1)})):Mt.isNonEmptyArray(s)&&r.each(s,function(e){a.addMessageAsAttachment(e)});w=this.getAttachmentsDownloadsForUpload(),Mt.isNonEmptyArray(w)&&jt.remote().messageUploadAttachments(function(e,t){if(Lt.StorageResultType.Success===e&&t&&t.Result){var s=null,i="";if(!a.viewModelVisibility())for(i in t.Result)t.Result.hasOwnProperty(i)&&(s=a.getAttachmentById(t.Result[i]),s&&s.tempName(i))}else a.setMessageAttachmentFailedDowbloadText()},w),this.triggerForResize()},_.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},_.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},_.prototype.tryToClosePopup=function(){var e=this;xt.isPopupVisible(W)||xt.showScreenPopup(W,[Mt.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){e.modalVisibility()&&Mt.delegateRun(e,"closeCommand")}])},_.prototype.onBuild=function(){this.initUploader();var s=this,i=null;c("ctrl+q, command+q",Lt.KeyState.Compose,function(){return s.identitiesDropdownTrigger(!0),!1}),c("ctrl+s, command+s",Lt.KeyState.Compose,function(){return s.saveCommand(),!1}),c("ctrl+enter, command+enter",Lt.KeyState.Compose,function(){return s.sendCommand(),!1}),c("esc",Lt.KeyState.Compose,function(){return s.modalVisibility()&&s.tryToClosePopup(),!1}),Gt.on("resize",function(){s.triggerForResize()}),this.dropboxEnabled()&&(i=document.createElement("script"),i.type="text/javascript",i.src="https://www.dropbox.com/static/api/1/dropins.js",t(i).attr("id","dropboxjs").attr("data-app-key",jt.settingsGet("DropboxApiKey")),document.body.appendChild(i)),this.driveEnabled()&&t.getScript("https://apis.google.com/js/api.js",function(){e.gapi&&s.driveVisible(!0)})},_.prototype.driveCallback=function(t,s){if(s&&e.XMLHttpRequest&&e.google&&s[e.google.picker.Response.ACTION]===e.google.picker.Action.PICKED&&s[e.google.picker.Response.DOCUMENTS]&&s[e.google.picker.Response.DOCUMENTS][0]&&s[e.google.picker.Response.DOCUMENTS][0].id){var i=this,o=new e.XMLHttpRequest;o.open("GET","https://www.googleapis.com/drive/v2/files/"+s[e.google.picker.Response.DOCUMENTS][0].id),o.setRequestHeader("Authorization","Bearer "+t),o.addEventListener("load",function(){if(o&&o.responseText){var e=JSON.parse(o.responseText),s=function(e,t,s){e&&e.exportLinks&&(e.exportLinks[t]?(e.downloadUrl=e.exportLinks[t],e.title=e.title+"."+s,e.mimeType=t):e.exportLinks["application/pdf"]&&(e.downloadUrl=e.exportLinks["application/pdf"],e.title=e.title+".pdf",e.mimeType="application/pdf"))};if(e&&!e.downloadUrl&&e.mimeType&&e.exportLinks)switch(e.mimeType.toString().toLowerCase()){case"application/vnd.google-apps.document":s(e,"application/vnd.openxmlformats-officedocument.wordprocessingml.document","docx");break;case"application/vnd.google-apps.spreadsheet":s(e,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlsx");break;case"application/vnd.google-apps.drawing":s(e,"image/png","png");break;case"application/vnd.google-apps.presentation":s(e,"application/vnd.openxmlformats-officedocument.presentationml.presentation","pptx");break;default:s(e,"application/pdf","pdf")}e&&e.downloadUrl&&i.addDriveAttachment(e,t)}}),o.send()}},_.prototype.driveCreatePiker=function(t){if(e.gapi&&t&&t.access_token){var s=this;e.gapi.load("picker",{callback:function(){if(e.google&&e.google.picker){var i=(new e.google.picker.PickerBuilder).addView((new e.google.picker.DocsView).setIncludeFolders(!0)).setAppId(jt.settingsGet("GoogleClientID")).setOAuthToken(t.access_token).setCallback(r.bind(s.driveCallback,s,t.access_token)).enableFeature(e.google.picker.Feature.NAV_HIDDEN).build();i.setVisible(!0)}}})}},_.prototype.driveOpenPopup=function(){if(e.gapi){var t=this;e.gapi.load("auth",{callback:function(){var s=e.gapi.auth.getToken();s?t.driveCreatePiker(s):e.gapi.auth.authorize({client_id:jt.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!0},function(s){if(s&&!s.error){var i=e.gapi.auth.getToken();i&&t.driveCreatePiker(i)}else e.gapi.auth.authorize({client_id:jt.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!1},function(s){if(s&&!s.error){var i=e.gapi.auth.getToken();i&&t.driveCreatePiker(i)}})})}})}},_.prototype.getAttachmentById=function(e){for(var t=this.attachments(),s=0,i=t.length;i>s;s++)if(t[s]&&e===t[s].id)return t[s];return null},_.prototype.initUploader=function(){if(this.composeUploaderButton()){var e={},t=Mt.pInt(jt.settingsGet("AttachmentLimit")),s=new a({action:jt.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});s?(s.on("onDragEnter",r.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",r.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",r.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",r.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",r.bind(function(t,s,i){var o=null;Mt.isUnd(e[t])?(o=this.getAttachmentById(t),o&&(e[t]=o)):o=e[t],o&&o.progress(" - "+Math.floor(s/i*100)+"%")},this)).on("onSelect",r.bind(function(e,i){this.dragAndDropOver(!1);var o=this,n=Mt.isUnd(i.FileName)?"":i.FileName.toString(),a=Mt.isNormal(i.Size)?Mt.pInt(i.Size):null,r=new A(e,n,a);return r.cancel=function(e){return function(){o.attachments.remove(function(t){return t&&t.id===e}),s&&s.cancel(e)}}(e),this.attachments.push(r),a>0&&t>0&&a>t?(r.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",r.bind(function(t){var s=null;Mt.isUnd(e[t])?(s=this.getAttachmentById(t),s&&(e[t]=s)):s=e[t],s&&(s.waiting(!1),s.uploading(!0))},this)).on("onComplete",r.bind(function(t,s,i){var o="",n=null,a=null,r=this.getAttachmentById(t);a=s&&i&&i.Result&&i.Result.Attachment?i.Result.Attachment:null,n=i&&i.Result&&i.Result.ErrorCode?i.Result.ErrorCode:null,null!==n?o=Mt.getUploadErrorDescByCode(n):a||(o=Mt.i18n("UPLOAD/ERROR_UNKNOWN")),r&&(""!==o&&0<o.length?r.waiting(!1).uploading(!1).error(o):a&&(r.waiting(!1).uploading(!1),r.initByUploadJson(a)),Mt.isUnd(e[t])&&delete e[t])},this)),this.addAttachmentEnabled(!0).dragAndDropEnabled(s.isDragAndDropSupported())):this.addAttachmentEnabled(!1).dragAndDropEnabled(!1)}},_.prototype.prepearAttachmentsForSendOrSave=function(){var e={};return r.each(this.attachmentsInReady(),function(t){t&&""!==t.tempName()&&t.enabled()&&(e[t.tempName()]=[t.fileName(),t.isInline?"1":"0",t.CID,t.contentLocation])}),e},_.prototype.addMessageAsAttachment=function(e){if(e){var t=this,s=null,i=e.subject(),o=function(e){return function(){t.attachments.remove(function(t){return t&&t.id===e})}};i=".eml"===i.substr(-4).toLowerCase()?i:i+".eml",s=new A(e.requestHash,i,e.size()),s.fromMessage=!0,s.cancel=o(e.requestHash),s.waiting(!1).uploading(!0),this.attachments.push(s)}},_.prototype.addDropboxAttachment=function(e){var t=this,s=null,i=function(e){return function(){t.attachments.remove(function(t){return t&&t.id===e})}},o=Mt.pInt(jt.settingsGet("AttachmentLimit")),n=e.bytes;return s=new A(e.link,e.name,n),s.fromMessage=!1,s.cancel=i(e.link),s.waiting(!1).uploading(!0),this.attachments.push(s),n>0&&o>0&&n>o?(s.uploading(!1),s.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(jt.remote().composeUploadExternals(function(e,t){var i=!1;s.uploading(!1),Lt.StorageResultType.Success===e&&t&&t.Result&&t.Result[s.id]&&(i=!0,s.tempName(t.Result[s.id])),i||s.error(Mt.getUploadErrorDescByCode(Lt.UploadErrorCode.FileNoUploaded))},[e.link]),!0)},_.prototype.addDriveAttachment=function(e,t){var s=this,i=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}},o=Mt.pInt(jt.settingsGet("AttachmentLimit")),n=null,a=e.fileSize?Mt.pInt(e.fileSize):0;return n=new A(e.downloadUrl,e.title,a),n.fromMessage=!1,n.cancel=i(e.downloadUrl),n.waiting(!1).uploading(!0),this.attachments.push(n),a>0&&o>0&&a>o?(n.uploading(!1),n.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(jt.remote().composeUploadDrive(function(e,t){var s=!1;n.uploading(!1),Lt.StorageResultType.Success===e&&t&&t.Result&&t.Result[n.id]&&(s=!0,n.tempName(t.Result[n.id][0]),n.size(Mt.pInt(t.Result[n.id][1]))),s||n.error(Mt.getUploadErrorDescByCode(Lt.UploadErrorCode.FileNoUploaded))},e.downloadUrl,t),!0)},_.prototype.prepearMessageAttachments=function(e,t){if(e){var s=this,i=Mt.isNonEmptyArray(e.attachments())?e.attachments():[],o=0,n=i.length,a=null,r=null,l=!1,c=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}};if(Lt.ComposeType.ForwardAsAttachment===t)this.addMessageAsAttachment(e);else for(;n>o;o++){switch(r=i[o],l=!1,t){case Lt.ComposeType.Reply:case Lt.ComposeType.ReplyAll:l=r.isLinked;break;case Lt.ComposeType.Forward:case Lt.ComposeType.Draft:case Lt.ComposeType.EditAsNew:l=!0}l&&(a=new A(r.download,r.fileName,r.estimatedSize,r.isInline,r.isLinked,r.cid,r.contentLocation),a.fromMessage=!0,a.cancel=c(r.download),a.waiting(!1).uploading(!0),this.attachments.push(a))}}},_.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(e){return e&&e.isLinked})},_.prototype.setMessageAttachmentFailedDowbloadText=function(){r.each(this.attachments(),function(e){e&&e.fromMessage&&e.waiting(!1).uploading(!1).error(Mt.getUploadErrorDescByCode(Lt.UploadErrorCode.FileNoUploaded))},this)},_.prototype.isEmptyForm=function(e){e=Mt.isUnd(e)?!0:!!e;var t=e?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&&t&&(!this.oEditor||""===this.oEditor.getData())},_.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.attachmentsInProcessError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},_.prototype.getAttachmentsDownloadsForUpload=function(){return r.map(r.filter(this.attachments(),function(e){return e&&""===e.tempName()}),function(e){return e.id})},_.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Mt.extendAsViewModel("PopupsContactsViewModel",U),U.prototype.getPropertyPlceholder=function(e){var t="";
|
||
switch(e){case Lt.ContactPropertyType.LastName:t="CONTACTS/PLACEHOLDER_ENTER_LAST_NAME";break;case Lt.ContactPropertyType.FirstName:t="CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME";break;case Lt.ContactPropertyType.Nick:t="CONTACTS/PLACEHOLDER_ENTER_NICK_NAME"}return t},U.prototype.addNewProperty=function(e,t){this.viewProperties.push(new w(e,t||"","",!0,this.getPropertyPlceholder(e)))},U.prototype.addNewOrFocusProperty=function(e,t){var s=r.find(this.viewProperties(),function(t){return e===t.type()});s?s.focused(!0):this.addNewProperty(e,t)},U.prototype.addNewTag=function(){this.viewTags.visibility(!0),this.viewTags.focusTrigger(!0)},U.prototype.addNewEmail=function(){this.addNewProperty(Lt.ContactPropertyType.Email,"Home")},U.prototype.addNewPhone=function(){this.addNewProperty(Lt.ContactPropertyType.Phone,"Mobile")},U.prototype.addNewWeb=function(){this.addNewProperty(Lt.ContactPropertyType.Web)},U.prototype.addNewNickname=function(){this.addNewOrFocusProperty(Lt.ContactPropertyType.Nick)},U.prototype.addNewNotes=function(){this.addNewOrFocusProperty(Lt.ContactPropertyType.Note)},U.prototype.addNewBirthday=function(){this.addNewOrFocusProperty(Lt.ContactPropertyType.Birthday)},U.prototype.exportVcf=function(){jt.download(jt.link().exportContactsVcf())},U.prototype.exportCsv=function(){jt.download(jt.link().exportContactsCsv())},U.prototype.initUploader=function(){if(this.importUploaderButton()){var t=new a({action:jt.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});t&&t.on("onStart",r.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",r.bind(function(t,s,i){this.contacts.importing(!1),this.reloadContactList(),t&&s&&i&&i.Result||e.alert(Mt.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},U.prototype.removeCheckedOrSelectedContactsFromList=function(){var e=this,t=this.contacts,s=this.currentContact(),i=this.contacts().length,o=this.contactsCheckedOrSelected();0<o.length&&(r.each(o,function(t){s&&s.idContact===t.idContact&&(s=null,e.currentContact(null)),t.deleted(!0),i--}),0>=i&&(this.bDropPageAfterDelete=!0),r.delay(function(){r.each(o,function(e){t.remove(e)})},500))},U.prototype.deleteSelectedContacts=function(){0<this.contactsCheckedOrSelected().length&&(jt.remote().contactsDelete(r.bind(this.deleteResponse,this),this.contactsCheckedOrSelectedUids()),this.removeCheckedOrSelectedContactsFromList())},U.prototype.deleteResponse=function(e,t){500<(Lt.StorageResultType.Success===e&&t&&t.Time?Mt.pInt(t.Time):0)?this.reloadContactList(this.bDropPageAfterDelete):r.delay(function(e){return function(){e.reloadContactList(e.bDropPageAfterDelete)}}(this),500)},U.prototype.removeProperty=function(e){this.viewProperties.remove(e)},U.prototype.populateViewContact=function(e){var t="",s="",i="",o=[];this.watchHash(!1),this.emptySelection(!1),this.viewReadOnly(!1),this.viewTags(""),e&&(t=e.idContact,Mt.isNonEmptyArray(e.properties)&&r.each(e.properties,function(e){e&&e[0]&&(Lt.ContactPropertyType.LastName===e[0]?s=e[1]:Lt.ContactPropertyType.FirstName===e[0]?i=e[1]:o.push(new w(e[0],e[2]||"",e[1])))}),this.viewTags(e.tags),this.viewReadOnly(!!e.readOnly)),this.viewTags.focusTrigger.valueHasMutated(),this.viewTags.visibility(""!==this.viewTags()),o.unshift(new w(Lt.ContactPropertyType.LastName,"",s,!1,this.getPropertyPlceholder(Lt.ContactPropertyType.LastName))),o.unshift(new w(Lt.ContactPropertyType.FirstName,"",i,!e,this.getPropertyPlceholder(Lt.ContactPropertyType.FirstName))),this.viewID(t),this.viewProperties([]),this.viewProperties(o),this.watchDirty(!1),this.watchHash(!0)},U.prototype.reloadContactList=function(e){var t=this,s=(this.contactsPage()-1)*It.Defaults.ContactsPerPage;this.bDropPageAfterDelete=!1,(Mt.isUnd(e)?1:!e)||(this.contactsPage(1),s=0),this.contacts.loading(!0),jt.remote().contacts(function(e,s){var i=0,o=[],n=[];Lt.StorageResultType.Success===e&&s&&s.Result&&s.Result.List&&(Mt.isNonEmptyArray(s.Result.List)&&(o=r.map(s.Result.List,function(e){var t=new C;return t.parse(e)?t:null}),o=r.compact(o),i=Mt.pInt(s.Result.Count),i=i>0?i:0),Mt.isNonEmptyArray(s.Result.Tags)&&(n=r.map(s.Result.Tags,function(e){var t=new T;return t.parse(e)?t:null}),n=r.compact(n))),t.contactsCount(i),t.contacts(o),t.contacts.loading(!1),t.contactTags(n),t.viewClearSearch(""!==t.search())},s,It.Defaults.ContactsPerPage,this.search())},U.prototype.onBuild=function(e){this.oContentVisible=t(".b-list-content",e),this.oContentScrollable=t(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,Lt.KeyState.ContactList);var i=this;c("delete",Lt.KeyState.ContactList,function(){return i.deleteCommand(),!1}),e.on("click",".e-pagenator .e-page",function(){var e=s.dataFor(this);e&&(i.contactsPage(Mt.pInt(e.value)),i.reloadContactList())}),this.initUploader()},U.prototype.onShow=function(){xt.routeOff(),this.reloadContactList(!0)},U.prototype.onHide=function(){xt.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},Mt.extendAsViewModel("PopupsAdvancedSearchViewModel",x),x.prototype.buildSearchStringValue=function(e){return-1<e.indexOf(" ")&&(e='"'+e+'"'),e},x.prototype.buildSearchString=function(){var e=[],t=Mt.trim(this.from()),s=Mt.trim(this.to()),i=Mt.trim(this.subject()),o=Mt.trim(this.text()),a=[],r=[];return t&&""!==t&&e.push("from:"+this.buildSearchStringValue(t)),s&&""!==s&&e.push("to:"+this.buildSearchStringValue(s)),i&&""!==i&&e.push("subject:"+this.buildSearchStringValue(i)),this.hasAttachment()&&r.push("attachment"),this.unseen()&&a.push("unseen"),this.starred()&&a.push("flagged"),0<r.length&&e.push("has:"+r.join(",")),0<a.length&&e.push("is:"+a.join(",")),-1<this.selectedDateValue()&&e.push("date:"+n().subtract("days",this.selectedDateValue()).format("YYYY.MM.DD")+"/"),o&&""!==o&&e.push("text:"+this.buildSearchStringValue(o)),Mt.trim(e.join(" "))},x.prototype.clearPopup=function(){this.from(""),this.to(""),this.subject(""),this.text(""),this.selectedDateValue(-1),this.hasAttachment(!1),this.starred(!1),this.unseen(!1),this.fromFocus(!0)},x.prototype.onShow=function(){this.clearPopup()},x.prototype.onFocus=function(){this.fromFocus(!0)},Mt.extendAsViewModel("PopupsAddAccountViewModel",V),V.prototype.clearPopup=function(){this.email(""),this.password(""),this.emailError(!1),this.passwordError(!1),this.submitRequest(!1),this.submitError("")},V.prototype.onShow=function(){this.clearPopup()},V.prototype.onFocus=function(){this.emailFocus(!0)},Mt.extendAsViewModel("PopupsAddOpenPgpKeyViewModel",H),H.prototype.clearPopup=function(){this.key(""),this.key.error(!1)},H.prototype.onShow=function(){this.clearPopup()},H.prototype.onFocus=function(){this.key.focus(!0)},Mt.extendAsViewModel("PopupsViewOpenPgpKeyViewModel",B),B.prototype.clearPopup=function(){this.key("")},B.prototype.selectKey=function(){var e=this.keyDom();e&&Mt.selectElement(e)},B.prototype.onShow=function(e){this.clearPopup(),e&&this.key(e.armor)},Mt.extendAsViewModel("PopupsGenerateNewOpenPgpKeyViewModel",G),G.prototype.clearPopup=function(){this.name(""),this.password(""),this.email(""),this.email.error(!1),this.keyBitLength(2048)},G.prototype.onShow=function(){this.clearPopup()},G.prototype.onFocus=function(){this.email.focus(!0)},Mt.extendAsViewModel("PopupsComposeOpenPgpViewModel",K),K.prototype.clearPopup=function(){this.notification(""),this.password(""),this.password.focus(!1),this.buttonFocus(!1),this.from(""),this.to([]),this.text(""),this.submitRequest(!1),this.resultCallback=null},K.prototype.onBuild=function(){c("tab,shift+tab",Lt.KeyState.PopupComposeOpenPGP,r.bind(function(){switch(!0){case this.password.focus():this.buttonFocus(!0);break;case this.buttonFocus():this.password.focus(!0)}return!1},this))},K.prototype.onHide=function(){this.clearPopup()},K.prototype.onFocus=function(){this.sign()?this.password.focus(!0):this.buttonFocus(!0)},K.prototype.onShow=function(e,t,s,i,o,n){this.clearPopup();var a=new v,l="",c=[];this.resultCallback=e,a.clear(),a.mailsoParse(s),""!==a.email&&(l=a.email),""!==i&&c.push(i),""!==o&&c.push(o),""!==n&&c.push(n),c=c.join(", ").split(","),c=r.compact(r.map(c,function(e){return a.clear(),a.mailsoParse(Mt.trim(e)),""===a.email?!1:a.email})),this.from(l),this.to(c),this.text(t)},Mt.extendAsViewModel("PopupsIdentityViewModel",q),q.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("")},q.prototype.onShow=function(e){this.clearPopup(),e&&(this.edit(!0),this.id=e.id,this.name(e.name()),this.email(e.email()),this.replyTo(e.replyTo()),this.bcc(e.bcc()),this.owner(this.id===jt.data().accountEmail()))},q.prototype.onFocus=function(){this.owner()||this.email.focused(!0)},Mt.extendAsViewModel("PopupsLanguagesViewModel",j),j.prototype.languageEnName=function(e){return Mt.convertLangName(e,!0)},j.prototype.resetMainLanguage=function(){var e=jt.data().mainLanguage();r.each(this.languages(),function(t){t.selected(t.key===e)})},j.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},j.prototype.onHide=function(){this.exp(!1)},j.prototype.changeLanguage=function(e){jt.data().mainLanguage(e),this.cancelCommand()},Mt.extendAsViewModel("PopupsTwoFactorTestViewModel",z),z.prototype.clearPopup=function(){this.code(""),this.code.focused(!1),this.code.status(null),this.testing(!1)},z.prototype.onShow=function(){this.clearPopup()},z.prototype.onFocus=function(){this.code.focused(!0)},Mt.extendAsViewModel("PopupsAskViewModel",W),W.prototype.clearPopup=function(){this.askDesc(""),this.yesButton(Mt.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton(Mt.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},W.prototype.yesClick=function(){this.cancelCommand(),Mt.isFunc(this.fYesAction)&&this.fYesAction.call(null)},W.prototype.noClick=function(){this.cancelCommand(),Mt.isFunc(this.fNoAction)&&this.fNoAction.call(null)},W.prototype.onShow=function(e,t,s,i,o){this.clearPopup(),this.fYesAction=t||null,this.fNoAction=s||null,this.askDesc(e||""),i&&this.yesButton(i),i&&this.yesButton(o)},W.prototype.onFocus=function(){this.yesFocus(!0)},W.prototype.onBuild=function(){c("tab, shift+tab, right, left",Lt.KeyState.PopupAsk,r.bind(function(){return this.yesFocus()?this.noFocus(!0):this.yesFocus(!0),!1},this)),c("esc",Lt.KeyState.PopupAsk,r.bind(function(){return this.noClick(),!1},this))},Mt.extendAsViewModel("PopupsKeyboardShortcutsHelpViewModel",J),J.prototype.onBuild=function(e){c("tab, shift+tab, left, right",Lt.KeyState.PopupKeyboardShortcutsHelp,r.bind(function(t,s){if(t&&s){var i=e.find(".nav.nav-tabs > li"),o=s&&("tab"===s.shortcut||"right"===s.shortcut),n=i.index(i.filter(".active"));return!o&&n>0?n--:o&&n<i.length-1?n++:n=o?0:i.length-1,i.eq(n).find('a[data-toggle="tab"]').tab("show"),!1}},this))},Mt.extendAsViewModel("PopupsFilterViewModel",Y),Y.prototype.clearPopup=function(){},Y.prototype.onShow=function(e){this.clearPopup(),this.filter(e)},Y.prototype.onFocus=function(){},Mt.extendAsViewModel("LoginViewModel",$),$.prototype.onShow=function(){xt.routeOff(),r.delay(r.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0),jt.settingsGet("UserLanguage")&&t.cookie("rllang",jt.data().language(),{expires:30})},this),100)},$.prototype.onHide=function(){this.submitFocus(!1),this.emailFocus(!1)},$.prototype.onBuild=function(){var s=this,i=jt.settingsGet("JsHash"),o=function(e){e=Mt.pInt(e),0===e?(s.submitRequest(!0),jt.loginAndLogoutReload()):s.submitError(Mt.getNotification(e))};switch(this.facebookLoginEnabled(!!jt.settingsGet("AllowFacebookSocial")),this.twitterLoginEnabled(!!jt.settingsGet("AllowTwitterSocial")),this.googleLoginEnabled(!!jt.settingsGet("AllowGoogleSocial")),(jt.settingsGet("SignMe")||"unused").toLowerCase()){case Lt.LoginSignMeTypeAsString.DefaultOff:this.signMeType(Lt.LoginSignMeType.DefaultOff);break;case Lt.LoginSignMeTypeAsString.DefaultOn:this.signMeType(Lt.LoginSignMeType.DefaultOn);break;default:case Lt.LoginSignMeTypeAsString.Unused:this.signMeType(Lt.LoginSignMeType.Unused)}this.email(jt.data().devEmail),this.password(jt.data().devPassword),this.googleLoginEnabled()&&(e["rl_"+i+"_google_login_service"]=o),this.facebookLoginEnabled()&&(e["rl_"+i+"_facebook_login_service"]=o),this.twitterLoginEnabled()&&(e["rl_"+i+"_twitter_login_service"]=o),r.delay(function(){jt.data().language.subscribe(function(e){s.langRequest(!0),t.ajax({url:jt.link().langLink(e),dataType:"script",cache:!0}).done(function(){s.bSendLanguage=!0,Mt.i18nToDoc(),t.cookie("rllang",jt.data().language(),{expires:30})}).always(function(){s.langRequest(!1)})})},50),Mt.triggerAutocompleteInputChange(!0)},$.prototype.submitForm=function(){this.submitCommand()},$.prototype.selectLanguage=function(){xt.showScreenPopup(j)},r.extend(X.prototype,b.prototype),X.prototype.accountClick=function(e,t){if(e&&t&&!Mt.isUnd(t.which)&&1===t.which){var s=this;this.accountsLoading(!0),r.delay(function(){s.accountsLoading(!1)},1e3)}return!0},X.prototype.emailTitle=function(){return jt.data().accountEmail()},X.prototype.settingsClick=function(){xt.setHash(jt.link().settings())},X.prototype.settingsHelp=function(){xt.showScreenPopup(J)},X.prototype.addAccountClick=function(){this.capaAdditionalAccounts&&xt.showScreenPopup(V)},X.prototype.logoutClick=function(){jt.remote().logout(function(){e.__rlah_clear&&e.__rlah_clear(),jt.loginAndLogoutReload(!0,jt.settingsGet("ParentEmail")&&0<jt.settingsGet("ParentEmail").length)})},X.prototype.onBuild=function(){var e=this;c("`",[Lt.KeyState.MessageList,Lt.KeyState.MessageView,Lt.KeyState.Settings],function(){e.viewModelVisibility()&&e.accountMenuDropdownTrigger(!0)}),c("shift+/",[Lt.KeyState.MessageList,Lt.KeyState.MessageView,Lt.KeyState.Settings],function(){return e.viewModelVisibility()?(xt.showScreenPopup(J),!1):void 0})},Mt.extendAsViewModel("MailBoxSystemDropDownViewModel",Q,X),Mt.extendAsViewModel("SettingsSystemDropDownViewModel",Z,X),Mt.extendAsViewModel("MailBoxFolderListViewModel",et),et.prototype.onBuild=function(e){this.oContentVisible=t(".b-content",e),this.oContentScrollable=t(".content",this.oContentVisible);var i=this;e.on("click",".b-folders .e-item .e-link .e-collapsed-sign",function(e){var t=s.dataFor(this),i=!1;t&&e&&(i=t.collapsed(),Mt.setExpandedFolder(t.fullNameHash,i),t.collapsed(!i),e.preventDefault(),e.stopPropagation())}).on("click",".b-folders .e-item .e-link.selectable",function(e){e.preventDefault();var t=jt.data(),i=s.dataFor(this);i&&(Lt.Layout.NoPreview===t.layout()&&t.message(null),i.fullNameRaw===t.currentFolderFullNameRaw()&&jt.cache().setFolderHash(i.fullNameRaw,""),xt.setHash(jt.link().mailBox(i.fullNameHash)))}),c("up, down",Lt.KeyState.FolderList,function(s,o){var n=-1,a=o&&"up"===o.shortcut?38:40,r=t(".b-folders .e-item .e-link:not(.hidden):visible",e);return s&&r.length&&(n=r.index(r.filter(".focused")),n>-1&&r.eq(n).removeClass("focused"),38===a&&n>0?n--:40===a&&n<r.length-1&&n++,r.eq(n).addClass("focused"),i.scrollToFocused()),!1}),c("enter",Lt.KeyState.FolderList,function(){var s=t(".b-folders .e-item .e-link:not(.hidden).focused",e);return s.length&&s[0]&&(i.folderList.focused(!1),s.click()),!1}),c("space",Lt.KeyState.FolderList,function(){var i=!0,o=null,n=t(".b-folders .e-item .e-link:not(.hidden).focused",e);return n.length&&n[0]&&(o=s.dataFor(n[0]),o&&(i=o.collapsed(),Mt.setExpandedFolder(o.fullNameHash,i),o.collapsed(!i))),!1}),c("esc, tab, shift+tab, right",Lt.KeyState.FolderList,function(){return i.folderList.focused(!1),!1}),i.folderList.focused.subscribe(function(s){t(".b-folders .e-item .e-link.focused",e).removeClass("focused"),s&&t(".b-folders .e-item .e-link.selected",e).addClass("focused")})},et.prototype.messagesDropOver=function(t){e.clearTimeout(this.iDropOverTimer),t&&t.collapsed()&&(this.iDropOverTimer=e.setTimeout(function(){t.collapsed(!1),Mt.setExpandedFolder(t.fullNameHash,!0),Mt.windowResize()},500))},et.prototype.messagesDropOut=function(){e.clearTimeout(this.iDropOverTimer)},et.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var e=20,s=t(".e-item .e-link.focused",this.oContentScrollable),i=s.position(),o=this.oContentVisible.height(),n=s.outerHeight();return i&&(i.top<0||i.top+n>o)?(this.oContentScrollable.scrollTop(i.top<0?this.oContentScrollable.scrollTop()+i.top-e:this.oContentScrollable.scrollTop()+i.top-o+n+e),!0):!1},et.prototype.messagesDrop=function(e,t){if(e&&t&&t.helper){var s=t.helper.data("rl-folder"),i=Bt.hasClass("rl-ctrl-key-pressed"),o=t.helper.data("rl-uids");Mt.isNormal(s)&&""!==s&&Mt.isArray(o)&&jt.moveMessagesToFolder(s,o,e.fullNameRaw,i)}},et.prototype.composeClick=function(){xt.showScreenPopup(_)},et.prototype.createFolder=function(){xt.showScreenPopup(k)},et.prototype.configureFolders=function(){xt.setHash(jt.link().settings("folders"))},et.prototype.contactsClick=function(){this.allowContacts&&xt.showScreenPopup(U)},Mt.extendAsViewModel("MailBoxMessageListViewModel",tt),tt.prototype.emptySubjectValue="",tt.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue),this.inputMessageListSearchFocus(!1)},tt.prototype.printableMessageCountForDeletion=function(){var e=this.messageListCheckedOrSelectedUidsWithSubMails().length;return e>1?" ("+(100>e?e:"99+")+")":""},tt.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},tt.prototype.moveSelectedMessagesToFolder=function(e,t){return this.canBeMoved()&&jt.moveMessagesToFolder(jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),e,t),!1},tt.prototype.dragAndDronHelper=function(e){e&&e.checked(!0);var t=Mt.draggeblePlace(),s=jt.data().messageListCheckedOrSelectedUidsWithSubMails();return t.data("rl-folder",jt.data().currentFolderFullNameRaw()),t.data("rl-uids",s),t.find(".text").text(""+s.length),r.defer(function(){var e=jt.data().messageListCheckedOrSelectedUidsWithSubMails();t.data("rl-uids",e),t.find(".text").text(""+e.length)}),t},tt.prototype.onMessageResponse=function(e,t,s){var i=jt.data();i.hideMessageBodies(),i.messageLoading(!1),Lt.StorageResultType.Success===e&&t&&t.Result?i.setMessage(t,s):Lt.StorageResultType.Unload===e?(i.message(null),i.messageError("")):Lt.StorageResultType.Abort!==e&&(i.message(null),i.messageError(Mt.getNotification(t&&t.ErrorCode?t.ErrorCode:Lt.Notification.UnknownError)))},tt.prototype.populateMessageBody=function(e){e&&(jt.remote().message(this.onMessageResponse,e.folderFullNameRaw,e.uid)?jt.data().messageLoading(!0):Mt.log("Error: Unknown message request: "+e.folderFullNameRaw+" ~ "+e.uid+" [e-101]"))},tt.prototype.setAction=function(e,t,s){var i=[],o=null,n=jt.cache(),a=0;if(Mt.isUnd(s)&&(s=jt.data().messageListChecked()),i=r.map(s,function(e){return e.uid}),""!==e&&0<i.length){switch(t){case Lt.MessageSetAction.SetSeen:r.each(s,function(e){e.unseen()&&a++,e.unseen(!1),n.storeMessageFlagsToCache(e)}),o=n.getFolderFromCacheList(e),o&&o.messageCountUnread(o.messageCountUnread()-a),jt.remote().messageSetSeen(Mt.emptyFunction,e,i,!0);break;case Lt.MessageSetAction.UnsetSeen:r.each(s,function(e){e.unseen()&&a++,e.unseen(!0),n.storeMessageFlagsToCache(e)}),o=n.getFolderFromCacheList(e),o&&o.messageCountUnread(o.messageCountUnread()-a+i.length),jt.remote().messageSetSeen(Mt.emptyFunction,e,i,!1);break;case Lt.MessageSetAction.SetFlag:r.each(s,function(e){e.flagged(!0),n.storeMessageFlagsToCache(e)}),jt.remote().messageSetFlagged(Mt.emptyFunction,e,i,!0);break;case Lt.MessageSetAction.UnsetFlag:r.each(s,function(e){e.flagged(!1),n.storeMessageFlagsToCache(e)}),jt.remote().messageSetFlagged(Mt.emptyFunction,e,i,!1)}jt.reloadFlagsCurrentMessageListAndMessageFromCache()}},tt.prototype.setActionForAll=function(e,t){var s=null,i=jt.data().messageList(),o=jt.cache();if(""!==e&&(s=o.getFolderFromCacheList(e))){switch(t){case Lt.MessageSetAction.SetSeen:s=o.getFolderFromCacheList(e),s&&(r.each(i,function(e){e.unseen(!1)}),s.messageCountUnread(0),o.clearMessageFlagsFromCacheByFolder(e)),jt.remote().messageSetSeenToAll(Mt.emptyFunction,e,!0);break;case Lt.MessageSetAction.UnsetSeen:s=o.getFolderFromCacheList(e),s&&(r.each(i,function(e){e.unseen(!0)}),s.messageCountUnread(s.messageCountAll()),o.clearMessageFlagsFromCacheByFolder(e)),jt.remote().messageSetSeenToAll(Mt.emptyFunction,e,!1)}jt.reloadFlagsCurrentMessageListAndMessageFromCache()}},tt.prototype.listSetSeen=function(){this.setAction(jt.data().currentFolderFullNameRaw(),Lt.MessageSetAction.SetSeen,jt.data().messageListCheckedOrSelected())},tt.prototype.listSetAllSeen=function(){this.setActionForAll(jt.data().currentFolderFullNameRaw(),Lt.MessageSetAction.SetSeen)},tt.prototype.listUnsetSeen=function(){this.setAction(jt.data().currentFolderFullNameRaw(),Lt.MessageSetAction.UnsetSeen,jt.data().messageListCheckedOrSelected())},tt.prototype.listSetFlags=function(){this.setAction(jt.data().currentFolderFullNameRaw(),Lt.MessageSetAction.SetFlag,jt.data().messageListCheckedOrSelected())},tt.prototype.listUnsetFlags=function(){this.setAction(jt.data().currentFolderFullNameRaw(),Lt.MessageSetAction.UnsetFlag,jt.data().messageListCheckedOrSelected())},tt.prototype.flagMessages=function(e){var t=this.messageListCheckedOrSelected(),s=[];e&&(0<t.length&&(s=r.map(t,function(e){return e.uid})),0<s.length&&-1<Mt.inArray(e.uid,s)?this.setAction(e.folderFullNameRaw,e.flagged()?Lt.MessageSetAction.UnsetFlag:Lt.MessageSetAction.SetFlag,t):this.setAction(e.folderFullNameRaw,e.flagged()?Lt.MessageSetAction.UnsetFlag:Lt.MessageSetAction.SetFlag,[e]))},tt.prototype.flagMessagesFast=function(e){var t=this.messageListCheckedOrSelected(),s=[];0<t.length&&(s=r.filter(t,function(e){return e.flagged()}),Mt.isUnd(e)?this.setAction(t[0].folderFullNameRaw,t.length===s.length?Lt.MessageSetAction.UnsetFlag:Lt.MessageSetAction.SetFlag,t):this.setAction(t[0].folderFullNameRaw,e?Lt.MessageSetAction.SetFlag:Lt.MessageSetAction.UnsetFlag,t))},tt.prototype.seenMessagesFast=function(e){var t=this.messageListCheckedOrSelected(),s=[];0<t.length&&(s=r.filter(t,function(e){return e.unseen()}),Mt.isUnd(e)?this.setAction(t[0].folderFullNameRaw,0<s.length?Lt.MessageSetAction.SetSeen:Lt.MessageSetAction.UnsetSeen,t):this.setAction(t[0].folderFullNameRaw,e?Lt.MessageSetAction.SetSeen:Lt.MessageSetAction.UnsetSeen,t))},tt.prototype.onBuild=function(e){var i=this,o=jt.data();this.oContentVisible=t(".b-content",e),this.oContentScrollable=t(".content",this.oContentVisible),this.oContentVisible.on("click",".fullThreadHandle",function(){var e=[],t=s.dataFor(this);return t&&!t.lastInCollapsedThreadLoading()&&(jt.data().messageListThreadFolder(t.folderFullNameRaw),e=jt.data().messageListThreadUids(),t.lastInCollapsedThread()?e.push(0<t.parentUid()?t.parentUid():t.uid):e=r.without(e,0<t.parentUid()?t.parentUid():t.uid),jt.data().messageListThreadUids(r.uniq(e)),t.lastInCollapsedThreadLoading(!0),t.lastInCollapsedThread(!t.lastInCollapsedThread()),jt.reloadMessageList()),!1}),this.selector.init(this.oContentVisible,this.oContentScrollable,Lt.KeyState.MessageList),e.on("click",".messageList .b-message-list-wrapper",function(){i.message.focused()&&i.message.focused(!1)}).on("click",".e-pagenator .e-page",function(){var e=s.dataFor(this);e&&xt.setHash(jt.link().mailBox(o.currentFolderFullNameHash(),e.value,o.messageListSearch()))}).on("click",".messageList .checkboxCkeckAll",function(){i.checkAll(!i.checkAll())}).on("click",".messageList .messageListItem .flagParent",function(){i.flagMessages(s.dataFor(this))}),this.initUploaderForAppend(),this.initShortcuts(),!Ot.bMobileDevice&&jt.capa(Lt.Capa.Prefetch)&&l&&(l.setIdleDuration(10),l.idle(function(){i.prefetchNextTick()}))},tt.prototype.initShortcuts=function(){var e=this;c("ctrl+p, command+p",Lt.KeyState.MessageList,function(){return!1}),c("z",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return e.archiveCommand(),!1}),c("delete, shift+delete, shift+3",Lt.KeyState.MessageList,function(t,s){return t?(0<jt.data().messageListCheckedOrSelected().length&&(s&&"shift+delete"===s.shortcut?e.deleteWithoutMoveCommand():e.deleteCommand()),!1):void 0}),c("ctrl+r, command+r",[Lt.KeyState.FolderList,Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return e.reloadCommand(),!1}),c("ctrl+a, command+a",Lt.KeyState.MessageList,function(){return e.checkAll(!(e.checkAll()&&!e.isIncompleteChecked())),!1}),c("w,c",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return xt.showScreenPopup(_),!1}),c("i",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return e.flagMessagesFast(),!1}),c("m",Lt.KeyState.MessageList,function(){return e.moveDropdownTrigger(!0),!1}),c("q",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return e.seenMessagesFast(!0),!1}),c("u",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return e.seenMessagesFast(!1),!1}),c("shift+f",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return e.multyForwardCommand(),!1}),c("/",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return e.inputMessageListSearchFocus(!0),!1}),c("esc",Lt.KeyState.MessageList,function(){return""!==e.messageListSearchDesc()?(e.cancelSearch(),!1):void 0}),c("tab, shift+tab, left, right",Lt.KeyState.MessageList,function(t,s){return t&&s&&"shift+tab"===s.shortcut||"left"===s.shortcut?e.folderList.focused(!0):e.message()&&e.message.focused(!0),!1}),c("ctrl+left, command+left",Lt.KeyState.MessageView,function(){return!1}),c("ctrl+right, command+right",Lt.KeyState.MessageView,function(){return!1})},tt.prototype.prefetchNextTick=function(){if(!this.bPrefetch&&!l.now()&&this.viewModelVisibility()){var e=this,t=jt.cache(),s=r.find(this.messageList(),function(e){return e&&!t.hasRequestedMessage(e.folderFullNameRaw,e.uid)});s&&(this.bPrefetch=!0,jt.cache().addRequestedMessage(s.folderFullNameRaw,s.uid),jt.remote().message(function(t,s){var i=!(Lt.StorageResultType.Success!==t||!s||!s.Result);r.delay(function(){e.bPrefetch=!1,i&&e.prefetchNextTick()},1e3)},s.folderFullNameRaw,s.uid))}},tt.prototype.composeClick=function(){xt.showScreenPopup(_)},tt.prototype.advancedSearchClick=function(){xt.showScreenPopup(x)},tt.prototype.quotaTooltip=function(){return Mt.i18n("MESSAGE_LIST/QUOTA_SIZE",{SIZE:Mt.friendlySize(this.userUsageSize()),PROC:this.userUsageProc(),LIMIT:Mt.friendlySize(this.userQuota())})},tt.prototype.initUploaderForAppend=function(){if(!jt.settingsGet("AllowAppendMessage")||!this.dragOverArea())return!1;var e=new a({action:jt.link().append(),name:"AppendFile",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,hidden:{Folder:function(){return jt.data().currentFolderFullNameRaw()}},dragAndDropElement:this.dragOverArea(),dragAndDropBodyElement:this.dragOverBodyArea()});return e.on("onDragEnter",r.bind(function(){this.dragOverEnter(!0)},this)).on("onDragLeave",r.bind(function(){this.dragOverEnter(!1)},this)).on("onBodyDragEnter",r.bind(function(){this.dragOver(!0)},this)).on("onBodyDragLeave",r.bind(function(){this.dragOver(!1)},this)).on("onSelect",r.bind(function(e,t){return e&&t&&"message/rfc822"===t.Type?(jt.data().messageListLoading(!0),!0):!1},this)).on("onComplete",r.bind(function(){jt.reloadMessageList(!0,!0)},this)),!!e},Mt.extendAsViewModel("MailBoxMessageViewViewModel",st),st.prototype.isPgpActionVisible=function(){return Lt.SignedVerifyStatus.Success!==this.viewPgpSignedVerifyStatus()},st.prototype.isPgpStatusVerifyVisible=function(){return Lt.SignedVerifyStatus.None!==this.viewPgpSignedVerifyStatus()},st.prototype.isPgpStatusVerifySuccess=function(){return Lt.SignedVerifyStatus.Success===this.viewPgpSignedVerifyStatus()},st.prototype.pgpStatusVerifyMessage=function(){var e="";switch(this.viewPgpSignedVerifyStatus()){case Lt.SignedVerifyStatus.UnknownPublicKeys:e=Mt.i18n("PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND");break;case Lt.SignedVerifyStatus.UnknownPrivateKey:e=Mt.i18n("PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND");break;case Lt.SignedVerifyStatus.Unverified:e=Mt.i18n("PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE");break;case Lt.SignedVerifyStatus.Error:e=Mt.i18n("PGP_NOTIFICATIONS/DECRYPTION_ERROR");break;case Lt.SignedVerifyStatus.Success:e=Mt.i18n("PGP_NOTIFICATIONS/GOOD_SIGNATURE",{USER:this.viewPgpSignedVerifyUser()})}return e},st.prototype.scrollToTop=function(){var e=t(".messageItem.nano .content",this.viewModelDom);e&&e[0]?e.scrollTop(0):t(".messageItem",this.viewModelDom).scrollTop(0),Mt.windowResize()},st.prototype.fullScreen=function(){this.fullScreenMode(!0),Mt.windowResize()},st.prototype.unFullScreen=function(){this.fullScreenMode(!1),Mt.windowResize()},st.prototype.toggleFullScreen=function(){Mt.removeSelection(),this.fullScreenMode(!this.fullScreenMode()),Mt.windowResize()},st.prototype.replyOrforward=function(e){xt.showScreenPopup(_,[e,jt.data().message()])},st.prototype.onBuild=function(e){var i=this,o=jt.data();this.fullScreenMode.subscribe(function(e){e&&i.message.focused(!0)},this),t(".attachmentsPlace",e).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){o.useKeyboardShortcuts(!1)},close:function(){o.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),e.on("click",".messageView .messageItem .messageItemHeader",function(){o.useKeyboardShortcuts()&&i.message()&&i.message.focused(!0)}).on("click","a",function(e){return!(e&&3!==e.which&&jt.mailToHelper(t(this).attr("href")))}).on("click",".attachmentsPlace .attachmentPreview",function(e){e&&e.stopPropagation&&e.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var e=s.dataFor(this);e&&e.download&&jt.download(e.linkDownload())}),this.message.focused.subscribe(function(e){this.messageDomFocused(e&&!Mt.inFocus()?!0:!1)},this),this.messageDomFocused.subscribe(function(e){e||Lt.KeyState.MessageView!==this.keyScope()||this.message.focused(!1)},this),this.keyScope.subscribe(function(e){Lt.KeyState.MessageView===e&&this.message.focused()&&this.messageDomFocused(!0)},this),this.oMessageScrollerDom=e.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null,this.initShortcuts()},st.prototype.escShortcuts=function(){return this.viewModelVisibility()&&this.message()?(this.fullScreenMode()?this.fullScreenMode(!1):Lt.Layout.NoPreview===jt.data().layout()?this.message(null):this.message.focused(!1),!1):void 0},st.prototype.initShortcuts=function(){var e=this,t=jt.data();c("esc",Lt.KeyState.MessageView,r.bind(this.escShortcuts,this)),c("enter",Lt.KeyState.MessageView,function(){return e.toggleFullScreen(),!1}),c("enter",Lt.KeyState.MessageList,function(){return Lt.Layout.NoPreview!==t.layout()&&e.message()?(e.toggleFullScreen(),!1):void 0}),c("r",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return t.message()?(e.replyCommand(),!1):void 0}),c("a",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return t.message()?(e.replyAllCommand(),!1):void 0}),c("f",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return t.message()?(e.forwardCommand(),!1):void 0}),c("b",[Lt.KeyState.MessageList,Lt.KeyState.MessageView],function(){return t.message()&&t.message().body?(Mt.toggleMessageBlockquote(t.message().body),!1):void 0}),c("ctrl+left, command+left, ctrl+up, command+up",Lt.KeyState.MessageView,function(){return e.goUpCommand(),!1}),c("ctrl+right, command+right, ctrl+down, command+down",Lt.KeyState.MessageView,function(){return e.goDownCommand(),!1}),c("ctrl+p, command+p",Lt.KeyState.MessageView,function(){return e.message()&&e.message().printMessage(),!1}),c("delete, shift+delete",Lt.KeyState.MessageView,function(t,s){return t?(s&&"shift+delete"===s.shortcut?e.deleteWithoutMoveCommand():e.deleteCommand(),!1):void 0
|
||
}),c("tab, shift+tab, left",Lt.KeyState.MessageView,function(){return!e.fullScreenMode()&&e.message()&&Lt.Layout.NoPreview!==t.layout()&&e.message.focused(!1),!1})},st.prototype.isDraftFolder=function(){return jt.data().message()&&jt.data().draftFolder()===jt.data().message().folderFullNameRaw},st.prototype.isSentFolder=function(){return jt.data().message()&&jt.data().sentFolder()===jt.data().message().folderFullNameRaw},st.prototype.isSpamFolder=function(){return jt.data().message()&&jt.data().spamFolder()===jt.data().message().folderFullNameRaw},st.prototype.isSpamDisabled=function(){return jt.data().message()&&jt.data().spamFolder()===It.Values.UnuseOptionValue},st.prototype.isArchiveFolder=function(){return jt.data().message()&&jt.data().archiveFolder()===jt.data().message().folderFullNameRaw},st.prototype.isArchiveDisabled=function(){return jt.data().message()&&jt.data().archiveFolder()===It.Values.UnuseOptionValue},st.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},st.prototype.composeClick=function(){xt.showScreenPopup(_)},st.prototype.editMessage=function(){jt.data().message()&&xt.showScreenPopup(_,[Lt.ComposeType.Draft,jt.data().message()])},st.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},st.prototype.showImages=function(e){e&&e.showExternalImages&&e.showExternalImages(!0)},st.prototype.printableCheckedMessageCount=function(){var e=this.messageListCheckedOrSelectedUidsWithSubMails().length;return e>0?100>e?e:"99+":""},st.prototype.verifyPgpSignedClearMessage=function(e){e&&e.verifyPgpSignedClearMessage()},st.prototype.decryptPgpEncryptedMessage=function(e){e&&e.decryptPgpEncryptedMessage(this.viewPgpPassword())},st.prototype.readReceipt=function(e){e&&""!==e.readReceipt()&&(jt.remote().sendReadReceiptMessage(Mt.emptyFunction,e.folderFullNameRaw,e.uid,e.readReceipt(),Mt.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:e.subject()}),Mt.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":jt.data().accountEmail()})),e.isReadReceipt(!0),jt.cache().storeMessageFlagsToCache(e),jt.reloadFlagsCurrentMessageListAndMessageFromCache())},Mt.extendAsViewModel("SettingsMenuViewModel",it),it.prototype.link=function(e){return jt.link().settings(e)},it.prototype.backToMailBoxClick=function(){xt.setHash(jt.link().inbox())},Mt.extendAsViewModel("SettingsPaneViewModel",ot),ot.prototype.onBuild=function(){var e=this;c("esc",Lt.KeyState.Settings,function(){e.backToMailBoxClick()})},ot.prototype.onShow=function(){jt.data().message(null)},ot.prototype.backToMailBoxClick=function(){xt.setHash(jt.link().inbox())},Mt.addSettingsViewModel(nt,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),nt.prototype.toggleLayout=function(){this.layout(Lt.Layout.NoPreview===this.layout()?Lt.Layout.SidePreview:Lt.Layout.NoPreview)},nt.prototype.onBuild=function(){var e=this;r.delay(function(){var s=jt.data(),i=Mt.settingsSaveHelperSimpleFunction(e.mppTrigger,e);s.language.subscribe(function(s){e.languageTrigger(Lt.SaveSettingsStep.Animate),t.ajax({url:jt.link().langLink(s),dataType:"script",cache:!0}).done(function(){Mt.i18nToDoc(),e.languageTrigger(Lt.SaveSettingsStep.TrueResult)}).fail(function(){e.languageTrigger(Lt.SaveSettingsStep.FalseResult)}).always(function(){r.delay(function(){e.languageTrigger(Lt.SaveSettingsStep.Idle)},1e3)}),jt.remote().saveSettings(Mt.emptyFunction,{Language:s})}),s.editorDefaultType.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{EditorDefaultType:e})}),s.messagesPerPage.subscribe(function(e){jt.remote().saveSettings(i,{MPP:e})}),s.showImages.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{ShowImages:e?"1":"0"})}),s.interfaceAnimation.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{InterfaceAnimation:e})}),s.useDesktopNotifications.subscribe(function(e){Mt.timeOutAction("SaveDesktopNotifications",function(){jt.remote().saveSettings(Mt.emptyFunction,{DesktopNotifications:e?"1":"0"})},3e3)}),s.replySameFolder.subscribe(function(e){Mt.timeOutAction("SaveReplySameFolder",function(){jt.remote().saveSettings(Mt.emptyFunction,{ReplySameFolder:e?"1":"0"})},3e3)}),s.useThreads.subscribe(function(e){s.messageList([]),jt.remote().saveSettings(Mt.emptyFunction,{UseThreads:e?"1":"0"})}),s.layout.subscribe(function(e){s.messageList([]),jt.remote().saveSettings(Mt.emptyFunction,{Layout:e})}),s.useCheckboxesInList.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{UseCheckboxesInList:e?"1":"0"})})},50)},nt.prototype.onShow=function(){jt.data().desktopNotifications.valueHasMutated()},nt.prototype.selectLanguage=function(){xt.showScreenPopup(j)},Mt.addSettingsViewModel(at,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),at.prototype.onBuild=function(){jt.data().contactsAutosave.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{ContactsAutosave:e?"1":"0"})})},Mt.addSettingsViewModel(rt,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),rt.prototype.addNewAccount=function(){xt.showScreenPopup(V)},rt.prototype.deleteAccount=function(t){if(t&&t.deleteAccess()){this.accountForDeletion(null);var s=function(e){return t===e};t&&(this.accounts.remove(s),jt.remote().accountDelete(function(t,s){Lt.StorageResultType.Success===t&&s&&s.Result&&s.Reload?(xt.routeOff(),xt.setHash(jt.link().root(),!0),xt.routeOff(),r.defer(function(){e.location.reload()})):jt.accountsAndIdentities()},t.email))}},Mt.addSettingsViewModel(lt,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),lt.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=jt.data().signature();this.editor=new d(e.signatureDom(),function(){jt.data().signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},lt.prototype.onBuild=function(){var e=this;r.delay(function(){var t=jt.data(),s=Mt.settingsSaveHelperSimpleFunction(e.displayNameTrigger,e),i=Mt.settingsSaveHelperSimpleFunction(e.replyTrigger,e),o=Mt.settingsSaveHelperSimpleFunction(e.signatureTrigger,e);t.displayName.subscribe(function(e){jt.remote().saveSettings(s,{DisplayName:e})}),t.replyTo.subscribe(function(e){jt.remote().saveSettings(i,{ReplyTo:e})}),t.signature.subscribe(function(e){jt.remote().saveSettings(o,{Signature:e})}),t.signatureToAll.subscribe(function(e){jt.remote().saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},Mt.addSettingsViewModel(ct,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),ct.prototype.formattedAccountIdentity=function(){var e=this.displayName.peek(),t=this.accountEmail.peek();return""===e?t:'"'+Mt.quoteName(e)+'" <'+t+">"},ct.prototype.addNewIdentity=function(){xt.showScreenPopup(q)},ct.prototype.editIdentity=function(e){xt.showScreenPopup(q,[e])},ct.prototype.deleteIdentity=function(e){if(e&&e.deleteAccess()){this.identityForDeletion(null);var t=function(t){return e===t};e&&(this.identities.remove(t),jt.remote().identityDelete(function(){jt.accountsAndIdentities()},e.id))}},ct.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=jt.data().signature();this.editor=new d(e.signatureDom(),function(){jt.data().signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},ct.prototype.onBuild=function(e){var t=this;e.on("click",".identity-item .e-action",function(){var e=s.dataFor(this);e&&t.editIdentity(e)}),r.delay(function(){var e=jt.data(),s=Mt.settingsSaveHelperSimpleFunction(t.displayNameTrigger,t),i=Mt.settingsSaveHelperSimpleFunction(t.replyTrigger,t),o=Mt.settingsSaveHelperSimpleFunction(t.signatureTrigger,t),n=Mt.settingsSaveHelperSimpleFunction(t.defaultIdentityIDTrigger,t);e.defaultIdentityID.subscribe(function(e){jt.remote().saveSettings(n,{DefaultIdentityID:e})}),e.displayName.subscribe(function(e){jt.remote().saveSettings(s,{DisplayName:e})}),e.replyTo.subscribe(function(e){jt.remote().saveSettings(i,{ReplyTo:e})}),e.signature.subscribe(function(e){jt.remote().saveSettings(o,{Signature:e})}),e.signatureToAll.subscribe(function(e){jt.remote().saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},Mt.addSettingsViewModel(ut,"SettingsFilters","SETTINGS_LABELS/LABEL_FILTERS_NAME","filters"),ut.prototype.deleteFilter=function(e){this.filters.remove(e)},ut.prototype.addFilter=function(){xt.showScreenPopup(Y,[new P])},Mt.addSettingsViewModel(dt,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),dt.prototype.showSecret=function(){this.secreting(!0),jt.remote().showTwoFactorSecret(this.onSecretResult)},dt.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},dt.prototype.createTwoFactor=function(){this.processing(!0),jt.remote().createTwoFactor(this.onResult)},dt.prototype.enableTwoFactor=function(){this.processing(!0),jt.remote().enableTwoFactor(this.onResult,this.viewEnable())},dt.prototype.testTwoFactor=function(){xt.showScreenPopup(z)},dt.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),jt.remote().clearTwoFactor(this.onResult)},dt.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},dt.prototype.onResult=function(e,t){if(this.processing(!1),this.clearing(!1),Lt.StorageResultType.Success===e&&t&&t.Result?(this.viewUser(Mt.pString(t.Result.User)),this.viewEnable(!!t.Result.Enable),this.twoFactorStatus(!!t.Result.IsSet),this.viewSecret(Mt.pString(t.Result.Secret)),this.viewBackupCodes(Mt.pString(t.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Mt.pString(t.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var s=this;this.viewEnable.subscribe(function(e){this.viewEnable.subs&&jt.remote().enableTwoFactor(function(e,t){Lt.StorageResultType.Success===e&&t&&t.Result||(s.viewEnable.subs=!1,s.viewEnable(!1),s.viewEnable.subs=!0)},e)},this)}},dt.prototype.onSecretResult=function(e,t){this.secreting(!1),Lt.StorageResultType.Success===e&&t&&t.Result?(this.viewSecret(Mt.pString(t.Result.Secret)),this.viewUrl(Mt.pString(t.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},dt.prototype.onBuild=function(){this.processing(!0),jt.remote().getTwoFactor(this.onResult)},Mt.addSettingsViewModel(ht,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Mt.addSettingsViewModel(pt,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),pt.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},pt.prototype.onChangePasswordResponse=function(e,t){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),Lt.StorageResultType.Success===e&&t&&t.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(t&&Lt.Notification.CurrentPasswordIncorrect===t.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(Mt.getNotification(t&&t.ErrorCode?t.ErrorCode:Lt.Notification.CouldNotSaveNewPassword)))},Mt.addSettingsViewModel(mt,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),mt.prototype.folderEditOnEnter=function(e){var t=e?Mt.trim(e.nameForEdit()):"";""!==t&&e.name()!==t&&(jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,""),jt.data().foldersRenaming(!0),jt.remote().folderRename(function(e,t){jt.data().foldersRenaming(!1),Lt.StorageResultType.Success===e&&t&&t.Result||jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),jt.folders()},e.fullNameRaw,t),jt.cache().removeFolderFromCacheList(e.fullNameRaw),e.name(t)),e.edited(!1)},mt.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},mt.prototype.onShow=function(){jt.data().foldersListError("")},mt.prototype.createFolder=function(){xt.showScreenPopup(k)},mt.prototype.systemFolder=function(){xt.showScreenPopup(O)},mt.prototype.deleteFolder=function(e){if(e&&e.canBeDeleted()&&e.deleteAccess()&&0===e.privateMessageCountAll()){this.folderForDeletion(null);var t=function(s){return e===s?!0:(s.subFolders.remove(t),!1)};e&&(jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,""),jt.data().folderList.remove(t),jt.data().foldersDeleting(!0),jt.remote().folderDelete(function(e,t){jt.data().foldersDeleting(!1),Lt.StorageResultType.Success===e&&t&&t.Result||jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),jt.folders()},e.fullNameRaw),jt.cache().removeFolderFromCacheList(e.fullNameRaw))}else 0<e.privateMessageCountAll()&&jt.data().foldersListError(Mt.getNotification(Lt.Notification.CantDeleteNonEmptyFolder))},mt.prototype.subscribeFolder=function(e){jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,""),jt.remote().folderSetSubscribe(Mt.emptyFunction,e.fullNameRaw,!0),e.subScribed(!0)},mt.prototype.unSubscribeFolder=function(e){jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,""),jt.remote().folderSetSubscribe(Mt.emptyFunction,e.fullNameRaw,!1),e.subScribed(!1)},Mt.addSettingsViewModel(gt,"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes"),gt.prototype.onBuild=function(){var e=jt.data().theme();this.themesObjects(r.map(jt.data().themes(),function(t){return{name:t,nameDisplay:Mt.convertThemeName(t),selected:s.observable(t===e),themePreviewSrc:jt.link().themePreviewLink(t)}}))},Mt.addSettingsViewModel(ft,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),ft.prototype.addOpenPgpKey=function(){xt.showScreenPopup(H)},ft.prototype.generateOpenPgpKey=function(){xt.showScreenPopup(G)},ft.prototype.viewOpenPgpKey=function(e){e&&xt.showScreenPopup(B,[e])},ft.prototype.deleteOpenPgpKey=function(e){e&&e.deleteAccess()&&(this.openPgpKeyForDeletion(null),e&&jt.data().openpgpKeyring&&(this.openpgpkeys.remove(function(t){return e===t}),jt.data().openpgpKeyring[e.isPrivate?"privateKeys":"publicKeys"].removeForId(e.guid),jt.data().openpgpKeyring.store(),jt.reloadOpenPgpKeys()))},bt.prototype.populateDataOnStart=function(){var e=Mt.pInt(jt.settingsGet("Layout")),t=jt.settingsGet("Languages"),s=jt.settingsGet("Themes");Mt.isArray(t)&&this.languages(t),Mt.isArray(s)&&this.themes(s),this.mainLanguage(jt.settingsGet("Language")),this.mainTheme(jt.settingsGet("Theme")),this.capaAdditionalAccounts(jt.capa(Lt.Capa.AdditionalAccounts)),this.capaAdditionalIdentities(jt.capa(Lt.Capa.AdditionalIdentities)),this.capaGravatar(jt.capa(Lt.Capa.Gravatar)),this.determineUserLanguage(!!jt.settingsGet("DetermineUserLanguage")),this.determineUserDomain(!!jt.settingsGet("DetermineUserDomain")),this.capaThemes(jt.capa(Lt.Capa.Themes)),this.allowLanguagesOnLogin(!!jt.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!jt.settingsGet("AllowLanguagesOnSettings")),this.useLocalProxyForExternalImages(!!jt.settingsGet("UseLocalProxyForExternalImages")),this.editorDefaultType(jt.settingsGet("EditorDefaultType")),this.showImages(!!jt.settingsGet("ShowImages")),this.contactsAutosave(!!jt.settingsGet("ContactsAutosave")),this.interfaceAnimation(jt.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(jt.settingsGet("MPP")),this.desktopNotifications(!!jt.settingsGet("DesktopNotifications")),this.useThreads(!!jt.settingsGet("UseThreads")),this.replySameFolder(!!jt.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!jt.settingsGet("UseCheckboxesInList")),this.layout(Lt.Layout.SidePreview),-1<Mt.inArray(e,[Lt.Layout.NoPreview,Lt.Layout.SidePreview,Lt.Layout.BottomPreview])&&this.layout(e),this.facebookSupported(!!jt.settingsGet("SupportedFacebookSocial")),this.facebookEnable(!!jt.settingsGet("AllowFacebookSocial")),this.facebookAppID(jt.settingsGet("FacebookAppID")),this.facebookAppSecret(jt.settingsGet("FacebookAppSecret")),this.twitterEnable(!!jt.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(jt.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(jt.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!jt.settingsGet("AllowGoogleSocial")),this.googleClientID(jt.settingsGet("GoogleClientID")),this.googleClientSecret(jt.settingsGet("GoogleClientSecret")),this.googleApiKey(jt.settingsGet("GoogleApiKey")),this.dropboxEnable(!!jt.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(jt.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!jt.settingsGet("ContactsIsAllowed"))},r.extend(yt.prototype,bt.prototype),yt.prototype.purgeMessageBodyCache=function(){var e=0,s=null,i=Ot.iMessageBodyCacheCount-It.Values.MessageBodyCacheLimit;i>0&&(s=this.messagesBodiesDom(),s&&(s.find(".rl-cache-class").each(function(){var s=t(this);i>s.data("rl-cache-count")&&(s.addClass("rl-cache-purge"),e++)}),e>0&&r.delay(function(){s.find(".rl-cache-purge").remove()},300)))},yt.prototype.populateDataOnStart=function(){bt.prototype.populateDataOnStart.call(this),this.accountEmail(jt.settingsGet("Email")),this.accountIncLogin(jt.settingsGet("IncLogin")),this.accountOutLogin(jt.settingsGet("OutLogin")),this.projectHash(jt.settingsGet("ProjectHash")),this.defaultIdentityID(jt.settingsGet("DefaultIdentityID")),this.displayName(jt.settingsGet("DisplayName")),this.replyTo(jt.settingsGet("ReplyTo")),this.signature(jt.settingsGet("Signature")),this.signatureToAll(!!jt.settingsGet("SignatureToAll")),this.enableTwoFactor(!!jt.settingsGet("EnableTwoFactor")),this.lastFoldersHash=jt.local().get(Lt.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!jt.settingsGet("RemoteSuggestions"),this.devEmail=jt.settingsGet("DevEmail"),this.devPassword=jt.settingsGet("DevPassword")},yt.prototype.initUidNextAndNewMessages=function(t,s,i){if("INBOX"===t&&Mt.isNormal(s)&&""!==s){if(Mt.isArray(i)&&0<i.length){var o=jt.cache(),n=0,a=i.length,l=function(t,s,i){var o=null;qt&&jt.data().useDesktopNotifications()&&(o=new qt(s,{body:i,icon:t}),o&&(o.show&&o.show(),e.setTimeout(function(e){return function(){e.cancel?e.cancel():e.close&&e.close()}}(o),7e3)))};if(r.each(i,function(e){o.addNewMessageCache(t,e.Uid)}),a>3)l(jt.link().notificationMailIcon(),jt.data().accountEmail(),Mt.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:a}));else for(;a>n;n++)l(jt.link().notificationMailIcon(),E.emailsToLine(E.initEmailsFromJson(i[n].From),!1),i[n].Subject)}jt.cache().setFolderUidNext(t,s)}},yt.prototype.folderResponseParseRec=function(e,t){var s=0,i=0,o=null,n=null,a="",r=[],l=[];for(s=0,i=t.length;i>s;s++)o=t[s],o&&(a=o.FullNameRaw,n=jt.cache().getFolderFromCacheList(a),n||(n=N.newInstanceFromJson(o),n&&(jt.cache().setFolderToCacheList(a,n),jt.cache().setFolderFullNameRaw(n.fullNameHash,a))),n&&(n.collapsed(!Mt.isFolderExpanded(n.fullNameHash)),o.Extended&&(o.Extended.Hash&&jt.cache().setFolderHash(n.fullNameRaw,o.Extended.Hash),Mt.isNormal(o.Extended.MessageCount)&&n.messageCountAll(o.Extended.MessageCount),Mt.isNormal(o.Extended.MessageUnseenCount)&&n.messageCountUnread(o.Extended.MessageUnseenCount)),r=o.SubFolders,r&&"Collection/FolderCollection"===r["@Object"]&&r["@Collection"]&&Mt.isArray(r["@Collection"])&&n.subFolders(this.folderResponseParseRec(e,r["@Collection"])),l.push(n)));return l},yt.prototype.setFolders=function(e){var t=[],s=!1,i=jt.data(),o=function(e){return""===e||It.Values.UnuseOptionValue===e||null!==jt.cache().getFolderFromCacheList(e)?e:""};e&&e.Result&&"Collection/FolderCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])&&(Mt.isUnd(e.Result.Namespace)||(i.namespace=e.Result.Namespace),this.threading(!!jt.settingsGet("UseImapThread")&&e.Result.IsThreadsSupported&&!0),t=this.folderResponseParseRec(i.namespace,e.Result["@Collection"]),i.folderList(t),e.Result.SystemFolders&&""==""+jt.settingsGet("SentFolder")+jt.settingsGet("DraftFolder")+jt.settingsGet("SpamFolder")+jt.settingsGet("TrashFolder")+jt.settingsGet("ArchiveFolder")+jt.settingsGet("NullFolder")&&(jt.settingsSet("SentFolder",e.Result.SystemFolders[2]||null),jt.settingsSet("DraftFolder",e.Result.SystemFolders[3]||null),jt.settingsSet("SpamFolder",e.Result.SystemFolders[4]||null),jt.settingsSet("TrashFolder",e.Result.SystemFolders[5]||null),jt.settingsSet("ArchiveFolder",e.Result.SystemFolders[12]||null),s=!0),i.sentFolder(o(jt.settingsGet("SentFolder"))),i.draftFolder(o(jt.settingsGet("DraftFolder"))),i.spamFolder(o(jt.settingsGet("SpamFolder"))),i.trashFolder(o(jt.settingsGet("TrashFolder"))),i.archiveFolder(o(jt.settingsGet("ArchiveFolder"))),s&&jt.remote().saveSystemFolders(Mt.emptyFunction,{SentFolder:i.sentFolder(),DraftFolder:i.draftFolder(),SpamFolder:i.spamFolder(),TrashFolder:i.trashFolder(),ArchiveFolder:i.archiveFolder(),NullFolder:"NullFolder"}),jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},yt.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},yt.prototype.getNextFolderNames=function(e){e=Mt.isUnd(e)?!1:!!e;var t=[],s=10,i=n().unix(),o=i-300,a=[],l=function(t){r.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&o>t.interval&&(!e||t.subScribed())&&a.push([t.interval,t.fullNameRaw]),t&&0<t.subFolders().length&&l(t.subFolders())})};return l(this.folderList()),a.sort(function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0}),r.find(a,function(e){var o=jt.cache().getFolderFromCacheList(e[1]);return o&&(o.interval=i,t.push(e[1])),s<=t.length}),r.uniq(t)},yt.prototype.removeMessagesFromList=function(e,t,s,i){s=Mt.isNormal(s)?s:"",i=Mt.isUnd(i)?!1:!!i,t=r.map(t,function(e){return Mt.pInt(e)});var o=0,n=jt.data(),a=jt.cache(),l=n.messageList(),c=jt.cache().getFolderFromCacheList(e),u=""===s?null:a.getFolderFromCacheList(s||""),d=n.currentFolderFullNameRaw(),h=n.message(),p=d===e?r.filter(l,function(e){return e&&-1<Mt.inArray(Mt.pInt(e.uid),t)}):[];r.each(p,function(e){e&&e.unseen()&&o++}),c&&!i&&(c.messageCountAll(0<=c.messageCountAll()-t.length?c.messageCountAll()-t.length:0),o>0&&c.messageCountUnread(0<=c.messageCountUnread()-o?c.messageCountUnread()-o:0)),u&&(u.messageCountAll(u.messageCountAll()+t.length),o>0&&u.messageCountUnread(u.messageCountUnread()+o),u.actionBlink(!0)),0<p.length&&(i?r.each(p,function(e){e.checked(!1)}):(n.messageListIsNotCompleted(!0),r.each(p,function(e){h&&h.hash===e.hash&&(h=null,n.message(null)),e.deleted(!0)}),r.delay(function(){r.each(p,function(e){n.messageList.remove(e)})},400))),""!==e&&a.setFolderHash(e,""),""!==s&&a.setFolderHash(s,"")},yt.prototype.setMessage=function(e,s){var i=!1,o=!1,n=!1,a=null,r=null,l="",c="",u=!1,d=!1,h=this.messagesBodiesDom(),p=this.message();e&&p&&e.Result&&"Object/Message"===e.Result["@Object"]&&p.folderFullNameRaw===e.Result.Folder&&p.uid===e.Result.Uid&&(this.messageError(""),p.initUpdateByMessageJson(e.Result),jt.cache().addRequestedMessage(p.folderFullNameRaw,p.uid),s||p.initFlagsByJson(e.Result),h=h&&h[0]?h:null,h&&(l="rl-mgs-"+p.hash.replace(/[^a-zA-Z0-9]/g,""),r=h.find("#"+l),r&&r[0]?(p.body=r,p.body&&(p.body.data("rl-cache-count",++Ot.iMessageBodyCacheCount),p.fetchDataToDom())):(o=!!e.Result.HasExternals,n=!!e.Result.HasInternals,a=t('<div id="'+l+'" />').hide().addClass("rl-cache-class"),a.data("rl-cache-count",++Ot.iMessageBodyCacheCount),Mt.isNormal(e.Result.Html)&&""!==e.Result.Html?(i=!0,c=e.Result.Html.toString()):Mt.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(i=!1,c=Mt.plainToHtml(e.Result.Plain.toString(),!1),(p.isPgpSigned()||p.isPgpEncrypted())&&jt.data().capaOpenPGP()&&(p.plainRaw=Mt.pString(e.Result.Plain),d=/---BEGIN PGP MESSAGE---/.test(p.plainRaw),d||(u=/-----BEGIN PGP SIGNED MESSAGE-----/.test(p.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(p.plainRaw)),zt.empty(),u&&p.isPgpSigned()?c=zt.append(t('<pre class="b-plain-openpgp signed"></pre>').text(p.plainRaw)).html():d&&p.isPgpEncrypted()&&(c=zt.append(t('<pre class="b-plain-openpgp encrypted"></pre>').text(p.plainRaw)).html()),zt.empty(),p.isPgpSigned(u),p.isPgpEncrypted(d))):i=!1,a.html(Mt.linkify(c)).addClass("b-text-part "+(i?"html":"plain")),p.isHtml(!!i),p.hasImages(!!o),p.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.None),p.pgpSignedVerifyUser(""),p.body=a,p.body&&h.append(p.body),p.storeDataToDom(),n&&p.showInternalImages(!0),p.hasImages()&&this.showImages()&&p.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(p.body),this.hideMessageBodies(),p.body.show(),a&&Mt.initBlockquoteSwitcher(a)),jt.cache().initMessageFlagsFromCache(p),p.unseen()&&jt.setMessageSeen(p),Mt.windowResize())},yt.prototype.calculateMessageListHash=function(e){return r.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},yt.prototype.setMessageList=function(e,t){if(e&&e.Result&&"Collection/MessageCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])){var s=jt.data(),i=jt.cache(),o=null,a=0,r=0,l=0,c=0,u=[],d=n().unix(),h=s.staticMessageList,p=null,m=null,g=null,f=0,b=!1;for(l=Mt.pInt(e.Result.MessageResultCount),c=Mt.pInt(e.Result.Offset),Mt.isNonEmptyArray(e.Result.LastCollapsedThreadUids)&&(o=e.Result.LastCollapsedThreadUids),g=jt.cache().getFolderFromCacheList(Mt.isNormal(e.Result.Folder)?e.Result.Folder:""),g&&!t&&(g.interval=d,jt.cache().setFolderHash(e.Result.Folder,e.Result.FolderHash),Mt.isNormal(e.Result.MessageCount)&&g.messageCountAll(e.Result.MessageCount),Mt.isNormal(e.Result.MessageUnseenCount)&&(Mt.pInt(g.messageCountUnread())!==Mt.pInt(e.Result.MessageUnseenCount)&&(b=!0),g.messageCountUnread(e.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(g.fullNameRaw,e.Result.UidNext,e.Result.NewMessages)),b&&g&&jt.cache().clearMessageFlagsFromCacheByFolder(g.fullNameRaw),a=0,r=e.Result["@Collection"].length;r>a;a++)p=e.Result["@Collection"][a],p&&"Object/Message"===p["@Object"]&&(m=h[a],m&&m.initByJson(p)||(m=E.newInstanceFromJson(p)),m&&(i.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=f&&(f++,m.newForAnimation(!0)),m.deleted(!1),t?jt.cache().initMessageFlagsFromCache(m):jt.cache().storeMessageFlagsToCache(m),m.lastInCollapsedThread(o&&-1<Mt.inArray(Mt.pInt(m.uid),o)?!0:!1),u.push(m)));s.messageListCount(l),s.messageListSearch(Mt.isNormal(e.Result.Search)?e.Result.Search:""),s.messageListPage(Math.ceil(c/s.messagesPerPage()+1)),s.messageListEndFolder(Mt.isNormal(e.Result.Folder)?e.Result.Folder:""),s.messageListEndSearch(Mt.isNormal(e.Result.Search)?e.Result.Search:""),s.messageListEndPage(s.messageListPage()),s.messageList(u),s.messageListIsNotCompleted(!1),h.length<u.length&&(s.staticMessageList=u),i.clearNewMessageCache(),g&&(t||b||jt.data().useThreads())&&jt.folderInformation(g.fullNameRaw,u)}else jt.data().messageListCount(0),jt.data().messageList([]),jt.data().messageListError(Mt.getNotification(e&&e.ErrorCode?e.ErrorCode:Lt.Notification.CantGetMessageList))},yt.prototype.findPublicKeyByHex=function(e){return r.find(this.openpgpkeysPublic(),function(t){return t&&e===t.id})},yt.prototype.findPublicKeysByEmail=function(t){return r.compact(r.map(this.openpgpkeysPublic(),function(s){var i=null;if(s&&t===s.email)try{if(i=e.openpgp.key.readArmored(s.armor),i&&!i.err&&i.keys&&i.keys[0])return i.keys[0]}catch(o){}return null}))},yt.prototype.findPrivateKeyByEmail=function(t,s){var i=null,o=r.find(this.openpgpkeysPrivate(),function(e){return e&&t===e.email});if(o)try{i=e.openpgp.key.readArmored(o.armor),i&&!i.err&&i.keys&&i.keys[0]?(i=i.keys[0],i.decrypt(Mt.pString(s))):i=null}catch(n){i=null}return i},yt.prototype.findSelfPrivateKey=function(e){return this.findPrivateKeyByEmail(this.accountEmail(),e)},St.prototype.oRequests={},St.prototype.defaultResponse=function(t,s,i,o,n,a){var l=function(){Lt.StorageResultType.Success!==i&&Ot.bUnload&&(i=Lt.StorageResultType.Unload),Lt.StorageResultType.Success===i&&o&&!o.Result?(o&&-1<Mt.inArray(o.ErrorCode,[Lt.Notification.AuthError,Lt.Notification.AccessError,Lt.Notification.ConnectionError,Lt.Notification.DomainNotAllowed,Lt.Notification.AccountNotAllowed,Lt.Notification.MailServerError,Lt.Notification.UnknownNotification,Lt.Notification.UnknownError])&&Ot.iAjaxErrorCount++,o&&Lt.Notification.InvalidToken===o.ErrorCode&&Ot.iTokenErrorCount++,It.Values.TokenErrorLimit<Ot.iTokenErrorCount&&jt.loginAndLogoutReload(!0),(o.Logout||It.Values.AjaxErrorLimit<Ot.iAjaxErrorCount)&&(e.__rlah_clear&&e.__rlah_clear(),jt.loginAndLogoutReload(!0))):Lt.StorageResultType.Success===i&&o&&o.Result&&(Ot.iAjaxErrorCount=0,Ot.iTokenErrorCount=0),t&&(Dt.runHook("ajax-default-response",[s,Lt.StorageResultType.Success===i?o:null,i,n,a]),t(i,Lt.StorageResultType.Success===i?o:null,n,s,a))};switch(i){case"success":i=Lt.StorageResultType.Success;break;case"abort":i=Lt.StorageResultType.Abort;break;default:i=Lt.StorageResultType.Error}Lt.StorageResultType.Error===i?r.delay(l,300):l()},St.prototype.ajaxRequest=function(s,i,o,n,a){var l=this,c=""===n,u={},d=(new e.Date).getTime(),h=null,p="";return i=i||{},o=Mt.isNormal(o)?o:2e4,n=Mt.isUnd(n)?"":Mt.pString(n),a=Mt.isArray(a)?a:[],p=i.Action||"",p&&0<a.length&&r.each(a,function(e){l.oRequests[e]&&(l.oRequests[e].__aborted=!0,l.oRequests[e].abort&&l.oRequests[e].abort(),l.oRequests[e]=null)}),c&&(i.XToken=jt.settingsGet("Token")),h=t.ajax({type:c?"POST":"GET",url:jt.link().ajax(n),async:!0,dataType:"json",data:c?i:{},headers:u,timeout:o,global:!0}),h.always(function(t,o){var n=!1;t&&t.Time&&(n=Mt.pInt(t.Time)>(new e.Date).getTime()-d),p&&l.oRequests[p]&&(l.oRequests[p].__aborted&&(o="abort"),l.oRequests[p]=null),l.defaultResponse(s,p,o,t,n,i)}),p&&0<a.length&&-1<Mt.inArray(p,a)&&(this.oRequests[p]&&(this.oRequests[p].__aborted=!0,this.oRequests[p].abort&&this.oRequests[p].abort(),this.oRequests[p]=null),this.oRequests[p]=h),h},St.prototype.defaultRequest=function(e,t,s,i,o,n){s=s||{},s.Action=t,o=Mt.pString(o),Dt.runHook("ajax-default-request",[t,s,o]),this.ajaxRequest(e,s,Mt.isUnd(i)?It.Defaults.DefaultAjaxTimeout:Mt.pInt(i),o,n)},St.prototype.noop=function(e){this.defaultRequest(e,"Noop")},St.prototype.jsError=function(e,t,s,i,o,n,a){this.defaultRequest(e,"JsError",{Message:t,FileName:s,LineNo:i,Location:o,HtmlCapa:n,TimeOnPage:a})},St.prototype.jsInfo=function(e,t,s,i){this.defaultRequest(e,"JsInfo",{Type:t,Data:s,IsError:(Mt.isUnd(i)?1:!i)?"0":"1"})},St.prototype.getPublicKey=function(e){this.defaultRequest(e,"GetPublicKey")},St.prototype.jsVersion=function(e,t){this.defaultRequest(e,"Version",{Version:t})},r.extend(vt.prototype,St.prototype),vt.prototype.folders=function(e){this.defaultRequest(e,"Folders",{SentFolder:jt.settingsGet("SentFolder"),DraftFolder:jt.settingsGet("DraftFolder"),SpamFolder:jt.settingsGet("SpamFolder"),TrashFolder:jt.settingsGet("TrashFolder"),ArchiveFolder:jt.settingsGet("ArchiveFolder")},null,"",["Folders"])},vt.prototype.login=function(e,t,s,i,o,n,a,r){this.defaultRequest(e,"Login",{Email:t,Login:s,Password:i,Language:n||"",AdditionalCode:a||"",AdditionalCodeSignMe:r?"1":"0",SignMe:o?"1":"0"})},vt.prototype.getTwoFactor=function(e){this.defaultRequest(e,"GetTwoFactorInfo")},vt.prototype.createTwoFactor=function(e){this.defaultRequest(e,"CreateTwoFactorSecret")},vt.prototype.clearTwoFactor=function(e){this.defaultRequest(e,"ClearTwoFactorInfo")},vt.prototype.showTwoFactorSecret=function(e){this.defaultRequest(e,"ShowTwoFactorSecret")},vt.prototype.testTwoFactor=function(e,t){this.defaultRequest(e,"TestTwoFactorInfo",{Code:t})},vt.prototype.enableTwoFactor=function(e,t){this.defaultRequest(e,"EnableTwoFactor",{Enable:t?"1":"0"})},vt.prototype.clearTwoFactorInfo=function(e){this.defaultRequest(e,"ClearTwoFactorInfo")},vt.prototype.contactsSync=function(e){this.defaultRequest(e,"ContactsSync",null,It.Defaults.ContactsSyncAjaxTimeout)},vt.prototype.saveContactsSyncData=function(e,t,s,i,o){this.defaultRequest(e,"SaveContactsSyncData",{Enable:t?"1":"0",Url:s,User:i,Password:o})
|
||
},vt.prototype.accountAdd=function(e,t,s,i){this.defaultRequest(e,"AccountAdd",{Email:t,Login:s,Password:i})},vt.prototype.accountDelete=function(e,t){this.defaultRequest(e,"AccountDelete",{EmailToDelete:t})},vt.prototype.identityUpdate=function(e,t,s,i,o,n){this.defaultRequest(e,"IdentityUpdate",{Id:t,Email:s,Name:i,ReplyTo:o,Bcc:n})},vt.prototype.identityDelete=function(e,t){this.defaultRequest(e,"IdentityDelete",{IdToDelete:t})},vt.prototype.accountsAndIdentities=function(e){this.defaultRequest(e,"AccountsAndIdentities")},vt.prototype.messageList=function(e,t,s,i,o,n){t=Mt.pString(t);var a=jt.data(),r=jt.cache().getFolderHash(t);n=Mt.isUnd(n)?!1:!!n,s=Mt.isUnd(s)?0:Mt.pInt(s),i=Mt.isUnd(s)?20:Mt.pInt(i),o=Mt.pString(o),""===r||""!==o&&-1!==o.indexOf("is:")?this.defaultRequest(e,"MessageList",{Folder:t,Offset:s,Limit:i,Search:o,UidNext:"INBOX"===t?jt.cache().getFolderUidNext(t):"",UseThreads:jt.data().threading()&&jt.data().useThreads()?"1":"0",ExpandedThreadUid:a.threading()&&t===a.messageListThreadFolder()?a.messageListThreadUids().join(","):""},""===o?It.Defaults.DefaultAjaxTimeout:It.Defaults.SearchAjaxTimeout,"",n?[]:["MessageList"]):this.defaultRequest(e,"MessageList",{},""===o?It.Defaults.DefaultAjaxTimeout:It.Defaults.SearchAjaxTimeout,"MessageList/"+kt.urlsafe_encode([t,s,i,o,a.projectHash(),r,"INBOX"===t?jt.cache().getFolderUidNext(t):"",a.threading()&&a.useThreads()?"1":"0",a.threading()&&t===a.messageListThreadFolder()?a.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),n?[]:["MessageList"])},vt.prototype.messageUploadAttachments=function(e,t){this.defaultRequest(e,"MessageUploadAttachments",{Attachments:t},999e3)},vt.prototype.message=function(e,t,s){return t=Mt.pString(t),s=Mt.pInt(s),jt.cache().getFolderFromCacheList(t)&&s>0?(this.defaultRequest(e,"Message",{},null,"Message/"+kt.urlsafe_encode([t,s,jt.data().projectHash(),jt.data().threading()&&jt.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},vt.prototype.composeUploadExternals=function(e,t){this.defaultRequest(e,"ComposeUploadExternals",{Externals:t},999e3)},vt.prototype.composeUploadDrive=function(e,t,s){this.defaultRequest(e,"ComposeUploadDrive",{AccessToken:s,Url:t},999e3)},vt.prototype.folderInformation=function(e,t,s){var i=!0,o=jt.cache(),n=[];Mt.isArray(s)&&0<s.length&&(i=!1,r.each(s,function(e){o.getMessageFlagsFromCache(e.folderFullNameRaw,e.uid)||n.push(e.uid),0<e.threads().length&&r.each(e.threads(),function(t){o.getMessageFlagsFromCache(e.folderFullNameRaw,t)||n.push(t)})}),0<n.length&&(i=!0)),i?this.defaultRequest(e,"FolderInformation",{Folder:t,FlagsUids:Mt.isArray(n)?n.join(","):"",UidNext:"INBOX"===t?jt.cache().getFolderUidNext(t):""}):jt.data().useThreads()&&jt.reloadFlagsCurrentMessageListAndMessageFromCache()},vt.prototype.folderInformationMultiply=function(e,t){this.defaultRequest(e,"FolderInformationMultiply",{Folders:t})},vt.prototype.logout=function(e){this.defaultRequest(e,"Logout")},vt.prototype.messageSetFlagged=function(e,t,s,i){this.defaultRequest(e,"MessageSetFlagged",{Folder:t,Uids:s.join(","),SetAction:i?"1":"0"})},vt.prototype.messageSetSeen=function(e,t,s,i){this.defaultRequest(e,"MessageSetSeen",{Folder:t,Uids:s.join(","),SetAction:i?"1":"0"})},vt.prototype.messageSetSeenToAll=function(e,t,s){this.defaultRequest(e,"MessageSetSeenToAll",{Folder:t,SetAction:s?"1":"0"})},vt.prototype.saveMessage=function(e,t,s,i,o,n,a,r,l,c,u,d,h,p,m){this.defaultRequest(e,"SaveMessage",{MessageFolder:t,MessageUid:s,DraftFolder:i,From:o,To:n,Cc:a,Bcc:r,Subject:l,TextIsHtml:c?"1":"0",Text:u,DraftInfo:h,InReplyTo:p,References:m,Attachments:d},It.Defaults.SaveMessageAjaxTimeout)},vt.prototype.sendReadReceiptMessage=function(e,t,s,i,o,n){this.defaultRequest(e,"SendReadReceiptMessage",{MessageFolder:t,MessageUid:s,ReadReceipt:i,Subject:o,Text:n})},vt.prototype.sendMessage=function(e,t,s,i,o,n,a,r,l,c,u,d,h,p,m,g){this.defaultRequest(e,"SendMessage",{MessageFolder:t,MessageUid:s,SentFolder:i,From:o,To:n,Cc:a,Bcc:r,Subject:l,TextIsHtml:c?"1":"0",Text:u,DraftInfo:h,InReplyTo:p,References:m,ReadReceiptRequest:g?"1":"0",Attachments:d},It.Defaults.SendMessageAjaxTimeout)},vt.prototype.saveSystemFolders=function(e,t){this.defaultRequest(e,"SystemFoldersUpdate",t)},vt.prototype.saveSettings=function(e,t){this.defaultRequest(e,"SettingsUpdate",t)},vt.prototype.changePassword=function(e,t,s){this.defaultRequest(e,"ChangePassword",{PrevPassword:t,NewPassword:s})},vt.prototype.folderCreate=function(e,t,s){this.defaultRequest(e,"FolderCreate",{Folder:t,Parent:s},null,"",["Folders"])},vt.prototype.folderDelete=function(e,t){this.defaultRequest(e,"FolderDelete",{Folder:t},null,"",["Folders"])},vt.prototype.folderRename=function(e,t,s){this.defaultRequest(e,"FolderRename",{Folder:t,NewFolderName:s},null,"",["Folders"])},vt.prototype.folderClear=function(e,t){this.defaultRequest(e,"FolderClear",{Folder:t})},vt.prototype.folderSetSubscribe=function(e,t,s){this.defaultRequest(e,"FolderSubscribe",{Folder:t,Subscribe:s?"1":"0"})},vt.prototype.messagesMove=function(e,t,s,i,o){this.defaultRequest(e,"MessageMove",{FromFolder:t,ToFolder:s,Uids:i.join(","),Learning:o||""},null,"",["MessageList"])},vt.prototype.messagesCopy=function(e,t,s,i){this.defaultRequest(e,"MessageCopy",{FromFolder:t,ToFolder:s,Uids:i.join(",")})},vt.prototype.messagesDelete=function(e,t,s){this.defaultRequest(e,"MessageDelete",{Folder:t,Uids:s.join(",")},null,"",["MessageList"])},vt.prototype.appDelayStart=function(e){this.defaultRequest(e,"AppDelayStart")},vt.prototype.quota=function(e){this.defaultRequest(e,"Quota")},vt.prototype.contacts=function(e,t,s,i){this.defaultRequest(e,"Contacts",{Offset:t,Limit:s,Search:i},null,"",["Contacts"])},vt.prototype.contactSave=function(e,t,s,i,o){this.defaultRequest(e,"ContactSave",{RequestUid:t,Uid:Mt.trim(s),Tags:Mt.trim(i),Properties:o})},vt.prototype.contactsDelete=function(e,t){this.defaultRequest(e,"ContactsDelete",{Uids:t.join(",")})},vt.prototype.suggestions=function(e,t,s){this.defaultRequest(e,"Suggestions",{Query:t,Page:s},null,"",["Suggestions"])},vt.prototype.facebookUser=function(e){this.defaultRequest(e,"SocialFacebookUserInformation")},vt.prototype.facebookDisconnect=function(e){this.defaultRequest(e,"SocialFacebookDisconnect")},vt.prototype.twitterUser=function(e){this.defaultRequest(e,"SocialTwitterUserInformation")},vt.prototype.twitterDisconnect=function(e){this.defaultRequest(e,"SocialTwitterDisconnect")},vt.prototype.googleUser=function(e){this.defaultRequest(e,"SocialGoogleUserInformation")},vt.prototype.googleDisconnect=function(e){this.defaultRequest(e,"SocialGoogleDisconnect")},vt.prototype.socialUsers=function(e){this.defaultRequest(e,"SocialUsers")},Ct.prototype.oServices={},Ct.prototype.bCapaGravatar=!1,Ct.prototype.clear=function(){this.bCapaGravatar=!!this.bCapaGravatar},Ct.prototype.getUserPic=function(e,t){e=Mt.trim(e),t(this.bCapaGravatar&&""!==e?jt.link().avatarLink(e):"",e)},r.extend(wt.prototype,Ct.prototype),wt.prototype.oFoldersCache={},wt.prototype.oFoldersNamesCache={},wt.prototype.oFolderHashCache={},wt.prototype.oFolderUidNextCache={},wt.prototype.oMessageListHashCache={},wt.prototype.oMessageFlagsCache={},wt.prototype.oBodies={},wt.prototype.oNewMessage={},wt.prototype.oRequestedMessage={},wt.prototype.clear=function(){Ct.prototype.clear.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oBodies={}},wt.prototype.getMessageKey=function(e,t){return e+"#"+t},wt.prototype.addRequestedMessage=function(e,t){this.oRequestedMessage[this.getMessageKey(e,t)]=!0},wt.prototype.hasRequestedMessage=function(e,t){return!0===this.oRequestedMessage[this.getMessageKey(e,t)]},wt.prototype.addNewMessageCache=function(e,t){this.oNewMessage[this.getMessageKey(e,t)]=!0},wt.prototype.hasNewMessageAndRemoveFromCache=function(e,t){return this.oNewMessage[this.getMessageKey(e,t)]?(this.oNewMessage[this.getMessageKey(e,t)]=null,!0):!1},wt.prototype.clearNewMessageCache=function(){this.oNewMessage={}},wt.prototype.getFolderFullNameRaw=function(e){return""!==e&&this.oFoldersNamesCache[e]?this.oFoldersNamesCache[e]:""},wt.prototype.setFolderFullNameRaw=function(e,t){this.oFoldersNamesCache[e]=t},wt.prototype.getFolderHash=function(e){return""!==e&&this.oFolderHashCache[e]?this.oFolderHashCache[e]:""},wt.prototype.setFolderHash=function(e,t){this.oFolderHashCache[e]=t},wt.prototype.getFolderUidNext=function(e){return""!==e&&this.oFolderUidNextCache[e]?this.oFolderUidNextCache[e]:""},wt.prototype.setFolderUidNext=function(e,t){this.oFolderUidNextCache[e]=t},wt.prototype.getFolderFromCacheList=function(e){return""!==e&&this.oFoldersCache[e]?this.oFoldersCache[e]:null},wt.prototype.setFolderToCacheList=function(e,t){this.oFoldersCache[e]=t},wt.prototype.removeFolderFromCacheList=function(e){this.setFolderToCacheList(e,null)},wt.prototype.getMessageFlagsFromCache=function(e,t){return this.oMessageFlagsCache[e]&&this.oMessageFlagsCache[e][t]?this.oMessageFlagsCache[e][t]:null},wt.prototype.setMessageFlagsToCache=function(e,t,s){this.oMessageFlagsCache[e]||(this.oMessageFlagsCache[e]={}),this.oMessageFlagsCache[e][t]=s},wt.prototype.clearMessageFlagsFromCacheByFolder=function(e){this.oMessageFlagsCache[e]={}},wt.prototype.initMessageFlagsFromCache=function(e){if(e){var t=this,s=this.getMessageFlagsFromCache(e.folderFullNameRaw,e.uid),i=null,o=null;s&&0<s.length&&(e.unseen(!!s[0]),e.flagged(!!s[1]),e.answered(!!s[2]),e.forwarded(!!s[3]),e.isReadReceipt(!!s[4])),0<e.threads().length&&(i=r.find(e.threads(),function(s){var i=t.getMessageFlagsFromCache(e.folderFullNameRaw,s);return i&&0<i.length&&!!i[0]}),o=r.find(e.threads(),function(s){var i=t.getMessageFlagsFromCache(e.folderFullNameRaw,s);return i&&0<i.length&&!!i[1]}),e.hasUnseenSubMessage(i&&0<Mt.pInt(i)),e.hasFlaggedSubMessage(o&&0<Mt.pInt(o)))}},wt.prototype.storeMessageFlagsToCache=function(e){e&&this.setMessageFlagsToCache(e.folderFullNameRaw,e.uid,[e.unseen(),e.flagged(),e.answered(),e.forwarded(),e.isReadReceipt()])},wt.prototype.storeMessageFlagsToCacheByFolderAndUid=function(e,t,s){Mt.isArray(s)&&0<s.length&&this.setMessageFlagsToCache(e,t,s)},r.extend(Tt.prototype,y.prototype),Tt.prototype.onRoute=function(e){var i=this,o=null,n=null,a=null,l=null;n=r.find(_t.settings,function(t){return t&&t.__rlSettingsData&&e===t.__rlSettingsData.Route}),n&&(r.find(_t["settings-removed"],function(e){return e&&e===n})&&(n=null),n&&r.find(_t["settings-disabled"],function(e){return e&&e===n})&&(n=null)),n?(n.__builded&&n.__vm?o=n.__vm:(a=this.oViewModelPlace,a&&1===a.length?(n=n,o=new n,l=t("<div></div>").addClass("rl-settings-view-model").hide(),l.appendTo(a),o.data=jt.data(),o.viewModelDom=l,o.__rlSettingsData=n.__rlSettingsData,n.__dom=l,n.__builded=!0,n.__vm=o,s.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:n.__rlSettingsData.Template}}},o),Mt.delegateRun(o,"onBuild",[l])):Mt.log("Cannot find sub settings view model position: SettingsSubScreen")),o&&r.defer(function(){i.oCurrentSubScreen&&(Mt.delegateRun(i.oCurrentSubScreen,"onHide"),i.oCurrentSubScreen.viewModelDom.hide()),i.oCurrentSubScreen=o,i.oCurrentSubScreen&&(i.oCurrentSubScreen.viewModelDom.show(),Mt.delegateRun(i.oCurrentSubScreen,"onShow"),Mt.delegateRun(i.oCurrentSubScreen,"onFocus",[],200),r.each(i.menu(),function(e){e.selected(o&&o.__rlSettingsData&&e.route===o.__rlSettingsData.Route)}),t("#rl-content .b-settings .b-content .content").scrollTop(0)),Mt.windowResize()})):xt.setHash(jt.link().settings(),!1,!0)},Tt.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Mt.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},Tt.prototype.onBuild=function(){r.each(_t.settings,function(e){e&&e.__rlSettingsData&&!r.find(_t["settings-removed"],function(t){return t&&t===e})&&this.menu.push({route:e.__rlSettingsData.Route,label:e.__rlSettingsData.Label,selected:s.observable(!1),disabled:!!r.find(_t["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=t("#rl-content #rl-settings-subscreen")},Tt.prototype.routes=function(){var e=r.find(_t.settings,function(e){return e&&e.__rlSettingsData&&e.__rlSettingsData.IsDefault}),t=e?e.__rlSettingsData.Route:"general",s={subname:/^(.*)$/,normalize_:function(e,s){return s.subname=Mt.isUnd(s.subname)?t:Mt.pString(s.subname),[s.subname]}};return[["{subname}/",s],["{subname}",s],["",s]]},r.extend(Ft.prototype,y.prototype),Ft.prototype.onShow=function(){jt.setTitle("")},r.extend(At.prototype,y.prototype),At.prototype.oLastRoute={},At.prototype.setNewTitle=function(){var e=jt.data().accountEmail(),t=jt.data().foldersInboxUnreadCount();jt.setTitle((""===e?"":(t>0?"("+t+") ":" ")+e+" - ")+Mt.i18n("TITLES/MAILBOX"))},At.prototype.onShow=function(){this.setNewTitle(),jt.data().keyScope(Lt.KeyState.MessageList)},At.prototype.onRoute=function(e,t,s,i){if(Mt.isUnd(i)?1:!i){var o=jt.data(),n=jt.cache().getFolderFullNameRaw(e),a=jt.cache().getFolderFromCacheList(n);a&&(o.currentFolder(a).messageListPage(t).messageListSearch(s),Lt.Layout.NoPreview===o.layout()&&o.message()&&o.message(null),jt.reloadMessageList())}else Lt.Layout.NoPreview!==jt.data().layout()||jt.data().message()||jt.historyBack()},At.prototype.onStart=function(){var e=jt.data(),t=function(){Mt.windowResize()};(jt.capa(Lt.Capa.AdditionalAccounts)||jt.capa(Lt.Capa.AdditionalIdentities))&&jt.accountsAndIdentities(),r.delay(function(){"INBOX"!==e.currentFolderFullNameRaw()&&jt.folderInformation("INBOX")},1e3),r.delay(function(){jt.quota()},5e3),r.delay(function(){jt.remote().appDelayStart(Mt.emptyFunction)},35e3),Bt.toggleClass("rl-no-preview-pane",Lt.Layout.NoPreview===e.layout()),e.folderList.subscribe(t),e.messageList.subscribe(t),e.message.subscribe(t),e.layout.subscribe(function(e){Bt.toggleClass("rl-no-preview-pane",Lt.Layout.NoPreview===e)}),e.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},At.prototype.routes=function(){var e=function(){return["Inbox",1,"",!0]},t=function(e,t){return t[0]=Mt.pString(t[0]),t[1]=Mt.pInt(t[1]),t[1]=0>=t[1]?1:t[1],t[2]=Mt.pString(t[2]),""===e&&(t[0]="Inbox",t[1]=1),[decodeURI(t[0]),t[1],decodeURI(t[2]),!1]},s=function(e,t){return t[0]=Mt.pString(t[0]),t[1]=Mt.pString(t[1]),""===e&&(t[0]="Inbox"),[decodeURI(t[0]),1,decodeURI(t[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:s}],[/^message-preview$/,{normalize_:e}],[/^([^\/]*)$/,{normalize_:t}]]},r.extend(Et.prototype,Tt.prototype),Et.prototype.onShow=function(){jt.setTitle(this.sSettingsTitle),jt.data().keyScope(Lt.KeyState.Settings)},r.extend(Nt.prototype,f.prototype),Nt.prototype.oSettings=null,Nt.prototype.oPlugins=null,Nt.prototype.oLocal=null,Nt.prototype.oLink=null,Nt.prototype.oSubs={},Nt.prototype.download=function(t){var s=null,i=null,o=navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(s=document.createElement("a"),s.href=t,document.createEvent&&(i=document.createEvent("MouseEvents"),i&&i.initEvent&&s.dispatchEvent))?(i.initEvent("click",!0,!0),s.dispatchEvent(i),!0):(Ot.bMobileDevice?(e.open(t,"_self"),e.focus()):this.iframe.attr("src",t),!0)},Nt.prototype.link=function(){return null===this.oLink&&(this.oLink=new u),this.oLink},Nt.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new g),this.oLocal},Nt.prototype.settingsGet=function(e){return null===this.oSettings&&(this.oSettings=Mt.isNormal(Vt)?Vt:{}),Mt.isUnd(this.oSettings[e])?null:this.oSettings[e]},Nt.prototype.settingsSet=function(e,t){null===this.oSettings&&(this.oSettings=Mt.isNormal(Vt)?Vt:{}),this.oSettings[e]=t},Nt.prototype.setTitle=function(t){t=(Mt.isNormal(t)&&0<t.length?t+" - ":"")+jt.settingsGet("Title")||"",e.document.title="_",e.document.title=t},Nt.prototype.loginAndLogoutReload=function(t,s){var i=Mt.pString(jt.settingsGet("CustomLogoutLink")),o=!!jt.settingsGet("InIframe");t=Mt.isUnd(t)?!1:!!t,s=Mt.isUnd(s)?!1:!!s,t&&s&&e.close&&e.close(),t&&""!==i&&e.location.href!==i?r.delay(function(){o&&e.parent?e.parent.location.href=i:e.location.href=i},100):(xt.routeOff(),xt.setHash(jt.link().root(),!0),xt.routeOff(),r.delay(function(){o&&e.parent?e.parent.location.reload():e.location.reload()},100))},Nt.prototype.historyBack=function(){e.history.back()},Nt.prototype.getAutocomplete=function(e,t){t([],e)},Nt.prototype.sub=function(e,t,s){return Mt.isUnd(this.oSubs[e])&&(this.oSubs[e]=[]),this.oSubs[e].push([t,s]),this},Nt.prototype.pub=function(e,t){return Dt.runHook("rl-pub",[e,t]),Mt.isUnd(this.oSubs[e])||r.each(this.oSubs[e],function(e){e[0]&&e[0].apply(e[1]||null,t||[])}),this},Nt.prototype.capa=function(e){var t=this.settingsGet("Capa");return Mt.isArray(t)&&Mt.isNormal(e)&&-1<Mt.inArray(e,t)},Nt.prototype.bootstart=function(){var e=this;Mt.initOnStartOrLangChange(function(){Mt.initNotificationLanguage()},null),r.delay(function(){Mt.windowResize()},1e3),ssm.addState({id:"mobile",maxWidth:767,onEnter:function(){Bt.addClass("ssm-state-mobile"),e.pub("ssm.mobile-enter")},onLeave:function(){Bt.removeClass("ssm-state-mobile"),e.pub("ssm.mobile-leave")}}),ssm.addState({id:"tablet",minWidth:768,maxWidth:999,onEnter:function(){Bt.addClass("ssm-state-tablet")},onLeave:function(){Bt.removeClass("ssm-state-tablet")}}),ssm.addState({id:"desktop",minWidth:1e3,maxWidth:1400,onEnter:function(){Bt.addClass("ssm-state-desktop")},onLeave:function(){Bt.removeClass("ssm-state-desktop")}}),ssm.addState({id:"desktop-large",minWidth:1400,onEnter:function(){Bt.addClass("ssm-state-desktop-large")},onLeave:function(){Bt.removeClass("ssm-state-desktop-large")}}),jt.sub("ssm.mobile-enter",function(){jt.data().leftPanelDisabled(!0)}),jt.sub("ssm.mobile-leave",function(){jt.data().leftPanelDisabled(!1)}),jt.data().leftPanelDisabled.subscribe(function(e){Bt.toggleClass("rl-left-panel-disabled",e)}),ssm.ready()},r.extend(Rt.prototype,Nt.prototype),Rt.prototype.oData=null,Rt.prototype.oRemote=null,Rt.prototype.oCache=null,Rt.prototype.data=function(){return null===this.oData&&(this.oData=new yt),this.oData},Rt.prototype.remote=function(){return null===this.oRemote&&(this.oRemote=new vt),this.oRemote},Rt.prototype.cache=function(){return null===this.oCache&&(this.oCache=new wt),this.oCache},Rt.prototype.reloadFlagsCurrentMessageListAndMessageFromCache=function(){var e=jt.cache();r.each(jt.data().messageList(),function(t){e.initMessageFlagsFromCache(t)}),e.initMessageFlagsFromCache(jt.data().message())},Rt.prototype.reloadMessageList=function(e,t){var s=jt.data(),i=(s.messageListPage()-1)*s.messagesPerPage();(Mt.isUnd(t)?1:!t)||jt.cache().setFolderHash(s.currentFolderFullNameRaw(),""),(Mt.isUnd(e)?1:!e)||(s.messageListPage(1),i=0),s.messageListLoading(!0),jt.remote().messageList(function(e,t,i){Lt.StorageResultType.Success===e&&t&&t.Result?(s.messageListError(""),s.messageListLoading(!1),s.setMessageList(t,i)):Lt.StorageResultType.Unload===e?(s.messageListError(""),s.messageListLoading(!1)):Lt.StorageResultType.Abort!==e&&(s.messageList([]),s.messageListLoading(!1),s.messageListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST")))},s.currentFolderFullNameRaw(),i,s.messagesPerPage(),s.messageListSearch())},Rt.prototype.recacheInboxMessageList=function(){jt.remote().messageList(Mt.emptyFunction,"INBOX",0,jt.data().messagesPerPage(),"",!0)},Rt.prototype.reloadMessageListHelper=function(e){jt.reloadMessageList(e)},Rt.prototype.contactsSync=function(e){var t=jt.data().contacts;return t.importing()||t.syncing()||!jt.data().enableContactsSync()||!jt.data().allowContactsSync()?!1:(t.syncing(!0),jt.remote().contactsSync(function(s,i){t.syncing(!1),e&&e(s,i)}),!0)},Rt.prototype.messagesMoveTrigger=function(){var e=this,t=jt.data().spamFolder();r.each(this.oMoveCache,function(s){var i=t===s.To,o=!i&&t===s.From&&"INBOX"===s.To;jt.remote().messagesMove(e.moveOrDeleteResponseHelper,s.From,s.To,s.Uid,i?"SPAM":o?"HAM":"")}),this.oMoveCache={}},Rt.prototype.messagesMoveHelper=function(e,t,s){var i="$$"+e+"$$"+t+"$$";this.oMoveCache[i]||(this.oMoveCache[i]={From:e,To:t,Uid:[]}),this.oMoveCache[i].Uid=r.union(this.oMoveCache[i].Uid,s),this.messagesMoveTrigger()},Rt.prototype.messagesCopyHelper=function(e,t,s){jt.remote().messagesCopy(this.moveOrDeleteResponseHelper,e,t,s)},Rt.prototype.messagesDeleteHelper=function(e,t){jt.remote().messagesDelete(this.moveOrDeleteResponseHelper,e,t)},Rt.prototype.moveOrDeleteResponseHelper=function(t,s){Lt.StorageResultType.Success===t&&jt.data().currentFolder()&&(s&&Mt.isArray(s.Result)&&2===s.Result.length?jt.cache().setFolderHash(s.Result[0],s.Result[1]):(jt.cache().setFolderHash(jt.data().currentFolderFullNameRaw(),""),s&&-1<Mt.inArray(s.ErrorCode,[Lt.Notification.CantMoveMessage,Lt.Notification.CantCopyMessage])&&e.alert(Mt.getNotification(s.ErrorCode))),jt.reloadMessageListHelper(0===jt.data().messageList().length),jt.quotaDebounce())},Rt.prototype.deleteMessagesFromFolderWithoutCheck=function(e,t){this.messagesDeleteHelper(e,t),jt.data().removeMessagesFromList(e,t)},Rt.prototype.deleteMessagesFromFolder=function(e,t,s,i){var o=this,n=jt.data(),a=jt.cache(),r=null,l=null;switch(e){case Lt.FolderType.Spam:r=a.getFolderFromCacheList(n.spamFolder()),l=Lt.SetSystemFoldersNotification.Spam;break;case Lt.FolderType.NotSpam:r=a.getFolderFromCacheList("INBOX");break;case Lt.FolderType.Trash:r=a.getFolderFromCacheList(n.trashFolder()),l=Lt.SetSystemFoldersNotification.Trash;break;case Lt.FolderType.Archive:r=a.getFolderFromCacheList(n.archiveFolder()),l=Lt.SetSystemFoldersNotification.Archive}i=Mt.isUnd(i)?!0:!!i,i&&(Lt.FolderType.Spam===e&&It.Values.UnuseOptionValue===n.spamFolder()||Lt.FolderType.Trash===e&&It.Values.UnuseOptionValue===n.trashFolder()||Lt.FolderType.Archive===e&&It.Values.UnuseOptionValue===n.archiveFolder())&&(i=!1),!r&&i?xt.showScreenPopup(O,[l]):i&&(Lt.FolderType.Trash!==e||t!==n.spamFolder()&&t!==n.trashFolder())?r&&(this.messagesMoveHelper(t,r.fullNameRaw,s),n.removeMessagesFromList(t,s,r.fullNameRaw)):xt.showScreenPopup(W,[Mt.i18n("POPUPS_ASK/DESC_WANT_DELETE_MESSAGES"),function(){o.messagesDeleteHelper(t,s),n.removeMessagesFromList(t,s)}])},Rt.prototype.moveMessagesToFolder=function(e,t,s,i){if(e!==s&&Mt.isArray(t)&&0<t.length){var o=jt.cache().getFolderFromCacheList(e),n=jt.cache().getFolderFromCacheList(s);if(o&&n)return(Mt.isUnd(i)?1:!i)?this.messagesMoveHelper(o.fullNameRaw,n.fullNameRaw,t):this.messagesCopyHelper(o.fullNameRaw,n.fullNameRaw,t),jt.data().removeMessagesFromList(o.fullNameRaw,t,n.fullNameRaw,i),!0}return!1},Rt.prototype.folders=function(e){this.data().foldersLoading(!0),this.remote().folders(r.bind(function(t,s){jt.data().foldersLoading(!1),Lt.StorageResultType.Success===t?(this.data().setFolders(s),e&&e(!0)):e&&e(!1)},this))},Rt.prototype.reloadOpenPgpKeys=function(){if(jt.data().capaOpenPGP()){var e=[],t=new v,s=jt.data().openpgpKeyring,i=s?s.getAllKeys():[];r.each(i,function(s,i){if(s&&s.primaryKey){var o=s.getPrimaryUser(),n=o&&o.user?o.user.userId.userid:s.users&&s.users[0]?s.users[0].userId.userid:"";t.clear(),t.mailsoParse(n),t.validate()&&e.push(new M(i,s.primaryKey.getFingerprint(),s.primaryKey.getKeyId().toHex().toLowerCase(),n,t.email,s.isPrivate(),s.armor()))}}),jt.data().openpgpkeys(e)}},Rt.prototype.accountsAndIdentities=function(){var e=jt.data();e.accountsLoading(!0),e.identitiesLoading(!0),jt.remote().accountsAndIdentities(function(t,s){if(e.accountsLoading(!1),e.identitiesLoading(!1),Lt.StorageResultType.Success===t&&s.Result){var i=jt.settingsGet("ParentEmail"),o=e.accountEmail();i=""===i?o:i,Mt.isArray(s.Result.Accounts)&&e.accounts(r.map(s.Result.Accounts,function(e){return new R(e,e!==i)})),Mt.isArray(s.Result.Identities)&&e.identities(r.map(s.Result.Identities,function(e){var t=Mt.pString(e.Id),s=Mt.pString(e.Email),i=new I(t,s,t!==o);return i.name(Mt.pString(e.Name)),i.replyTo(Mt.pString(e.ReplyTo)),i.bcc(Mt.pString(e.Bcc)),i}))}})},Rt.prototype.quota=function(){this.remote().quota(function(e,t){Lt.StorageResultType.Success===e&&t&&t.Result&&Mt.isArray(t.Result)&&1<t.Result.length&&Mt.isPosNumeric(t.Result[0],!0)&&Mt.isPosNumeric(t.Result[1],!0)&&(jt.data().userQuota(1024*Mt.pInt(t.Result[1])),jt.data().userUsageSize(1024*Mt.pInt(t.Result[0])))})},Rt.prototype.folderInformation=function(e,t){""!==Mt.trim(e)&&this.remote().folderInformation(function(e,t){if(Lt.StorageResultType.Success===e&&t&&t.Result&&t.Result.Hash&&t.Result.Folder){var s=n().unix(),i=jt.cache().getFolderHash(t.Result.Folder),o=jt.cache().getFolderFromCacheList(t.Result.Folder),a=!1,r="",l=[],c=!1,u=null;if(o){if(o.interval=s,t.Result.Hash&&jt.cache().setFolderHash(t.Result.Folder,t.Result.Hash),Mt.isNormal(t.Result.MessageCount)&&o.messageCountAll(t.Result.MessageCount),Mt.isNormal(t.Result.MessageUnseenCount)&&(Mt.pInt(o.messageCountUnread())!==Mt.pInt(t.Result.MessageUnseenCount)&&(c=!0),o.messageCountUnread(t.Result.MessageUnseenCount)),c&&jt.cache().clearMessageFlagsFromCacheByFolder(o.fullNameRaw),t.Result.Flags){for(r in t.Result.Flags)t.Result.Flags.hasOwnProperty(r)&&(a=!0,u=t.Result.Flags[r],jt.cache().storeMessageFlagsToCacheByFolderAndUid(o.fullNameRaw,r.toString(),[!u.IsSeen,!!u.IsFlagged,!!u.IsAnswered,!!u.IsForwarded,!!u.IsReadReceipt]));a&&jt.reloadFlagsCurrentMessageListAndMessageFromCache()}jt.data().initUidNextAndNewMessages(o.fullNameRaw,t.Result.UidNext,t.Result.NewMessages),t.Result.Hash!==i||""===i?o.fullNameRaw===jt.data().currentFolderFullNameRaw()?jt.reloadMessageList():"INBOX"===o.fullNameRaw&&jt.recacheInboxMessageList():c&&o.fullNameRaw===jt.data().currentFolderFullNameRaw()&&(l=jt.data().messageList(),Mt.isNonEmptyArray(l)&&jt.folderInformation(o.fullNameRaw,l))}}},e,t)},Rt.prototype.folderInformationMultiply=function(e){e=Mt.isUnd(e)?!1:!!e;var t=n().unix(),s=jt.data().getNextFolderNames(e);Mt.isNonEmptyArray(s)&&this.remote().folderInformationMultiply(function(s,i){Lt.StorageResultType.Success===s&&i&&i.Result&&i.Result.List&&Mt.isNonEmptyArray(i.Result.List)&&(r.each(i.Result.List,function(e){var s=[],i=jt.cache().getFolderHash(e.Folder),o=jt.cache().getFolderFromCacheList(e.Folder),n=!1;o&&(o.interval=t,e.Hash&&jt.cache().setFolderHash(e.Folder,e.Hash),Mt.isNormal(e.MessageCount)&&o.messageCountAll(e.MessageCount),Mt.isNormal(e.MessageUnseenCount)&&(Mt.pInt(o.messageCountUnread())!==Mt.pInt(e.MessageUnseenCount)&&(n=!0),o.messageCountUnread(e.MessageUnseenCount)),n&&jt.cache().clearMessageFlagsFromCacheByFolder(o.fullNameRaw),e.Hash!==i||""===i?o.fullNameRaw===jt.data().currentFolderFullNameRaw()&&jt.reloadMessageList():n&&o.fullNameRaw===jt.data().currentFolderFullNameRaw()&&(s=jt.data().messageList(),Mt.isNonEmptyArray(s)&&jt.folderInformation(o.fullNameRaw,s)))}),e&&jt.folderInformationMultiply(!0))},s)},Rt.prototype.setMessageSeen=function(e){if(e.unseen()){e.unseen(!1);var t=jt.cache().getFolderFromCacheList(e.folderFullNameRaw);t&&t.messageCountUnread(0<=t.messageCountUnread()-1?t.messageCountUnread()-1:0),jt.cache().storeMessageFlagsToCache(e),jt.reloadFlagsCurrentMessageListAndMessageFromCache()}jt.remote().messageSetSeen(Mt.emptyFunction,e.folderFullNameRaw,[e.uid],!0)},Rt.prototype.googleConnect=function(){e.open(jt.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")},Rt.prototype.twitterConnect=function(){e.open(jt.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")},Rt.prototype.facebookConnect=function(){e.open(jt.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")},Rt.prototype.socialUsers=function(e){var t=jt.data();e&&(t.googleActions(!0),t.facebookActions(!0),t.twitterActions(!0)),jt.remote().socialUsers(function(e,s){Lt.StorageResultType.Success===e&&s&&s.Result?(t.googleUserName(s.Result.Google||""),t.facebookUserName(s.Result.Facebook||""),t.twitterUserName(s.Result.Twitter||"")):(t.googleUserName(""),t.facebookUserName(""),t.twitterUserName("")),t.googleLoggined(""!==t.googleUserName()),t.facebookLoggined(""!==t.facebookUserName()),t.twitterLoggined(""!==t.twitterUserName()),t.googleActions(!1),t.facebookActions(!1),t.twitterActions(!1)})},Rt.prototype.googleDisconnect=function(){jt.data().googleActions(!0),jt.remote().googleDisconnect(function(){jt.socialUsers()})},Rt.prototype.facebookDisconnect=function(){jt.data().facebookActions(!0),jt.remote().facebookDisconnect(function(){jt.socialUsers()})},Rt.prototype.twitterDisconnect=function(){jt.data().twitterActions(!0),jt.remote().twitterDisconnect(function(){jt.socialUsers()})},Rt.prototype.folderListOptionsBuilder=function(t,s,i,o,n,a,r,l,c,u){var d=0,h=0,p=null,m=!1,g=" ",f=[];for(c=Mt.isNormal(c)?c:0<t.length,u=Mt.isUnd(u)?!1:!!u,n=Mt.isNormal(n)?n:0,a=Mt.isNormal(a)?a:null,r=Mt.isNormal(r)?r:null,l=Mt.isNormal(l)?l:null,Mt.isArray(i)||(i=[]),Mt.isArray(o)||(o=[]),d=0,h=o.length;h>d;d++)f.push({id:o[d][0],name:o[d][1],system:!1,seporator:!1,disabled:!1});for(m=!0,d=0,h=t.length;h>d;d++)p=t[d],(r?r.call(null,p):!0)&&(m&&0<f.length&&f.push({id:"---",name:"---",system:!1,seporator:!0,disabled:!0}),m=!1,f.push({id:p.fullNameRaw,name:l?l.call(null,p):p.name(),system:!0,seporator:!1,disabled:!p.selectable||-1<Mt.inArray(p.fullNameRaw,i)||(a?a.call(null,p):!1)}));for(m=!0,d=0,h=s.length;h>d;d++)p=s[d],(p.subScribed()||!p.existen)&&(r?r.call(null,p):!0)&&(Lt.FolderType.User===p.type()||!c||0<p.subFolders().length)&&(m&&0<f.length&&f.push({id:"---",name:"---",system:!1,seporator:!0,disabled:!0}),m=!1,f.push({id:p.fullNameRaw,name:new e.Array(p.deep+1-n).join(g)+(l?l.call(null,p):p.name()),system:!1,seporator:!1,disabled:!p.selectable||-1<Mt.inArray(p.fullNameRaw,i)||(a?a.call(null,p):!1)})),p.subScribed()&&0<p.subFolders().length&&(f=f.concat(jt.folderListOptionsBuilder([],p.subFolders(),i,[],n,a,r,l,c,u)));return f},Rt.prototype.getAutocomplete=function(e,t){var s=[];jt.remote().suggestions(function(e,i){Lt.StorageResultType.Success===e&&i&&Mt.isArray(i.Result)?(s=r.map(i.Result,function(e){return e&&e[0]?new v(e[0],e[1]):null}),t(r.compact(s))):Lt.StorageResultType.Abort!==e&&t([])},e)},Rt.prototype.getContactTagsAutocomplete=function(e,t){t(r.filter(jt.data().contactTags(),function(t){return t&&t.filterHelper(e)}))},Rt.prototype.mailToHelper=function(t){if(t&&"mailto:"===t.toString().substr(0,7).toLowerCase()){t=t.toString().substr(7);var s={},i=null,o=t.replace(/\?.+$/,""),n=t.replace(/^[^\?]*\?/,"");return i=new v,i.parse(e.decodeURIComponent(o)),i&&i.email&&(s=Mt.simpleQueryParser(n),xt.showScreenPopup(_,[Lt.ComposeType.Empty,null,[i],Mt.isUnd(s.subject)?null:Mt.pString(s.subject),Mt.isUnd(s.body)?null:Mt.plainToHtml(Mt.pString(s.body))])),!0}return!1},Rt.prototype.bootstart=function(){jt.pub("rl.bootstart"),Nt.prototype.bootstart.call(this),jt.data().populateDataOnStart();var s="",i=jt.settingsGet("JsHash"),o=Mt.pInt(jt.settingsGet("ContactsSyncInterval")),n=jt.settingsGet("AllowGoogleSocial"),a=jt.settingsGet("AllowFacebookSocial"),l=jt.settingsGet("AllowTwitterSocial");jt.settingsGet("ChangePasswordIsAllowed")||Mt.removeSettingsViewModel(pt),jt.settingsGet("ContactsIsAllowed")||Mt.removeSettingsViewModel(at),jt.capa(Lt.Capa.AdditionalAccounts)||Mt.removeSettingsViewModel(rt),Mt.removeSettingsViewModel(jt.capa(Lt.Capa.AdditionalIdentities)?lt:ct),jt.capa(Lt.Capa.OpenPGP)||Mt.removeSettingsViewModel(ft),jt.capa(Lt.Capa.TwoFactor)||Mt.removeSettingsViewModel(dt),jt.capa(Lt.Capa.Themes)||Mt.removeSettingsViewModel(gt),jt.capa(Lt.Capa.Filters)||Mt.removeSettingsViewModel(ut),n||a||l||Mt.removeSettingsViewModel(ht),Mt.initOnStartOrLangChange(function(){t.extend(!0,t.magnificPopup.defaults,{tClose:Mt.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:Mt.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:Mt.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:Mt.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:Mt.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:Mt.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:Mt.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})
|
||
},this),e.SimplePace&&(e.SimplePace.set(70),e.SimplePace.sleep()),jt.settingsGet("Auth")?(this.setTitle(Mt.i18n("TITLES/LOADING")),this.folders(r.bind(function(t){xt.hideLoading(),t?(e.$LAB&&e.crypto&&e.crypto.getRandomValues&&jt.capa(Lt.Capa.OpenPGP)?e.$LAB.script(e.openpgp?"":jt.link().openPgpJs()).wait(function(){e.openpgp&&(jt.data().openpgpKeyring=new e.openpgp.Keyring,jt.data().capaOpenPGP(!0),jt.pub("openpgp.init"),jt.reloadOpenPgpKeys())}):jt.data().capaOpenPGP(!1),xt.startScreens([At,Et]),(n||a||l)&&jt.socialUsers(!0),jt.sub("interval.2m",function(){jt.folderInformation("INBOX")}),jt.sub("interval.2m",function(){var e=jt.data().currentFolderFullNameRaw();"INBOX"!==e&&jt.folderInformation(e)}),jt.sub("interval.3m",function(){jt.folderInformationMultiply()}),jt.sub("interval.5m",function(){jt.quota()}),jt.sub("interval.10m",function(){jt.folders()}),o=o>=5?o:20,o=320>=o?o:320,e.setInterval(function(){jt.contactsSync()},6e4*o+5e3),r.delay(function(){jt.contactsSync()},5e3),r.delay(function(){jt.folderInformationMultiply(!0)},500),Dt.runHook("rl-start-user-screens"),jt.pub("rl.bootstart-user-screens"),jt.settingsGet("AccountSignMe")&&e.navigator.registerProtocolHandler&&r.delay(function(){try{e.navigator.registerProtocolHandler("mailto",e.location.protocol+"//"+e.location.host+e.location.pathname+"?mailto&to=%s",""+(jt.settingsGet("Title")||"RainLoop"))}catch(t){}jt.settingsGet("MailToEmail")&&jt.mailToHelper(jt.settingsGet("MailToEmail"))},500)):(xt.startScreens([Ft]),Dt.runHook("rl-start-login-screens"),jt.pub("rl.bootstart-login-screens")),e.SimplePace&&e.SimplePace.set(100),Ot.bMobileDevice||r.defer(function(){Mt.initLayoutResizer("#rl-left","#rl-right",Lt.ClientSideKeyName.FolderListSize)})},this))):(s=Mt.pString(jt.settingsGet("CustomLoginLink")),s?(xt.routeOff(),xt.setHash(jt.link().root(),!0),xt.routeOff(),r.defer(function(){e.location.href=s})):(xt.hideLoading(),xt.startScreens([Ft]),Dt.runHook("rl-start-login-screens"),jt.pub("rl.bootstart-login-screens"),e.SimplePace&&e.SimplePace.set(100))),n&&(e["rl_"+i+"_google_service"]=function(){jt.data().googleActions(!0),jt.socialUsers()}),a&&(e["rl_"+i+"_facebook_service"]=function(){jt.data().facebookActions(!0),jt.socialUsers()}),l&&(e["rl_"+i+"_twitter_service"]=function(){jt.data().twitterActions(!0),jt.socialUsers()}),jt.sub("interval.1m",function(){Ot.momentTrigger(!Ot.momentTrigger())}),Dt.runHook("rl-start-screens"),jt.pub("rl.bootstart-end")},jt=new Rt,Bt.addClass(Ot.bMobileDevice?"mobile":"no-mobile"),Gt.keydown(Mt.killCtrlAandS).keyup(Mt.killCtrlAandS),Gt.unload(function(){Ot.bUnload=!0}),Bt.on("click.dropdown.data-api",function(){Mt.detectDropdownVisibility()}),e.rl=e.rl||{},e.rl.addHook=Dt.addHook,e.rl.settingsGet=Dt.mainSettingsGet,e.rl.remoteRequest=Dt.remoteRequest,e.rl.pluginSettingsGet=Dt.settingsGet,e.rl.addSettingsViewModel=Mt.addSettingsViewModel,e.rl.createCommand=Mt.createCommand,e.rl.EmailModel=v,e.rl.Enums=Lt,e.__RLBOOT=function(s){t(function(){e.rainloopTEMPLATES&&e.rainloopTEMPLATES[0]?(t("#rl-templates").html(e.rainloopTEMPLATES[0]),r.delay(function(){e.rainloopAppData={},e.rainloopI18N={},e.rainloopTEMPLATES={},xt.setBoot(jt).bootstart(),Bt.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):s(!1),e.__RLBOOT=null})}}(window,jQuery,ko,crossroads,hasher,moment,Jua,_,ifvisible,key); |