snappymail/rainloop/v/0.0.0/static/js/admin.min.js
2014-07-31 19:13:32 +04:00

5 lines
116 KiB
JavaScript

/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
!function(e,t,i,n,o,s){"use strict";function a(){this.sBase="#/",this.sServer="./?",this.sVersion=lt.settingsGet("Version"),this.sSpecSuffix=lt.settingsGet("AuthAccountHash")||"0",this.sStaticPrefix=lt.settingsGet("StaticPrefix")||"rainloop/v/"+this.sVersion+"/static/"}function r(){}function l(){}function c(){var e=[l,r],t=s.find(e,function(e){return e.supported()});t&&(t=t,this.oDriver=new t)}function u(){}function d(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=$.pString(e),this.sTemplate=$.pString(t),this.sDefaultKeyScope=W.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelName="",this.viewModelVisibility=i.observable(!1),this.modalVisibility=i.observable(!1).extend({rateLimit:0}),this.viewModelDom=null}function p(e,t){this.sScreenName=e,this.aViewModels=$.isArray(t)?t:[]}function g(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null}function h(e,t){this.email=e||"",this.name=t||"",this.privateType=null,this.clearDuplicateName()}function m(){this.idContactTag=0,this.name=i.observable(""),this.readOnly=!1}function f(){d.call(this,"Popups","PopupsDomain"),this.edit=i.observable(!1),this.saving=i.observable(!1),this.savingError=i.observable(""),this.whiteListPage=i.observable(!1),this.testing=i.observable(!1),this.testingDone=i.observable(!1),this.testingImapError=i.observable(!1),this.testingSmtpError=i.observable(!1),this.testingImapErrorDesc=i.observable(""),this.testingSmtpErrorDesc=i.observable(""),this.testingImapError.subscribe(function(e){e||this.testingImapErrorDesc("")},this),this.testingSmtpError.subscribe(function(e){e||this.testingSmtpErrorDesc("")},this),this.testingImapErrorDesc=i.observable(""),this.testingSmtpErrorDesc=i.observable(""),this.imapServerFocus=i.observable(!1),this.smtpServerFocus=i.observable(!1),this.name=i.observable(""),this.name.focused=i.observable(!1),this.imapServer=i.observable(""),this.imapPort=i.observable(""+z.Values.ImapDefaulPort),this.imapSecure=i.observable(W.ServerSecure.None),this.imapShortLogin=i.observable(!1),this.smtpServer=i.observable(""),this.smtpPort=i.observable(""+z.Values.SmtpDefaulPort),this.smtpSecure=i.observable(W.ServerSecure.None),this.smtpShortLogin=i.observable(!1),this.smtpAuth=i.observable(!0),this.whiteList=i.observable(""),this.headerText=i.computed(function(){var e=this.name();return this.edit()?'Edit Domain "'+e+'"':"Add Domain"+(""===e?"":' "'+e+'"')},this),this.domainIsComputed=i.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this),this.canBeTested=i.computed(function(){return!this.testing()&&this.domainIsComputed()},this),this.canBeSaved=i.computed(function(){return!this.saving()&&this.domainIsComputed()},this),this.createOrAddCommand=$.createCommand(this,function(){this.saving(!0),lt.remote().createOrUpdateDomain(s.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),$.pInt(this.imapPort()),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),$.pInt(this.smtpPort()),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),this.whiteList())},this.canBeSaved),this.testConnectionCommand=$.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),lt.remote().testConnectionForDomain(s.bind(this.onTestConnectionResponse,this),this.name(),this.imapServer(),$.pInt(this.imapPort()),this.imapSecure(),this.smtpServer(),$.pInt(this.smtpPort()),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=$.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())}),this.imapServerFocus.subscribe(function(e){e&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name().replace(/[.]?[*][.]?/g,""))},this),this.smtpServerFocus.subscribe(function(e){e&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer().replace(/imap/gi,"smtp"))},this),this.imapSecure.subscribe(function(e){var t=$.pInt(this.imapPort());switch(e=$.pString(e)){case"0":993===t&&this.imapPort("143");break;case"1":143===t&&this.imapPort("993")}},this),this.smtpSecure.subscribe(function(e){var t=$.pInt(this.smtpPort());switch(e=$.pString(e)){case"0":(465===t||587===t)&&this.smtpPort("25");break;case"1":(25===t||587===t)&&this.smtpPort("465");break;case"2":(25===t||465===t)&&this.smtpPort("587")}},this),g.constructorEnd(this)}function b(){d.call(this,"Popups","PopupsPlugin");var e=this;this.onPluginSettingsUpdateResponse=s.bind(this.onPluginSettingsUpdateResponse,this),this.saveError=i.observable(""),this.name=i.observable(""),this.readme=i.observable(""),this.configures=i.observableArray([]),this.hasReadme=i.computed(function(){return""!==this.readme()},this),this.hasConfiguration=i.computed(function(){return 0<this.configures().length},this),this.readmePopoverConf={placement:"top",trigger:"hover",title:"About",content:function(){return e.readme()}},this.saveCommand=$.createCommand(this,function(){var e={};e.Name=this.name(),s.each(this.configures(),function(t){var i=t.value();(!1===i||!0===i)&&(i=i?"1":"0"),e["_"+t.Name]=i},this),this.saveError(""),lt.remote().pluginSettingsUpdate(this.onPluginSettingsUpdateResponse,e)},this.hasConfiguration),this.bDisabeCloseOnEsc=!0,this.sDefaultKeyScope=W.KeyState.All,this.tryToClosePopup=s.debounce(s.bind(this.tryToClosePopup,this),200),g.constructorEnd(this)}function S(){d.call(this,"Popups","PopupsActivate");var e=this;this.domain=i.observable(""),this.key=i.observable(""),this.key.focus=i.observable(!1),this.activationSuccessed=i.observable(!1),this.licenseTrigger=lt.data().licenseTrigger,this.activateProcess=i.observable(!1),this.activateText=i.observable(""),this.activateText.isError=i.observable(!1),this.key.subscribe(function(){this.activateText(""),this.activateText.isError(!1)},this),this.activationSuccessed.subscribe(function(e){e&&this.licenseTrigger(!this.licenseTrigger())},this),this.activateCommand=$.createCommand(this,function(){this.activateProcess(!0),this.validateSubscriptionKey()?lt.remote().licensingActivate(function(t,i){e.activateProcess(!1),W.StorageResultType.Success===t&&i.Result?!0===i.Result?(e.activationSuccessed(!0),e.activateText("Subscription Key Activated Successfully"),e.activateText.isError(!1)):(e.activateText(i.Result),e.activateText.isError(!0),e.key.focus(!0)):i.ErrorCode?(e.activateText($.getNotification(i.ErrorCode)),e.activateText.isError(!0),e.key.focus(!0)):(e.activateText($.getNotification(W.Notification.UnknownError)),e.activateText.isError(!0),e.key.focus(!0))},this.domain(),this.key()):(this.activateProcess(!1),this.activateText("Invalid Subscription Key"),this.activateText.isError(!0),this.key.focus(!0))},function(){return!this.activateProcess()&&""!==this.domain()&&""!==this.key()&&!this.activationSuccessed()}),g.constructorEnd(this)}function v(){d.call(this,"Popups","PopupsLanguages"),this.exp=i.observable(!1),this.languages=i.computed(function(){return s.map(lt.data().languages(),function(e){return{key:e,selected:i.observable(!1),fullName:$.convertLangName(e)}})}),lt.data().mainLanguage.subscribe(function(){this.resetMainLanguage()},this),g.constructorEnd(this)}function y(){d.call(this,"Popups","PopupsAsk"),this.askDesc=i.observable(""),this.yesButton=i.observable(""),this.noButton=i.observable(""),this.yesFocus=i.observable(!1),this.noFocus=i.observable(!1),this.fYesAction=null,this.fNoAction=null,this.bDisabeCloseOnEsc=!0,this.sDefaultKeyScope=W.KeyState.PopupAsk,g.constructorEnd(this)}function A(){d.call(this,"Center","AdminLogin"),this.login=i.observable(""),this.password=i.observable(""),this.loginError=i.observable(!1),this.passwordError=i.observable(!1),this.loginFocus=i.observable(!1),this.login.subscribe(function(){this.loginError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=i.observable(!1),this.submitError=i.observable(""),this.submitCommand=$.createCommand(this,function(){return $.triggerAutocompleteInputChange(),this.loginError(""===$.trim(this.login())),this.passwordError(""===$.trim(this.password())),this.loginError()||this.passwordError()?!1:(this.submitRequest(!0),lt.remote().adminLogin(s.bind(function(e,t){W.StorageResultType.Success===e&&t&&"AdminLogin"===t.Action?t.Result?lt.loginAndLogoutReload():t.ErrorCode&&(this.submitRequest(!1),this.submitError($.getNotification(t.ErrorCode))):(this.submitRequest(!1),this.submitError($.getNotification(W.Notification.UnknownError)))},this),this.login(),this.password()),!0)},function(){return!this.submitRequest()}),g.constructorEnd(this)}function C(e){d.call(this,"Left","AdminMenu"),this.leftPanelDisabled=lt.data().leftPanelDisabled,this.menu=e.menu,g.constructorEnd(this)}function w(){d.call(this,"Right","AdminPane"),this.adminDomain=i.observable(lt.settingsGet("AdminDomain")),this.version=i.observable(lt.settingsGet("Version")),this.adminManLoadingVisibility=lt.data().adminManLoadingVisibility,g.constructorEnd(this)}function T(){var e=lt.data();this.mainLanguage=e.mainLanguage,this.mainTheme=e.mainTheme,this.language=e.language,this.theme=e.theme,this.allowLanguagesOnSettings=e.allowLanguagesOnSettings,this.capaThemes=e.capaThemes,this.capaGravatar=e.capaGravatar,this.capaAdditionalAccounts=e.capaAdditionalAccounts,this.capaAdditionalIdentities=e.capaAdditionalIdentities,this.mainAttachmentLimit=i.observable($.pInt(lt.settingsGet("AttachmentLimit"))/1048576).extend({posInterer:25}),this.uploadData=lt.settingsGet("PhpUploadSizes"),this.uploadDataDesc=this.uploadData&&(this.uploadData.upload_max_filesize||this.uploadData.post_max_size)?[this.uploadData.upload_max_filesize?"upload_max_filesize = "+this.uploadData.upload_max_filesize+"; ":"",this.uploadData.post_max_size?"post_max_size = "+this.uploadData.post_max_size:""].join(""):"",this.themesOptions=i.computed(function(){return s.map(e.themes(),function(e){return{optValue:e,optText:$.convertThemeName(e)}})}),this.mainLanguageFullName=i.computed(function(){return $.convertLangName(this.mainLanguage())},this),this.weakPassword=!!lt.settingsGet("WeakPassword"),this.attachmentLimitTrigger=i.observable(W.SaveSettingsStep.Idle),this.languageTrigger=i.observable(W.SaveSettingsStep.Idle),this.themeTrigger=i.observable(W.SaveSettingsStep.Idle)}function N(){var e=lt.data();this.determineUserLanguage=e.determineUserLanguage,this.determineUserDomain=e.determineUserDomain,this.defaultDomain=i.observable(lt.settingsGet("LoginDefaultDomain")),this.allowLanguagesOnLogin=e.allowLanguagesOnLogin,this.defaultDomainTrigger=i.observable(W.SaveSettingsStep.Idle)}function E(){this.title=i.observable(lt.settingsGet("Title")),this.title.trigger=i.observable(W.SaveSettingsStep.Idle),this.loadingDesc=i.observable(lt.settingsGet("LoadingDescription")),this.loadingDesc.trigger=i.observable(W.SaveSettingsStep.Idle),this.loginLogo=i.observable(lt.settingsGet("LoginLogo")),this.loginLogo.trigger=i.observable(W.SaveSettingsStep.Idle),this.loginDescription=i.observable(lt.settingsGet("LoginDescription")),this.loginDescription.trigger=i.observable(W.SaveSettingsStep.Idle),this.loginCss=i.observable(lt.settingsGet("LoginCss")),this.loginCss.trigger=i.observable(W.SaveSettingsStep.Idle)}function I(){this.defautOptionsAfterRender=$.defautOptionsAfterRender,this.enableContacts=i.observable(!!lt.settingsGet("ContactsEnable")),this.contactsSharing=i.observable(!!lt.settingsGet("ContactsSharing")),this.contactsSync=i.observable(!!lt.settingsGet("ContactsSync"));var e=["sqlite","mysql","pgsql"],t=[],n=function(e){switch(e){case"sqlite":e="SQLite";break;case"mysql":e="MySQL";break;case"pgsql":e="PostgreSQL"}return e};lt.settingsGet("SQLiteIsSupported")&&t.push("sqlite"),lt.settingsGet("MySqlIsSupported")&&t.push("mysql"),lt.settingsGet("PostgreSqlIsSupported")&&t.push("pgsql"),this.contactsSupported=0<t.length,this.contactsTypes=i.observableArray([]),this.contactsTypesOptions=this.contactsTypes.map(function(e){var i=-1===$.inArray(e,t);return{id:e,name:n(e)+(i?" (not supported)":""),disabled:i}}),this.contactsTypes(e),this.contactsType=i.observable(""),this.mainContactsType=i.computed({owner:this,read:this.contactsType,write:function(e){e!==this.contactsType()?-1<$.inArray(e,t)?this.contactsType(e):0<t.length&&this.contactsType(""):this.contactsType.valueHasMutated()}}),this.contactsType.subscribe(function(){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage("")},this),this.pdoDsn=i.observable(lt.settingsGet("ContactsPdoDsn")),this.pdoUser=i.observable(lt.settingsGet("ContactsPdoUser")),this.pdoPassword=i.observable(lt.settingsGet("ContactsPdoPassword")),this.pdoDsnTrigger=i.observable(W.SaveSettingsStep.Idle),this.pdoUserTrigger=i.observable(W.SaveSettingsStep.Idle),this.pdoPasswordTrigger=i.observable(W.SaveSettingsStep.Idle),this.contactsTypeTrigger=i.observable(W.SaveSettingsStep.Idle),this.testing=i.observable(!1),this.testContactsSuccess=i.observable(!1),this.testContactsError=i.observable(!1),this.testContactsErrorMessage=i.observable(""),this.testContactsCommand=$.createCommand(this,function(){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage(""),this.testing(!0),lt.remote().testContacts(this.onTestContactsResponse,{ContactsPdoType:this.contactsType(),ContactsPdoDsn:this.pdoDsn(),ContactsPdoUser:this.pdoUser(),ContactsPdoPassword:this.pdoPassword()})},function(){return""!==this.pdoDsn()&&""!==this.pdoUser()}),this.contactsType(lt.settingsGet("ContactsPdoType")),this.onTestContactsResponse=s.bind(this.onTestContactsResponse,this)}function P(){var e=lt.data();this.domains=e.domains,this.domainsLoading=e.domainsLoading,this.iDomainForDeletionTimeout=0,this.visibility=i.computed(function(){return e.domainsLoading()?"visible":"hidden"},this),this.domainForDeletion=i.observable(null).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&(e.deleteAccess(!0),this.startDomainForDeletionTimeout())}]})}function _(){this.useLocalProxyForExternalImages=lt.data().useLocalProxyForExternalImages,this.capaOpenPGP=i.observable(lt.capa(W.Capa.OpenPGP)),this.capaTwoFactorAuth=i.observable(lt.capa(W.Capa.TwoFactor)),this.adminLogin=i.observable(lt.settingsGet("AdminLogin")),this.adminPassword=i.observable(""),this.adminPasswordNew=i.observable(""),this.adminPasswordNew2=i.observable(""),this.adminPasswordNewError=i.observable(!1),this.adminPasswordUpdateError=i.observable(!1),this.adminPasswordUpdateSuccess=i.observable(!1),this.adminPassword.subscribe(function(){this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1)},this),this.adminPasswordNew.subscribe(function(){this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1),this.adminPasswordNewError(!1)},this),this.adminPasswordNew2.subscribe(function(){this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1),this.adminPasswordNewError(!1)},this),this.saveNewAdminPasswordCommand=$.createCommand(this,function(){return this.adminPasswordNew()!==this.adminPasswordNew2()?(this.adminPasswordNewError(!0),!1):(this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1),void lt.remote().saveNewAdminPassword(this.onNewAdminPasswordResponse,{Password:this.adminPassword(),NewPassword:this.adminPasswordNew()}))},function(){return""!==this.adminPassword()&&""!==this.adminPasswordNew()&&""!==this.adminPasswordNew2()}),this.onNewAdminPasswordResponse=s.bind(this.onNewAdminPasswordResponse,this)}function D(){var e=lt.data();this.googleEnable=e.googleEnable,this.googleClientID=e.googleClientID,this.googleApiKey=e.googleApiKey,this.googleClientSecret=e.googleClientSecret,this.googleTrigger1=i.observable(W.SaveSettingsStep.Idle),this.googleTrigger2=i.observable(W.SaveSettingsStep.Idle),this.googleTrigger3=i.observable(W.SaveSettingsStep.Idle),this.facebookSupported=e.facebookSupported,this.facebookEnable=e.facebookEnable,this.facebookAppID=e.facebookAppID,this.facebookAppSecret=e.facebookAppSecret,this.facebookTrigger1=i.observable(W.SaveSettingsStep.Idle),this.facebookTrigger2=i.observable(W.SaveSettingsStep.Idle),this.twitterEnable=e.twitterEnable,this.twitterConsumerKey=e.twitterConsumerKey,this.twitterConsumerSecret=e.twitterConsumerSecret,this.twitterTrigger1=i.observable(W.SaveSettingsStep.Idle),this.twitterTrigger2=i.observable(W.SaveSettingsStep.Idle),this.dropboxEnable=e.dropboxEnable,this.dropboxApiKey=e.dropboxApiKey,this.dropboxTrigger1=i.observable(W.SaveSettingsStep.Idle)}function R(){var e=lt.data();this.enabledPlugins=i.observable(!!lt.settingsGet("EnabledPlugins")),this.pluginsError=i.observable(""),this.plugins=e.plugins,this.pluginsLoading=e.pluginsLoading,this.visibility=i.computed(function(){return e.pluginsLoading()?"visible":"hidden"},this),this.onPluginLoadRequest=s.bind(this.onPluginLoadRequest,this),this.onPluginDisableRequest=s.bind(this.onPluginDisableRequest,this)}function k(){var e=lt.data();this.packagesError=i.observable(""),this.packages=e.packages,this.packagesLoading=e.packagesLoading,this.packagesReal=e.packagesReal,this.packagesMainUpdatable=e.packagesMainUpdatable,this.packagesCurrent=this.packages.filter(function(e){return e&&""!==e.installed&&!e.compare}),this.packagesAvailableForUpdate=this.packages.filter(function(e){return e&&""!==e.installed&&!!e.compare}),this.packagesAvailableForInstallation=this.packages.filter(function(e){return e&&""===e.installed}),this.visibility=i.computed(function(){return e.packagesLoading()?"visible":"hidden"},this)}function L(){this.licensing=lt.data().licensing,this.licensingProcess=lt.data().licensingProcess,this.licenseValid=lt.data().licenseValid,this.licenseExpired=lt.data().licenseExpired,this.licenseError=lt.data().licenseError,this.licenseTrigger=lt.data().licenseTrigger,this.adminDomain=i.observable(""),this.subscriptionEnabled=i.observable(!!lt.settingsGet("SubscriptionEnabled")),this.licenseTrigger.subscribe(function(){this.subscriptionEnabled()&&lt.reloadLicensing(!0)},this)}function O(){var e=lt.data();this.version=i.observable(lt.settingsGet("Version")),this.access=i.observable(!!lt.settingsGet("CoreAccess")),this.errorDesc=i.observable(""),this.coreReal=e.coreReal,this.coreUpdatable=e.coreUpdatable,this.coreAccess=e.coreAccess,this.coreChecking=e.coreChecking,this.coreUpdating=e.coreUpdating,this.coreRemoteVersion=e.coreRemoteVersion,this.coreRemoteRelease=e.coreRemoteRelease,this.coreVersionCompare=e.coreVersionCompare,this.statusType=i.computed(function(){var e="",t=this.coreVersionCompare(),i=this.coreChecking(),n=this.coreUpdating(),o=this.coreReal();return i?e="checking":n?e="updating":o&&0===t?e="up-to-date":o&&-1===t?e="available":o||(e="error",this.errorDesc("Cannot access the repository at the moment.")),e},this)}function x(){this.leftPanelDisabled=i.observable(!1),this.useKeyboardShortcuts=i.observable(!0),this.keyScopeReal=i.observable(W.KeyState.All),this.keyScopeFake=i.observable(W.KeyState.All),this.keyScope=i.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(e){W.KeyState.Menu!==e&&(W.KeyState.Compose===e?$.disableKeyFilter():$.restoreKeyFilter(),this.keyScopeFake(e),X.dropdownVisibility()&&(e=W.KeyState.Menu)),this.keyScopeReal(e)}}),this.keyScopeReal.subscribe(function(e){key.setScope(e)}),this.leftPanelDisabled.subscribe(function(e){lt.pub("left-panel."+(e?"off":"on"))}),X.dropdownVisibility.subscribe(function(e){e?(X.tooltipTrigger(!X.tooltipTrigger()),this.keyScope(W.KeyState.Menu)):W.KeyState.Menu===key.getScope()&&this.keyScope(this.keyScopeFake())},this),$.initDataConstructorBySettings(this)}function F(){x.call(this),this.domainsLoading=i.observable(!1).extend({throttle:100}),this.domains=i.observableArray([]),this.pluginsLoading=i.observable(!1).extend({throttle:100}),this.plugins=i.observableArray([]),this.packagesReal=i.observable(!0),this.packagesMainUpdatable=i.observable(!0),this.packagesLoading=i.observable(!1).extend({throttle:100}),this.packages=i.observableArray([]),this.coreReal=i.observable(!0),this.coreUpdatable=i.observable(!0),this.coreAccess=i.observable(!0),this.coreChecking=i.observable(!1).extend({throttle:100}),this.coreUpdating=i.observable(!1).extend({throttle:100}),this.coreRemoteVersion=i.observable(""),this.coreRemoteRelease=i.observable(""),this.coreVersionCompare=i.observable(-2),this.licensing=i.observable(!1),this.licensingProcess=i.observable(!1),this.licenseValid=i.observable(!1),this.licenseExpired=i.observable(0),this.licenseError=i.observable(""),this.licenseTrigger=i.observable(!1),this.adminManLoading=i.computed(function(){return"000"!==[this.domainsLoading()?"1":"0",this.pluginsLoading()?"1":"0",this.packagesLoading()?"1":"0"].join("")},this),this.adminManLoadingVisibility=i.computed(function(){return this.adminManLoading()?"visible":"hidden"},this).extend({rateLimit:300})}function U(){this.oRequests={}}function M(){U.call(this),this.oRequests={}}function V(){this.oServices={},this.bCapaGravatar=lt.capa(W.Capa.Gravatar)}function H(){V.call(this)}function G(e){p.call(this,"settings",e),this.menu=i.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function q(){p.call(this,"login",[A])}function B(){G.call(this,[C,w])}function K(){u.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=i.observableArray([]),this.popupVisibility=i.computed(function(){return 0<this.popupVisibilityNames().length},this),this.iframe=t('<iframe style="display:none" src="javascript:;" />').appendTo("body"),st.on("error",function(e){lt&&e&&e.originalEvent&&e.originalEvent.message&&-1===$.inArray(e.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&lt.remote().jsError($.emptyFunction,e.originalEvent.message,e.originalEvent.filename,e.originalEvent.lineno,location&&location.toString?location.toString():"",ot.attr("class"),$.microtime()-X.now)}),at.on("keydown",function(e){e&&e.ctrlKey&&ot.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&ot.removeClass("rl-ctrl-key-pressed")})}function j(){K.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var z={},W={},Y={},$={},J={},Q={},X={},Z={settings:[],"settings-removed":[],"settings-disabled":[]},et=[],tt=null,it=e.rainloopAppData||{},nt=e.rainloopI18N||{},ot=t("html"),st=t(e),at=t(e.document),rt=e.Notification&&e.Notification.requestPermission?e.Notification:null,lt=null;X.now=(new Date).getTime(),X.momentTrigger=i.observable(!0),X.dropdownVisibility=i.observable(!1).extend({rateLimit:0}),X.tooltipTrigger=i.observable(!1).extend({rateLimit:0}),X.langChangeTrigger=i.observable(!0),X.iAjaxErrorCount=0,X.iTokenErrorCount=0,X.iMessageBodyCacheCount=0,X.bUnload=!1,X.sUserAgent=(navigator.userAgent||"").toLowerCase(),X.bIsiOSDevice=-1<X.sUserAgent.indexOf("iphone")||-1<X.sUserAgent.indexOf("ipod")||-1<X.sUserAgent.indexOf("ipad"),X.bIsAndroidDevice=-1<X.sUserAgent.indexOf("android"),X.bMobileDevice=X.bIsiOSDevice||X.bIsAndroidDevice,X.bDisableNanoScroll=X.bMobileDevice,X.bAllowPdfPreview=!X.bMobileDevice,X.bAnimationSupported=!X.bMobileDevice&&ot.hasClass("csstransitions"),X.bXMLHttpRequestSupported=!!e.XMLHttpRequest,X.sAnimationType="",X.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,enterMode:e.CKEDITOR.ENTER_BR,shiftEnterMode:e.CKEDITOR.ENTER_BR,font_defaultLabel:"Arial",fontSize_defaultLabel:"13",fontSize_sizes:"10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px"},X.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"},X.bAllowPdfPreview&&navigator&&navigator.mimeTypes&&(X.bAllowPdfPreview=!!s.find(navigator.mimeTypes,function(e){return e&&"application/pdf"===e.type})),z.Defaults={},z.Values={},z.DataImages={},z.Defaults.MessagesPerPage=20,z.Defaults.ContactsPerPage=50,z.Defaults.MessagesPerPageArray=[10,20,30,50,100],z.Defaults.DefaultAjaxTimeout=3e4,z.Defaults.SearchAjaxTimeout=3e5,z.Defaults.SendMessageAjaxTimeout=3e5,z.Defaults.SaveMessageAjaxTimeout=2e5,z.Defaults.ContactsSyncAjaxTimeout=2e5,z.Values.UnuseOptionValue="__UNUSE__",z.Values.ClientSideCookieIndexName="rlcsc",z.Values.ImapDefaulPort=143,z.Values.ImapDefaulSecurePort=993,z.Values.SmtpDefaulPort=25,z.Values.SmtpDefaulSecurePort=465,z.Values.MessageBodyCacheLimit=15,z.Values.AjaxErrorLimit=7,z.Values.TokenErrorLimit=10,z.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",z.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",W.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},W.State={Empty:10,Login:20,Auth:30},W.StateType={Webmail:0,Admin:1},W.Capa={Prem:"PREM",TwoFactor:"TWO_FACTOR",OpenPGP:"OPEN_PGP",Prefetch:"PREFETCH",Gravatar:"GRAVATAR",Themes:"THEMES",Filters:"FILTERS",AdditionalAccounts:"ADDITIONAL_ACCOUNTS",AdditionalIdentities:"ADDITIONAL_IDENTITIES"},W.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"},W.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,Archive:15,NotSpam:80,User:99},W.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},W.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},W.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},W.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},W.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4,Archive:5},W.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},W.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},W.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},W.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},W.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},W.MessagePriority={Low:5,Normal:3,High:1},W.EditorDefaultType={Html:"Html",Plain:"Plain"},W.CustomThemeType={Light:"Light",Dark:"Dark"},W.ServerSecure={None:0,SSL:1,TLS:2},W.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},W.EmailType={Defailt:0,Facebook:1,Google:2},W.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},W.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},W.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},W.FilterConditionField={From:"From",To:"To",Recipient:"Recipient",Subject:"Subject"},W.FilterConditionType={Contains:"Contains",NotContains:"NotContains",EqualTo:"EqualTo",NotEqualTo:"NotEqualTo"},W.FiltersAction={Move:"Move",Delete:"Delete",Forward:"Forward"},W.FilterRulesType={And:"And",Or:"Or",All:"All"},W.SignedVerifyStatus={UnknownPublicKeys:-4,UnknownPrivateKey:-3,Unverified:-2,Error:-1,None:0,Success:1},W.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},W.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},$.trim=t.trim,$.inArray=t.inArray,$.isArray=s.isArray,$.isFunc=s.isFunction,$.isUnd=s.isUndefined,$.isNull=s.isNull,$.emptyFunction=function(){},$.isNormal=function(e){return!$.isUnd(e)&&!$.isNull(e)},$.windowResize=s.debounce(function(t){$.isUnd(t)?st.resize():e.setTimeout(function(){st.resize()},t)},50),$.isPosNumeric=function(e,t){return $.isNormal(e)?($.isUnd(t)?0:!t)?/^[1-9]+[0-9]*$/.test(e.toString()):/^[0-9]*$/.test(e.toString()):!1},$.pInt=function(t,i){var n=$.isNormal(t)&&""!==t?e.parseInt(t,10):i||0;return e.isNaN(n)?i||0:n},$.pString=function(e){return $.isNormal(e)?""+e:""},$.isNonEmptyArray=function(e){return $.isArray(e)&&0<e.length},$.rsaEncode=function(t,i,n,o){if(e.crypto&&e.crypto.getRandomValues&&e.RSAKey&&i&&n&&o){var s=new e.RSAKey;if(s.setPublic(o,n),t=s.encrypt($.fakeMd5()+":"+t+":"+$.fakeMd5()),!1!==t)return"rsa:"+i+":"+t}return!1},$.rsaEncode.supported=!!(e.crypto&&e.crypto.getRandomValues&&e.RSAKey),$.exportPath=function(t,i,n){for(var o=null,s=t.split("."),a=n||e;s.length&&(o=s.shift());)s.length||$.isUnd(i)?a=a[o]?a[o]:a[o]={}:a[o]=i},$.pImport=function(e,t,i){e[t]=i},$.pExport=function(e,t,i){return $.isUnd(e[t])?i:e[t]},$.encodeHtml=function(e){return $.isNormal(e)?e.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""},$.splitPlainText=function(e,t){var i="",n="",o=e,s=0,a=0;for(t=$.isUnd(t)?100:t;o.length>t;)n=o.substring(0,t),s=n.lastIndexOf(" "),a=n.lastIndexOf("\n"),-1!==a&&(s=a),-1===s&&(s=t),i+=n.substring(0,s)+"\n",o=o.substring(s+1);return i+o},$.timeOutAction=function(){var t={};return function(i,n,o){$.isUnd(t[i])&&(t[i]=0),e.clearTimeout(t[i]),t[i]=e.setTimeout(n,o)}}(),$.timeOutActionSecond=function(){var t={};return function(i,n,o){t[i]||(t[i]=e.setTimeout(function(){n(),t[i]=0},o))}}(),$.audio=function(){var t=!1;return function(i,n){if(!1===t)if(X.bIsiOSDevice)t=null;else{var o=!1,s=!1,a=e.Audio?new e.Audio:null;a&&a.canPlayType&&a.play?(o=""!==a.canPlayType('audio/mpeg; codecs="mp3"'),o||(s=""!==a.canPlayType('audio/ogg; codecs="vorbis"')),o||s?(t=a,t.preload="none",t.loop=!1,t.autoplay=!1,t.muted=!1,t.src=o?i:n):t=null):t=null}return t}}(),$.hos=function(e,t){return e&&Object.hasOwnProperty?Object.hasOwnProperty.call(e,t):!1},$.i18n=function(e,t,i){var n="",o=$.isUnd(nt[e])?$.isUnd(i)?e:i:nt[e];if(!$.isUnd(t)&&!$.isNull(t))for(n in t)$.hos(t,n)&&(o=o.replace("%"+n+"%",t[n]));return o},$.i18nToNode=function(e){s.defer(function(){t(".i18n",e).each(function(){var e=t(this),i="";i=e.data("i18n-text"),i?e.text($.i18n(i)):(i=e.data("i18n-html"),i&&e.html($.i18n(i)),i=e.data("i18n-placeholder"),i&&e.attr("placeholder",$.i18n(i)),i=e.data("i18n-title"),i&&e.attr("title",$.i18n(i)))
})})},$.i18nToDoc=function(){e.rainloopI18N&&(nt=e.rainloopI18N||{},$.i18nToNode(at),X.langChangeTrigger(!X.langChangeTrigger())),e.rainloopI18N={}},$.initOnStartOrLangChange=function(e,t,i){e&&e.call(t),i?X.langChangeTrigger.subscribe(function(){e&&e.call(t),i.call(t)}):e&&X.langChangeTrigger.subscribe(e,t)},$.inFocus=function(){return document.activeElement?($.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=t(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},$.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var e=t(document.activeElement);e.is("input,textarea")&&document.activeElement.blur()}},$.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()},$.replySubjectAdd=function(e,t){e=$.trim(e.toUpperCase()),t=$.trim(t.replace(/[\s]+/," "));var i=0,n="",o=!1,s="",a=[],r=[],l="RE"===e,c="FWD"===e,u=!c;if(""!==t){for(o=!1,r=t.split(":"),i=0;i<r.length;i++)s=$.trim(r[i]),o||!/^(RE|FWD)$/i.test(s)&&!/^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(s)?(a.push(r[i]),o=!0):(l||(l=!!/^RE/i.test(s)),c||(c=!!/^FWD/i.test(s)));0<a.length&&(n=$.trim(a.join(":")))}return u?l=!1:c=!1,$.trim((u?"Re: ":"Fwd: ")+(l?"Re: ":"")+(c?"Fwd: ":"")+n)},$.fixLongSubject=function(e){var t=30,i=/^Re([\[\(]([\d]+)[\]\)]|):[\s]{0,3}Re([\[\(]([\d]+)[\]\)]|):/gi,n=null;e=$.trim(e.replace(/[\s]+/," "));do t--,n=i.exec(e),(!n||$.isUnd(n[0]))&&(n=null),n&&(e=e.replace(i,"Re:"));while(n||t>0);return e.replace(/[\s]+/," ")},$._replySubjectAdd_=function(t,i,n){var o=null,s=$.trim(i);return s=null===(o=new e.RegExp("^"+t+"[\\s]?\\:(.*)$","gi").exec(i))||$.isUnd(o[1])?null===(o=new e.RegExp("^("+t+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(i))||$.isUnd(o[1])||$.isUnd(o[2])||$.isUnd(o[3])?t+": "+i:o[1]+($.pInt(o[2])+1)+o[3]:t+"[2]: "+o[1],s=s.replace(/[\s]+/g," "),s=($.isUnd(n)?!0:n)?$.fixLongSubject(s):s},$._fixLongSubject_=function(e){var t=0,i=null;e=$.trim(e.replace(/[\s]+/," "));do i=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!i||$.isUnd(i[0]))&&(i=null),i&&(t=0,t+=$.isUnd(i[2])?1:0+$.pInt(i[2]),t+=$.isUnd(i[4])?1:0+$.pInt(i[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(i);return e=e.replace(/[\s]+/," ")},$.roundNumber=function(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)},$.friendlySize=function(e){return e=$.pInt(e),e>=1073741824?$.roundNumber(e/1073741824,1)+"GB":e>=1048576?$.roundNumber(e/1048576,1)+"MB":e>=1024?$.roundNumber(e/1024,0)+"KB":e+"B"},$.log=function(t){e.console&&e.console.log&&e.console.log(t)},$.getNotification=function(e,t){return e=$.pInt(e),W.Notification.ClientViewError===e&&t?t:$.isUnd(Y[e])?"":Y[e]},$.initNotificationLanguage=function(){Y[W.Notification.InvalidToken]=$.i18n("NOTIFICATIONS/INVALID_TOKEN"),Y[W.Notification.AuthError]=$.i18n("NOTIFICATIONS/AUTH_ERROR"),Y[W.Notification.AccessError]=$.i18n("NOTIFICATIONS/ACCESS_ERROR"),Y[W.Notification.ConnectionError]=$.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Y[W.Notification.CaptchaError]=$.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Y[W.Notification.SocialFacebookLoginAccessDisable]=$.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Y[W.Notification.SocialTwitterLoginAccessDisable]=$.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Y[W.Notification.SocialGoogleLoginAccessDisable]=$.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Y[W.Notification.DomainNotAllowed]=$.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Y[W.Notification.AccountNotAllowed]=$.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Y[W.Notification.AccountTwoFactorAuthRequired]=$.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Y[W.Notification.AccountTwoFactorAuthError]=$.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Y[W.Notification.CouldNotSaveNewPassword]=$.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Y[W.Notification.CurrentPasswordIncorrect]=$.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Y[W.Notification.NewPasswordShort]=$.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Y[W.Notification.NewPasswordWeak]=$.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Y[W.Notification.NewPasswordForbidden]=$.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Y[W.Notification.ContactsSyncError]=$.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Y[W.Notification.CantGetMessageList]=$.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Y[W.Notification.CantGetMessage]=$.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Y[W.Notification.CantDeleteMessage]=$.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Y[W.Notification.CantMoveMessage]=$.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Y[W.Notification.CantCopyMessage]=$.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Y[W.Notification.CantSaveMessage]=$.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Y[W.Notification.CantSendMessage]=$.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Y[W.Notification.InvalidRecipients]=$.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Y[W.Notification.CantCreateFolder]=$.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Y[W.Notification.CantRenameFolder]=$.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Y[W.Notification.CantDeleteFolder]=$.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Y[W.Notification.CantDeleteNonEmptyFolder]=$.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Y[W.Notification.CantSubscribeFolder]=$.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Y[W.Notification.CantUnsubscribeFolder]=$.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Y[W.Notification.CantSaveSettings]=$.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Y[W.Notification.CantSavePluginSettings]=$.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Y[W.Notification.DomainAlreadyExists]=$.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Y[W.Notification.CantInstallPackage]=$.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Y[W.Notification.CantDeletePackage]=$.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Y[W.Notification.InvalidPluginPackage]=$.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Y[W.Notification.UnsupportedPluginPackage]=$.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Y[W.Notification.LicensingServerIsUnavailable]=$.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Y[W.Notification.LicensingExpired]=$.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Y[W.Notification.LicensingBanned]=$.i18n("NOTIFICATIONS/LICENSING_BANNED"),Y[W.Notification.DemoSendMessageError]=$.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Y[W.Notification.AccountAlreadyExists]=$.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Y[W.Notification.MailServerError]=$.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Y[W.Notification.InvalidInputArgument]=$.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),Y[W.Notification.UnknownNotification]=$.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Y[W.Notification.UnknownError]=$.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},$.getUploadErrorDescByCode=function(e){var t="";switch($.pInt(e)){case W.UploadErrorCode.FileIsTooBig:t=$.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case W.UploadErrorCode.FilePartiallyUploaded:t=$.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case W.UploadErrorCode.FileNoUploaded:t=$.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case W.UploadErrorCode.MissingTempFolder:t=$.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case W.UploadErrorCode.FileOnSaveingError:t=$.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case W.UploadErrorCode.FileType:t=$.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=$.i18n("UPLOAD/ERROR_UNKNOWN")}return t},$.delegateRun=function(e,t,i,n){e&&e[t]&&(n=$.pInt(n),0>=n?e[t].apply(e,$.isArray(i)?i:[]):s.delay(function(){e[t].apply(e,$.isArray(i)?i:[])},n))},$.killCtrlAandS=function(t){if(t=t||e.event,t&&t.ctrlKey&&!t.shiftKey&&!t.altKey){var i=t.target||t.srcElement,n=t.keyCode||t.which;if(n===W.EventKeyCode.S)return void t.preventDefault();if(i&&i.tagName&&i.tagName.match(/INPUT|TEXTAREA/i))return;n===W.EventKeyCode.A&&(e.getSelection?e.getSelection().removeAllRanges():e.document.selection&&e.document.selection.clear&&e.document.selection.clear(),t.preventDefault())}},$.createCommand=function(e,t,n){var o=t?function(){return o.canExecute&&o.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=i.observable(!0),n=$.isUnd(n)?!0:n,o.canExecute=i.computed($.isFunc(n)?function(){return o.enabled()&&n.call(e)}:function(){return o.enabled()&&!!n}),o},$.initDataConstructorBySettings=function(t){t.editorDefaultType=i.observable(W.EditorDefaultType.Html),t.showImages=i.observable(!1),t.interfaceAnimation=i.observable(W.InterfaceAnimation.Full),t.contactsAutosave=i.observable(!1),X.sAnimationType=W.InterfaceAnimation.Full,t.capaThemes=i.observable(!1),t.allowLanguagesOnSettings=i.observable(!0),t.allowLanguagesOnLogin=i.observable(!0),t.useLocalProxyForExternalImages=i.observable(!1),t.desktopNotifications=i.observable(!1),t.useThreads=i.observable(!0),t.replySameFolder=i.observable(!0),t.useCheckboxesInList=i.observable(!0),t.layout=i.observable(W.Layout.SidePreview),t.usePreviewPane=i.computed(function(){return W.Layout.NoPreview!==t.layout()}),t.interfaceAnimation.subscribe(function(e){if(X.bMobileDevice||e===W.InterfaceAnimation.None)ot.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),X.sAnimationType=W.InterfaceAnimation.None;else switch(e){case W.InterfaceAnimation.Full:ot.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),X.sAnimationType=e;break;case W.InterfaceAnimation.Normal:ot.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),X.sAnimationType=e}}),t.interfaceAnimation.valueHasMutated(),t.desktopNotificationsPermisions=i.computed(function(){t.desktopNotifications();var i=W.DesktopNotifications.NotSupported;if(rt&&rt.permission)switch(rt.permission.toLowerCase()){case"granted":i=W.DesktopNotifications.Allowed;break;case"denied":i=W.DesktopNotifications.Denied;break;case"default":i=W.DesktopNotifications.NotAllowed}else e.webkitNotifications&&e.webkitNotifications.checkPermission&&(i=e.webkitNotifications.checkPermission());return i}),t.useDesktopNotifications=i.computed({read:function(){return t.desktopNotifications()&&W.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()},write:function(e){if(e){var i=t.desktopNotificationsPermisions();W.DesktopNotifications.Allowed===i?t.desktopNotifications(!0):W.DesktopNotifications.NotAllowed===i?rt.requestPermission(function(){t.desktopNotifications.valueHasMutated(),W.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=i.observable(""),t.languages=i.observableArray([]),t.mainLanguage=i.computed({read:t.language,write:function(e){e!==t.language()?-1<$.inArray(e,t.languages())?t.language(e):0<t.languages().length&&t.language(t.languages()[0]):t.language.valueHasMutated()}}),t.theme=i.observable(""),t.themes=i.observableArray([]),t.mainTheme=i.computed({read:t.theme,write:function(e){if(e!==t.theme()){var i=t.themes();-1<$.inArray(e,i)?t.theme(e):0<i.length&&t.theme(i[0])}else t.theme.valueHasMutated()}}),t.capaAdditionalAccounts=i.observable(!1),t.capaAdditionalIdentities=i.observable(!1),t.capaGravatar=i.observable(!1),t.determineUserLanguage=i.observable(!1),t.determineUserDomain=i.observable(!1),t.messagesPerPage=i.observable(z.Defaults.MessagesPerPage),t.mainMessagesPerPage=t.messagesPerPage,t.mainMessagesPerPage=i.computed({read:t.messagesPerPage,write:function(e){-1<$.inArray($.pInt(e),z.Defaults.MessagesPerPageArray)?e!==t.messagesPerPage()&&t.messagesPerPage(e):t.messagesPerPage.valueHasMutated()}}),t.facebookSupported=i.observable(!1),t.facebookEnable=i.observable(!1),t.facebookAppID=i.observable(""),t.facebookAppSecret=i.observable(""),t.twitterEnable=i.observable(!1),t.twitterConsumerKey=i.observable(""),t.twitterConsumerSecret=i.observable(""),t.googleEnable=i.observable(!1),t.googleClientID=i.observable(""),t.googleClientSecret=i.observable(""),t.googleApiKey=i.observable(""),t.dropboxEnable=i.observable(!1),t.dropboxApiKey=i.observable(""),t.contactsIsAllowed=i.observable(!1)},$.createMomentDate=function(e){return $.isUnd(e.moment)&&(e.moment=i.observable(moment())),i.computed(function(){X.momentTrigger();var e=this.moment();return 1970===e.year()?"":e.fromNow()},e)},$.createMomentShortDate=function(e){return i.computed(function(){var e="",t=moment(),i=this.moment(),n=this.momentDate();return e=1970===i.year()?"":4>=t.diff(i,"hours")?n:t.format("L")===i.format("L")?$.i18n("MESSAGE_LIST/TODAY_AT",{TIME:i.format("LT")}):t.clone().subtract("days",1).format("L")===i.format("L")?$.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:i.format("LT")}):i.format(t.year()===i.year()?"D MMM.":"LL")},e)},$.isFolderExpanded=function(e){var t=lt.local().get(W.ClientSideKeyName.ExpandedFolders);return s.isArray(t)&&-1!==s.indexOf(t,e)},$.setExpandedFolder=function(e,t){var i=lt.local().get(W.ClientSideKeyName.ExpandedFolders);s.isArray(i)||(i=[]),t?(i.push(e),i=s.uniq(i)):i=s.without(i,e),lt.local().set(W.ClientSideKeyName.ExpandedFolders,i)},$.initLayoutResizer=function(e,i,n){var o=60,s=155,a=t(e),r=t(i),l=lt.local().get(n)||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=$.pInt(lt.local().get(n))||s;c(t>s?t:s)}},d=function(e,t){t&&t.size&&t.size.width&&(lt.local().set(n,t.size.width),r.css({left:""+t.size.width+"px"}))};null!==l&&c(l>s?l:s),a.resizable({helper:"ui-resizable-helper",minWidth:s,maxWidth:350,handles:"e",stop:d}),lt.sub("left-panel.off",function(){u(!0)}),lt.sub("left-panel.on",function(){u(!1)})},$.initBlockquoteSwitcher=function(e){if(e){var i=t("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===t(this).parent().closest("blockquote",e).length});i&&0<i.length&&i.each(function(){var e=t(this),i=e.height();(0===i||i>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"),$.windowResize()}).after("<br />").before("<br />"))})}},$.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()}))},$.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},$.extendAsViewModel=function(e,t,i){t&&(i||(i=d),t.__name=e,J.regViewModelHook(e,t),s.extend(t.prototype,i.prototype))},$.addSettingsViewModel=function(e,t,i,n,o){e.__rlSettingsData={Label:i,Template:t,Route:n,IsDefault:!!o},Z.settings.push(e)},$.removeSettingsViewModel=function(e){Z["settings-removed"].push(e)},$.disableSettingsViewModel=function(e){Z["settings-disabled"].push(e)},$.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=$.trim(e.substring(0,e.length-7))),$.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},$.quoteName=function(e){return e.replace(/["]/g,'\\"')},$.microtime=function(){return(new Date).getTime()},$.convertLangName=function(e,t){return $.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},$.fakeMd5=function(e){var t="",i="0123456789abcdefghijklmnopqrstuvwxyz";for(e=$.isUnd(e)?32:$.pInt(e);t.length<e;)t+=i.substr(Math.round(Math.random()*i.length),1);return t},$.md5=function(e){function t(e,t){return e<<t|e>>>32-t}function i(e,t){var i,n,o,s,a;return o=2147483648&e,s=2147483648&t,i=1073741824&e,n=1073741824&t,a=(1073741823&e)+(1073741823&t),i&n?2147483648^a^o^s:i|n?1073741824&a?3221225472^a^o^s:1073741824^a^o^s:a^o^s}function n(e,t,i){return e&t|~e&i}function o(e,t,i){return e&i|t&~i}function s(e,t,i){return e^t^i}function a(e,t,i){return t^(e|~i)}function r(e,o,s,a,r,l,c){return e=i(e,i(i(n(o,s,a),r),c)),i(t(e,l),o)}function l(e,n,s,a,r,l,c){return e=i(e,i(i(o(n,s,a),r),c)),i(t(e,l),n)}function c(e,n,o,a,r,l,c){return e=i(e,i(i(s(n,o,a),r),c)),i(t(e,l),n)}function u(e,n,o,s,r,l,c){return e=i(e,i(i(a(n,o,s),r),c)),i(t(e,l),n)}function d(e){for(var t,i=e.length,n=i+8,o=(n-n%64)/64,s=16*(o+1),a=Array(s-1),r=0,l=0;i>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[s-2]=i<<3,a[s-1]=i>>>29,a}function p(e){var t,i,n="",o="";for(i=0;3>=i;i++)t=e>>>8*i&255,o="0"+t.toString(16),n+=o.substr(o.length-2,2);return n}function g(e){e=e.replace(/rn/g,"n");for(var t="",i=0;i<e.length;i++){var n=e.charCodeAt(i);128>n?t+=String.fromCharCode(n):n>127&&2048>n?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}var h,m,f,b,S,v,y,A,C,w=Array(),T=7,N=12,E=17,I=22,P=5,_=9,D=14,R=20,k=4,L=11,O=16,x=23,F=6,U=10,M=15,V=21;for(e=g(e),w=d(e),v=1732584193,y=4023233417,A=2562383102,C=271733878,h=0;h<w.length;h+=16)m=v,f=y,b=A,S=C,v=r(v,y,A,C,w[h+0],T,3614090360),C=r(C,v,y,A,w[h+1],N,3905402710),A=r(A,C,v,y,w[h+2],E,606105819),y=r(y,A,C,v,w[h+3],I,3250441966),v=r(v,y,A,C,w[h+4],T,4118548399),C=r(C,v,y,A,w[h+5],N,1200080426),A=r(A,C,v,y,w[h+6],E,2821735955),y=r(y,A,C,v,w[h+7],I,4249261313),v=r(v,y,A,C,w[h+8],T,1770035416),C=r(C,v,y,A,w[h+9],N,2336552879),A=r(A,C,v,y,w[h+10],E,4294925233),y=r(y,A,C,v,w[h+11],I,2304563134),v=r(v,y,A,C,w[h+12],T,1804603682),C=r(C,v,y,A,w[h+13],N,4254626195),A=r(A,C,v,y,w[h+14],E,2792965006),y=r(y,A,C,v,w[h+15],I,1236535329),v=l(v,y,A,C,w[h+1],P,4129170786),C=l(C,v,y,A,w[h+6],_,3225465664),A=l(A,C,v,y,w[h+11],D,643717713),y=l(y,A,C,v,w[h+0],R,3921069994),v=l(v,y,A,C,w[h+5],P,3593408605),C=l(C,v,y,A,w[h+10],_,38016083),A=l(A,C,v,y,w[h+15],D,3634488961),y=l(y,A,C,v,w[h+4],R,3889429448),v=l(v,y,A,C,w[h+9],P,568446438),C=l(C,v,y,A,w[h+14],_,3275163606),A=l(A,C,v,y,w[h+3],D,4107603335),y=l(y,A,C,v,w[h+8],R,1163531501),v=l(v,y,A,C,w[h+13],P,2850285829),C=l(C,v,y,A,w[h+2],_,4243563512),A=l(A,C,v,y,w[h+7],D,1735328473),y=l(y,A,C,v,w[h+12],R,2368359562),v=c(v,y,A,C,w[h+5],k,4294588738),C=c(C,v,y,A,w[h+8],L,2272392833),A=c(A,C,v,y,w[h+11],O,1839030562),y=c(y,A,C,v,w[h+14],x,4259657740),v=c(v,y,A,C,w[h+1],k,2763975236),C=c(C,v,y,A,w[h+4],L,1272893353),A=c(A,C,v,y,w[h+7],O,4139469664),y=c(y,A,C,v,w[h+10],x,3200236656),v=c(v,y,A,C,w[h+13],k,681279174),C=c(C,v,y,A,w[h+0],L,3936430074),A=c(A,C,v,y,w[h+3],O,3572445317),y=c(y,A,C,v,w[h+6],x,76029189),v=c(v,y,A,C,w[h+9],k,3654602809),C=c(C,v,y,A,w[h+12],L,3873151461),A=c(A,C,v,y,w[h+15],O,530742520),y=c(y,A,C,v,w[h+2],x,3299628645),v=u(v,y,A,C,w[h+0],F,4096336452),C=u(C,v,y,A,w[h+7],U,1126891415),A=u(A,C,v,y,w[h+14],M,2878612391),y=u(y,A,C,v,w[h+5],V,4237533241),v=u(v,y,A,C,w[h+12],F,1700485571),C=u(C,v,y,A,w[h+3],U,2399980690),A=u(A,C,v,y,w[h+10],M,4293915773),y=u(y,A,C,v,w[h+1],V,2240044497),v=u(v,y,A,C,w[h+8],F,1873313359),C=u(C,v,y,A,w[h+15],U,4264355552),A=u(A,C,v,y,w[h+6],M,2734768916),y=u(y,A,C,v,w[h+13],V,1309151649),v=u(v,y,A,C,w[h+4],F,4149444226),C=u(C,v,y,A,w[h+11],U,3174756917),A=u(A,C,v,y,w[h+2],M,718787259),y=u(y,A,C,v,w[h+9],V,3951481745),v=i(v,m),y=i(y,f),A=i(A,b),C=i(C,S);var H=p(v)+p(y)+p(A)+p(C);return H.toLowerCase()},$.convertPlainTextToHtml=function(e){return e.toString().replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")},$.draggeblePlace=function(){return t('<div class="draggablePlace"><span class="text"></span>&nbsp;<i class="icon-copy icon-white visible-on-ctrl"></i><i class="icon-mail icon-white hidden-on-ctrl"></i></div>').appendTo("#rl-hidden")},$.defautOptionsAfterRender=function(e,i){i&&!$.isUnd(i.disabled)&&e&&t(e).toggleClass("disabled",i.disabled).prop("disabled",i.disabled)},$.windowPopupKnockout=function(i,n,o,s){var a=null,r=e.open(""),l="__OpenerApplyBindingsUid"+$.fakeMd5()+"__",c=t("#"+n);e[l]=function(){if(r&&r.document.body&&c&&c[0]){var n=t(r.document.body);t("#rl-content",n).html(c.html()),t("html",r.document).addClass("external "+t("html").attr("class")),$.i18nToNode(n),g.prototype.applyExternal(i,t("#rl-content",n)[0]),e[l]=null,s(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>'+$.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)},$.settingsSaveHelperFunction=function(e,t,i,n){return i=i||null,n=$.isUnd(n)?1e3:$.pInt(n),function(o,a,r,l,c){t.call(i,a&&a.Result?W.SaveSettingsStep.TrueResult:W.SaveSettingsStep.FalseResult),e&&e.call(i,o,a,r,l,c),s.delay(function(){t.call(i,W.SaveSettingsStep.Idle)},n)}},$.settingsSaveHelperSimpleFunction=function(e,t){return $.settingsSaveHelperFunction(null,e,t,1e3)},$.$div=t("<div></div>"),$.htmlToPlain=function(e){var i=0,n=0,o=0,s=0,a=0,r="",l=function(e){for(var t=100,i="",n="",o=e,s=0,a=0;o.length>t;)n=o.substring(0,t),s=n.lastIndexOf(" "),a=n.lastIndexOf("\n"),-1!==a&&(s=a),-1===s&&(s=t),i+=n.substring(0,s)+"\n",o=o.substring(s+1);return i+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]+arguments[2].replace(/</g,"&lt;").replace(/>/g,"&gt;"):""},p=function(){return arguments&&1<arguments.length?t.trim(arguments[1]):""};for(r=e.replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,d).replace(/<br\s?\/?>/gim,"\n").replace(/<\/h[\d]>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<hr[^>]*>/gim,"\n_______________________________\n\n").replace(/<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(/&nbsp;/gi," ").replace(/&quot;/gi,'"').replace(/<[^>]*>/gm,""),r=$.$div.html(r).text(),r=r.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/&gt;/gi,">").replace(/&lt;/gi,"<").replace(/&amp;/gi,"&"),i=0,a=100;a>0&&(a--,n=r.indexOf("__bq__start__",i),n>-1);)o=r.indexOf("__bq__start__",n+5),s=r.indexOf("__bq__end__",n+5),(-1===o||o>s)&&s>n?(r=r.substring(0,n)+c(r.substring(n+13,s))+r.substring(s+11),i=0):i=o>-1&&s>o?o-1:0;return r=r.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},$.plainToHtml=function(e,t){e=e.toString().replace(/\r/g,"");var i=!1,n=!0,o=!0,s=[],a="",r=0,l=e.split("\n");do{for(n=!1,s=[],r=0;r<l.length;r++)a=l[r],o=">"===a.substr(0,1),o&&!i?(n=!0,i=!0,s.push("~~~blockquote~~~"),s.push(a.substr(1))):!o&&i?(i=!1,s.push("~~~/blockquote~~~"),s.push(a)):s.push(o&&i?a.substr(1):a);i&&(i=!1,s.push("~~~/blockquote~~~")),l=s}while(n);return e=l.join("\n"),e=e.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/~~~blockquote~~~[\s]*/g,"<blockquote>").replace(/[\s]*~~~\/blockquote~~~/g,"</blockquote>").replace(/[\-_~]{10,}/g,"<hr />").replace(/\n/g,"<br />"),t?$.linkify(e):e},e.rainloop_Utils_htmlToPlain=$.htmlToPlain,e.rainloop_Utils_plainToHtml=$.plainToHtml,$.linkify=function(e){return t.fn&&t.fn.linkify&&(e=$.$div.html(e.replace(/&amp;/gi,"amp_amp_12345_amp_amp")).linkify().find(".linkified").removeClass("linkified").end().html().replace(/amp_amp_12345_amp_amp/g,"&amp;")),e},$.resizeAndCrop=function(t,i,n){var o=new e.Image;o.onload=function(){var e=[0,0],t=document.createElement("canvas"),o=t.getContext("2d");t.width=i,t.height=i,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],o.fillStyle="#fff",o.fillRect(0,0,i,i),o.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,i,i),n(t.toDataURL("image/jpeg"))},o.src=t},$.computedPagenatorHelper=function(e,t){return function(){var i=0,n=0,o=2,s=[],a=e(),r=t(),l=function(e,t,i){var n={current:e===a,name:$.isUnd(i)?e.toString():i.toString(),custom:$.isUnd(i)?!1:!0,title:$.isUnd(i)?"":e.toString(),value:e.toString()};($.isUnd(t)?0:!t)?s.unshift(n):s.push(n)};if(r>1||r>0&&a>r){for(a>r?(l(r),i=r,n=r):((3>=a||a>=r-2)&&(o+=2),l(a),i=a,n=a);o>0;)if(i-=1,n+=1,i>0&&(l(i,!1),o--),r>=n)l(n,!0),o--;else if(0>=i)break;3===i?l(2,!1):i>3&&l(Math.round((i-1)/2),!1,"..."),r-2===n?l(r-1,!0):r-2>n&&l(Math.round((r+n)/2),!0,"..."),i>1&&l(1,!1),r>n&&l(r,!0)}return s}},$.selectElement=function(t){if(e.getSelection){var i=e.getSelection();i.removeAllRanges();var n=document.createRange();n.selectNodeContents(t),i.addRange(n)}else if(document.selection){var o=document.body.createTextRange();o.moveToElementText(t),o.select()}},$.disableKeyFilter=function(){e.key&&(key.filter=function(){return lt.data().useKeyboardShortcuts()})},$.restoreKeyFilter=function(){e.key&&(key.filter=function(e){if(lt.data().useKeyboardShortcuts()){var t=e.target||e.srcElement,i=t?t.tagName:"";return i=i.toUpperCase(),!("INPUT"===i||"SELECT"===i||"TEXTAREA"===i||t&&"DIV"===i&&"editorHtmlArea"===t.className&&t.contentEditable)}return!1})},$.detectDropdownVisibility=s.debounce(function(){X.dropdownVisibility(!!s.find(et,function(e){return e.hasClass("open")}))},50),$.triggerAutocompleteInputChange=function(e){var i=function(){t(".checkAutocomplete").trigger("change")};e?s.delay(i,100):i()},Q={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return Q.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var t,i,n,o,s,a,r,l="",c=0;for(e=Q._utf8_encode(e);c<e.length;)t=e.charCodeAt(c++),i=e.charCodeAt(c++),n=e.charCodeAt(c++),o=t>>2,s=(3&t)<<4|i>>4,a=(15&i)<<2|n>>6,r=63&n,isNaN(i)?a=r=64:isNaN(n)&&(r=64),l=l+this._keyStr.charAt(o)+this._keyStr.charAt(s)+this._keyStr.charAt(a)+this._keyStr.charAt(r);return l},decode:function(e){var t,i,n,o,s,a,r,l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<e.length;)o=this._keyStr.indexOf(e.charAt(c++)),s=this._keyStr.indexOf(e.charAt(c++)),a=this._keyStr.indexOf(e.charAt(c++)),r=this._keyStr.indexOf(e.charAt(c++)),t=o<<2|s>>4,i=(15&s)<<4|a>>2,n=(3&a)<<6|r,l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(i)),64!==r&&(l+=String.fromCharCode(n));return Q._utf8_decode(l)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",i=0,n=e.length,o=0;n>i;i++)o=e.charCodeAt(i),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="",i=0,n=0,o=0,s=0;i<e.length;)n=e.charCodeAt(i),128>n?(t+=String.fromCharCode(n),i++):n>191&&224>n?(o=e.charCodeAt(i+1),t+=String.fromCharCode((31&n)<<6|63&o),i+=2):(o=e.charCodeAt(i+1),s=e.charCodeAt(i+2),t+=String.fromCharCode((15&n)<<12|(63&o)<<6|63&s),i+=3);return t}},i.bindingHandlers.tooltip={init:function(e,n){if(!X.bMobileDevice){var o=t(e),s=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")||X.dropdownVisibility()?"":'<span class="tooltip-class '+s+'">'+$.i18n(i.utils.unwrapObservable(n()))+"</span>"}}).click(function(){o.tooltip("hide")}),X.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}}},i.bindingHandlers.tooltip2={init:function(e,i){var n=t(e),o=n.data("tooltip-class")||"",s=n.data("tooltip-placement")||"top";n.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:s,title:function(){return n.is(".disabled")||X.dropdownVisibility()?"":'<span class="tooltip-class '+o+'">'+i()()+"</span>"}}).click(function(){n.tooltip("hide")}),X.tooltipTrigger.subscribe(function(){n.tooltip("hide")})}},i.bindingHandlers.tooltip3={init:function(e){var i=t(e);i.tooltip({container:"body",trigger:"hover manual",title:function(){return i.data("tooltip3-data")||""}}),at.click(function(){i.tooltip("hide")}),X.tooltipTrigger.subscribe(function(){i.tooltip("hide")})},update:function(e,n){var o=i.utils.unwrapObservable(n());""===o?t(e).data("tooltip3-data","").tooltip("hide"):t(e).data("tooltip3-data",o).tooltip("show")}},i.bindingHandlers.registrateBootstrapDropdown={init:function(e){et.push(t(e))}},i.bindingHandlers.openDropdownTrigger={update:function(e,n){if(i.utils.unwrapObservable(n())){var o=t(e);o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),$.detectDropdownVisibility()),n()(!1)}}},i.bindingHandlers.dropdownCloser={init:function(e){t(e).closest(".dropdown").on("click",".e-item",function(){t(e).dropdown("toggle")})}},i.bindingHandlers.popover={init:function(e,n){t(e).popover(i.utils.unwrapObservable(n()))}},i.bindingHandlers.csstext={init:function(e,n){e&&e.styleSheet&&!$.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=i.utils.unwrapObservable(n()):t(e).text(i.utils.unwrapObservable(n()))},update:function(e,n){e&&e.styleSheet&&!$.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=i.utils.unwrapObservable(n()):t(e).text(i.utils.unwrapObservable(n()))}},i.bindingHandlers.resizecrop={init:function(e){t(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,i){i()(),t(e).resizecrop({width:"100",height:"100"})}},i.bindingHandlers.onEnter={init:function(i,n,o,s){t(i).on("keypress",function(o){o&&13===e.parseInt(o.keyCode,10)&&(t(i).trigger("change"),n().call(s))})}},i.bindingHandlers.onEsc={init:function(i,n,o,s){t(i).on("keypress",function(o){o&&27===e.parseInt(o.keyCode,10)&&(t(i).trigger("change"),n().call(s))})}},i.bindingHandlers.clickOnTrue={update:function(e,n){i.utils.unwrapObservable(n())&&t(e).click()}},i.bindingHandlers.modal={init:function(e,n){t(e).toggleClass("fade",!X.bMobileDevice).modal({keyboard:!1,show:i.utils.unwrapObservable(n())}).on("shown",function(){$.windowResize()}).find(".close").click(function(){n()(!1)})},update:function(e,n){t(e).modal(i.utils.unwrapObservable(n())?"show":"hide")}},i.bindingHandlers.i18nInit={init:function(e){$.i18nToNode(e)}},i.bindingHandlers.i18nUpdate={update:function(e,t){i.utils.unwrapObservable(t()),$.i18nToNode(e)}},i.bindingHandlers.link={update:function(e,n){t(e).attr("href",i.utils.unwrapObservable(n()))}},i.bindingHandlers.title={update:function(e,n){t(e).attr("title",i.utils.unwrapObservable(n()))}},i.bindingHandlers.textF={init:function(e,n){t(e).text(i.utils.unwrapObservable(n()))}},i.bindingHandlers.initDom={init:function(e,t){t()(e)}},i.bindingHandlers.initResizeTrigger={init:function(e,n){var o=i.utils.unwrapObservable(n());t(e).css({height:o[1],"min-height":o[1]})},update:function(e,n){var o=i.utils.unwrapObservable(n()),s=$.pInt(o[1]),a=0,r=t(e).offset().top;r>0&&(r+=$.pInt(o[2]),a=st.height()-r,a>s&&(s=a),t(e).css({height:s,"min-height":s}))}},i.bindingHandlers.appendDom={update:function(e,n){t(e).hide().empty().append(i.utils.unwrapObservable(n())).show()}},i.bindingHandlers.draggable={init:function(n,o,s){if(!X.bMobileDevice){var a=100,r=3,l=s(),c=l&&l.droppableSelector?l.droppableSelector:"",u={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};c&&(u.drag=function(i){t(c).each(function(){var n=null,o=null,s=t(this),l=s.offset(),c=l.top+s.height();
e.clearInterval(s.data("timerScroll")),s.data("timerScroll",!1),i.pageX>=l.left&&i.pageX<=l.left+s.width()&&(i.pageY>=c-a&&i.pageY<=c&&(n=function(){s.scrollTop(s.scrollTop()+r),$.windowResize()},s.data("timerScroll",e.setInterval(n,10)),n()),i.pageY>=l.top&&i.pageY<=l.top+a&&(o=function(){s.scrollTop(s.scrollTop()-r),$.windowResize()},s.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?i.dataFor(e.target):null)},t(n).draggable(u).on("mousedown",function(){$.removeInFocus()})}}},i.bindingHandlers.droppable={init:function(e,i,n){if(!X.bMobileDevice){var o=i(),s=n(),a=s&&s.droppableOver?s.droppableOver:null,r=s&&s.droppableOut?s.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))}}},i.bindingHandlers.nano={init:function(e){X.bDisableNanoScroll||t(e).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},i.bindingHandlers.saveTrigger={init:function(e){var i=t(e);i.data("save-trigger-type",i.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===i.data("save-trigger-type")?i.append('&nbsp;&nbsp;<i class="icon-spinner animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>').addClass("settings-saved-trigger"):i.addClass("settings-saved-trigger-input")},update:function(e,n){var o=i.utils.unwrapObservable(n()),s=t(e);if("custom"===s.data("save-trigger-type"))switch(o.toString()){case"1":s.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":s.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":s.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:s.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(o.toString()){case"1":s.addClass("success").removeClass("error");break;case"0":s.addClass("error").removeClass("success");break;case"-2":break;default:s.removeClass("error success")}}},i.bindingHandlers.emailsTags={init:function(e,i){var n=t(e),o=i(),a=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};n.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:a,inputDelimiters:[",",";"],autoCompleteSource:function(e,t){lt.getAutocomplete(e.term,function(e){t(s.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return s.map(e,function(e){var t=$.trim(e),i=null;return""!==t?(i=new h,i.mailsoParse(t),i.clearDuplicateName(),[i.toLine(!1),i]):[t,null]})},change:s.bind(function(e){n.data("EmailsTagsValue",e.target.value),o(e.target.value)},this)}),o.subscribe(function(e){n.data("EmailsTagsValue")!==e&&(n.val(e),n.data("EmailsTagsValue",e),n.inputosaurus("refresh"))}),o.focusTrigger&&o.focusTrigger.subscribe(function(e){e&&n.inputosaurus("focus")})}},i.bindingHandlers.contactTags={init:function(e,i){var n=t(e),o=i(),a=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};n.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:a,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(e,t){lt.getContactsTagsAutocomplete(e.term,function(e){t(s.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return s.map(e,function(e){var t=$.trim(e),i=null;return""!==t?(i=new m,i.name(t),[i.toLine(!1),i]):[t,null]})},change:s.bind(function(e){n.data("ContactsTagsValue",e.target.value),o(e.target.value)},this)}),o.subscribe(function(e){n.data("ContactsTagsValue")!==e&&(n.val(e),n.data("ContactsTagsValue",e),n.inputosaurus("refresh"))}),o.focusTrigger&&o.focusTrigger.subscribe(function(e){e&&n.inputosaurus("focus")})}},i.bindingHandlers.command={init:function(e,n,o,s){var a=t(e),r=n();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");a.addClass("command"),i.bindingHandlers[a.is("form")?"submit":"click"].init.apply(s,arguments)},update:function(e,i){var n=!0,o=t(e),s=i();n=s.enabled(),o.toggleClass("command-not-enabled",!n),n&&(n=s.canExecute(),o.toggleClass("command-can-not-be-execute",!n)),o.toggleClass("command-disabled disable disabled",!n).toggleClass("no-disabled",!!n),(o.is("input")||o.is("button"))&&o.prop("disabled",!n)}},i.extenders.trimmer=function(e){var t=i.computed({read:e,write:function(t){e($.trim(t.toString()))},owner:this});return t(e()),t},i.extenders.posInterer=function(e,t){var n=i.computed({read:e,write:function(i){var n=$.pInt(i.toString(),t);0>=n&&(n=t),n===e()&&""+n!=""+i&&e(n+1),e(n)}});return n(e()),n},i.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},i.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},i.extenders.falseTimeout=function(t,i){return t.iTimeout=0,t.subscribe(function(n){n&&(e.clearTimeout(t.iTimeout),t.iTimeout=e.setTimeout(function(){t(!1),t.iTimeout=0},$.pInt(i)))}),t},i.observable.fn.validateNone=function(){return this.hasError=i.observable(!1),this},i.observable.fn.validateEmail=function(){return this.hasError=i.observable(!1),this.subscribe(function(e){e=$.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},i.observable.fn.validateSimpleEmail=function(){return this.hasError=i.observable(!1),this.subscribe(function(e){e=$.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},i.observable.fn.validateFunc=function(e){return this.hasFuncError=i.observable(!1),$.isFunc(e)&&(this.subscribe(function(t){this.hasFuncError(!e(t))},this),this.valueHasMutated()),this},a.prototype.root=function(){return this.sBase},a.prototype.attachmentDownload=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},a.prototype.attachmentPreview=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+e},a.prototype.attachmentPreviewAsPlain=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},a.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},a.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},a.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},a.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},a.prototype.change=function(t){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+e.encodeURIComponent(t)+"/"},a.prototype.ajax=function(e){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+e},a.prototype.messageViewLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},a.prototype.messageDownloadLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},a.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},a.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},a.prototype.settings=function(e){var t=this.sBase+"settings";return $.isUnd(e)||""===e||(t+="/"+e),t},a.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},a.prototype.mailBox=function(e,t,i){t=$.isNormal(t)?$.pInt(t):1,i=$.pString(i);var n=this.sBase+"mailbox/";return""!==e&&(n+=encodeURI(e)),t>1&&(n=n.replace(/[\/]+$/,""),n+="/p"+t),""!==i&&(n=n.replace(/[\/]+$/,""),n+="/"+encodeURI(i)),n},a.prototype.phpInfo=function(){return this.sServer+"Info"},a.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},a.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},a.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},a.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},a.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},a.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=$.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},a.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},a.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/openpgp.min.js"},a.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},a.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},a.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},J.oViewModelsHooks={},J.oSimpleHooks={},J.regViewModelHook=function(e,t){t&&(t.__hookName=e)},J.addHook=function(e,t){$.isFunc(t)&&($.isArray(J.oSimpleHooks[e])||(J.oSimpleHooks[e]=[]),J.oSimpleHooks[e].push(t))},J.runHook=function(e,t){$.isArray(J.oSimpleHooks[e])&&(t=t||[],s.each(J.oSimpleHooks[e],function(e){e.apply(null,t)}))},J.mainSettingsGet=function(e){return lt?lt.settingsGet(e):null},J.remoteRequest=function(e,t,i,n,o,s){lt&&lt.remote().defaultRequest(e,t,i,n,o,s)},J.settingsGet=function(e,t){var i=J.mainSettingsGet("Plugins");return i=i&&$.isUnd(i[e])?null:i[e],i?$.isUnd(i[t])?null:i[t]:null},r.supported=function(){return!0},r.prototype.set=function(e,i){var n=t.cookie(z.Values.ClientSideCookieIndexName),o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[e]=i,t.cookie(z.Values.ClientSideCookieIndexName,JSON.stringify(s),{expires:30}),o=!0}catch(a){}return o},r.prototype.get=function(e){var i=t.cookie(z.Values.ClientSideCookieIndexName),n=null;try{n=null===i?null:JSON.parse(i),n=n&&!$.isUnd(n[e])?n[e]:null}catch(o){}return n},l.supported=function(){return!!e.localStorage},l.prototype.set=function(t,i){var n=e.localStorage[z.Values.ClientSideCookieIndexName]||null,o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[t]=i,e.localStorage[z.Values.ClientSideCookieIndexName]=JSON.stringify(s),o=!0}catch(a){}return o},l.prototype.get=function(t){var i=e.localStorage[z.Values.ClientSideCookieIndexName]||null,n=null;try{n=null===i?null:JSON.parse(i),n=n&&!$.isUnd(n[t])?n[t]:null}catch(o){}return n},c.prototype.oDriver=null,c.prototype.set=function(e,t){return this.oDriver?this.oDriver.set("p"+e,t):!1},c.prototype.get=function(e){return this.oDriver?this.oDriver.get("p"+e):null},u.prototype.bootstart=function(){},d.prototype.sPosition="",d.prototype.sTemplate="",d.prototype.viewModelName="",d.prototype.viewModelDom=null,d.prototype.viewModelTemplate=function(){return this.sTemplate},d.prototype.viewModelPosition=function(){return this.sPosition},d.prototype.cancelCommand=d.prototype.closeCommand=function(){},d.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=lt.data().keyScope(),lt.data().keyScope(this.sDefaultKeyScope)},d.prototype.restoreKeyScope=function(){lt.data().keyScope(this.sCurrentKeyScope)},d.prototype.registerPopupKeyDown=function(){var e=this;st.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&W.EventKeyCode.Esc===t.keyCode)return $.delegateRun(e,"cancelCommand"),!1;if(W.EventKeyCode.Backspace===t.keyCode&&!$.inFocus())return!1}return!0})},p.prototype.oCross=null,p.prototype.sScreenName="",p.prototype.aViewModels=[],p.prototype.viewModels=function(){return this.aViewModels},p.prototype.screenName=function(){return this.sScreenName},p.prototype.routes=function(){return null},p.prototype.__cross=function(){return this.oCross},p.prototype.__start=function(){var e=this.routes(),t=null,i=null;$.isNonEmptyArray(e)&&(i=s.bind(this.onRoute||$.emptyFunction,this),t=n.create(),s.each(e,function(e){t.addRoute(e[0],i).rules=e[1]}),this.oCross=t)},g.constructorEnd=function(e){$.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},g.prototype.sDefaultScreenName="",g.prototype.oScreens={},g.prototype.oBoot=null,g.prototype.oCurrentScreen=null,g.prototype.hideLoading=function(){t("#rl-loading").hide()},g.prototype.routeOff=function(){o.changed.active=!1},g.prototype.routeOn=function(){o.changed.active=!0},g.prototype.setBoot=function(e){return $.isNormal(e)&&(this.oBoot=e),this},g.prototype.screen=function(e){return""===e||$.isUnd(this.oScreens[e])?null:this.oScreens[e]},g.prototype.buildViewModel=function(e,n){if(e&&!e.__builded){var o=new e(n),a=o.viewModelPosition(),r=t("#rl-content #rl-"+a.toLowerCase()),l=null;e.__builded=!0,e.__vm=o,o.data=lt.data(),o.viewModelName=e.__name,r&&1===r.length?(l=t("<div></div>").addClass("rl-view-model").addClass("RL-"+o.viewModelTemplate()).hide(),l.appendTo(r),o.viewModelDom=l,e.__dom=l,"Popups"===a&&(o.cancelCommand=o.closeCommand=$.createCommand(o,function(){tt.hideScreenPopup(e)}),o.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),lt.popupVisibilityNames.push(this.viewModelName),o.viewModelDom.css("z-index",3e3+lt.popupVisibilityNames().length+10),$.delegateRun(this,"onFocus",[],500)):($.delegateRun(this,"onHide"),this.restoreKeyScope(),lt.popupVisibilityNames.remove(this.viewModelName),o.viewModelDom.css("z-index",2e3),X.tooltipTrigger(!X.tooltipTrigger()),s.delay(function(){t.viewModelDom.hide()},300))},o)),J.runHook("view-model-pre-build",[e.__name,o,l]),i.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:o.viewModelTemplate()}}},o),$.delegateRun(o,"onBuild",[l]),o&&"Popups"===a&&o.registerPopupKeyDown(),J.runHook("view-model-post-build",[e.__name,o,l])):$.log("Cannot find view model position: "+a)}return e?e.__vm:null},g.prototype.applyExternal=function(e,t){e&&t&&i.applyBindings(e,t)},g.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),J.runHook("view-model-on-hide",[e.__name,e.__vm]))},g.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),$.delegateRun(e.__vm,"onShow",t||[]),J.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},g.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},g.prototype.screenOnRoute=function(e,t){var i=this,n=null,o=null;""===$.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(n=this.screen(e),n||(n=this.screen(this.sDefaultScreenName),n&&(t=e+"/"+t,e=this.sDefaultScreenName)),n&&n.__started&&(n.__builded||(n.__builded=!0,$.isNonEmptyArray(n.viewModels())&&s.each(n.viewModels(),function(e){this.buildViewModel(e,n)},this),$.delegateRun(n,"onBuild")),s.defer(function(){i.oCurrentScreen&&($.delegateRun(i.oCurrentScreen,"onHide"),$.isNonEmptyArray(i.oCurrentScreen.viewModels())&&s.each(i.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),$.delegateRun(e.__vm,"onHide"))})),i.oCurrentScreen=n,i.oCurrentScreen&&($.delegateRun(i.oCurrentScreen,"onShow"),J.runHook("screen-on-show",[i.oCurrentScreen.screenName(),i.oCurrentScreen]),$.isNonEmptyArray(i.oCurrentScreen.viewModels())&&s.each(i.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),$.delegateRun(e.__vm,"onShow"),$.delegateRun(e.__vm,"onFocus",[],200),J.runHook("view-model-on-show",[e.__name,e.__vm]))},i)),o=n.__cross(),o&&o.parse(t)})))},g.prototype.startScreens=function(e){t("#rl-content").css({visibility:"hidden"}),s.each(e,function(e){var t=new e,i=t?t.screenName():"";t&&""!==i&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=i),this.oScreens[i]=t)},this),s.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),J.runHook("screen-pre-start",[e.screenName(),e]),$.delegateRun(e,"onStart"),J.runHook("screen-post-start",[e.screenName(),e]))},this);var i=n.create();i.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,s.bind(this.screenOnRoute,this)),o.initialized.add(i.parse,i),o.changed.add(i.parse,i),o.init(),t("#rl-content").css({visibility:"visible"}),s.delay(function(){ot.removeClass("rl-started-trigger").addClass("rl-started")},50)},g.prototype.setHash=function(e,t,i){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,i=$.isUnd(i)?!1:!!i,($.isUnd(t)?1:!t)?(o.changed.active=!0,o[i?"replaceHash":"setHash"](e),o.setHash(e)):(o.changed.active=!1,o[i?"replaceHash":"setHash"](e),o.changed.active=!0)},g.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},tt=new g,h.newInstanceFromJson=function(e){var t=new h;return t.initByJson(e)?t:null},h.prototype.name="",h.prototype.email="",h.prototype.privateType=null,h.prototype.clear=function(){this.email="",this.name="",this.privateType=null},h.prototype.validate=function(){return""!==this.name||""!==this.email},h.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},h.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},h.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=W.EmailType.Facebook),null===this.privateType&&(this.privateType=W.EmailType.Default)),this.privateType},h.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},h.prototype.parse=function(e){this.clear(),e=$.trim(e);var t=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g,i=t.exec(e);i?(this.name=i[1]||"",this.email=i[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},h.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=$.trim(e.Name),this.email=$.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},h.prototype.toLine=function(e,t,i){var n="";return""!==this.email&&(t=$.isUnd(t)?!1:!!t,i=$.isUnd(i)?!1:!!i,e&&""!==this.name?n=t?'<a href="mailto:'+$.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+$.encodeHtml(this.name)+"</a>":i?$.encodeHtml(this.name):this.name:(n=this.email,""!==this.name?t?n=$.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+$.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+$.encodeHtml(n)+"</a>"+$.encodeHtml(">"):(n='"'+this.name+'" <'+n+">",i&&(n=$.encodeHtml(n))):t&&(n='<a href="mailto:'+$.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+$.encodeHtml(this.email)+"</a>"))),n},h.prototype.mailsoParse=function(e){if(e=$.trim(e),""===e)return!1;for(var t=function(e,t,i){e+="";var n=e.length;return 0>t&&(t+=n),n="undefined"==typeof i?n:0>i?i+n:i+t,t>=e.length||0>t||t>n?!1:e.slice(t,n)},i=function(e,t,i,n){return 0>i&&(i+=e.length),n=void 0!==n?n:e.length,0>n&&(n=n+e.length-i),e.slice(0,i)+t.substr(0,n)+t.slice(n)+e.slice(i+n)},n="",o="",s="",a=!1,r=!1,l=!1,c=null,u=0,d=0,p=0;p<e.length;){switch(e.substr(p,1)){case'"':a||r||l?r||l||(d=p,n=t(e,u+1,d-u-1),e=i(e,"",u,d-u+1),d=0,p=0,u=0,a=!1):(a=!0,u=p);break;case"<":a||r||l||(p>0&&0===n.length&&(n=t(e,0,p)),r=!0,u=p);break;case">":r&&(d=p,o=t(e,u+1,d-u-1),e=i(e,"",u,d-u+1),d=0,p=0,u=0,r=!1);break;case"(":a||r||l||(l=!0,u=p);break;case")":l&&(d=p,s=t(e,u+1,d-u-1),e=i(e,"",u,d-u+1),d=0,p=0,u=0,l=!1);break;case"\\":p++}p++}return 0===o.length&&(c=e.match(/[^@\s]+@\S+/i),c&&c[0]?o=c[0]:n=e),o.length>0&&0===n.length&&0===s.length&&(n=e.replace(o,"")),o=$.trim(o).replace(/^[<]+/,"").replace(/[>]+$/,""),n=$.trim(n).replace(/^["']+/,"").replace(/["']+$/,""),s=$.trim(s).replace(/^[(]+/,"").replace(/[)]+$/,""),n=n.replace(/\\\\(.)/,"$1"),s=s.replace(/\\\\(.)/,"$1"),this.name=n,this.email=o,this.clearDuplicateName(),!0},h.prototype.inputoTagLine=function(){return 0<this.name.length?this.name+" ("+this.email+")":this.email},m.prototype.parse=function(e){var t=!1;return e&&"Object/Tag"===e["@Object"]&&(this.idContact=$.pInt(e.IdContactTag),this.name($.pString(e.Name)),this.readOnly=!!e.ReadOnly,t=!0),t},m.prototype.filterHelper=function(e){return-1!==this.name().toLowerCase().indexOf(e.toLowerCase())},m.prototype.toLine=function(e){return($.isUnd(e)?1:!e)?this.name():$.encodeHtml(this.name())},$.extendAsViewModel("PopupsDomainViewModel",f),f.prototype.onTestConnectionResponse=function(e,t){this.testing(!1),W.StorageResultType.Success===e&&t.Result?(this.testingDone(!0),this.testingImapError(!0!==t.Result.Imap),this.testingSmtpError(!0!==t.Result.Smtp),this.testingImapError()&&t.Result.Imap&&this.testingImapErrorDesc(t.Result.Imap),this.testingSmtpError()&&t.Result.Smtp&&this.testingSmtpErrorDesc(t.Result.Smtp)):(this.testingImapError(!0),this.testingSmtpError(!0))},f.prototype.onDomainCreateOrSaveResponse=function(e,t){this.saving(!1),W.StorageResultType.Success===e&&t?t.Result?(lt.reloadDomainList(),this.closeCommand()):W.Notification.DomainAlreadyExists===t.ErrorCode&&this.savingError("Domain already exists"):this.savingError("Unknown error")},f.prototype.onHide=function(){this.whiteListPage(!1)},f.prototype.onShow=function(e){this.saving(!1),this.whiteListPage(!1),this.testing(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.clearForm(),e&&(this.edit(!0),this.name($.trim(e.Name)),this.imapServer($.trim(e.IncHost)),this.imapPort(""+$.pInt(e.IncPort)),this.imapSecure($.trim(e.IncSecure)),this.imapShortLogin(!!e.IncShortLogin),this.smtpServer($.trim(e.OutHost)),this.smtpPort(""+$.pInt(e.OutPort)),this.smtpSecure($.trim(e.OutSecure)),this.smtpShortLogin(!!e.OutShortLogin),this.smtpAuth(!!e.OutAuth),this.whiteList($.trim(e.WhiteList)))},f.prototype.onFocus=function(){""===this.name()&&this.name.focused(!0)},f.prototype.clearForm=function(){this.edit(!1),this.whiteListPage(!1),this.savingError(""),this.name(""),this.name.focused(!1),this.imapServer(""),this.imapPort(""+z.Values.ImapDefaulPort),this.imapSecure(W.ServerSecure.None),this.imapShortLogin(!1),this.smtpServer(""),this.smtpPort(""+z.Values.SmtpDefaulPort),this.smtpSecure(W.ServerSecure.None),this.smtpShortLogin(!1),this.smtpAuth(!0),this.whiteList("")},$.extendAsViewModel("PopupsPluginViewModel",b),b.prototype.onPluginSettingsUpdateResponse=function(e,t){W.StorageResultType.Success===e&&t&&t.Result?this.cancelCommand():(this.saveError(""),this.saveError(t&&t.ErrorCode?$.getNotification(t.ErrorCode):$.getNotification(W.Notification.CantSavePluginSettings)))},b.prototype.onShow=function(e){if(this.name(),this.readme(),this.configures([]),e){this.name(e.Name),this.readme(e.Readme);var t=e.Config;$.isNonEmptyArray(t)&&this.configures(s.map(t,function(e){return{value:i.observable(e[0]),Name:e[1],Type:e[2],Label:e[3],Default:e[4],Desc:e[5]}}))}},b.prototype.tryToClosePopup=function(){var e=this;tt.isPopupVisible(y)||tt.showScreenPopup(y,[$.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){e.modalVisibility()&&$.delegateRun(e,"cancelCommand")}])},b.prototype.onBuild=function(){key("esc",W.KeyState.All,s.bind(function(){return this.modalVisibility()&&this.tryToClosePopup(),!1},this))},$.extendAsViewModel("PopupsActivateViewModel",S),S.prototype.onShow=function(){this.domain(lt.settingsGet("AdminDomain")),this.activateProcess()||(this.key(""),this.activateText(""),this.activateText.isError(!1),this.activationSuccessed(!1))},S.prototype.onFocus=function(){this.activateProcess()||this.key.focus(!0)},S.prototype.validateSubscriptionKey=function(){var e=this.key();return""===e||!!/^RL[\d]+-[A-Z0-9\-]+Z$/.test($.trim(e))},$.extendAsViewModel("PopupsLanguagesViewModel",v),v.prototype.languageEnName=function(e){return $.convertLangName(e,!0)},v.prototype.resetMainLanguage=function(){var e=lt.data().mainLanguage();s.each(this.languages(),function(t){t.selected(t.key===e)})},v.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},v.prototype.onHide=function(){this.exp(!1)},v.prototype.changeLanguage=function(e){lt.data().mainLanguage(e),this.cancelCommand()},$.extendAsViewModel("PopupsAskViewModel",y),y.prototype.clearPopup=function(){this.askDesc(""),this.yesButton($.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton($.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},y.prototype.yesClick=function(){this.cancelCommand(),$.isFunc(this.fYesAction)&&this.fYesAction.call(null)},y.prototype.noClick=function(){this.cancelCommand(),$.isFunc(this.fNoAction)&&this.fNoAction.call(null)},y.prototype.onShow=function(e,t,i,n,o){this.clearPopup(),this.fYesAction=t||null,this.fNoAction=i||null,this.askDesc(e||""),n&&this.yesButton(n),n&&this.yesButton(o)},y.prototype.onFocus=function(){this.yesFocus(!0)},y.prototype.onBuild=function(){key("tab, shift+tab, right, left",W.KeyState.PopupAsk,s.bind(function(){return this.yesFocus()?this.noFocus(!0):this.yesFocus(!0),!1},this)),key("esc",W.KeyState.PopupAsk,s.bind(function(){return this.noClick(),!1},this))},$.extendAsViewModel("AdminLoginViewModel",A),A.prototype.onShow=function(){tt.routeOff(),s.delay(s.bind(function(){this.loginFocus(!0)},this),100)},A.prototype.onHide=function(){this.loginFocus(!1)},A.prototype.onBuild=function(){$.triggerAutocompleteInputChange(!0)},A.prototype.submitForm=function(){this.submitCommand()},$.extendAsViewModel("AdminMenuViewModel",C),C.prototype.link=function(e){return"#/"+e},$.extendAsViewModel("AdminPaneViewModel",w),w.prototype.logoutClick=function(){lt.remote().adminLogout(function(){lt.loginAndLogoutReload()})},$.addSettingsViewModel(T,"AdminSettingsGeneral","General","general",!0),T.prototype.onBuild=function(){var e=this;s.delay(function(){var t=$.settingsSaveHelperSimpleFunction(e.attachmentLimitTrigger,e),i=$.settingsSaveHelperSimpleFunction(e.languageTrigger,e),n=$.settingsSaveHelperSimpleFunction(e.themeTrigger,e);e.mainAttachmentLimit.subscribe(function(e){lt.remote().saveAdminConfig(t,{AttachmentLimit:$.pInt(e)})}),e.language.subscribe(function(e){lt.remote().saveAdminConfig(i,{Language:$.trim(e)})}),e.theme.subscribe(function(e){lt.remote().saveAdminConfig(n,{Theme:$.trim(e)})}),e.capaAdditionalAccounts.subscribe(function(e){lt.remote().saveAdminConfig(null,{CapaAdditionalAccounts:e?"1":"0"})}),e.capaAdditionalIdentities.subscribe(function(e){lt.remote().saveAdminConfig(null,{CapaAdditionalIdentities:e?"1":"0"})}),e.capaGravatar.subscribe(function(e){lt.remote().saveAdminConfig(null,{CapaGravatar:e?"1":"0"})}),e.capaThemes.subscribe(function(e){lt.remote().saveAdminConfig(null,{CapaThemes:e?"1":"0"})}),e.allowLanguagesOnSettings.subscribe(function(e){lt.remote().saveAdminConfig(null,{AllowLanguagesOnSettings:e?"1":"0"})})},50)},T.prototype.selectLanguage=function(){tt.showScreenPopup(v)},T.prototype.phpInfoLink=function(){return lt.link().phpInfo()},$.addSettingsViewModel(N,"AdminSettingsLogin","Login","login"),N.prototype.onBuild=function(){var e=this;s.delay(function(){var t=$.settingsSaveHelperSimpleFunction(e.defaultDomainTrigger,e);e.determineUserLanguage.subscribe(function(e){lt.remote().saveAdminConfig(null,{DetermineUserLanguage:e?"1":"0"})}),e.determineUserDomain.subscribe(function(e){lt.remote().saveAdminConfig(null,{DetermineUserDomain:e?"1":"0"})}),e.allowLanguagesOnLogin.subscribe(function(e){lt.remote().saveAdminConfig(null,{AllowLanguagesOnLogin:e?"1":"0"})}),e.defaultDomain.subscribe(function(e){lt.remote().saveAdminConfig(t,{LoginDefaultDomain:$.trim(e)})})},50)},$.addSettingsViewModel(E,"AdminSettingsBranding","Branding","branding"),E.prototype.onBuild=function(){var e=this;s.delay(function(){var t=$.settingsSaveHelperSimpleFunction(e.title.trigger,e),i=$.settingsSaveHelperSimpleFunction(e.loadingDesc.trigger,e),n=$.settingsSaveHelperSimpleFunction(e.loginLogo.trigger,e),o=$.settingsSaveHelperSimpleFunction(e.loginDescription.trigger,e),s=$.settingsSaveHelperSimpleFunction(e.loginCss.trigger,e);e.title.subscribe(function(e){lt.remote().saveAdminConfig(t,{Title:$.trim(e)})}),e.loadingDesc.subscribe(function(e){lt.remote().saveAdminConfig(i,{LoadingDescription:$.trim(e)})}),e.loginLogo.subscribe(function(e){lt.remote().saveAdminConfig(n,{LoginLogo:$.trim(e)})}),e.loginDescription.subscribe(function(e){lt.remote().saveAdminConfig(o,{LoginDescription:$.trim(e)})}),e.loginCss.subscribe(function(e){lt.remote().saveAdminConfig(s,{LoginCss:$.trim(e)})})},50)},$.addSettingsViewModel(I,"AdminSettingsContacts","Contacts","contacts"),I.prototype.onTestContactsResponse=function(e,t){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage(""),W.StorageResultType.Success===e&&t&&t.Result&&t.Result.Result?this.testContactsSuccess(!0):(this.testContactsError(!0),this.testContactsErrorMessage(t&&t.Result?t.Result.Message||"":"")),this.testing(!1)},I.prototype.onShow=function(){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage("")},I.prototype.onBuild=function(){var e=this;s.delay(function(){var t=$.settingsSaveHelperSimpleFunction(e.pdoDsnTrigger,e),i=$.settingsSaveHelperSimpleFunction(e.pdoUserTrigger,e),n=$.settingsSaveHelperSimpleFunction(e.pdoPasswordTrigger,e),o=$.settingsSaveHelperSimpleFunction(e.contactsTypeTrigger,e);e.enableContacts.subscribe(function(e){lt.remote().saveAdminConfig(null,{ContactsEnable:e?"1":"0"})}),e.contactsSharing.subscribe(function(e){lt.remote().saveAdminConfig(null,{ContactsSharing:e?"1":"0"})}),e.contactsSync.subscribe(function(e){lt.remote().saveAdminConfig(null,{ContactsSync:e?"1":"0"})}),e.contactsType.subscribe(function(e){lt.remote().saveAdminConfig(o,{ContactsPdoType:e})}),e.pdoDsn.subscribe(function(e){lt.remote().saveAdminConfig(t,{ContactsPdoDsn:$.trim(e)})}),e.pdoUser.subscribe(function(e){lt.remote().saveAdminConfig(i,{ContactsPdoUser:$.trim(e)})}),e.pdoPassword.subscribe(function(e){lt.remote().saveAdminConfig(n,{ContactsPdoPassword:$.trim(e)})}),e.contactsType(lt.settingsGet("ContactsPdoType"))},50)},$.addSettingsViewModel(P,"AdminSettingsDomains","Domains","domains"),P.prototype.startDomainForDeletionTimeout=function(){var t=this;e.clearInterval(this.iDomainForDeletionTimeout),this.iDomainForDeletionTimeout=e.setTimeout(function(){t.domainForDeletion(null)},3e3)},P.prototype.createDomain=function(){tt.showScreenPopup(f)},P.prototype.deleteDomain=function(e){this.domains.remove(e),lt.remote().domainDelete(s.bind(this.onDomainListChangeRequest,this),e.name)},P.prototype.disableDomain=function(e){e.disabled(!e.disabled()),lt.remote().domainDisable(s.bind(this.onDomainListChangeRequest,this),e.name,e.disabled())},P.prototype.onBuild=function(e){var t=this;e.on("click",".b-admin-domains-list-table .e-item .e-action",function(){var e=i.dataFor(this);e&&lt.remote().domain(s.bind(t.onDomainLoadRequest,t),e.name)}),lt.reloadDomainList()},P.prototype.onDomainLoadRequest=function(e,t){W.StorageResultType.Success===e&&t&&t.Result&&tt.showScreenPopup(f,[t.Result])},P.prototype.onDomainListChangeRequest=function(){lt.reloadDomainList()},$.addSettingsViewModel(_,"AdminSettingsSecurity","Security","security"),_.prototype.onNewAdminPasswordResponse=function(e,t){W.StorageResultType.Success===e&&t&&t.Result?(this.adminPassword(""),this.adminPasswordNew(""),this.adminPasswordNew2(""),this.adminPasswordUpdateSuccess(!0)):this.adminPasswordUpdateError(!0)},_.prototype.onBuild=function(){this.capaOpenPGP.subscribe(function(e){lt.remote().saveAdminConfig($.emptyFunction,{CapaOpenPGP:e?"1":"0"})}),this.capaTwoFactorAuth.subscribe(function(e){lt.remote().saveAdminConfig($.emptyFunction,{CapaTwoFactorAuth:e?"1":"0"})}),this.useLocalProxyForExternalImages.subscribe(function(e){lt.remote().saveAdminConfig(null,{UseLocalProxyForExternalImages:e?"1":"0"})})},_.prototype.onHide=function(){this.adminPassword(""),this.adminPasswordNew(""),this.adminPasswordNew2("")},_.prototype.phpInfoLink=function(){return lt.link().phpInfo()},$.addSettingsViewModel(D,"AdminSettingsSocial","Social","social"),D.prototype.onBuild=function(){var e=this;
s.delay(function(){var t=$.settingsSaveHelperSimpleFunction(e.facebookTrigger1,e),i=$.settingsSaveHelperSimpleFunction(e.facebookTrigger2,e),n=$.settingsSaveHelperSimpleFunction(e.twitterTrigger1,e),o=$.settingsSaveHelperSimpleFunction(e.twitterTrigger2,e),s=$.settingsSaveHelperSimpleFunction(e.googleTrigger1,e),a=$.settingsSaveHelperSimpleFunction(e.googleTrigger2,e),r=$.settingsSaveHelperSimpleFunction(e.googleTrigger3,e),l=$.settingsSaveHelperSimpleFunction(e.dropboxTrigger1,e);e.facebookEnable.subscribe(function(t){e.facebookSupported()&&lt.remote().saveAdminConfig($.emptyFunction,{FacebookEnable:t?"1":"0"})}),e.facebookAppID.subscribe(function(i){e.facebookSupported()&&lt.remote().saveAdminConfig(t,{FacebookAppID:$.trim(i)})}),e.facebookAppSecret.subscribe(function(t){e.facebookSupported()&&lt.remote().saveAdminConfig(i,{FacebookAppSecret:$.trim(t)})}),e.twitterEnable.subscribe(function(e){lt.remote().saveAdminConfig($.emptyFunction,{TwitterEnable:e?"1":"0"})}),e.twitterConsumerKey.subscribe(function(e){lt.remote().saveAdminConfig(n,{TwitterConsumerKey:$.trim(e)})}),e.twitterConsumerSecret.subscribe(function(e){lt.remote().saveAdminConfig(o,{TwitterConsumerSecret:$.trim(e)})}),e.googleEnable.subscribe(function(e){lt.remote().saveAdminConfig($.emptyFunction,{GoogleEnable:e?"1":"0"})}),e.googleClientID.subscribe(function(e){lt.remote().saveAdminConfig(s,{GoogleClientID:$.trim(e)})}),e.googleClientSecret.subscribe(function(e){lt.remote().saveAdminConfig(a,{GoogleClientSecret:$.trim(e)})}),e.googleApiKey.subscribe(function(e){lt.remote().saveAdminConfig(r,{GoogleApiKey:$.trim(e)})}),e.dropboxEnable.subscribe(function(e){lt.remote().saveAdminConfig($.emptyFunction,{DropboxEnable:e?"1":"0"})}),e.dropboxApiKey.subscribe(function(e){lt.remote().saveAdminConfig(l,{DropboxApiKey:$.trim(e)})})},50)},$.addSettingsViewModel(R,"AdminSettingsPlugins","Plugins","plugins"),R.prototype.disablePlugin=function(e){e.disabled(!e.disabled()),lt.remote().pluginDisable(this.onPluginDisableRequest,e.name,e.disabled())},R.prototype.configurePlugin=function(e){lt.remote().plugin(this.onPluginLoadRequest,e.name)},R.prototype.onBuild=function(e){var t=this;e.on("click",".e-item .configure-plugin-action",function(){var e=i.dataFor(this);e&&t.configurePlugin(e)}).on("click",".e-item .disabled-plugin",function(){var e=i.dataFor(this);e&&t.disablePlugin(e)}),this.enabledPlugins.subscribe(function(e){lt.remote().saveAdminConfig($.emptyFunction,{EnabledPlugins:e?"1":"0"})})},R.prototype.onShow=function(){this.pluginsError(""),lt.reloadPluginList()},R.prototype.onPluginLoadRequest=function(e,t){W.StorageResultType.Success===e&&t&&t.Result&&tt.showScreenPopup(b,[t.Result])},R.prototype.onPluginDisableRequest=function(e,t){W.StorageResultType.Success===e&&t&&!t.Result&&t.ErrorCode&&this.pluginsError(W.Notification.UnsupportedPluginPackage===t.ErrorCode&&t.ErrorMessage&&""!==t.ErrorMessage?t.ErrorMessage:$.getNotification(t.ErrorCode)),lt.reloadPluginList()},$.addSettingsViewModel(k,"AdminSettingsPackages","Packages","packages"),k.prototype.onShow=function(){this.packagesError("")},k.prototype.onBuild=function(){lt.reloadPackagesList()},k.prototype.requestHelper=function(t,i){var n=this;return function(o,a){W.StorageResultType.Success===o&&a&&a.Result||n.packagesError(a&&a.ErrorCode?$.getNotification(a.ErrorCode):$.getNotification(i?W.Notification.CantInstallPackage:W.Notification.CantDeletePackage)),s.each(lt.data().packages(),function(e){e&&t&&e.loading()&&t.file===e.file&&(t.loading(!1),e.loading(!1))}),W.StorageResultType.Success===o&&a&&a.Result&&a.Result.Reload?e.location.reload():lt.reloadPackagesList()}},k.prototype.deletePackage=function(e){e&&(e.loading(!0),lt.remote().packageDelete(this.requestHelper(e,!1),e))},k.prototype.installPackage=function(e){e&&(e.loading(!0),lt.remote().packageInstall(this.requestHelper(e,!0),e))},$.addSettingsViewModel(L,"AdminSettingsLicensing","Licensing","licensing"),L.prototype.onBuild=function(){this.subscriptionEnabled()&&lt.reloadLicensing(!1)},L.prototype.onShow=function(){this.adminDomain(lt.settingsGet("AdminDomain"))},L.prototype.showActivationForm=function(){tt.showScreenPopup(S)},L.prototype.licenseExpiredMomentValue=function(){var e=this.licenseExpired(),t=moment.unix(e);return e&&1898625600===e?"Never":t.format("LL")+" ("+t.from(moment())+")"},$.addSettingsViewModel(O,"AdminSettingsAbout","About","about"),O.prototype.onBuild=function(){this.access()&&lt.reloadCoreData()},O.prototype.updateCoreData=function(){this.coreUpdating()||lt.updateCoreData()},x.prototype.populateDataOnStart=function(){var e=$.pInt(lt.settingsGet("Layout")),t=lt.settingsGet("Languages"),i=lt.settingsGet("Themes");$.isArray(t)&&this.languages(t),$.isArray(i)&&this.themes(i),this.mainLanguage(lt.settingsGet("Language")),this.mainTheme(lt.settingsGet("Theme")),this.capaAdditionalAccounts(lt.capa(W.Capa.AdditionalAccounts)),this.capaAdditionalIdentities(lt.capa(W.Capa.AdditionalIdentities)),this.capaGravatar(lt.capa(W.Capa.Gravatar)),this.determineUserLanguage(!!lt.settingsGet("DetermineUserLanguage")),this.determineUserDomain(!!lt.settingsGet("DetermineUserDomain")),this.capaThemes(lt.capa(W.Capa.Themes)),this.allowLanguagesOnLogin(!!lt.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!lt.settingsGet("AllowLanguagesOnSettings")),this.useLocalProxyForExternalImages(!!lt.settingsGet("UseLocalProxyForExternalImages")),this.editorDefaultType(lt.settingsGet("EditorDefaultType")),this.showImages(!!lt.settingsGet("ShowImages")),this.contactsAutosave(!!lt.settingsGet("ContactsAutosave")),this.interfaceAnimation(lt.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(lt.settingsGet("MPP")),this.desktopNotifications(!!lt.settingsGet("DesktopNotifications")),this.useThreads(!!lt.settingsGet("UseThreads")),this.replySameFolder(!!lt.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!lt.settingsGet("UseCheckboxesInList")),this.layout(W.Layout.SidePreview),-1<$.inArray(e,[W.Layout.NoPreview,W.Layout.SidePreview,W.Layout.BottomPreview])&&this.layout(e),this.facebookSupported(!!lt.settingsGet("SupportedFacebookSocial")),this.facebookEnable(!!lt.settingsGet("AllowFacebookSocial")),this.facebookAppID(lt.settingsGet("FacebookAppID")),this.facebookAppSecret(lt.settingsGet("FacebookAppSecret")),this.twitterEnable(!!lt.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(lt.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(lt.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!lt.settingsGet("AllowGoogleSocial")),this.googleClientID(lt.settingsGet("GoogleClientID")),this.googleClientSecret(lt.settingsGet("GoogleClientSecret")),this.googleApiKey(lt.settingsGet("GoogleApiKey")),this.dropboxEnable(!!lt.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(lt.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!lt.settingsGet("ContactsIsAllowed"))},s.extend(F.prototype,x.prototype),F.prototype.populateDataOnStart=function(){x.prototype.populateDataOnStart.call(this)},U.prototype.oRequests={},U.prototype.defaultResponse=function(t,i,n,o,a,r){var l=function(){W.StorageResultType.Success!==n&&X.bUnload&&(n=W.StorageResultType.Unload),W.StorageResultType.Success===n&&o&&!o.Result?(o&&-1<$.inArray(o.ErrorCode,[W.Notification.AuthError,W.Notification.AccessError,W.Notification.ConnectionError,W.Notification.DomainNotAllowed,W.Notification.AccountNotAllowed,W.Notification.MailServerError,W.Notification.UnknownNotification,W.Notification.UnknownError])&&X.iAjaxErrorCount++,o&&W.Notification.InvalidToken===o.ErrorCode&&X.iTokenErrorCount++,z.Values.TokenErrorLimit<X.iTokenErrorCount&&lt.loginAndLogoutReload(!0),(o.Logout||z.Values.AjaxErrorLimit<X.iAjaxErrorCount)&&(e.__rlah_clear&&e.__rlah_clear(),lt.loginAndLogoutReload(!0))):W.StorageResultType.Success===n&&o&&o.Result&&(X.iAjaxErrorCount=0,X.iTokenErrorCount=0),t&&(J.runHook("ajax-default-response",[i,W.StorageResultType.Success===n?o:null,n,a,r]),t(n,W.StorageResultType.Success===n?o:null,a,i,r))};switch(n){case"success":n=W.StorageResultType.Success;break;case"abort":n=W.StorageResultType.Abort;break;default:n=W.StorageResultType.Error}W.StorageResultType.Error===n?s.delay(l,300):l()},U.prototype.ajaxRequest=function(i,n,o,a,r){var l=this,c=""===a,u={},d=(new e.Date).getTime(),p=null,g="";return n=n||{},o=$.isNormal(o)?o:2e4,a=$.isUnd(a)?"":$.pString(a),r=$.isArray(r)?r:[],g=n.Action||"",g&&0<r.length&&s.each(r,function(e){l.oRequests[e]&&(l.oRequests[e].__aborted=!0,l.oRequests[e].abort&&l.oRequests[e].abort(),l.oRequests[e]=null)}),c&&(n.XToken=lt.settingsGet("Token")),p=t.ajax({type:c?"POST":"GET",url:lt.link().ajax(a),async:!0,dataType:"json",data:c?n:{},headers:u,timeout:o,global:!0}),p.always(function(t,o){var s=!1;t&&t.Time&&(s=$.pInt(t.Time)>(new e.Date).getTime()-d),g&&l.oRequests[g]&&(l.oRequests[g].__aborted&&(o="abort"),l.oRequests[g]=null),l.defaultResponse(i,g,o,t,s,n)}),g&&0<r.length&&-1<$.inArray(g,r)&&(this.oRequests[g]&&(this.oRequests[g].__aborted=!0,this.oRequests[g].abort&&this.oRequests[g].abort(),this.oRequests[g]=null),this.oRequests[g]=p),p},U.prototype.defaultRequest=function(e,t,i,n,o,s){i=i||{},i.Action=t,o=$.pString(o),J.runHook("ajax-default-request",[t,i,o]),this.ajaxRequest(e,i,$.isUnd(n)?z.Defaults.DefaultAjaxTimeout:$.pInt(n),o,s)},U.prototype.noop=function(e){this.defaultRequest(e,"Noop")},U.prototype.jsError=function(e,t,i,n,o,s,a){this.defaultRequest(e,"JsError",{Message:t,FileName:i,LineNo:n,Location:o,HtmlCapa:s,TimeOnPage:a})},U.prototype.jsInfo=function(e,t,i,n){this.defaultRequest(e,"JsInfo",{Type:t,Data:i,IsError:($.isUnd(n)?1:!n)?"0":"1"})},U.prototype.getPublicKey=function(e){this.defaultRequest(e,"GetPublicKey")},U.prototype.jsVersion=function(e,t){this.defaultRequest(e,"Version",{Version:t})},s.extend(M.prototype,U.prototype),M.prototype.adminLogin=function(e,t,i){this.defaultRequest(e,"AdminLogin",{Login:t,Password:i})},M.prototype.adminLogout=function(e){this.defaultRequest(e,"AdminLogout")},M.prototype.saveAdminConfig=function(e,t){this.defaultRequest(e,"AdminSettingsUpdate",t)},M.prototype.domainList=function(e){this.defaultRequest(e,"AdminDomainList")},M.prototype.pluginList=function(e){this.defaultRequest(e,"AdminPluginList")},M.prototype.packagesList=function(e){this.defaultRequest(e,"AdminPackagesList")},M.prototype.coreData=function(e){this.defaultRequest(e,"AdminCoreData")},M.prototype.updateCoreData=function(e){this.defaultRequest(e,"AdminUpdateCoreData",{},9e4)},M.prototype.packageInstall=function(e,t){this.defaultRequest(e,"AdminPackageInstall",{Id:t.id,Type:t.type,File:t.file},6e4)},M.prototype.packageDelete=function(e,t){this.defaultRequest(e,"AdminPackageDelete",{Id:t.id})},M.prototype.domain=function(e,t){this.defaultRequest(e,"AdminDomainLoad",{Name:t})},M.prototype.plugin=function(e,t){this.defaultRequest(e,"AdminPluginLoad",{Name:t})},M.prototype.domainDelete=function(e,t){this.defaultRequest(e,"AdminDomainDelete",{Name:t})},M.prototype.domainDisable=function(e,t,i){return this.defaultRequest(e,"AdminDomainDisable",{Name:t,Disabled:i?"1":"0"})},M.prototype.pluginSettingsUpdate=function(e,t){return this.defaultRequest(e,"AdminPluginSettingsUpdate",t)},M.prototype.licensing=function(e,t){return this.defaultRequest(e,"AdminLicensing",{Force:t?"1":"0"})},M.prototype.licensingActivate=function(e,t,i){return this.defaultRequest(e,"AdminLicensingActivate",{Domain:t,Key:i})},M.prototype.pluginDisable=function(e,t,i){return this.defaultRequest(e,"AdminPluginDisable",{Name:t,Disabled:i?"1":"0"})},M.prototype.createOrUpdateDomain=function(e,t,i,n,o,s,a,r,l,c,u,d,p){this.defaultRequest(e,"AdminDomainSave",{Create:t?"1":"0",Name:i,IncHost:n,IncPort:o,IncSecure:s,IncShortLogin:a?"1":"0",OutHost:r,OutPort:l,OutSecure:c,OutShortLogin:u?"1":"0",OutAuth:d?"1":"0",WhiteList:p})},M.prototype.testConnectionForDomain=function(e,t,i,n,o,s,a,r,l){this.defaultRequest(e,"AdminDomainTest",{Name:t,IncHost:i,IncPort:n,IncSecure:o,OutHost:s,OutPort:a,OutSecure:r,OutAuth:l?"1":"0"})},M.prototype.testContacts=function(e,t){this.defaultRequest(e,"AdminContactsTest",t)},M.prototype.saveNewAdminPassword=function(e,t){this.defaultRequest(e,"AdminPasswordUpdate",t)},M.prototype.adminPing=function(e){this.defaultRequest(e,"AdminPing")},V.prototype.oServices={},V.prototype.bCapaGravatar=!1,V.prototype.clear=function(){this.oServices={}},V.prototype.getUserPic=function(e,t){e=$.trim(e);var i="",n="",o=e.toLowerCase();n=o.substr(e.indexOf("@")+1),i=""!==n&&this.oServices[n]?this.oServices[n]:"",this.bCapaGravatar&&""===i&&""!==o?t("//secure.gravatar.com/avatar/"+$.md5(o)+".jpg?s=80&d=mm",e):t(i,e)},V.prototype.setServicesData=function(e){this.oServices=e},s.extend(H.prototype,V.prototype),s.extend(G.prototype,p.prototype),G.prototype.onRoute=function(e){var n=this,o=null,a=null,r=null,l=null;a=s.find(Z.settings,function(t){return t&&t.__rlSettingsData&&e===t.__rlSettingsData.Route}),a&&(s.find(Z["settings-removed"],function(e){return e&&e===a})&&(a=null),a&&s.find(Z["settings-disabled"],function(e){return e&&e===a})&&(a=null)),a?(a.__builded&&a.__vm?o=a.__vm:(r=this.oViewModelPlace,r&&1===r.length?(a=a,o=new a,l=t("<div></div>").addClass("rl-settings-view-model").hide(),l.appendTo(r),o.data=lt.data(),o.viewModelDom=l,o.__rlSettingsData=a.__rlSettingsData,a.__dom=l,a.__builded=!0,a.__vm=o,i.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:a.__rlSettingsData.Template}}},o),$.delegateRun(o,"onBuild",[l])):$.log("Cannot find sub settings view model position: SettingsSubScreen")),o&&s.defer(function(){n.oCurrentSubScreen&&($.delegateRun(n.oCurrentSubScreen,"onHide"),n.oCurrentSubScreen.viewModelDom.hide()),n.oCurrentSubScreen=o,n.oCurrentSubScreen&&(n.oCurrentSubScreen.viewModelDom.show(),$.delegateRun(n.oCurrentSubScreen,"onShow"),$.delegateRun(n.oCurrentSubScreen,"onFocus",[],200),s.each(n.menu(),function(e){e.selected(o&&o.__rlSettingsData&&e.route===o.__rlSettingsData.Route)}),t("#rl-content .b-settings .b-content .content").scrollTop(0)),$.windowResize()})):tt.setHash(lt.link().settings(),!1,!0)},G.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&($.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},G.prototype.onBuild=function(){s.each(Z.settings,function(e){e&&e.__rlSettingsData&&!s.find(Z["settings-removed"],function(t){return t&&t===e})&&this.menu.push({route:e.__rlSettingsData.Route,label:e.__rlSettingsData.Label,selected:i.observable(!1),disabled:!!s.find(Z["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=t("#rl-content #rl-settings-subscreen")},G.prototype.routes=function(){var e=s.find(Z.settings,function(e){return e&&e.__rlSettingsData&&e.__rlSettingsData.IsDefault}),t=e?e.__rlSettingsData.Route:"general",i={subname:/^(.*)$/,normalize_:function(e,i){return i.subname=$.isUnd(i.subname)?t:$.pString(i.subname),[i.subname]}};return[["{subname}/",i],["{subname}",i],["",i]]},s.extend(q.prototype,p.prototype),q.prototype.onShow=function(){lt.setTitle("")},s.extend(B.prototype,G.prototype),B.prototype.onShow=function(){lt.setTitle("")},s.extend(K.prototype,u.prototype),K.prototype.oSettings=null,K.prototype.oPlugins=null,K.prototype.oLocal=null,K.prototype.oLink=null,K.prototype.oSubs={},K.prototype.download=function(t){var i=null,n=null,o=navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(i=document.createElement("a"),i.href=t,document.createEvent&&(n=document.createEvent("MouseEvents"),n&&n.initEvent&&i.dispatchEvent))?(n.initEvent("click",!0,!0),i.dispatchEvent(n),!0):(X.bMobileDevice?(e.open(t,"_self"),e.focus()):this.iframe.attr("src",t),!0)},K.prototype.link=function(){return null===this.oLink&&(this.oLink=new a),this.oLink},K.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new c),this.oLocal},K.prototype.settingsGet=function(e){return null===this.oSettings&&(this.oSettings=$.isNormal(it)?it:{}),$.isUnd(this.oSettings[e])?null:this.oSettings[e]},K.prototype.settingsSet=function(e,t){null===this.oSettings&&(this.oSettings=$.isNormal(it)?it:{}),this.oSettings[e]=t},K.prototype.setTitle=function(t){t=($.isNormal(t)&&0<t.length?t+" - ":"")+lt.settingsGet("Title")||"",e.document.title="_",e.document.title=t},K.prototype.loginAndLogoutReload=function(t,i){var n=$.pString(lt.settingsGet("CustomLogoutLink")),o=!!lt.settingsGet("InIframe");t=$.isUnd(t)?!1:!!t,i=$.isUnd(i)?!1:!!i,t&&i&&e.close&&e.close(),t&&""!==n&&e.location.href!==n?s.delay(function(){o&&e.parent?e.parent.location.href=n:e.location.href=n},100):(tt.routeOff(),tt.setHash(lt.link().root(),!0),tt.routeOff(),s.delay(function(){o&&e.parent?e.parent.location.reload():e.location.reload()},100))},K.prototype.historyBack=function(){e.history.back()},K.prototype.getAutocomplete=function(e,t){t([],e)},K.prototype.sub=function(e,t,i){return $.isUnd(this.oSubs[e])&&(this.oSubs[e]=[]),this.oSubs[e].push([t,i]),this},K.prototype.pub=function(e,t){return J.runHook("rl-pub",[e,t]),$.isUnd(this.oSubs[e])||s.each(this.oSubs[e],function(e){e[0]&&e[0].apply(e[1]||null,t||[])}),this},K.prototype.capa=function(e){var t=this.settingsGet("Capa");return $.isArray(t)&&$.isNormal(e)&&-1<$.inArray(e,t)},K.prototype.bootstart=function(){var e=this;$.initOnStartOrLangChange(function(){$.initNotificationLanguage()},null),s.delay(function(){$.windowResize()},1e3),ssm.addState({id:"mobile",maxWidth:767,onEnter:function(){ot.addClass("ssm-state-mobile"),e.pub("ssm.mobile-enter")},onLeave:function(){ot.removeClass("ssm-state-mobile"),e.pub("ssm.mobile-leave")}}),ssm.addState({id:"tablet",minWidth:768,maxWidth:999,onEnter:function(){ot.addClass("ssm-state-tablet")},onLeave:function(){ot.removeClass("ssm-state-tablet")}}),ssm.addState({id:"desktop",minWidth:1e3,maxWidth:1400,onEnter:function(){ot.addClass("ssm-state-desktop")},onLeave:function(){ot.removeClass("ssm-state-desktop")}}),ssm.addState({id:"desktop-large",minWidth:1400,onEnter:function(){ot.addClass("ssm-state-desktop-large")},onLeave:function(){ot.removeClass("ssm-state-desktop-large")}}),lt.sub("ssm.mobile-enter",function(){lt.data().leftPanelDisabled(!0)}),lt.sub("ssm.mobile-leave",function(){lt.data().leftPanelDisabled(!1)}),lt.data().leftPanelDisabled.subscribe(function(e){ot.toggleClass("rl-left-panel-disabled",e)}),ssm.ready()},s.extend(j.prototype,K.prototype),j.prototype.oData=null,j.prototype.oRemote=null,j.prototype.oCache=null,j.prototype.data=function(){return null===this.oData&&(this.oData=new F),this.oData},j.prototype.remote=function(){return null===this.oRemote&&(this.oRemote=new M),this.oRemote},j.prototype.cache=function(){return null===this.oCache&&(this.oCache=new H),this.oCache},j.prototype.reloadDomainList=function(){lt.data().domainsLoading(!0),lt.remote().domainList(function(e,t){if(lt.data().domainsLoading(!1),W.StorageResultType.Success===e&&t&&t.Result){var n=s.map(t.Result,function(e,t){return{name:t,disabled:i.observable(!e),deleteAccess:i.observable(!1)}},this);lt.data().domains(n)}})},j.prototype.reloadPluginList=function(){lt.data().pluginsLoading(!0),lt.remote().pluginList(function(e,t){if(lt.data().pluginsLoading(!1),W.StorageResultType.Success===e&&t&&t.Result){var n=s.map(t.Result,function(e){return{name:e.Name,disabled:i.observable(!e.Enabled),configured:i.observable(!!e.Configured)}},this);lt.data().plugins(n)}})},j.prototype.reloadPackagesList=function(){lt.data().packagesLoading(!0),lt.data().packagesReal(!0),lt.remote().packagesList(function(e,t){if(lt.data().packagesLoading(!1),W.StorageResultType.Success===e&&t&&t.Result){lt.data().packagesReal(!!t.Result.Real),lt.data().packagesMainUpdatable(!!t.Result.MainUpdatable);var n=[],o={};s.each(lt.data().packages(),function(e){e&&e.loading()&&(o[e.file]=e)}),$.isArray(t.Result.List)&&(n=s.compact(s.map(t.Result.List,function(e){return e?(e.loading=i.observable(!$.isUnd(o[e.file])),"core"!==e.type||e.canBeInstalled?e:null):null}))),lt.data().packages(n)}else lt.data().packagesReal(!1)})},j.prototype.updateCoreData=function(){var t=lt.data();t.coreUpdating(!0),lt.remote().updateCoreData(function(i,n){t.coreUpdating(!1),t.coreRemoteVersion(""),t.coreRemoteRelease(""),t.coreVersionCompare(-2),W.StorageResultType.Success===i&&n&&n.Result?(t.coreReal(!0),e.location.reload()):t.coreReal(!1)})},j.prototype.reloadCoreData=function(){var e=lt.data();e.coreChecking(!0),e.coreReal(!0),lt.remote().coreData(function(t,i){e.coreChecking(!1),W.StorageResultType.Success===t&&i&&i.Result?(e.coreReal(!!i.Result.Real),e.coreUpdatable(!!i.Result.Updatable),e.coreAccess(!!i.Result.Access),e.coreRemoteVersion(i.Result.RemoteVersion||""),e.coreRemoteRelease(i.Result.RemoteRelease||""),e.coreVersionCompare($.pInt(i.Result.VersionCompare))):(e.coreReal(!1),e.coreRemoteVersion(""),e.coreRemoteRelease(""),e.coreVersionCompare(-2))})},j.prototype.reloadLicensing=function(e){e=$.isUnd(e)?!1:!!e,lt.data().licensingProcess(!0),lt.data().licenseError(""),lt.remote().licensing(function(e,t){lt.data().licensingProcess(!1),W.StorageResultType.Success===e&&t&&t.Result&&$.isNormal(t.Result.Expired)?(lt.data().licenseValid(!0),lt.data().licenseExpired($.pInt(t.Result.Expired)),lt.data().licenseError(""),lt.data().licensing(!0)):t&&t.ErrorCode&&-1<$.inArray($.pInt(t.ErrorCode),[W.Notification.LicensingServerIsUnavailable,W.Notification.LicensingExpired])?(lt.data().licenseError($.getNotification($.pInt(t.ErrorCode))),lt.data().licensing(!0)):W.StorageResultType.Abort===e?(lt.data().licenseError($.getNotification(W.Notification.LicensingServerIsUnavailable)),lt.data().licensing(!0)):lt.data().licensing(!1)},e)},j.prototype.bootstart=function(){K.prototype.bootstart.call(this),lt.data().populateDataOnStart(),tt.hideLoading(),lt.settingsGet("AllowAdminPanel")?(lt.capa(W.Capa.Prem)||$.removeSettingsViewModel(E),tt.startScreens(lt.settingsGet("Auth")?[B]:[q])):(tt.routeOff(),tt.setHash(lt.link().root(),!0),tt.routeOff(),s.defer(function(){e.location.href="/"})),e.SimplePace&&e.SimplePace.set(100)},lt=new j,ot.addClass(X.bMobileDevice?"mobile":"no-mobile"),st.keydown($.killCtrlAandS).keyup($.killCtrlAandS),st.unload(function(){X.bUnload=!0}),ot.on("click.dropdown.data-api",function(){$.detectDropdownVisibility()}),e.rl=e.rl||{},e.rl.addHook=J.addHook,e.rl.settingsGet=J.mainSettingsGet,e.rl.remoteRequest=J.remoteRequest,e.rl.pluginSettingsGet=J.settingsGet,e.rl.addSettingsViewModel=$.addSettingsViewModel,e.rl.createCommand=$.createCommand,e.rl.EmailModel=h,e.rl.Enums=W,e.__RLBOOT=function(i){t(function(){e.rainloopTEMPLATES&&e.rainloopTEMPLATES[0]?(t("#rl-templates").html(e.rainloopTEMPLATES[0]),s.delay(function(){e.rainloopAppData={},e.rainloopI18N={},e.rainloopTEMPLATES={},tt.setBoot(lt).bootstart(),ot.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):i(!1),e.__RLBOOT=null})},e.SimplePace&&e.SimplePace.add(10)}(window,jQuery,ko,crossroads,hasher,_);