From 17f6204d2a30b2d39a987b1ccf545f2b739e3bac Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Sun, 9 Feb 2014 21:09:10 +0400 Subject: [PATCH] Small improvements --- dev/Storages/WebMailData.js | 11 +++ dev/ViewModels/MailBoxFolderListViewModel.js | 1 + dev/ViewModels/PopupsDomainViewModel.js | 2 +- package.json | 4 +- .../0.0.0/app/libraries/RainLoop/Actions.php | 52 +++++----- .../Providers/Domain/DefaultDomain.php | 94 ++++++++++++++----- .../libraries/RainLoop/Providers/Login.php | 61 ------------ .../RainLoop/Providers/Login/DefaultLogin.php | 18 ---- .../Providers/Login/LoginInterface.php | 15 --- .../app/templates/Views/MailFolderList.html | 2 +- rainloop/v/0.0.0/static/js/admin.js | 2 +- rainloop/v/0.0.0/static/js/admin.min.js | 2 +- rainloop/v/0.0.0/static/js/app.js | 12 +++ rainloop/v/0.0.0/static/js/app.min.js | 14 +-- 14 files changed, 137 insertions(+), 153 deletions(-) delete mode 100644 rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login.php delete mode 100644 rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login/DefaultLogin.php delete mode 100644 rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login/LoginInterface.php diff --git a/dev/Storages/WebMailData.js b/dev/Storages/WebMailData.js index b91d7f2fe..5851cf8c2 100644 --- a/dev/Storages/WebMailData.js +++ b/dev/Storages/WebMailData.js @@ -88,6 +88,17 @@ function WebMailDataStorage() this.foldersDeleting = ko.observable(false); this.foldersRenaming = ko.observable(false); + this.foldersChanging = ko.computed(function () { + var + bLoading = this.foldersLoading(), + bCreating = this.foldersCreating(), + bDeleting = this.foldersDeleting(), + bRenaming = this.foldersRenaming() + ; + return bLoading || bCreating || bDeleting || bRenaming; + }, this); + + this.foldersInboxUnreadCount = ko.observable(0); this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null, diff --git a/dev/ViewModels/MailBoxFolderListViewModel.js b/dev/ViewModels/MailBoxFolderListViewModel.js index ffea7927e..491afd177 100644 --- a/dev/ViewModels/MailBoxFolderListViewModel.js +++ b/dev/ViewModels/MailBoxFolderListViewModel.js @@ -10,6 +10,7 @@ function MailBoxFolderListViewModel() this.folderList = RL.data().folderList; this.folderListSystem = RL.data().folderListSystem; + this.foldersChanging = RL.data().foldersChanging; this.iDropOverTimer = 0; diff --git a/dev/ViewModels/PopupsDomainViewModel.js b/dev/ViewModels/PopupsDomainViewModel.js index 9c1b415ac..ff4ca08ac 100644 --- a/dev/ViewModels/PopupsDomainViewModel.js +++ b/dev/ViewModels/PopupsDomainViewModel.js @@ -45,7 +45,7 @@ function PopupsDomainViewModel() this.smtpServerFocus.subscribe(function (bValue) { if (bValue && '' !== this.imapServer() && '' === this.smtpServer()) { - this.smtpServer(this.imapServer()); + this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp')); } }, this); diff --git a/package.json b/package.json index 35e0f8362..236ff4998 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "RainLoop", "title": "RainLoop Webmail", - "version": "1.6.2", - "release": "672", + "version": "1.6.3", + "release": "701", "description": "Simple, modern & fast web-based email client", "homepage": "http://rainloop.net", "main": "Gruntfile.js", diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index e9328af07..b8960e055 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -71,11 +71,6 @@ class Actions */ private $oSettingsProvider; - /** - * @var \RainLoop\Providers\Login - */ - private $oLoginProvider; - /** * @var \RainLoop\Providers\PersonalAddressBook */ @@ -120,7 +115,6 @@ class Actions $this->oFilesProvider = null; $this->oSettingsProvider = null; $this->oDomainProvider = null; - $this->oLoginProvider = null; $this->oPersonalAddressBookProvider = null; $this->oSuggestionsProvider = null; $this->oChangePasswordProvider = null; @@ -224,7 +218,8 @@ class Actions case 'domain': // \RainLoop\Providers\Domain\DomainSimpleInterface // \RainLoop\Providers\Domain\DomainAdminInterface - $oResult = new \RainLoop\Providers\Domain\DefaultDomain(APP_PRIVATE_DATA.'domains'); + $oResult = new \RainLoop\Providers\Domain\DefaultDomain(APP_PRIVATE_DATA.'domains', + $this->Cacher()); break; case 'personal-address-book': // \RainLoop\Providers\PersonalAddressBook\PersonalAddressBookInterface @@ -577,20 +572,6 @@ class Actions return $this->oPersonalAddressBookProvider; } - /** - * @return \RainLoop\Providers\Login - */ - public function LoginProvider() - { - if (null === $this->oLoginProvider) - { - $this->oLoginProvider = new \RainLoop\Providers\Login( - $this->fabrica('login'), $this->DomainProvider()); - } - - return $this->oLoginProvider; - } - /** * @return \OAuth2\Client|null */ @@ -805,6 +786,29 @@ class Actions return $bResult; } + + /** + * @param string $sEmail + * @param string $sLogin + * @param string $sPassword + * @param bool $sSignMeToken = '' + * + * @return \RainLoop\Account|null + */ + public function LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken = '') + { + $oResult = null; + if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword)) + { + $oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true); + if ($oDomain instanceof \RainLoop\Domain && !$oDomain->Disabled() && $oDomain->ValidateWhiteList($sEmail, $sLogin)) + { + $oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken); + } + } + + return $oResult; + } /** * @param string $sToken @@ -823,8 +827,8 @@ class Actions if (!empty($aAccountHash[0]) && 'token' === $aAccountHash[0] && 8 === \count($aAccountHash) && !empty($aAccountHash[7]) && (!$bValidateShortToken || \RainLoop\Utils::GetShortToken() === $aAccountHash[7])) { - $oAccount = $this->LoginProvider()->Provide( - $aAccountHash[1], $aAccountHash[2], $aAccountHash[3], empty($aAccountHash[5]) ? '' : $aAccountHash[5]); + $oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3], + empty($aAccountHash[5]) ? '' : $aAccountHash[5]); if ($oAccount instanceof \RainLoop\Account) { @@ -1301,7 +1305,7 @@ class Actions $this->Plugins()->RunHook('filter.login-credentials', array(&$sEmail, &$sLogin, &$sPassword)); - $oAccount = $this->LoginProvider()->Provide($sEmail, $sLogin, $sPassword, $sSignMeToken); + $oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken); if (!($oAccount instanceof \RainLoop\Account)) { $this->loginErrorDelay(); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php index cbbfcccae..21cc6812b 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php @@ -9,14 +9,21 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface */ protected $sDomainPath; + /** + * @var \MailSo\Cache\CacheClient + */ + protected $oCacher; + /** * @param string $sDomainPath + * @param \MailSo\Cache\CacheClient $oCacher = null * * @return void */ - public function __construct($sDomainPath) + public function __construct($sDomainPath, $oCacher = null) { $this->sDomainPath = \rtrim(\trim($sDomainPath), '\\/'); + $this->oCacher = $oCacher; } /** @@ -76,6 +83,55 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface return false !== \file_put_contents($this->sDomainPath.'/disabled', \trim(\implode(',', $aResult), ', ')); } + /** + * @return string + */ + private function wildcardDomainsCacheKey() + { + return '/WildCard/DomainCache/'.\md5(APP_VERSION.APP_PRIVATE_DATA_NAME).'/'; + } + + /** + * @return string + */ + private function getWildcardDomainsLine() + { + if ($this->oCacher) + { + $sResult = $this->oCacher->Get($this->wildcardDomainsCacheKey()); + if (0 < \strlen($sResult)) + { + return $sResult; + } + } + + $sResult = ''; + $aNames = array(); + + $aList = \glob($this->sDomainPath.'/*.ini'); + foreach ($aList as $sFile) + { + $sName = \strtolower(\substr(\basename($sFile), 0, -4)); + if ('default' === $sName || false !== strpos($sName, '_wildcard_')) + { + $aNames[] = $this->codeFileName($sName, true); + } + } + + if (0 < \count($aNames)) + { + \rsort($aNames, SORT_STRING); + $sResult = \implode(' ', $aNames); + } + + if ($this->oCacher) + { + $this->oCacher->Set($this->wildcardDomainsCacheKey(), $sResult); + } + + return $sResult; + } + /** * @param string $sName * @param bool $bFindWithWildCard = false @@ -86,7 +142,9 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface { $mResult = null; + $sFoundedValue = ''; $sName = \strtolower($sName); + $sRealFileName = $this->codeFileName($sName); if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini')) @@ -96,28 +154,9 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface } else if ($bFindWithWildCard) { - $sNames = ''; - $aNames = array(); - - $aList = \glob($this->sDomainPath.'/*.ini'); - foreach ($aList as $sFile) - { - $sName = \strtolower(\substr(\basename($sFile), 0, -4)); - if ('default' === $sName || false !== strpos($sName, '_wildcard_')) - { - $aNames[] = $this->codeFileName($sName, true); - } - } - - if (0 < \count($aNames)) - { - \rsort($aNames, SORT_STRING); - $sNames = \implode(' ', $aNames); - } - + $sNames = $this->getWildcardDomainsLine(); if (0 < \strlen($sNames)) { - $sFoundedValue = ''; if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sName, $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue)) { $mResult = $this->Load($sFoundedValue, false); @@ -132,7 +171,8 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface $sDisabled = @\file_get_contents($this->sDomainPath.'/disabled'); if (false !== $sDisabled && 0 < \strlen($sDisabled)) { - $mResult->SetDisabled(false !== \strpos(strtolower(','.$sDisabled.','), \strtolower(','.$sName.','))); + $sDisabledName = 0 < \strlen($sFoundedValue) ? $sFoundedValue : $sName; + $mResult->SetDisabled(false !== \strpos(strtolower(','.$sDisabled.','), \strtolower(','.$sDisabledName.','))); } } } @@ -150,6 +190,11 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface $sName = \strtolower($oDomain->Name()); $sRealFileName = $this->codeFileName($sName); + if ($this->oCacher) + { + $this->oCacher->Delete($this->wildcardDomainsCacheKey()); + } + $mResult = \file_put_contents($this->sDomainPath.'/'.$sRealFileName.'.ini', $oDomain->ToIniString()); return \is_int($mResult) && 0 < $mResult; } @@ -175,6 +220,11 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface $this->Disable($sName, false); } + if ($this->oCacher) + { + $this->oCacher->Delete($this->wildcardDomainsCacheKey()); + } + return $bResult; } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login.php deleted file mode 100644 index e6f70b1d2..000000000 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login.php +++ /dev/null @@ -1,61 +0,0 @@ -oDriver = $oDriver; - $this->oDomainProvider = $oDomainProvider; - } - - /** - * @param string $sEmail - * @param string $sLogin - * @param string $sPassword - * @param bool $sSignMeToken = '' - * - * @return \RainLoop\Account|null - */ - public function Provide($sEmail, $sLogin, $sPassword, $sSignMeToken = '') - { - $oResult = null; - - if ($this->oDriver->ProvideParameters($sEmail, $sLogin, $sPassword)) - { - $oDomain = $this->oDomainProvider->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true); - if ($oDomain instanceof \RainLoop\Domain && !$oDomain->Disabled() && $oDomain->ValidateWhiteList($sEmail, $sLogin)) - { - $oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken); - } - } - - return $oResult; - } - - /** - * @return bool - */ - public function IsActive() - { - return $this->oDriver instanceof \RainLoop\Providers\Login\LoginInterface; - } -} \ No newline at end of file diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login/DefaultLogin.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login/DefaultLogin.php deleted file mode 100644 index 54ade2454..000000000 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Login/DefaultLogin.php +++ /dev/null @@ -1,18 +0,0 @@ -
- + diff --git a/rainloop/v/0.0.0/static/js/admin.js b/rainloop/v/0.0.0/static/js/admin.js index 1fb97e829..c4436fc3e 100644 --- a/rainloop/v/0.0.0/static/js/admin.js +++ b/rainloop/v/0.0.0/static/js/admin.js @@ -4521,7 +4521,7 @@ function PopupsDomainViewModel() this.smtpServerFocus.subscribe(function (bValue) { if (bValue && '' !== this.imapServer() && '' === this.smtpServer()) { - this.smtpServer(this.imapServer()); + this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp')); } }, this); diff --git a/rainloop/v/0.0.0/static/js/admin.min.js b/rainloop/v/0.0.0/static/js/admin.min.js index 03ad0e8f7..09469aebe 100644 --- a/rainloop/v/0.0.0/static/js/admin.min.js +++ b/rainloop/v/0.0.0/static/js/admin.min.js @@ -1,4 +1,4 @@ /*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -!function(a,b,c,d,e,f){"use strict";function g(){this.sBase="#/",this.sCdnStaticDomain=fb.settingsGet("CdnStaticDomain"),this.sVersion=fb.settingsGet("Version"),this.sSpecSuffix=fb.settingsGet("AuthAccountHash")||"0",this.sServer=(fb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function h(){}function i(){}function j(){var a=[i,h],b=f.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function k(){}function l(a,b){this.sPosition=V.pString(a),this.sTemplate=V.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function m(a,b){this.sScreenName=a,this.aViewModels=V.isArray(b)?b:[]}function n(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null,this.popupVisibility=c.observable(!1),this.popupVisibility.subscribe(function(a){fb&&fb.popupVisibility(a)})}function o(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function p(){l.call(this,"Popups","PopupsDomain"),this.edit=c.observable(!1),this.saving=c.observable(!1),this.savingError=c.observable(""),this.whiteListPage=c.observable(!1),this.testing=c.observable(!1),this.testingDone=c.observable(!1),this.testingImapError=c.observable(!1),this.testingSmtpError=c.observable(!1),this.imapServerFocus=c.observable(!1),this.smtpServerFocus=c.observable(!1),this.name=c.observable(""),this.name.focused=c.observable(!1),this.imapServer=c.observable(""),this.imapPort=c.observable(S.Values.ImapDefaulPort),this.imapSecure=c.observable(T.ServerSecure.None),this.imapShortLogin=c.observable(!1),this.smtpServer=c.observable(""),this.smtpPort=c.observable(S.Values.SmtpDefaulPort),this.smtpSecure=c.observable(T.ServerSecure.None),this.smtpShortLogin=c.observable(!1),this.smtpAuth=c.observable(!0),this.whiteList=c.observable(""),this.imapServerFocus.subscribe(function(a){a&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name().replace(/[.]?[*][.]?/g,""))},this),this.smtpServerFocus.subscribe(function(a){a&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer())},this),this.headerText=c.computed(function(){var a=this.name();return this.edit()?'Edit Domain "'+a+'"':"Add Domain"+(""===a?"":' "'+a+'"')},this),this.domainIsComputed=c.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this),this.canBeTested=c.computed(function(){return!this.testing()&&this.domainIsComputed()},this),this.canBeSaved=c.computed(function(){return!this.saving()&&this.domainIsComputed()},this),this.createOrAddCommand=V.createCommand(this,function(){this.saving(!0),fb.remote().createOrUpdateDomain(f.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),this.whiteList())},this.canBeSaved),this.testConnectionCommand=V.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),fb.remote().testConnectionForDomain(f.bind(this.onTestConnectionResponse,this),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=V.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())}),n.constructorEnd(this)}function q(){l.call(this,"Popups","PopupsPlugin");var a=this;this.onPluginSettingsUpdateResponse=f.bind(this.onPluginSettingsUpdateResponse,this),this.saveError=c.observable(""),this.name=c.observable(""),this.readme=c.observable(""),this.configures=c.observableArray([]),this.hasReadme=c.computed(function(){return""!==this.readme()},this),this.hasConfiguration=c.computed(function(){return 0').appendTo("body"),cb.on("error",function(a){fb&&a&&a.originalEvent&&a.originalEvent.message&&-1===V.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&fb.remote().jsError(V.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",bb.attr("class"),V.microtime()-Y.now)})}function R(){Q.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var S={},T={},U={},V={},W={},X={},Y={},Z={settings:[],"settings-removed":[],"settings-disabled":[]},$=null,_=a.rainloopAppData||{},ab=a.rainloopI18N||{},bb=b("html"),cb=b(a),db=b(a.document),eb=a.Notification&&a.Notification.requestPermission?a.Notification:null,fb=null;Y.now=(new Date).getTime(),Y.momentTrigger=c.observable(!0),Y.langChangeTrigger=c.observable(!0),Y.iAjaxErrorCount=0,Y.iTokenErrorCount=0,Y.iMessageBodyCacheCount=0,Y.bUnload=!1,Y.sUserAgent=(navigator.userAgent||"").toLowerCase(),Y.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},V.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=V.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},V.timeOutAction=function(){var b={};return function(c,d,e){V.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),V.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),V.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Y.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),V.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},V.i18n=function(a,b,c){var d="",e=V.isUnd(ab[a])?V.isUnd(c)?a:c:ab[a];if(!V.isUnd(b)&&!V.isNull(b))for(d in b)V.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},V.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(V.i18n(c)):(c=a.data("i18n-html"),c&&a.html(V.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",V.i18n(c)))})})},V.i18nToDoc=function(){a.rainloopI18N&&(ab=a.rainloopI18N||{},V.i18nToNode(db),Y.langChangeTrigger(!Y.langChangeTrigger())),a.rainloopI18N={}},V.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Y.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Y.langChangeTrigger.subscribe(a,b)},V.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)},V.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},V.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},V.replySubjectAdd=function(b,c,d){var e=null,f=V.trim(c);return null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||V.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||V.isUnd(e[1])||V.isUnd(e[2])||V.isUnd(e[3])?f=b+": "+c:(f=e[1]+(V.pInt(e[2])+1)+e[3],f=e[1]+(V.pInt(e[2])+1)+e[3]):f=b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),(V.isUnd(d)?!0:d)?V.fixLongSubject(f):f},V.fixLongSubject=function(a){var b=0,c=null;a=V.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||V.isUnd(c[0]))&&(c=null),c&&(b=0,b+=V.isUnd(c[2])?1:0+V.pInt(c[2]),b+=V.isUnd(c[4])?1:0+V.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},V.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},V.friendlySize=function(a){return a=V.pInt(a),a>=1073741824?V.roundNumber(a/1073741824,1)+"GB":a>=1048576?V.roundNumber(a/1048576,1)+"MB":a>=1024?V.roundNumber(a/1024,0)+"KB":a+"B"},V.log=function(b){a.console&&a.console.log&&a.console.log(b)},V.getNotification=function(a,b){return a=V.pInt(a),T.Notification.ClientViewError===a&&b?b:V.isUnd(U[a])?"":U[a]},V.initNotificationLanguage=function(){U[T.Notification.InvalidToken]=V.i18n("NOTIFICATIONS/INVALID_TOKEN"),U[T.Notification.AuthError]=V.i18n("NOTIFICATIONS/AUTH_ERROR"),U[T.Notification.AccessError]=V.i18n("NOTIFICATIONS/ACCESS_ERROR"),U[T.Notification.ConnectionError]=V.i18n("NOTIFICATIONS/CONNECTION_ERROR"),U[T.Notification.CaptchaError]=V.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),U[T.Notification.SocialFacebookLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),U[T.Notification.SocialTwitterLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),U[T.Notification.SocialGoogleLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),U[T.Notification.DomainNotAllowed]=V.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),U[T.Notification.AccountNotAllowed]=V.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),U[T.Notification.CantGetMessageList]=V.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),U[T.Notification.CantGetMessage]=V.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),U[T.Notification.CantDeleteMessage]=V.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),U[T.Notification.CantMoveMessage]=V.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),U[T.Notification.CantCopyMessage]=V.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),U[T.Notification.CantSaveMessage]=V.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),U[T.Notification.CantSendMessage]=V.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),U[T.Notification.InvalidRecipients]=V.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),U[T.Notification.CantCreateFolder]=V.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),U[T.Notification.CantRenameFolder]=V.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),U[T.Notification.CantDeleteFolder]=V.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),U[T.Notification.CantDeleteNonEmptyFolder]=V.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),U[T.Notification.CantSubscribeFolder]=V.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),U[T.Notification.CantUnsubscribeFolder]=V.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),U[T.Notification.CantSaveSettings]=V.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),U[T.Notification.CantSavePluginSettings]=V.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),U[T.Notification.DomainAlreadyExists]=V.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),U[T.Notification.CantInstallPackage]=V.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),U[T.Notification.CantDeletePackage]=V.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),U[T.Notification.InvalidPluginPackage]=V.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),U[T.Notification.UnsupportedPluginPackage]=V.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),U[T.Notification.LicensingServerIsUnavailable]=V.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),U[T.Notification.LicensingExpired]=V.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),U[T.Notification.LicensingBanned]=V.i18n("NOTIFICATIONS/LICENSING_BANNED"),U[T.Notification.DemoSendMessageError]=V.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),U[T.Notification.AccountAlreadyExists]=V.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),U[T.Notification.MailServerError]=V.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),U[T.Notification.UnknownNotification]=V.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),U[T.Notification.UnknownError]=V.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},V.getUploadErrorDescByCode=function(a){var b="";switch(V.pInt(a)){case T.UploadErrorCode.FileIsTooBig:b=V.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case T.UploadErrorCode.FilePartiallyUploaded:b=V.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case T.UploadErrorCode.FileNoUploaded:b=V.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case T.UploadErrorCode.MissingTempFolder:b=V.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case T.UploadErrorCode.FileOnSaveingError:b=V.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case T.UploadErrorCode.FileType:b=V.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=V.i18n("UPLOAD/ERROR_UNKNOWN")}return b},V.delegateRun=function(a,b,c,d){a&&a[b]&&(d=V.pInt(d),0>=d?a[b].apply(a,V.isArray(c)?c:[]):f.delay(function(){a[b].apply(a,V.isArray(c)?c:[])},d))},V.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===T.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===T.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},V.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=V.isUnd(d)?!0:d,e.canExecute=V.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},V.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(T.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(T.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Y.sAnimationType=T.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(T.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return T.Layout.NoPreview!==b.layout() +!function(a,b,c,d,e,f){"use strict";function g(){this.sBase="#/",this.sCdnStaticDomain=fb.settingsGet("CdnStaticDomain"),this.sVersion=fb.settingsGet("Version"),this.sSpecSuffix=fb.settingsGet("AuthAccountHash")||"0",this.sServer=(fb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function h(){}function i(){}function j(){var a=[i,h],b=f.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function k(){}function l(a,b){this.sPosition=V.pString(a),this.sTemplate=V.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function m(a,b){this.sScreenName=a,this.aViewModels=V.isArray(b)?b:[]}function n(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null,this.popupVisibility=c.observable(!1),this.popupVisibility.subscribe(function(a){fb&&fb.popupVisibility(a)})}function o(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function p(){l.call(this,"Popups","PopupsDomain"),this.edit=c.observable(!1),this.saving=c.observable(!1),this.savingError=c.observable(""),this.whiteListPage=c.observable(!1),this.testing=c.observable(!1),this.testingDone=c.observable(!1),this.testingImapError=c.observable(!1),this.testingSmtpError=c.observable(!1),this.imapServerFocus=c.observable(!1),this.smtpServerFocus=c.observable(!1),this.name=c.observable(""),this.name.focused=c.observable(!1),this.imapServer=c.observable(""),this.imapPort=c.observable(S.Values.ImapDefaulPort),this.imapSecure=c.observable(T.ServerSecure.None),this.imapShortLogin=c.observable(!1),this.smtpServer=c.observable(""),this.smtpPort=c.observable(S.Values.SmtpDefaulPort),this.smtpSecure=c.observable(T.ServerSecure.None),this.smtpShortLogin=c.observable(!1),this.smtpAuth=c.observable(!0),this.whiteList=c.observable(""),this.imapServerFocus.subscribe(function(a){a&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name().replace(/[.]?[*][.]?/g,""))},this),this.smtpServerFocus.subscribe(function(a){a&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer().replace(/imap/gi,"smtp"))},this),this.headerText=c.computed(function(){var a=this.name();return this.edit()?'Edit Domain "'+a+'"':"Add Domain"+(""===a?"":' "'+a+'"')},this),this.domainIsComputed=c.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this),this.canBeTested=c.computed(function(){return!this.testing()&&this.domainIsComputed()},this),this.canBeSaved=c.computed(function(){return!this.saving()&&this.domainIsComputed()},this),this.createOrAddCommand=V.createCommand(this,function(){this.saving(!0),fb.remote().createOrUpdateDomain(f.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),this.whiteList())},this.canBeSaved),this.testConnectionCommand=V.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),fb.remote().testConnectionForDomain(f.bind(this.onTestConnectionResponse,this),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=V.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())}),n.constructorEnd(this)}function q(){l.call(this,"Popups","PopupsPlugin");var a=this;this.onPluginSettingsUpdateResponse=f.bind(this.onPluginSettingsUpdateResponse,this),this.saveError=c.observable(""),this.name=c.observable(""),this.readme=c.observable(""),this.configures=c.observableArray([]),this.hasReadme=c.computed(function(){return""!==this.readme()},this),this.hasConfiguration=c.computed(function(){return 0').appendTo("body"),cb.on("error",function(a){fb&&a&&a.originalEvent&&a.originalEvent.message&&-1===V.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&fb.remote().jsError(V.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",bb.attr("class"),V.microtime()-Y.now)})}function R(){Q.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var S={},T={},U={},V={},W={},X={},Y={},Z={settings:[],"settings-removed":[],"settings-disabled":[]},$=null,_=a.rainloopAppData||{},ab=a.rainloopI18N||{},bb=b("html"),cb=b(a),db=b(a.document),eb=a.Notification&&a.Notification.requestPermission?a.Notification:null,fb=null;Y.now=(new Date).getTime(),Y.momentTrigger=c.observable(!0),Y.langChangeTrigger=c.observable(!0),Y.iAjaxErrorCount=0,Y.iTokenErrorCount=0,Y.iMessageBodyCacheCount=0,Y.bUnload=!1,Y.sUserAgent=(navigator.userAgent||"").toLowerCase(),Y.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},V.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=V.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},V.timeOutAction=function(){var b={};return function(c,d,e){V.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),V.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),V.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Y.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),V.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},V.i18n=function(a,b,c){var d="",e=V.isUnd(ab[a])?V.isUnd(c)?a:c:ab[a];if(!V.isUnd(b)&&!V.isNull(b))for(d in b)V.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},V.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(V.i18n(c)):(c=a.data("i18n-html"),c&&a.html(V.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",V.i18n(c)))})})},V.i18nToDoc=function(){a.rainloopI18N&&(ab=a.rainloopI18N||{},V.i18nToNode(db),Y.langChangeTrigger(!Y.langChangeTrigger())),a.rainloopI18N={}},V.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Y.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Y.langChangeTrigger.subscribe(a,b)},V.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)},V.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},V.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},V.replySubjectAdd=function(b,c,d){var e=null,f=V.trim(c);return null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||V.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||V.isUnd(e[1])||V.isUnd(e[2])||V.isUnd(e[3])?f=b+": "+c:(f=e[1]+(V.pInt(e[2])+1)+e[3],f=e[1]+(V.pInt(e[2])+1)+e[3]):f=b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),(V.isUnd(d)?!0:d)?V.fixLongSubject(f):f},V.fixLongSubject=function(a){var b=0,c=null;a=V.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||V.isUnd(c[0]))&&(c=null),c&&(b=0,b+=V.isUnd(c[2])?1:0+V.pInt(c[2]),b+=V.isUnd(c[4])?1:0+V.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},V.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},V.friendlySize=function(a){return a=V.pInt(a),a>=1073741824?V.roundNumber(a/1073741824,1)+"GB":a>=1048576?V.roundNumber(a/1048576,1)+"MB":a>=1024?V.roundNumber(a/1024,0)+"KB":a+"B"},V.log=function(b){a.console&&a.console.log&&a.console.log(b)},V.getNotification=function(a,b){return a=V.pInt(a),T.Notification.ClientViewError===a&&b?b:V.isUnd(U[a])?"":U[a]},V.initNotificationLanguage=function(){U[T.Notification.InvalidToken]=V.i18n("NOTIFICATIONS/INVALID_TOKEN"),U[T.Notification.AuthError]=V.i18n("NOTIFICATIONS/AUTH_ERROR"),U[T.Notification.AccessError]=V.i18n("NOTIFICATIONS/ACCESS_ERROR"),U[T.Notification.ConnectionError]=V.i18n("NOTIFICATIONS/CONNECTION_ERROR"),U[T.Notification.CaptchaError]=V.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),U[T.Notification.SocialFacebookLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),U[T.Notification.SocialTwitterLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),U[T.Notification.SocialGoogleLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),U[T.Notification.DomainNotAllowed]=V.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),U[T.Notification.AccountNotAllowed]=V.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),U[T.Notification.CantGetMessageList]=V.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),U[T.Notification.CantGetMessage]=V.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),U[T.Notification.CantDeleteMessage]=V.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),U[T.Notification.CantMoveMessage]=V.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),U[T.Notification.CantCopyMessage]=V.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),U[T.Notification.CantSaveMessage]=V.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),U[T.Notification.CantSendMessage]=V.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),U[T.Notification.InvalidRecipients]=V.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),U[T.Notification.CantCreateFolder]=V.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),U[T.Notification.CantRenameFolder]=V.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),U[T.Notification.CantDeleteFolder]=V.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),U[T.Notification.CantDeleteNonEmptyFolder]=V.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),U[T.Notification.CantSubscribeFolder]=V.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),U[T.Notification.CantUnsubscribeFolder]=V.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),U[T.Notification.CantSaveSettings]=V.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),U[T.Notification.CantSavePluginSettings]=V.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),U[T.Notification.DomainAlreadyExists]=V.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),U[T.Notification.CantInstallPackage]=V.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),U[T.Notification.CantDeletePackage]=V.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),U[T.Notification.InvalidPluginPackage]=V.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),U[T.Notification.UnsupportedPluginPackage]=V.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),U[T.Notification.LicensingServerIsUnavailable]=V.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),U[T.Notification.LicensingExpired]=V.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),U[T.Notification.LicensingBanned]=V.i18n("NOTIFICATIONS/LICENSING_BANNED"),U[T.Notification.DemoSendMessageError]=V.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),U[T.Notification.AccountAlreadyExists]=V.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),U[T.Notification.MailServerError]=V.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),U[T.Notification.UnknownNotification]=V.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),U[T.Notification.UnknownError]=V.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},V.getUploadErrorDescByCode=function(a){var b="";switch(V.pInt(a)){case T.UploadErrorCode.FileIsTooBig:b=V.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case T.UploadErrorCode.FilePartiallyUploaded:b=V.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case T.UploadErrorCode.FileNoUploaded:b=V.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case T.UploadErrorCode.MissingTempFolder:b=V.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case T.UploadErrorCode.FileOnSaveingError:b=V.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case T.UploadErrorCode.FileType:b=V.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=V.i18n("UPLOAD/ERROR_UNKNOWN")}return b},V.delegateRun=function(a,b,c,d){a&&a[b]&&(d=V.pInt(d),0>=d?a[b].apply(a,V.isArray(c)?c:[]):f.delay(function(){a[b].apply(a,V.isArray(c)?c:[])},d))},V.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===T.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===T.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},V.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=V.isUnd(d)?!0:d,e.canExecute=V.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},V.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(T.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(T.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Y.sAnimationType=T.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(T.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return T.Layout.NoPreview!==b.layout() }),b.interfaceAnimation.subscribe(function(a){if(Y.bMobileDevice||a===T.InterfaceAnimation.None)bb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Y.sAnimationType=T.InterfaceAnimation.None;else switch(a){case T.InterfaceAnimation.Full:bb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Y.sAnimationType=a;break;case T.InterfaceAnimation.Normal:bb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Y.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=T.DesktopNotifications.NotSupported;if(eb&&eb.permission)switch(eb.permission.toLowerCase()){case"granted":c=T.DesktopNotifications.Allowed;break;case"denied":c=T.DesktopNotifications.Denied;break;case"default":c=T.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&T.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();T.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):T.DesktopNotifications.NotAllowed===c?eb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),T.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1=b.diff(c,"hours")?d:b.format("L")===c.format("L")?V.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?V.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},V.isFolderExpanded=function(a){var b=fb.local().get(T.ClientSideKeyName.ExpandedFolders);return f.isArray(b)&&-1!==f.indexOf(b,a)},V.setExpandedFolder=function(a,b){var c=fb.local().get(T.ClientSideKeyName.ExpandedFolders);f.isArray(c)||(c=[]),b?(c.push(a),c=f.uniq(c)):c=f.without(c,a),fb.local().set(T.ClientSideKeyName.ExpandedFolders,c)},V.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=fb.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(fb.local().set(d,b.size.width),f.css({left:""+b.size.width+"px"}))};null!==g&&(e.css({width:""+g+"px"}),f.css({left:""+g+"px"})),e.resizable({helper:"ui-resizable-helper",minWidth:120,maxWidth:400,handles:"e",stop:h})},V.initBlockquoteSwitcher=function(a){if(a){var c=b("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===b(this).parent().closest("blockquote",a).length});c&&0100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),V.windowResize()}).after("
").before("
"))})}},V.removeBlockquoteSwitcher=function(a){a&&(b(a).find("blockquote.rl-bq-switcher").each(function(){b(this).removeClass("rl-bq-switcher hidden-bq")}),b(a).find(".rlBlockquoteSwitcher").each(function(){b(this).remove()}))},V.extendAsViewModel=function(a,b,c){b&&(c||(c=l),b.__name=a,W.regViewModelHook(a,b),f.extend(b.prototype,c.prototype))},V.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Z.settings.push(a)},V.removeSettingsViewModel=function(a){Z["settings-removed"].push(a)},V.disableSettingsViewModel=function(a){Z["settings-disabled"].push(a)},V.convertThemeName=function(a){return V.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},V.quoteName=function(a){return a.replace(/["]/g,'\\"')},V.microtime=function(){return(new Date).getTime()},V.convertLangName=function(a,b){return V.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},V.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=V.isUnd(a)?32:V.pInt(a);b.length/g,">").replace(/")},V.draggeblePlace=function(){return b('
 
').appendTo("#rl-hidden")},V.defautOptionsAfterRender=function(a,b){b&&!V.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},V.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+V.fakeMd5()+"__",j=b("#"+d);a[i]=function(){if(h&&h.document.body&&j&&j[0]){var d=b(h.document.body);b("#rl-content",d).html(j.html()),b("html",h.document).addClass("external "+b("html").attr("class")),V.i18nToNode(d),n.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+V.encodeHtml(e)+'
'),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},V.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=V.isUnd(d)?1e3:V.pInt(d),function(e,g,h,i,j){b.call(c,g&&g.Result?T.SaveSettingsStep.TrueResult:T.SaveSettingsStep.FalseResult),a&&a.call(c,e,g,h,i,j),f.delay(function(){b.call(c,T.SaveSettingsStep.Idle)},d)}},V.settingsSaveHelperSimpleFunction=function(a,b){return V.settingsSaveHelperFunction(null,a,b,1e3)},V.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},V.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:V.isUnd(c)?a.toString():c.toString(),custom:V.isUnd(c)?!1:!0,title:V.isUnd(c)?"":a.toString(),value:a.toString()};(V.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},X={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return X.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=X._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return X._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;cd?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!Y.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+V.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Y.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){V.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){V.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),V.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=V.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=V.pInt(e[2]),g=cb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!Y.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),V.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),V.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null,!!a.shiftKey)},b(d).draggable(k).on("mousedown",function(){V.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Y.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){Y.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append('  ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c();d.inputosaurus({parseOnBlur:!0,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){fb.getAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=V.trim(a),c=null;return""!==b?(c=new o,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(){d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(V.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},V.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=V.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=V.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),V.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},g.prototype.root=function(){return this.sBase},g.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},g.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},g.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},g.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},g.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},g.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},g.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},g.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},g.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},g.prototype.settings=function(a){var b=this.sBase+"settings";return V.isUnd(a)||""===a||(b+="/"+a),b},g.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},g.prototype.mailBox=function(a,b,c){b=V.isNormal(b)?V.pInt(b):1,c=V.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},g.prototype.phpInfo=function(){return this.sServer+"Info"},g.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},g.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},g.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},g.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.js"},g.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},W.oViewModelsHooks={},W.oSimpleHooks={},W.regViewModelHook=function(a,b){b&&(b.__hookName=a)},W.addHook=function(a,b){V.isFunc(b)&&(V.isArray(W.oSimpleHooks[a])||(W.oSimpleHooks[a]=[]),W.oSimpleHooks[a].push(b))},W.runHook=function(a,b){V.isArray(W.oSimpleHooks[a])&&(b=b||[],f.each(W.oSimpleHooks[a],function(a){a.apply(null,b)}))},W.mainSettingsGet=function(a){return fb?fb.settingsGet(a):null},W.remoteRequest=function(a,b,c,d,e,f){fb&&fb.remote().defaultRequest(a,b,c,d,e,f)},W.settingsGet=function(a,b){var c=W.mainSettingsGet("Plugins");return c=c&&V.isUnd(c[a])?null:c[a],c?V.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(S.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(S.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(S.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!V.isUnd(d[a])?d[a]:null}catch(e){}return d},i.supported=function(){return!!a.localStorage},i.prototype.set=function(b,c){var d=a.localStorage[S.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[S.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[S.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!V.isUnd(d[b])?d[b]:null}catch(e){}return d},j.prototype.oDriver=null,j.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},j.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},k.prototype.bootstart=function(){},l.prototype.sPosition="",l.prototype.sTemplate="",l.prototype.viewModelName="",l.prototype.viewModelDom=null,l.prototype.viewModelTemplate=function(){return this.sTemplate},l.prototype.viewModelPosition=function(){return this.sPosition},l.prototype.cancelCommand=l.prototype.closeCommand=function(){},m.prototype.oCross=null,m.prototype.sScreenName="",m.prototype.aViewModels=[],m.prototype.viewModels=function(){return this.aViewModels},m.prototype.screenName=function(){return this.sScreenName},m.prototype.routes=function(){return null},m.prototype.__cross=function(){return this.oCross},m.prototype.__start=function(){var a=this.routes(),b=null,c=null;V.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||V.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.constructorEnd=function(a){V.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.hideLoading=function(){b("#rl-loading").hide()},n.prototype.routeOff=function(){e.changed.active=!1},n.prototype.routeOn=function(){e.changed.active=!0},n.prototype.setBoot=function(a){return V.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||V.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=fb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b("
").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(h),e.data=fb.data(),e.viewModelDom=i,e.__rlSettingsData=g.__rlSettingsData,g.__dom=i,g.__builded=!0,g.__vm=e,c.applyBindings(e,i[0]),V.delegateRun(e,"onBuild",[i])):V.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&f.defer(function(){d.oCurrentSubScreen&&(V.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),V.delegateRun(d.oCurrentSubScreen,"onShow"),V.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),f.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),V.windowResize()})):$.setHash(fb.link().settings(),!1,!0)},N.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(V.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},N.prototype.onBuild=function(){f.each(Z.settings,function(a){a&&a.__rlSettingsData&&!f.find(Z["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!f.find(Z["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},N.prototype.routes=function(){var a=f.find(Z.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",c={subname:/^(.*)$/,normalize_:function(a,c){return c.subname=V.isUnd(c.subname)?b:V.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(O.prototype,m.prototype),O.prototype.onShow=function(){fb.setTitle("")},f.extend(P.prototype,N.prototype),P.prototype.onShow=function(){fb.setTitle("")},f.extend(Q.prototype,k.prototype),Q.prototype.oSettings=null,Q.prototype.oPlugins=null,Q.prototype.oLocal=null,Q.prototype.oLink=null,Q.prototype.oSubs={},Q.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):(Y.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},Q.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},Q.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},Q.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=V.isNormal(_)?_:{}),V.isUnd(this.oSettings[a])?null:this.oSettings[a]},Q.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=V.isNormal(_)?_:{}),this.oSettings[a]=b},Q.prototype.setTitle=function(b){b=(V.isNormal(b)&&00&&-1b?b:a))},this),this.body=null,this.plainRaw="",this.isRtl=c.observable(!1),this.isHtml=c.observable(!1),this.hasImages=c.observable(!1),this.attachments=c.observableArray([]),this.isPgpSigned=c.observable(!1),this.isPgpEncrypted=c.observable(!1),this.pgpSignature=c.observable(""),this.priority=c.observable(qb.MessagePriority.Normal),this.readReceipt=c.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=c.observable(0),this.threads=c.observableArray([]),this.threadsLen=c.observable(0),this.hasUnseenSubMessage=c.observable(!1),this.hasFlaggedSubMessage=c.observable(!1),this.lastInCollapsedThread=c.observable(!1),this.lastInCollapsedThreadLoading=c.observable(!1),this.threadsLenResult=c.computed(function(){var a=this.threadsLen();return 0===this.parentUid()&&a>0?a+1:""},this)}function z(){this.name=c.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.selectable=!1,this.existen=!0,this.isNamespaceFolder=!1,this.isGmailFolder=!1,this.isUnpaddigFolder=!1,this.interval=0,this.type=c.observable(qb.FolderType.User),this.selected=c.observable(!1),this.edited=c.observable(!1),this.collapsed=c.observable(!0),this.subScribed=c.observable(!0),this.subFolders=c.observableArray([]),this.deleteAccess=c.observable(!1),this.actionBlink=c.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=c.observable(""),this.name.subscribe(function(a){this.nameForEdit(a)},this),this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this),this.privateMessageCountAll=c.observable(0),this.privateMessageCountUnread=c.observable(0),this.collapsedPrivate=c.observable(!0)}function A(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function B(a,b,d){this.id=a,this.email=c.observable(b),this.name=c.observable(""),this.replyTo=c.observable(""),this.bcc=c.observable(""),this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(d)}function C(){q.call(this,"Popups","PopupsFolderClear"),this.selectedFolder=c.observable(null),this.clearingProcess=c.observable(!1),this.clearingError=c.observable(""),this.folderFullNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this),this.folderNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.localName():""},this),this.dangerDescHtml=c.computed(function(){return sb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=sb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Eb.data().message(null),Eb.data().messageList([]),this.clearingProcess(!0),Eb.cache().setFolderHash(b.fullNameRaw,""),Eb.remote().folderClear(function(b,c){a.clearingProcess(!1),qb.StorageResultType.Success===b&&c&&c.Result?(Eb.reloadMessageList(!0),a.cancelCommand()):c&&c.ErrorCode?a.clearingError(sb.getNotification(c.ErrorCode)):a.clearingError(sb.getNotification(qb.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),s.constructorEnd(this)}function D(){q.call(this,"Popups","PopupsFolderCreate"),sb.initOnStartOrLangChange(function(){this.sNoParentText=sb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(pb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Eb.data(),b=[],c=null,d=null,e=a.folderList(),f=function(a){return a?a.isSystemFolder()?a.name()+" "+a.manageFolderSystemName():a.name():""};return b.push(["",this.sNoParentText]),""!==a.namespace&&(c=function(b){return a.namespace!==b.fullNameRaw.substr(0,a.namespace.length)}),Eb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=sb.createCommand(this,function(){var a=Eb.data(),b=this.selectedParentValue();""===b&&1=a?1:a},this),this.contactsPagenator=c.computed(sb.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewIDStr=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewScopeType=c.observable(qb.ContactScopeType.Default),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(qb.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-10&&b>0&&a>b},this),this.hasMessages=c.computed(function(){return 0'),e.after(f),e.remove()),f&&f[0]&&f.attr("data-href",g).attr("data-theme",a[0]).text(a[1]),d.themeTrigger(qb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(qb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Eb.remote().saveSettings(null,{Theme:c})},this)}function db(){sb.initDataConstructorBySettings(this)}function eb(){db.call(this);var a=function(a){return function(){var b=Eb.cache().getFolderFromCacheList(a());b&&b.type(qb.FolderType.User)}},d=function(a){return function(b){var c=Eb.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.observable(""),this.sentFolder.subscribe(a(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange"),this.sentFolder.subscribe(d(qb.FolderType.SentItems),this),this.draftFolder.subscribe(d(qb.FolderType.Draft),this),this.spamFolder.subscribe(d(qb.FolderType.Spam),this),this.trashFolder.subscribe(d(qb.FolderType.Trash),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||pb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.namespace="",this.folderList=c.observableArray([]),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.foldersInboxUnreadCount=c.observable(0),this.currentFolder=c.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.currentFolderFullNameRaw=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=c.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=c.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=c.computed(function(){var a=["INBOX"],b=this.folderList(),c=this.sentFolder(),d=this.draftFolder(),e=this.spamFolder(),f=this.trashFolder();return sb.isArray(b)&&0=a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){xb.setHash(Eb.link().mailBox(this.currentFolderFullNameHash(),1,sb.trim(a.toString())))},owner:this}),this.messageListError=c.observable(""),this.messageListLoading=c.observable(!1),this.messageListIsNotCompleted=c.observable(!1),this.messageListCompleteLoadingThrottle=c.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=c.computed(function(){var a=this.messageListLoading(),b=this.messageListIsNotCompleted();return a||b},this),this.messageListCompleteLoading.subscribe(function(a){this.messageListCompleteLoadingThrottle(a)},this),this.messageList.subscribe(h.debounce(function(a){h.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500)),this.staticMessageList=new y,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this),this.messageFullScreenMode=c.observable(!1),this.messageError=c.observable(""),this.messagesBodiesDom=c.observable(null),this.messagesBodiesDom.subscribe(function(a){!a||a instanceof jQuery||this.messagesBodiesDom(b(a))},this),this.messageActiveDom=c.observable(null),this.isMessageSelected=c.computed(function(){return null!==this.message()},this),this.currentMessage=c.observable(null),this.message.subscribe(function(a){null===a&&(this.currentMessage(null),this.hideMessageBodies())},this),this.messageListChecked=c.computed(function(){return h.filter(this.messageList(),function(a){return a.checked()})},this),this.messageListCheckedOrSelected=c.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return h.union(a,b?[b]:[])},this),this.messageListCheckedUids=c.computed(function(){var a=[];return h.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),00?Math.ceil(b/a*100):0},this),this.useKeyboardShortcuts=c.observable(!0),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(qb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function fb(){this.oRequests={}}function gb(){fb.call(this),this.oRequests={}}function hb(){this.oEmailsPicsHashes={},this.oServices={}}function ib(){hb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function jb(a){r.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function kb(){r.call(this,"login",[N])}function lb(){r.call(this,"mailbox",[P,R,S,T]),this.oLastRoute={}}function mb(){jb.call(this,[Q,U,V]),sb.initOnStartOrLangChange(function(){this.sSettingsTitle=sb.i18n("TITLES/SETTINGS")},this,function(){Eb.setTitle(this.sSettingsTitle)})}function nb(){p.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibility=c.observable(!1),this.iframe=b('
").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=V.createCommand(e,function(){$.hideScreenPopup(a)})),W.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),V.delegateRun(e,"onBuild",[h]),W.runHook("view-model-post-build",[a.__name,e,h])):V.log("Cannot find view model position: "+f)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),V.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),W.runHook("view-model-on-hide",[a.__name,a.__vm]),f.delay(function(){a.__dom.hide()},300))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),V.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),W.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),V.delegateRun(a.__vm,"onFocus",[],500)))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===V.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,V.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),V.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(V.delegateRun(c.oCurrentScreen,"onHide"),V.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),V.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(V.delegateRun(c.oCurrentScreen,"onShow"),W.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),V.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),V.delegateRun(a.__vm,"onShow"),V.delegateRun(a.__vm,"onFocus",[],200),W.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),W.runHook("screen-pre-start",[a.screenName(),a]),V.delegateRun(a,"onStart"),W.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),f.delay(function(){bb.removeClass("rl-started-trigger").addClass("rl-started")},50)},n.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=V.isUnd(c)?!1:!!c,(V.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},n.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},$=new n,o.newInstanceFromJson=function(a){var b=new o;return b.initByJson(a)?b:null},o.prototype.name="",o.prototype.email="",o.prototype.privateType=null,o.prototype.clear=function(){this.email="",this.name="",this.privateType=null},o.prototype.validate=function(){return""!==this.name||""!==this.email},o.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},o.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},o.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=T.EmailType.Facebook),null===this.privateType&&(this.privateType=T.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){this.clear(),a=V.trim(a);var b=/(?:"([^"]+)")? ?,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},o.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=V.trim(a.Name),this.email=V.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=V.isUnd(b)?!1:!!b,c=V.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+V.encodeHtml(this.name)+"":c?V.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=V.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+V.encodeHtml(d)+""+V.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=V.encodeHtml(d))):b&&(d=''+V.encodeHtml(this.email)+""))),d},o.prototype.mailsoParse=function(a){if(a=V.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=V.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=V.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=V.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},o.prototype.inputoTagLine=function(){return 0(new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0