diff --git a/build/plugin.xml b/build/plugin.xml
index 39633ae23..e9ea5b756 100644
--- a/build/plugin.xml
+++ b/build/plugin.xml
@@ -93,6 +93,10 @@
-
+
]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,r).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),i.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,o).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},$.plainToHtml=function(e){return e.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},$.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),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>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 >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 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()?"":''+$.i18n(i.utils.unwrapObservable(n()))+""}}).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()?"":''+i()()+""}}).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(' ').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.getUserPicUrlFromHash=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+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"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},a.prototype.emptyFullContactPic=function(){return e.location.protocol+"//"+e.location.hostname+("80"==""+e.location.port||""==""+e.location.port?"":":"+e.location.port)+e.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},a.prototype.sound=function(e){return"rainloop/v/"+this.sVersion+"/static/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"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},a.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/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&<.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(j.Values.ClientSideCookieIndexName),o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[e]=i,t.cookie(j.Values.ClientSideCookieIndexName,JSON.stringify(s),{expires:30}),o=!0}catch(a){}return o},r.prototype.get=function(e){var i=t.cookie(j.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[j.Values.ClientSideCookieIndexName]||null,o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[t]=i,e.localStorage[j.Values.ClientSideCookieIndexName]=JSON.stringify(s),o=!0}catch(a){}return o},l.prototype.get=function(t){var i=e.localStorage[j.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("").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.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?'")+'" target="_blank" tabindex="-1">'+$.encodeHtml(this.name)+"":i?$.encodeHtml(this.name):this.name:(n=this.email,""!==this.name?t?n=$.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+$.encodeHtml(n)+""+$.encodeHtml(">"):(n='"'+this.name+'" <'+n+">",i&&(n=$.encodeHtml(n))):t&&(n=''+$.encodeHtml(this.email)+""))),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 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 (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
]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,r).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),i.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,o).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},$.plainToHtml=function(e){return e.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},$.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),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>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 >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 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()?"":''+$.i18n(i.utils.unwrapObservable(n()))+""}}).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()?"":''+i()()+""}}).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(' ').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.getUserPicUrlFromHash=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+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"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},a.prototype.emptyFullContactPic=function(){return e.location.protocol+"//"+e.location.hostname+("80"==""+e.location.port||""==""+e.location.port?"":":"+e.location.port)+e.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},a.prototype.sound=function(e){return"rainloop/v/"+this.sVersion+"/static/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"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},a.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/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&<.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(j.Values.ClientSideCookieIndexName),o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[e]=i,t.cookie(j.Values.ClientSideCookieIndexName,JSON.stringify(s),{expires:30}),o=!0}catch(a){}return o},r.prototype.get=function(e){var i=t.cookie(j.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[j.Values.ClientSideCookieIndexName]||null,o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[t]=i,e.localStorage[j.Values.ClientSideCookieIndexName]=JSON.stringify(s),o=!0}catch(a){}return o},l.prototype.get=function(t){var i=e.localStorage[j.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("").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.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?'")+'" target="_blank" tabindex="-1">'+$.encodeHtml(this.name)+"":i?$.encodeHtml(this.name):this.name:(n=this.email,""!==this.name?t?n=$.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+$.encodeHtml(n)+""+$.encodeHtml(">"):(n='"'+this.name+'" <'+n+">",i&&(n=$.encodeHtml(n))):t&&(n=''+$.encodeHtml(this.email)+""))),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 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 (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
]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,r).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),s.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,o).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Mt.plainToHtml=function(e){return e.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Mt.resizeAndCrop=function(t,s,i){var o=new e.Image;o.onload=function(){var e=[0,0],t=document.createElement("canvas"),o=t.getContext("2d");t.width=s,t.height=s,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],o.fillStyle="#fff",o.fillRect(0,0,s,s),o.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,s,s),i(t.toDataURL("image/jpeg"))},o.src=t},Mt.computedPagenatorHelper=function(e,t){return function(){var s=0,i=0,o=2,n=[],a=e(),r=t(),l=function(e,t,s){var i={current:e===a,name:Mt.isUnd(s)?e.toString():s.toString(),custom:Mt.isUnd(s)?!1:!0,title:Mt.isUnd(s)?"":e.toString(),value:e.toString()};(Mt.isUnd(t)?0:!t)?n.unshift(i):n.push(i)};if(r>1||r>0&&a>r){for(a>r?(l(r),s=r,i=r):((3>=a||a>=r-2)&&(o+=2),l(a),s=a,i=a);o>0;)if(s-=1,i+=1,s>0&&(l(s,!1),o--),r>=i)l(i,!0),o--;else if(0>=s)break;3===s?l(2,!1):s>3&&l(Math.round((s-1)/2),!1,"..."),r-2===i?l(r-1,!0):r-2>i&&l(Math.round((r+i)/2),!0,"..."),s>1&&l(1,!1),r>i&&l(r,!0)}return n}},Mt.selectElement=function(t){if(e.getSelection){var s=e.getSelection();s.removeAllRanges();var i=document.createRange();i.selectNodeContents(t),s.addRange(i)}else if(document.selection){var o=document.body.createTextRange();o.moveToElementText(t),o.select()}},Mt.disableKeyFilter=function(){e.key&&(c.filter=function(){return jt.data().useKeyboardShortcuts()})},Mt.restoreKeyFilter=function(){e.key&&(c.filter=function(e){if(jt.data().useKeyboardShortcuts()){var t=e.target||e.srcElement,s=t?t.tagName:"";return s=s.toUpperCase(),!("INPUT"===s||"SELECT"===s||"TEXTAREA"===s||t&&"DIV"===s&&"editorHtmlArea"===t.className&&t.contentEditable)}return!1})},Mt.detectDropdownVisibility=r.debounce(function(){kt.dropdownVisibility(!!r.find(Ut,function(e){return e.hasClass("open")}))},50),Ot={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return Ot.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=Ot._utf8_encode(e);c>2,n=(3&t)<<4|s>>4,a=(15&s)<<2|i>>6,r=63&i,isNaN(s)?a=r=64:isNaN(i)&&(r=64),l=l+this._keyStr.charAt(o)+this._keyStr.charAt(n)+this._keyStr.charAt(a)+this._keyStr.charAt(r);return l},decode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c >4,s=(15&n)<<4|a>>2,i=(3&a)<<6|r,l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(s)),64!==r&&(l+=String.fromCharCode(i));return Ot._utf8_decode(l)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",s=0,i=e.length,o=0;i>s;s++)o=e.charCodeAt(s),128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128));return t},_utf8_decode:function(e){for(var t="",s=0,i=0,o=0,n=0;s i?(t+=String.fromCharCode(i),s++):i>191&&224>i?(o=e.charCodeAt(s+1),t+=String.fromCharCode((31&i)<<6|63&o),s+=2):(o=e.charCodeAt(s+1),n=e.charCodeAt(s+2),t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&n),s+=3);return t}},s.bindingHandlers.tooltip={init:function(e,i){if(!kt.bMobileDevice){var o=t(e),n=o.data("tooltip-class")||"",a=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:a,trigger:"hover",title:function(){return o.is(".disabled")||kt.dropdownVisibility()?"":''+Mt.i18n(s.utils.unwrapObservable(i()))+""}}).click(function(){o.tooltip("hide")}),kt.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}}},s.bindingHandlers.tooltip2={init:function(e,s){var i=t(e),o=i.data("tooltip-class")||"",n=i.data("tooltip-placement")||"top";i.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:n,title:function(){return i.is(".disabled")||kt.dropdownVisibility()?"":''+s()()+""}}).click(function(){i.tooltip("hide")}),kt.tooltipTrigger.subscribe(function(){i.tooltip("hide")})}},s.bindingHandlers.tooltip3={init:function(e){var s=t(e);s.tooltip({container:"body",trigger:"hover manual",title:function(){return s.data("tooltip3-data")||""}}),Kt.click(function(){s.tooltip("hide")}),kt.tooltipTrigger.subscribe(function(){s.tooltip("hide")})},update:function(e,i){var o=s.utils.unwrapObservable(i());""===o?t(e).data("tooltip3-data","").tooltip("hide"):t(e).data("tooltip3-data",o).tooltip("show")}},s.bindingHandlers.registrateBootstrapDropdown={init:function(e){Ut.push(t(e))}},s.bindingHandlers.openDropdownTrigger={update:function(e,i){if(s.utils.unwrapObservable(i())){var o=t(e);o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),Mt.detectDropdownVisibility()),i()(!1)}}},s.bindingHandlers.dropdownCloser={init:function(e){t(e).closest(".dropdown").on("click",".e-item",function(){t(e).dropdown("toggle")})}},s.bindingHandlers.popover={init:function(e,i){t(e).popover(s.utils.unwrapObservable(i()))}},s.bindingHandlers.csstext={init:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))},update:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.resizecrop={init:function(e){t(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,s){s()(),t(e).resizecrop({width:"100",height:"100"})}},s.bindingHandlers.onEnter={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&13===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.onEsc={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&27===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.clickOnTrue={update:function(e,i){s.utils.unwrapObservable(i())&&t(e).click()}},s.bindingHandlers.modal={init:function(e,i){t(e).toggleClass("fade",!kt.bMobileDevice).modal({keyboard:!1,show:s.utils.unwrapObservable(i())}).on("shown",function(){Mt.windowResize()}).find(".close").click(function(){i()(!1)})},update:function(e,i){t(e).modal(s.utils.unwrapObservable(i())?"show":"hide")}},s.bindingHandlers.i18nInit={init:function(e){Mt.i18nToNode(e)}},s.bindingHandlers.i18nUpdate={update:function(e,t){s.utils.unwrapObservable(t()),Mt.i18nToNode(e)}},s.bindingHandlers.link={update:function(e,i){t(e).attr("href",s.utils.unwrapObservable(i()))}},s.bindingHandlers.title={update:function(e,i){t(e).attr("title",s.utils.unwrapObservable(i()))}},s.bindingHandlers.textF={init:function(e,i){t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.initDom={init:function(e,t){t()(e)}},s.bindingHandlers.initResizeTrigger={init:function(e,i){var o=s.utils.unwrapObservable(i());t(e).css({height:o[1],"min-height":o[1]})},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=Mt.pInt(o[1]),a=0,r=t(e).offset().top;r>0&&(r+=Mt.pInt(o[2]),a=Gt.height()-r,a>n&&(n=a),t(e).css({height:n,"min-height":n}))}},s.bindingHandlers.appendDom={update:function(e,i){t(e).hide().empty().append(s.utils.unwrapObservable(i())).show()}},s.bindingHandlers.draggable={init:function(i,o,n){if(!kt.bMobileDevice){var a=100,r=3,l=n(),c=l&&l.droppableSelector?l.droppableSelector:"",u={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};c&&(u.drag=function(s){t(c).each(function(){var i=null,o=null,n=t(this),l=n.offset(),c=l.top+n.height();e.clearInterval(n.data("timerScroll")),n.data("timerScroll",!1),s.pageX>=l.left&&s.pageX<=l.left+n.width()&&(s.pageY>=c-a&&s.pageY<=c&&(i=function(){n.scrollTop(n.scrollTop()+r),Mt.windowResize()},n.data("timerScroll",e.setInterval(i,10)),i()),s.pageY>=l.top&&s.pageY<=l.top+a&&(o=function(){n.scrollTop(n.scrollTop()-r),Mt.windowResize()},n.data("timerScroll",e.setInterval(o,10)),o()))})},u.stop=function(){t(c).each(function(){e.clearInterval(t(this).data("timerScroll")),t(this).data("timerScroll",!1)})}),u.helper=function(e){return o()(e&&e.target?s.dataFor(e.target):null)},t(i).draggable(u).on("mousedown",function(){Mt.removeInFocus()})}}},s.bindingHandlers.droppable={init:function(e,s,i){if(!kt.bMobileDevice){var o=s(),n=i(),a=n&&n.droppableOver?n.droppableOver:null,r=n&&n.droppableOut?n.droppableOut:null,l={tolerance:"pointer",hoverClass:"droppableHover"};o&&(l.drop=function(e,t){o(e,t)},a&&(l.over=function(e,t){a(e,t)}),r&&(l.out=function(e,t){r(e,t)}),t(e).droppable(l))}}},s.bindingHandlers.nano={init:function(e){kt.bDisableNanoScroll||t(e).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},s.bindingHandlers.saveTrigger={init:function(e){var s=t(e);s.data("save-trigger-type",s.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===s.data("save-trigger-type")?s.append(' ').addClass("settings-saved-trigger"):s.addClass("settings-saved-trigger-input")},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=t(e);if("custom"===n.data("save-trigger-type"))switch(o.toString()){case"1":n.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":n.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":n.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:n.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(o.toString()){case"1":n.addClass("success").removeClass("error");break;case"0":n.addClass("error").removeClass("success");break;case"-2":break;default:n.removeClass("error success")}}},s.bindingHandlers.emailsTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:n,inputDelimiters:[",",";"],autoCompleteSource:function(e,t){jt.getAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new v,s.mailsoParse(t),s.clearDuplicateName(),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("EmailsTagsValue",e.target.value),o(e.target.value)},this)}),o.subscribe(function(e){i.data("EmailsTagsValue")!==e&&(i.val(e),i.data("EmailsTagsValue",e),i.inputosaurus("refresh"))}),o.focusTrigger&&o.focusTrigger.subscribe(function(e){e&&i.inputosaurus("focus")})}},s.bindingHandlers.contactTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:n,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(e,t){jt.getContactsTagsAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new T,s.name(t),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("ContactsTagsValue",e.target.value),o(e.target.value)},this)}),o.subscribe(function(e){i.data("ContactsTagsValue")!==e&&(i.val(e),i.data("ContactsTagsValue",e),i.inputosaurus("refresh"))}),o.focusTrigger&&o.focusTrigger.subscribe(function(e){e&&i.inputosaurus("focus")})}},s.bindingHandlers.command={init:function(e,i,o,n){var a=t(e),r=i();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");a.addClass("command"),s.bindingHandlers[a.is("form")?"submit":"click"].init.apply(n,arguments)},update:function(e,s){var i=!0,o=t(e),n=s();i=n.enabled(),o.toggleClass("command-not-enabled",!i),i&&(i=n.canExecute(),o.toggleClass("command-can-not-be-execute",!i)),o.toggleClass("command-disabled disable disabled",!i).toggleClass("no-disabled",!!i),(o.is("input")||o.is("button"))&&o.prop("disabled",!i)}},s.extenders.trimmer=function(e){var t=s.computed({read:e,write:function(t){e(Mt.trim(t.toString()))},owner:this});return t(e()),t},s.extenders.posInterer=function(e,t){var i=s.computed({read:e,write:function(s){var i=Mt.pInt(s.toString(),t);0>=i&&(i=t),i===e()&&""+i!=""+s&&e(i+1),e(i)}});return i(e()),i},s.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},s.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},s.extenders.falseTimeout=function(t,s){return t.iTimeout=0,t.subscribe(function(i){i&&(e.clearTimeout(t.iTimeout),t.iTimeout=e.setTimeout(function(){t(!1),t.iTimeout=0},Mt.pInt(s)))}),t},s.observable.fn.validateNone=function(){return this.hasError=s.observable(!1),this},s.observable.fn.validateEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateSimpleEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateFunc=function(e){return this.hasFuncError=s.observable(!1),Mt.isFunc(e)&&(this.subscribe(function(t){this.hasFuncError(!e(t))},this),this.valueHasMutated()),this},u.prototype.root=function(){return this.sBase},u.prototype.attachmentDownload=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.attachmentPreview=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+e},u.prototype.attachmentPreviewAsPlain=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},u.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},u.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},u.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},u.prototype.change=function(t){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+e.encodeURIComponent(t)+"/"},u.prototype.ajax=function(e){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+e},u.prototype.messageViewLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.messageDownloadLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},u.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},u.prototype.settings=function(e){var t=this.sBase+"settings";return Mt.isUnd(e)||""===e||(t+="/"+e),t},u.prototype.admin=function(e){var t=this.sBase;switch(e){case"AdminDomains":t+="domains";break;case"AdminSecurity":t+="security";break;case"AdminLicensing":t+="licensing"}return t},u.prototype.mailBox=function(e,t,s){t=Mt.isNormal(t)?Mt.pInt(t):1,s=Mt.pString(s);var i=this.sBase+"mailbox/";return""!==e&&(i+=encodeURI(e)),t>1&&(i=i.replace(/[\/]+$/,""),i+="/p"+t),""!==s&&(i=i.replace(/[\/]+$/,""),i+="/"+encodeURI(s)),i},u.prototype.phpInfo=function(){return this.sServer+"Info"},u.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},u.prototype.getUserPicUrlFromHash=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+e+"/"+this.sVersion+"/"},u.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},u.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},u.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},u.prototype.emptyFullContactPic=function(){return e.location.protocol+"//"+e.location.hostname+("80"==""+e.location.port||""==""+e.location.port?"":":"+e.location.port)+e.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},u.prototype.sound=function(e){return"rainloop/v/"+this.sVersion+"/static/sounds/"+e},u.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=Mt.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},u.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},u.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},u.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Dt.oViewModelsHooks={},Dt.oSimpleHooks={},Dt.regViewModelHook=function(e,t){t&&(t.__hookName=e)},Dt.addHook=function(e,t){Mt.isFunc(t)&&(Mt.isArray(Dt.oSimpleHooks[e])||(Dt.oSimpleHooks[e]=[]),Dt.oSimpleHooks[e].push(t))},Dt.runHook=function(e,t){Mt.isArray(Dt.oSimpleHooks[e])&&(t=t||[],r.each(Dt.oSimpleHooks[e],function(e){e.apply(null,t)}))},Dt.mainSettingsGet=function(e){return jt?jt.settingsGet(e):null},Dt.remoteRequest=function(e,t,s,i,o,n){jt&&jt.remote().defaultRequest(e,t,s,i,o,n)},Dt.settingsGet=function(e,t){var s=Dt.mainSettingsGet("Plugins");return s=s&&Mt.isUnd(s[e])?null:s[e],s?Mt.isUnd(s[t])?null:s[t]:null},d.prototype.blurTrigger=function(){if(this.fOnBlur){var t=this;e.clearTimeout(t.iBlurTimer),t.iBlurTimer=e.setTimeout(function(){t.fOnBlur()},200)}},d.prototype.focusTrigger=function(){this.fOnBlur&&e.clearTimeout(this.iBlurTimer)},d.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},d.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},d.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},d.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},d.prototype.modeToggle=function(e){this.editor&&(e?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},d.prototype.setHtml=function(e,t){this.editor&&(this.modeToggle(!0),this.editor.setData(e),t&&this.focus())},d.prototype.setPlain=function(e,t){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(e);this.editor.setData(e),t&&this.focus()}},d.prototype.init=function(){if(this.$element&&this.$element[0]){var t=this,s=kt.oHtmlEditorDefaultConfig,i=jt.settingsGet("Language"),o=!!jt.settingsGet("AllowHtmlEditorSourceButton");o&&s.toolbarGroups&&!s.toolbarGroups.__SourceInited&&(s.toolbarGroups.__SourceInited=!0,s.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),s.language=kt.oHtmlEditorLangsMap[i]||"en",e.CKEDITOR.env&&(e.CKEDITOR.env.isCompatible=!0),t.editor=e.CKEDITOR.appendTo(t.$element[0],s),t.editor.on("key",function(e){return e&&e.data&&9===e.data.keyCode?!1:void 0}),t.editor.on("blur",function(){t.blurTrigger()}),t.editor.on("mode",function(){t.blurTrigger(),t.fOnModeChange&&t.fOnModeChange("plain"!==t.editor.mode)}),t.editor.on("focus",function(){t.focusTrigger()}),t.fOnReady&&t.editor.on("instanceReady",function(){t.editor.setKeystroke(e.CKEDITOR.CTRL+65,"selectAll"),t.fOnReady(),t.__resizable=!0,t.resize()})}},d.prototype.focus=function(){this.editor&&this.editor.focus()},d.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},d.prototype.resize=function(){if(this.editor&&this.__resizable)try{this.editor.resize(this.$element.width(),this.$element.innerHeight())}catch(e){}},d.prototype.clear=function(e){this.setHtml("",e)},h.prototype.itemSelected=function(e){this.isListChecked()?e||(this.oCallbacks.onItemSelect||this.emptyFunction)(e||null):e&&(this.oCallbacks.onItemSelect||this.emptyFunction)(e)},h.prototype.goDown=function(e){this.newSelectPosition(It.EventKeyCode.Down,!1,e)},h.prototype.goUp=function(e){this.newSelectPosition(It.EventKeyCode.Up,!1,e)},h.prototype.init=function(e,i,o){if(this.oContentVisible=e,this.oContentScrollable=i,o=o||"all",this.oContentVisible&&this.oContentScrollable){var n=this;t(this.oContentVisible).on("selectstart",function(e){e&&e.preventDefault&&e.preventDefault()}).on("click",this.sItemSelector,function(e){n.actionClick(s.dataFor(this),e)}).on("click",this.sItemCheckedSelector,function(e){var t=s.dataFor(this);t&&(e&&e.shiftKey?n.actionClick(t,e):(n.focusedItem(t),t.checked(!t.checked())))}),c("enter",o,function(){return n.focusedItem()&&!n.focusedItem().selected()?(n.actionClick(n.focusedItem()),!1):!0}),c("ctrl+up, command+up, ctrl+down, command+down",o,function(){return!1}),c("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",o,function(e,t){if(e&&t&&t.shortcut){var s=0;switch(t.shortcut){case"up":case"shift+up":s=It.EventKeyCode.Up;break;case"down":case"shift+down":s=It.EventKeyCode.Down;break;case"insert":s=It.EventKeyCode.Insert;break;case"space":s=It.EventKeyCode.Space;break;case"home":s=It.EventKeyCode.Home;break;case"end":s=It.EventKeyCode.End;break;case"pageup":s=It.EventKeyCode.PageUp;break;case"pagedown":s=It.EventKeyCode.PageDown}if(s>0)return n.newSelectPosition(s,c.shift),!1}})}},h.prototype.autoSelect=function(e){this.bAutoSelect=!!e},h.prototype.getItemUid=function(e){var t="",s=this.oCallbacks.onItemGetUid||null;return s&&e&&(t=s(e)),t.toString()},h.prototype.newSelectPosition=function(e,t,s){var i=0,o=10,n=!1,a=!1,l=null,c=this.list(),u=c?c.length:0,d=this.focusedItem();if(u>0)if(d){if(d)if(It.EventKeyCode.Down===e||It.EventKeyCode.Up===e||It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e)r.each(c,function(t){if(!a)switch(e){case It.EventKeyCode.Up:d===t?a=!0:l=t;break;case It.EventKeyCode.Down:case It.EventKeyCode.Insert:n?(l=t,a=!0):d===t&&(n=!0)}});else if(It.EventKeyCode.Home===e||It.EventKeyCode.End===e)It.EventKeyCode.Home===e?l=c[0]:It.EventKeyCode.End===e&&(l=c[c.length-1]);else if(It.EventKeyCode.PageDown===e){for(;u>i;i++)if(d===c[i]){i+=o,i=i>u-1?u-1:i,l=c[i];break}}else if(It.EventKeyCode.PageUp===e)for(i=u;i>=0;i--)if(d===c[i]){i-=o,i=0>i?0:i,l=c[i];break}}else It.EventKeyCode.Down===e||It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e||It.EventKeyCode.Home===e||It.EventKeyCode.PageUp===e?l=c[0]:(It.EventKeyCode.Up===e||It.EventKeyCode.End===e||It.EventKeyCode.PageDown===e)&&(l=c[c.length-1]);l?(this.focusedItem(l),d&&(t?(It.EventKeyCode.Up===e||It.EventKeyCode.Down===e)&&d.checked(!d.checked()):(It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e)&&d.checked(!d.checked())),!this.bAutoSelect&&!s||this.isListChecked()||It.EventKeyCode.Space===e||this.selectedItem(l),this.scrollToFocused()):d&&(!t||It.EventKeyCode.Up!==e&&It.EventKeyCode.Down!==e?(It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e)&&d.checked(!d.checked()):d.checked(!d.checked()),this.focusedItem(d)) -},h.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var e=20,s=t(this.sItemFocusedSelector,this.oContentScrollable),i=s.position(),o=this.oContentVisible.height(),n=s.outerHeight();return i&&(i.top<0||i.top+n>o)?(this.oContentScrollable.scrollTop(i.top<0?this.oContentScrollable.scrollTop()+i.top-e:this.oContentScrollable.scrollTop()+i.top-o+n+e),!0):!1},h.prototype.scrollToTop=function(e){return this.oContentVisible&&this.oContentScrollable?(e?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},h.prototype.eventClickFunction=function(e,t){var s=this.getItemUid(e),i=0,o=0,n=null,a="",r=!1,l=!1,c=[],u=!1;if(t&&t.shiftKey&&""!==s&&""!==this.sLastUid&&s!==this.sLastUid)for(c=this.list(),u=e.checked(),i=0,o=c.length;o>i;i++)n=c[i],a=this.getItemUid(n),r=!1,(a===this.sLastUid||a===s)&&(r=!0),r&&(l=!l),(l||r)&&n.checked(u);this.sLastUid=""===s?"":s},h.prototype.actionClick=function(e,t){if(e){var s=!0,i=this.getItemUid(e);t&&(!t.shiftKey||t.ctrlKey||t.altKey?!t.ctrlKey||t.shiftKey||t.altKey||(s=!1,this.focusedItem(e),this.selectedItem()&&e!==this.selectedItem()&&this.selectedItem().checked(!0),e.checked(!e.checked())):(s=!1,""===this.sLastUid&&(this.sLastUid=i),e.checked(!e.checked()),this.eventClickFunction(e,t),this.focusedItem(e))),s&&(this.focusedItem(e),this.selectedItem(e))}},h.prototype.on=function(e,t){this.oCallbacks[e]=t},p.supported=function(){return!0},p.prototype.set=function(e,s){var i=t.cookie(Lt.Values.ClientSideCookieIndexName),o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[e]=s,t.cookie(Lt.Values.ClientSideCookieIndexName,JSON.stringify(n),{expires:30}),o=!0}catch(a){}return o},p.prototype.get=function(e){var s=t.cookie(Lt.Values.ClientSideCookieIndexName),i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[e])?i[e]:null}catch(o){}return i},m.supported=function(){return!!e.localStorage},m.prototype.set=function(t,s){var i=e.localStorage[Lt.Values.ClientSideCookieIndexName]||null,o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[t]=s,e.localStorage[Lt.Values.ClientSideCookieIndexName]=JSON.stringify(n),o=!0}catch(a){}return o},m.prototype.get=function(t){var s=e.localStorage[Lt.Values.ClientSideCookieIndexName]||null,i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[t])?i[t]:null}catch(o){}return i},g.prototype.oDriver=null,g.prototype.set=function(e,t){return this.oDriver?this.oDriver.set("p"+e,t):!1},g.prototype.get=function(e){return this.oDriver?this.oDriver.get("p"+e):null},f.prototype.bootstart=function(){},b.prototype.sPosition="",b.prototype.sTemplate="",b.prototype.viewModelName="",b.prototype.viewModelDom=null,b.prototype.viewModelTemplate=function(){return this.sTemplate},b.prototype.viewModelPosition=function(){return this.sPosition},b.prototype.cancelCommand=b.prototype.closeCommand=function(){},b.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=jt.data().keyScope(),jt.data().keyScope(this.sDefaultKeyScope)},b.prototype.restoreKeyScope=function(){jt.data().keyScope(this.sCurrentKeyScope)},b.prototype.registerPopupKeyDown=function(){var e=this;Gt.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&It.EventKeyCode.Esc===t.keyCode)return Mt.delegateRun(e,"cancelCommand"),!1;if(It.EventKeyCode.Backspace===t.keyCode&&!Mt.inFocus())return!1}return!0})},y.prototype.oCross=null,y.prototype.sScreenName="",y.prototype.aViewModels=[],y.prototype.viewModels=function(){return this.aViewModels},y.prototype.screenName=function(){return this.sScreenName},y.prototype.routes=function(){return null},y.prototype.__cross=function(){return this.oCross},y.prototype.__start=function(){var e=this.routes(),t=null,s=null;Mt.isNonEmptyArray(e)&&(s=r.bind(this.onRoute||Mt.emptyFunction,this),t=i.create(),r.each(e,function(e){t.addRoute(e[0],s).rules=e[1]}),this.oCross=t)},S.constructorEnd=function(e){Mt.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},S.prototype.sDefaultScreenName="",S.prototype.oScreens={},S.prototype.oBoot=null,S.prototype.oCurrentScreen=null,S.prototype.hideLoading=function(){t("#rl-loading").hide()},S.prototype.routeOff=function(){o.changed.active=!1},S.prototype.routeOn=function(){o.changed.active=!0},S.prototype.setBoot=function(e){return Mt.isNormal(e)&&(this.oBoot=e),this},S.prototype.screen=function(e){return""===e||Mt.isUnd(this.oScreens[e])?null:this.oScreens[e]},S.prototype.buildViewModel=function(e,i){if(e&&!e.__builded){var o=new e(i),n=o.viewModelPosition(),a=t("#rl-content #rl-"+n.toLowerCase()),l=null;e.__builded=!0,e.__vm=o,o.data=jt.data(),o.viewModelName=e.__name,a&&1===a.length?(l=t("").addClass("rl-view-model").addClass("RL-"+o.viewModelTemplate()).hide(),l.appendTo(a),o.viewModelDom=l,e.__dom=l,"Popups"===n&&(o.cancelCommand=o.closeCommand=Mt.createCommand(o,function(){xt.hideScreenPopup(e)}),o.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),jt.popupVisibilityNames.push(this.viewModelName),o.viewModelDom.css("z-index",3e3+jt.popupVisibilityNames().length+10),Mt.delegateRun(this,"onFocus",[],500)):(Mt.delegateRun(this,"onHide"),this.restoreKeyScope(),jt.popupVisibilityNames.remove(this.viewModelName),o.viewModelDom.css("z-index",2e3),kt.tooltipTrigger(!kt.tooltipTrigger()),r.delay(function(){t.viewModelDom.hide()},300))},o)),Dt.runHook("view-model-pre-build",[e.__name,o,l]),s.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:o.viewModelTemplate()}}},o),Mt.delegateRun(o,"onBuild",[l]),o&&"Popups"===n&&o.registerPopupKeyDown(),Dt.runHook("view-model-post-build",[e.__name,o,l])):Mt.log("Cannot find view model position: "+n)}return e?e.__vm:null},S.prototype.applyExternal=function(e,t){e&&t&&s.applyBindings(e,t)},S.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),Dt.runHook("view-model-on-hide",[e.__name,e.__vm]))},S.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),Mt.delegateRun(e.__vm,"onShow",t||[]),Dt.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},S.prototype.screenOnRoute=function(e,t){var s=this,i=null,o=null;""===Mt.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(i=this.screen(e),i||(i=this.screen(this.sDefaultScreenName),i&&(t=e+"/"+t,e=this.sDefaultScreenName)),i&&i.__started&&(i.__builded||(i.__builded=!0,Mt.isNonEmptyArray(i.viewModels())&&r.each(i.viewModels(),function(e){this.buildViewModel(e,i)},this),Mt.delegateRun(i,"onBuild")),r.defer(function(){s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onHide"),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),Mt.delegateRun(e.__vm,"onHide"))})),s.oCurrentScreen=i,s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onShow"),Dt.runHook("screen-on-show",[s.oCurrentScreen.screenName(),s.oCurrentScreen]),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),Mt.delegateRun(e.__vm,"onShow"),Mt.delegateRun(e.__vm,"onFocus",[],200),Dt.runHook("view-model-on-show",[e.__name,e.__vm]))},s)),o=i.__cross(),o&&o.parse(t)})))},S.prototype.startScreens=function(e){t("#rl-content").css({visibility:"hidden"}),r.each(e,function(e){var t=new e,s=t?t.screenName():"";t&&""!==s&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=s),this.oScreens[s]=t)},this),r.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),Dt.runHook("screen-pre-start",[e.screenName(),e]),Mt.delegateRun(e,"onStart"),Dt.runHook("screen-post-start",[e.screenName(),e]))},this);var s=i.create();s.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,r.bind(this.screenOnRoute,this)),o.initialized.add(s.parse,s),o.changed.add(s.parse,s),o.init(),t("#rl-content").css({visibility:"visible"}),r.delay(function(){Bt.removeClass("rl-started-trigger").addClass("rl-started")},50)},S.prototype.setHash=function(e,t,s){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,s=Mt.isUnd(s)?!1:!!s,(Mt.isUnd(t)?1:!t)?(o.changed.active=!0,o[s?"replaceHash":"setHash"](e),o.setHash(e)):(o.changed.active=!1,o[s?"replaceHash":"setHash"](e),o.changed.active=!0)},S.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},xt=new S,v.newInstanceFromJson=function(e){var t=new v;return t.initByJson(e)?t:null},v.prototype.name="",v.prototype.email="",v.prototype.privateType=null,v.prototype.clear=function(){this.email="",this.name="",this.privateType=null},v.prototype.validate=function(){return""!==this.name||""!==this.email},v.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},v.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},v.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=It.EmailType.Facebook),null===this.privateType&&(this.privateType=It.EmailType.Default)),this.privateType},v.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},v.prototype.parse=function(e){this.clear(),e=Mt.trim(e);var t=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,s=t.exec(e);s?(this.name=s[1]||"",this.email=s[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},v.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=Mt.trim(e.Name),this.email=Mt.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},v.prototype.toLine=function(e,t,s){var i="";return""!==this.email&&(t=Mt.isUnd(t)?!1:!!t,s=Mt.isUnd(s)?!1:!!s,e&&""!==this.name?i=t?'")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(this.name)+"":s?Mt.encodeHtml(this.name):this.name:(i=this.email,""!==this.name?t?i=Mt.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(i)+""+Mt.encodeHtml(">"):(i='"'+this.name+'" <'+i+">",s&&(i=Mt.encodeHtml(i))):t&&(i=''+Mt.encodeHtml(this.email)+""))),i},v.prototype.mailsoParse=function(e){if(e=Mt.trim(e),""===e)return!1;for(var t=function(e,t,s){e+="";var i=e.length;return 0>t&&(t+=i),i="undefined"==typeof s?i:0>s?s+i:s+t,t>=e.length||0>t||t>i?!1:e.slice(t,i)},s=function(e,t,s,i){return 0>s&&(s+=e.length),i=void 0!==i?i:e.length,0>i&&(i=i+e.length-s),e.slice(0,s)+t.substr(0,i)+t.slice(i)+e.slice(s+i)},i="",o="",n="",a=!1,r=!1,l=!1,c=null,u=0,d=0,h=0;h 0&&0===i.length&&(i=t(e,0,h)),r=!0,u=h);break;case">":r&&(d=h,o=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,r=!1);break;case"(":a||r||l||(l=!0,u=h);break;case")":l&&(d=h,n=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,l=!1);break;case"\\":h++}h++}return 0===o.length&&(c=e.match(/[^@\s]+@\S+/i),c&&c[0]?o=c[0]:i=e),o.length>0&&0===i.length&&0===n.length&&(i=e.replace(o,"")),o=Mt.trim(o).replace(/^[<]+/,"").replace(/[>]+$/,""),i=Mt.trim(i).replace(/^["']+/,"").replace(/["']+$/,""),n=Mt.trim(n).replace(/^[(]+/,"").replace(/[)]+$/,""),i=i.replace(/\\\\(.)/,"$1"),n=n.replace(/\\\\(.)/,"$1"),this.name=i,this.email=o,this.clearDuplicateName(),!0},v.prototype.inputoTagLine=function(){return 0 +$/,""),t=!0),t},F.prototype.isImage=function(){return-1 o;o++)i.push(e[o].toLine(t,s));return i.join(", ")},E.initEmailsFromJson=function(e){var t=0,s=0,i=null,o=[];if(Mt.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)i=v.newInstanceFromJson(e[t]),i&&o.push(i);return o},E.replyHelper=function(e,t,s){if(e&&0 i;i++)Mt.isUnd(t[e[i].email])&&(t[e[i].email]=!0,s.push(e[i]))},E.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(It.MessagePriority.Normal),this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isRtl(!1),this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(It.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(It.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},E.prototype.computeSenderEmail=function(){var e=jt.data().sentFolder(),t=jt.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===e||this.folderFullNameRaw===t?this.toEmailsString():this.fromEmailString())},E.prototype.initByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.folderFullNameRaw=e.Folder,this.uid=e.Uid,this.hash=e.Hash,this.requestHash=e.RequestHash,this.size(Mt.pInt(e.Size)),this.from=E.initEmailsFromJson(e.From),this.to=E.initEmailsFromJson(e.To),this.cc=E.initEmailsFromJson(e.Cc),this.bcc=E.initEmailsFromJson(e.Bcc),this.replyTo=E.initEmailsFromJson(e.ReplyTo),this.deliveredTo=E.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),this.dateTimeStampInUTC(Mt.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(E.emailsToLine(this.from,!0)),this.toEmailsString(E.emailsToLine(this.to,!0)),this.parentUid(Mt.pInt(e.ParentThread)),this.threads(Mt.isArray(e.Threads)?e.Threads:[]),this.threadsLen(Mt.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},E.prototype.initUpdateByMessageJson=function(e){var t=!1,s=It.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(s=Mt.pInt(e.Priority),this.priority(-1 t;t++)i=F.newInstanceFromJson(e["@Collection"][t]),i&&(""!==i.cidWithOutTags&&0 +$/,""),t=r.find(s,function(t){return e===t.cidWithOutTags})),t||null},E.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return Mt.isNonEmptyArray(s)&&(t=r.find(s,function(t){return e===t.contentLocation})),t||null},E.prototype.messageId=function(){return this.sMessageId},E.prototype.inReplyTo=function(){return this.sInReplyTo},E.prototype.references=function(){return this.sReferences},E.prototype.fromAsSingleEmail=function(){return Mt.isArray(this.from)&&this.from[0]?this.from[0].email:""},E.prototype.viewLink=function(){return jt.link().messageViewLink(this.requestHash)},E.prototype.downloadLink=function(){return jt.link().messageDownloadLink(this.requestHash)},E.prototype.replyEmails=function(e){var t=[],s=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,s,t),0===t.length&&E.replyHelper(this.from,s,t),t},E.prototype.replyAllEmails=function(e){var t=[],s=[],i=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,i,t),0===t.length&&E.replyHelper(this.from,i,t),E.replyHelper(this.to,i,t),E.replyHelper(this.cc,i,s),[t,s]},E.prototype.textBodyToString=function(){return this.body?this.body.html():""},E.prototype.attachmentsToStringLine=function(){var e=r.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0 =0&&o&&!n&&i.attr("src",o)}),s&&e.setTimeout(function(){i.print()},100))})},E.prototype.printMessage=function(){this.viewPopupMessage(!0)},E.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},E.prototype.populateByMessageListItem=function(e){return this.folderFullNameRaw=e.folderFullNameRaw,this.uid=e.uid,this.hash=e.hash,this.requestHash=e.requestHash,this.subject(e.subject()),this.size(e.size()),this.dateTimeStampInUTC(e.dateTimeStampInUTC()),this.priority(e.priority()),this.fromEmailString(e.fromEmailString()),this.toEmailsString(e.toEmailsString()),this.emails=e.emails,this.from=e.from,this.to=e.to,this.cc=e.cc,this.bcc=e.bcc,this.replyTo=e.replyTo,this.deliveredTo=e.deliveredTo,this.unseen(e.unseen()),this.flagged(e.flagged()),this.answered(e.answered()),this.forwarded(e.forwarded()),this.isReadReceipt(e.isReadReceipt()),this.selected(e.selected()),this.checked(e.checked()),this.hasAttachments(e.hasAttachments()),this.attachmentsMainType(e.attachmentsMainType()),this.moment(e.moment()),this.body=null,this.priority(It.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(e.parentUid()),this.threads(e.threads()),this.threadsLen(e.threadsLen()),this.computeSenderEmail(),this},E.prototype.showExternalImages=function(e){this.body&&this.body.data("rl-has-images")&&(e=Mt.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),t("[data-x-src]",this.body).each(function(){e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",t(this).attr("data-x-src")).removeAttr("data-x-src"):t(this).attr("src",t(this).attr("data-x-src")).removeAttr("data-x-src")}),t("[data-x-style-url]",this.body).each(function(){var e=Mt.trim(t(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+t(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),e&&(t("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t(".RL-MailMessageView .messageView .messageItem .content")[0]}),Gt.resize()),Mt.windowResize(500))},E.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=Mt.isUnd(e)?!1:e;var s=this;t("[data-x-src-cid]",this.body).each(function(){var i=s.findAttachmentByCid(t(this).attr("data-x-src-cid"));i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-src-location]",this.body).each(function(){var i=s.findAttachmentByContentLocation(t(this).attr("data-x-src-location"));i||(i=s.findAttachmentByCid(t(this).attr("data-x-src-location"))),i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-style-cid]",this.body).each(function(){var e="",i="",o=s.findAttachmentByCid(t(this).attr("data-x-style-cid"));o&&o.linkPreview&&(i=t(this).attr("data-x-style-cid-name"),""!==i&&(e=Mt.trim(t(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+i+": url('"+o.linkPreview()+"')")))}),e&&!function(e,t){r.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(t("img.lazy",s.body),t(".RL-MailMessageView .messageView .messageItem .content")[0]),Mt.windowResize(500)}},E.prototype.storeDataToDom=function(){this.body&&(this.body.data("rl-is-rtl",!!this.isRtl()),this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw),jt.data().capaOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser())))},E.prototype.storePgpVerifyDataToDom=function(){this.body&&jt.data().capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},E.prototype.fetchDataToDom=function(){this.body&&(this.isRtl(!!this.body.data("rl-is-rtl")),this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=Mt.pString(this.body.data("rl-plain-raw")),jt.data().capaOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(It.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},E.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var s=[],i=null,o=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",n=jt.data().findPublicKeysByEmail(o),a=null,l=null,c="";this.pgpSignedVerifyStatus(It.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{i=e.openpgp.cleartext.readArmored(this.plainRaw),i&&i.getText&&(this.pgpSignedVerifyStatus(n.length?It.SignedVerifyStatus.Unverified:It.SignedVerifyStatus.UnknownPublicKeys),s=i.verify(n),s&&0 ').text(c)).html(),zt.empty(),this.replacePlaneTextBody(c)))))}catch(u){}this.storePgpVerifyDataToDom()}},E.prototype.decryptPgpEncryptedMessage=function(s){if(this.isPgpEncrypted()){var i=[],o=null,n=null,a=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",l=jt.data().findPublicKeysByEmail(a),c=jt.data().findSelfPrivateKey(s),u=null,d=null,h="";this.pgpSignedVerifyStatus(It.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),c||this.pgpSignedVerifyStatus(It.SignedVerifyStatus.UnknownPrivateKey);try{o=e.openpgp.message.readArmored(this.plainRaw),o&&c&&o.decrypt&&(this.pgpSignedVerifyStatus(It.SignedVerifyStatus.Unverified),n=o.decrypt(c),n&&(i=n.verify(l),i&&0 ').text(h)).html(),zt.empty(),this.replacePlaneTextBody(h)))}catch(p){}this.storePgpVerifyDataToDom()}},E.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},E.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},N.newInstanceFromJson=function(e){var t=new N;return t.initByJson(e)?t.initComputed():null},N.prototype.initComputed=function(){return this.hasSubScribedSubfolders=s.computed(function(){return!!r.find(this.subFolders(),function(e){return e.subScribed()&&!e.isSystemFolder() +return e||t||s||i},this),this.foldersInboxUnreadCount=s.observable(0),this.currentFolder=s.observable(null).extend({toggleSubscribe:[null,function(e){e&&e.selected(!1)},function(e){e&&e.selected(!0)}]}),this.currentFolderFullNameRaw=s.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=s.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=s.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=s.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=s.computed(function(){var e=["INBOX"],t=this.folderList(),s=this.sentFolder(),i=this.draftFolder(),o=this.spamFolder(),n=this.trashFolder(),a=this.archiveFolder();return Mt.isArray(t)&&0 =e?1:e},this),this.mainMessageListSearch=s.computed({read:this.messageListSearch,write:function(e){xt.setHash(jt.link().mailBox(this.currentFolderFullNameHash(),1,Mt.trim(e.toString())))},owner:this}),this.messageListError=s.observable(""),this.messageListLoading=s.observable(!1),this.messageListIsNotCompleted=s.observable(!1),this.messageListCompleteLoadingThrottle=s.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=s.computed(function(){var e=this.messageListLoading(),t=this.messageListIsNotCompleted();return e||t},this),this.messageListCompleteLoading.subscribe(function(e){this.messageListCompleteLoadingThrottle(e)},this),this.messageList.subscribe(r.debounce(function(e){r.each(e,function(e){e.newForAnimation()&&e.newForAnimation(!1)})},500)),this.staticMessageList=new E,this.message=s.observable(null),this.messageLoading=s.observable(!1),this.messageLoadingThrottle=s.observable(!1).extend({throttle:50}),this.message.focused=s.observable(!1),this.message.subscribe(function(t){t?It.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.hideMessageBodies(),It.Layout.NoPreview===jt.data().layout()&&-1 0?Math.ceil(t/e*100):0},this),this.capaOpenPGP=s.observable(!1),this.openpgpkeys=s.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(e){return!(!e||e.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(e){return!(!e||!e.isPrivate)}),this.googleActions=s.observable(!1),this.googleLoggined=s.observable(!1),this.googleUserName=s.observable(""),this.facebookActions=s.observable(!1),this.facebookLoggined=s.observable(!1),this.facebookUserName=s.observable(""),this.twitterActions=s.observable(!1),this.twitterLoggined=s.observable(!1),this.twitterUserName=s.observable(""),this.customThemeType=s.observable(It.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=r.throttle(this.purgeMessageBodyCache,3e4)}function St(){this.oRequests={}}function vt(){St.call(this),this.oRequests={}}function Ct(){this.oEmailsPicsHashes={},this.oServices={},this.bCapaGravatar=jt.capa(It.Capa.Gravatar)}function wt(){Ct.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function Tt(e){y.call(this,"settings",e),this.menu=s.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function Ft(){y.call(this,"login",[$])}function At(){y.call(this,"mailbox",[Q,et,tt,st]),this.oLastRoute={}}function Et(){Tt.call(this,[Z,it,ot]),Mt.initOnStartOrLangChange(function(){this.sSettingsTitle=Mt.i18n("TITLES/SETTINGS")},this,function(){jt.setTitle(this.sSettingsTitle)})}function Nt(){f.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=s.observableArray([]),this.popupVisibility=s.computed(function(){return 0 ').appendTo("body"),Gt.on("error",function(e){jt&&e&&e.originalEvent&&e.originalEvent.message&&-1===Mt.inArray(e.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&jt.remote().jsError(Mt.emptyFunction,e.originalEvent.message,e.originalEvent.filename,e.originalEvent.lineno,location&&location.toString?location.toString():"",Bt.attr("class"),Mt.microtime()-kt.now)}),Kt.on("keydown",function(e){e&&e.ctrlKey&&Bt.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&Bt.removeClass("rl-ctrl-key-pressed")})}function Rt(){Nt.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=r.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=r.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=r.debounce(this.messagesMoveTrigger,500),e.setInterval(function(){jt.pub("interval.30s")},3e4),e.setInterval(function(){jt.pub("interval.1m")},6e4),e.setInterval(function(){jt.pub("interval.2m")},12e4),e.setInterval(function(){jt.pub("interval.3m")},18e4),e.setInterval(function(){jt.pub("interval.5m")},3e5),e.setInterval(function(){jt.pub("interval.10m")},6e5),e.setTimeout(function(){e.setInterval(function(){jt.pub("interval.10m-after5m")},6e5)},3e5),t.wakeUp(function(){jt.remote().jsVersion(function(t,s){It.StorageResultType.Success===t&&s&&!s.Result&&(e.parent&&jt.settingsGet("InIframe")?e.parent.location.reload():e.location.reload())},jt.settingsGet("Version"))},{},36e5)}var Lt={},It={},Pt={},Mt={},Dt={},Ot={},kt={},_t={settings:[],"settings-removed":[],"settings-disabled":[]},Ut=[],xt=null,Vt=e.rainloopAppData||{},Ht=e.rainloopI18N||{},Bt=t("html"),Gt=t(e),Kt=t(e.document),qt=e.Notification&&e.Notification.requestPermission?e.Notification:null,jt=null,zt=t("");kt.now=(new Date).getTime(),kt.momentTrigger=s.observable(!0),kt.dropdownVisibility=s.observable(!1).extend({rateLimit:0}),kt.tooltipTrigger=s.observable(!1).extend({rateLimit:0}),kt.langChangeTrigger=s.observable(!0),kt.iAjaxErrorCount=0,kt.iTokenErrorCount=0,kt.iMessageBodyCacheCount=0,kt.bUnload=!1,kt.sUserAgent=(navigator.userAgent||"").toLowerCase(),kt.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},Mt.splitPlainText=function(e,t){var s="",i="",o=e,n=0,a=0;for(t=Mt.isUnd(t)?100:t;o.length>t;)i=o.substring(0,t),n=i.lastIndexOf(" "),a=i.lastIndexOf("\n"),-1!==a&&(n=a),-1===n&&(n=t),s+=i.substring(0,n)+"\n",o=o.substring(n+1);return s+o},Mt.timeOutAction=function(){var t={};return function(s,i,o){Mt.isUnd(t[s])&&(t[s]=0),e.clearTimeout(t[s]),t[s]=e.setTimeout(i,o)}}(),Mt.timeOutActionSecond=function(){var t={};return function(s,i,o){t[s]||(t[s]=e.setTimeout(function(){i(),t[s]=0},o))}}(),Mt.audio=function(){var t=!1;return function(s,i){if(!1===t)if(kt.bIsiOSDevice)t=null;else{var o=!1,n=!1,a=e.Audio?new e.Audio:null;a&&a.canPlayType&&a.play?(o=""!==a.canPlayType('audio/mpeg; codecs="mp3"'),o||(n=""!==a.canPlayType('audio/ogg; codecs="vorbis"')),o||n?(t=a,t.preload="none",t.loop=!1,t.autoplay=!1,t.muted=!1,t.src=o?s:i):t=null):t=null}return t}}(),Mt.hos=function(e,t){return e&&Object.hasOwnProperty?Object.hasOwnProperty.call(e,t):!1},Mt.i18n=function(e,t,s){var i="",o=Mt.isUnd(Ht[e])?Mt.isUnd(s)?e:s:Ht[e];if(!Mt.isUnd(t)&&!Mt.isNull(t))for(i in t)Mt.hos(t,i)&&(o=o.replace("%"+i+"%",t[i]));return o},Mt.i18nToNode=function(e){r.defer(function(){t(".i18n",e).each(function(){var e=t(this),s="";s=e.data("i18n-text"),s?e.text(Mt.i18n(s)):(s=e.data("i18n-html"),s&&e.html(Mt.i18n(s)),s=e.data("i18n-placeholder"),s&&e.attr("placeholder",Mt.i18n(s)),s=e.data("i18n-title"),s&&e.attr("title",Mt.i18n(s)))})})},Mt.i18nToDoc=function(){e.rainloopI18N&&(Ht=e.rainloopI18N||{},Mt.i18nToNode(Kt),kt.langChangeTrigger(!kt.langChangeTrigger())),e.rainloopI18N={}},Mt.initOnStartOrLangChange=function(e,t,s){e&&e.call(t),s?kt.langChangeTrigger.subscribe(function(){e&&e.call(t),s.call(t)}):e&&kt.langChangeTrigger.subscribe(e,t)},Mt.inFocus=function(){return document.activeElement?(Mt.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=t(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},Mt.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var e=t(document.activeElement);e.is("input,textarea")&&document.activeElement.blur()}},Mt.removeSelection=function(){if(e&&e.getSelection){var t=e.getSelection();t&&t.removeAllRanges&&t.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},Mt.replySubjectAdd=function(t,s,i){var o=null,n=Mt.trim(s);return n=null===(o=new e.RegExp("^"+t+"[\\s]?\\:(.*)$","gi").exec(s))||Mt.isUnd(o[1])?null===(o=new e.RegExp("^("+t+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(s))||Mt.isUnd(o[1])||Mt.isUnd(o[2])||Mt.isUnd(o[3])?t+": "+s:o[1]+(Mt.pInt(o[2])+1)+o[3]:t+"[2]: "+o[1],n=n.replace(/[\s]+/g," "),n=(Mt.isUnd(i)?!0:i)?Mt.fixLongSubject(n):n},Mt.fixLongSubject=function(e){var t=0,s=null;e=Mt.trim(e.replace(/[\s]+/," "));do s=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!s||Mt.isUnd(s[0]))&&(s=null),s&&(t=0,t+=Mt.isUnd(s[2])?1:0+Mt.pInt(s[2]),t+=Mt.isUnd(s[4])?1:0+Mt.pInt(s[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(s);return e=e.replace(/[\s]+/," ")},Mt.roundNumber=function(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)},Mt.friendlySize=function(e){return e=Mt.pInt(e),e>=1073741824?Mt.roundNumber(e/1073741824,1)+"GB":e>=1048576?Mt.roundNumber(e/1048576,1)+"MB":e>=1024?Mt.roundNumber(e/1024,0)+"KB":e+"B"},Mt.log=function(t){e.console&&e.console.log&&e.console.log(t)},Mt.getNotification=function(e,t){return e=Mt.pInt(e),It.Notification.ClientViewError===e&&t?t:Mt.isUnd(Pt[e])?"":Pt[e]},Mt.initNotificationLanguage=function(){Pt[It.Notification.InvalidToken]=Mt.i18n("NOTIFICATIONS/INVALID_TOKEN"),Pt[It.Notification.AuthError]=Mt.i18n("NOTIFICATIONS/AUTH_ERROR"),Pt[It.Notification.AccessError]=Mt.i18n("NOTIFICATIONS/ACCESS_ERROR"),Pt[It.Notification.ConnectionError]=Mt.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Pt[It.Notification.CaptchaError]=Mt.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Pt[It.Notification.SocialFacebookLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Pt[It.Notification.SocialTwitterLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Pt[It.Notification.SocialGoogleLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Pt[It.Notification.DomainNotAllowed]=Mt.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Pt[It.Notification.AccountNotAllowed]=Mt.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Pt[It.Notification.AccountTwoFactorAuthRequired]=Mt.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Pt[It.Notification.AccountTwoFactorAuthError]=Mt.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Pt[It.Notification.CouldNotSaveNewPassword]=Mt.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Pt[It.Notification.CurrentPasswordIncorrect]=Mt.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Pt[It.Notification.NewPasswordShort]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Pt[It.Notification.NewPasswordWeak]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Pt[It.Notification.NewPasswordForbidden]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Pt[It.Notification.ContactsSyncError]=Mt.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Pt[It.Notification.CantGetMessageList]=Mt.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Pt[It.Notification.CantGetMessage]=Mt.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Pt[It.Notification.CantDeleteMessage]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Pt[It.Notification.CantMoveMessage]=Mt.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Pt[It.Notification.CantCopyMessage]=Mt.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Pt[It.Notification.CantSaveMessage]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Pt[It.Notification.CantSendMessage]=Mt.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Pt[It.Notification.InvalidRecipients]=Mt.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Pt[It.Notification.CantCreateFolder]=Mt.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Pt[It.Notification.CantRenameFolder]=Mt.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Pt[It.Notification.CantDeleteFolder]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Pt[It.Notification.CantDeleteNonEmptyFolder]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Pt[It.Notification.CantSubscribeFolder]=Mt.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Pt[It.Notification.CantUnsubscribeFolder]=Mt.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Pt[It.Notification.CantSaveSettings]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Pt[It.Notification.CantSavePluginSettings]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Pt[It.Notification.DomainAlreadyExists]=Mt.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Pt[It.Notification.CantInstallPackage]=Mt.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Pt[It.Notification.CantDeletePackage]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Pt[It.Notification.InvalidPluginPackage]=Mt.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Pt[It.Notification.UnsupportedPluginPackage]=Mt.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Pt[It.Notification.LicensingServerIsUnavailable]=Mt.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Pt[It.Notification.LicensingExpired]=Mt.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Pt[It.Notification.LicensingBanned]=Mt.i18n("NOTIFICATIONS/LICENSING_BANNED"),Pt[It.Notification.DemoSendMessageError]=Mt.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Pt[It.Notification.AccountAlreadyExists]=Mt.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Pt[It.Notification.MailServerError]=Mt.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Pt[It.Notification.UnknownNotification]=Mt.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Pt[It.Notification.UnknownError]=Mt.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Mt.getUploadErrorDescByCode=function(e){var t="";switch(Mt.pInt(e)){case It.UploadErrorCode.FileIsTooBig:t=Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case It.UploadErrorCode.FilePartiallyUploaded:t=Mt.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case It.UploadErrorCode.FileNoUploaded:t=Mt.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case It.UploadErrorCode.MissingTempFolder:t=Mt.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case It.UploadErrorCode.FileOnSaveingError:t=Mt.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case It.UploadErrorCode.FileType:t=Mt.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=Mt.i18n("UPLOAD/ERROR_UNKNOWN")}return t},Mt.delegateRun=function(e,t,s,i){e&&e[t]&&(i=Mt.pInt(i),0>=i?e[t].apply(e,Mt.isArray(s)?s:[]):r.delay(function(){e[t].apply(e,Mt.isArray(s)?s:[])},i))},Mt.killCtrlAandS=function(t){if(t=t||e.event,t&&t.ctrlKey&&!t.shiftKey&&!t.altKey){var s=t.target||t.srcElement,i=t.keyCode||t.which;if(i===It.EventKeyCode.S)return void t.preventDefault();if(s&&s.tagName&&s.tagName.match(/INPUT|TEXTAREA/i))return;i===It.EventKeyCode.A&&(e.getSelection?e.getSelection().removeAllRanges():e.document.selection&&e.document.selection.clear&&e.document.selection.clear(),t.preventDefault())}},Mt.createCommand=function(e,t,i){var o=t?function(){return o.canExecute&&o.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=s.observable(!0),i=Mt.isUnd(i)?!0:i,o.canExecute=s.computed(Mt.isFunc(i)?function(){return o.enabled()&&i.call(e)}:function(){return o.enabled()&&!!i}),o},Mt.initDataConstructorBySettings=function(t){t.editorDefaultType=s.observable(It.EditorDefaultType.Html),t.showImages=s.observable(!1),t.interfaceAnimation=s.observable(It.InterfaceAnimation.Full),t.contactsAutosave=s.observable(!1),kt.sAnimationType=It.InterfaceAnimation.Full,t.capaThemes=s.observable(!1),t.allowLanguagesOnSettings=s.observable(!0),t.allowLanguagesOnLogin=s.observable(!0),t.useLocalProxyForExternalImages=s.observable(!1),t.desktopNotifications=s.observable(!1),t.useThreads=s.observable(!0),t.replySameFolder=s.observable(!0),t.useCheckboxesInList=s.observable(!0),t.layout=s.observable(It.Layout.SidePreview),t.usePreviewPane=s.computed(function(){return It.Layout.NoPreview!==t.layout()}),t.interfaceAnimation.subscribe(function(e){if(kt.bMobileDevice||e===It.InterfaceAnimation.None)Bt.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),kt.sAnimationType=It.InterfaceAnimation.None;else switch(e){case It.InterfaceAnimation.Full:Bt.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),kt.sAnimationType=e;break;case It.InterfaceAnimation.Normal:Bt.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),kt.sAnimationType=e}}),t.interfaceAnimation.valueHasMutated(),t.desktopNotificationsPermisions=s.computed(function(){t.desktopNotifications();var s=It.DesktopNotifications.NotSupported;if(qt&&qt.permission)switch(qt.permission.toLowerCase()){case"granted":s=It.DesktopNotifications.Allowed;break;case"denied":s=It.DesktopNotifications.Denied;break;case"default":s=It.DesktopNotifications.NotAllowed}else e.webkitNotifications&&e.webkitNotifications.checkPermission&&(s=e.webkitNotifications.checkPermission());return s}),t.useDesktopNotifications=s.computed({read:function(){return t.desktopNotifications()&&It.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()},write:function(e){if(e){var s=t.desktopNotificationsPermisions();It.DesktopNotifications.Allowed===s?t.desktopNotifications(!0):It.DesktopNotifications.NotAllowed===s?qt.requestPermission(function(){t.desktopNotifications.valueHasMutated(),It.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()?t.desktopNotifications()?t.desktopNotifications.valueHasMutated():t.desktopNotifications(!0):t.desktopNotifications()?t.desktopNotifications(!1):t.desktopNotifications.valueHasMutated()}):t.desktopNotifications(!1)}else t.desktopNotifications(!1)}}),t.language=s.observable(""),t.languages=s.observableArray([]),t.mainLanguage=s.computed({read:t.language,write:function(e){e!==t.language()?-1 =t.diff(s,"hours")?i:t.format("L")===s.format("L")?Mt.i18n("MESSAGE_LIST/TODAY_AT",{TIME:s.format("LT")}):t.clone().subtract("days",1).format("L")===s.format("L")?Mt.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:s.format("LT")}):s.format(t.year()===s.year()?"D MMM.":"LL")},e)},Mt.isFolderExpanded=function(e){var t=jt.local().get(It.ClientSideKeyName.ExpandedFolders);return r.isArray(t)&&-1!==r.indexOf(t,e)},Mt.setExpandedFolder=function(e,t){var s=jt.local().get(It.ClientSideKeyName.ExpandedFolders);r.isArray(s)||(s=[]),t?(s.push(e),s=r.uniq(s)):s=r.without(s,e),jt.local().set(It.ClientSideKeyName.ExpandedFolders,s)},Mt.initLayoutResizer=function(e,s,i){var o=60,n=155,a=t(e),r=t(s),l=jt.local().get(i)||null,c=function(e){e&&(a.css({width:""+e+"px"}),r.css({left:""+e+"px"}))},u=function(e){if(e)a.resizable("disable"),c(o);else{a.resizable("enable");var t=Mt.pInt(jt.local().get(i))||n;c(t>n?t:n)}},d=function(e,t){t&&t.size&&t.size.width&&(jt.local().set(i,t.size.width),r.css({left:""+t.size.width+"px"}))};null!==l&&c(l>n?l:n),a.resizable({helper:"ui-resizable-helper",minWidth:n,maxWidth:350,handles:"e",stop:d}),jt.sub("left-panel.off",function(){u(!0)}),jt.sub("left-panel.on",function(){u(!1)})},Mt.initBlockquoteSwitcher=function(e){if(e){var s=t("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===t(this).parent().closest("blockquote",e).length});s&&0 100)&&(e.addClass("rl-bq-switcher hidden-bq"),t('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),Mt.windowResize() +}).after("
").before("
"))})}},Mt.removeBlockquoteSwitcher=function(e){e&&(t(e).find("blockquote.rl-bq-switcher").each(function(){t(this).removeClass("rl-bq-switcher hidden-bq")}),t(e).find(".rlBlockquoteSwitcher").each(function(){t(this).remove()}))},Mt.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},Mt.extendAsViewModel=function(e,t,s){t&&(s||(s=b),t.__name=e,Dt.regViewModelHook(e,t),r.extend(t.prototype,s.prototype))},Mt.addSettingsViewModel=function(e,t,s,i,o){e.__rlSettingsData={Label:s,Template:t,Route:i,IsDefault:!!o},_t.settings.push(e)},Mt.removeSettingsViewModel=function(e){_t["settings-removed"].push(e)},Mt.disableSettingsViewModel=function(e){_t["settings-disabled"].push(e)},Mt.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=Mt.trim(e.substring(0,e.length-7))),Mt.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Mt.quoteName=function(e){return e.replace(/["]/g,'\\"')},Mt.microtime=function(){return(new Date).getTime()},Mt.convertLangName=function(e,t){return Mt.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},Mt.fakeMd5=function(e){var t="",s="0123456789abcdefghijklmnopqrstuvwxyz";for(e=Mt.isUnd(e)?32:Mt.pInt(e);t.length>>32-t}function s(e,t){var s,i,o,n,a;return o=2147483648&e,n=2147483648&t,s=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t),s&i?2147483648^a^o^n:s|i?1073741824&a?3221225472^a^o^n:1073741824^a^o^n:a^o^n}function i(e,t,s){return e&t|~e&s}function o(e,t,s){return e&s|t&~s}function n(e,t,s){return e^t^s}function a(e,t,s){return t^(e|~s)}function r(e,o,n,a,r,l,c){return e=s(e,s(s(i(o,n,a),r),c)),s(t(e,l),o)}function l(e,i,n,a,r,l,c){return e=s(e,s(s(o(i,n,a),r),c)),s(t(e,l),i)}function c(e,i,o,a,r,l,c){return e=s(e,s(s(n(i,o,a),r),c)),s(t(e,l),i)}function u(e,i,o,n,r,l,c){return e=s(e,s(s(a(i,o,n),r),c)),s(t(e,l),i)}function d(e){for(var t,s=e.length,i=s+8,o=(i-i%64)/64,n=16*(o+1),a=Array(n-1),r=0,l=0;s>l;)t=(l-l%4)/4,r=l%4*8,a[t]=a[t]|e.charCodeAt(l)< >>29,a}function h(e){var t,s,i="",o="";for(s=0;3>=s;s++)t=e>>>8*s&255,o="0"+t.toString(16),i+=o.substr(o.length-2,2);return i}function p(e){e=e.replace(/rn/g,"n");for(var t="",s=0;s i?t+=String.fromCharCode(i):i>127&&2048>i?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t}var m,g,f,b,y,S,v,C,w,T=Array(),F=7,A=12,E=17,N=22,R=5,L=9,I=14,P=20,M=4,D=11,O=16,k=23,_=6,U=10,x=15,V=21;for(e=p(e),T=d(e),S=1732584193,v=4023233417,C=2562383102,w=271733878,m=0;m /g,">").replace(/")},Mt.draggeblePlace=function(){return t(' ').appendTo("#rl-hidden")},Mt.defautOptionsAfterRender=function(e,s){s&&!Mt.isUnd(s.disabled)&&e&&t(e).toggleClass("disabled",s.disabled).prop("disabled",s.disabled)},Mt.windowPopupKnockout=function(s,i,o,n){var a=null,r=e.open(""),l="__OpenerApplyBindingsUid"+Mt.fakeMd5()+"__",c=t("#"+i);e[l]=function(){if(r&&r.document.body&&c&&c[0]){var i=t(r.document.body);t("#rl-content",i).html(c.html()),t("html",r.document).addClass("external "+t("html").attr("class")),Mt.i18nToNode(i),S.prototype.applyExternal(s,t("#rl-content",i)[0]),e[l]=null,n(r)}},r.document.open(),r.document.write(''+Mt.encodeHtml(o)+' '),r.document.close(),a=r.document.createElement("script"),a.type="text/javascript",a.innerHTML="if(window&&window.opener&&window.opener['"+l+"']){window.opener['"+l+"']();window.opener['"+l+"']=null}",r.document.getElementsByTagName("head")[0].appendChild(a)},Mt.settingsSaveHelperFunction=function(e,t,s,i){return s=s||null,i=Mt.isUnd(i)?1e3:Mt.pInt(i),function(o,n,a,l,c){t.call(s,n&&n.Result?It.SaveSettingsStep.TrueResult:It.SaveSettingsStep.FalseResult),e&&e.call(s,o,n,a,l,c),r.delay(function(){t.call(s,It.SaveSettingsStep.Idle)},i)}},Mt.settingsSaveHelperSimpleFunction=function(e,t){return Mt.settingsSaveHelperFunction(null,e,t,1e3)},Mt.htmlToPlain=function(e){var s="",i="> ",o=function(){if(arguments&&1\n",e.replace(/\n([> ]+)/gm,function(){return arguments&&1 ]*>(.|[\s\S\r\n]*)<\/div>/gim,n),e="\n"+t.trim(e)+"\n"),e}return""},a=function(){return arguments&&1 /g,">"):""},r=function(){if(arguments&&1 /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(/
]*>/gim,"\n_______________________________\n\n").replace(/]*>/gim,"").replace(/]*>(.|[\s\S\r\n]*)<\/div>/gim,n).replace(/").addClass("rl-settings-view-model").hide(),l.appendTo(a),o.data=jt.data(),o.viewModelDom=l,o.__rlSettingsData=n.__rlSettingsData,n.__dom=l,n.__builded=!0,n.__vm=o,s.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:n.__rlSettingsData.Template}}},o),Mt.delegateRun(o,"onBuild",[l])):Mt.log("Cannot find sub settings view model position: SettingsSubScreen")),o&&r.defer(function(){i.oCurrentSubScreen&&(Mt.delegateRun(i.oCurrentSubScreen,"onHide"),i.oCurrentSubScreen.viewModelDom.hide()),i.oCurrentSubScreen=o,i.oCurrentSubScreen&&(i.oCurrentSubScreen.viewModelDom.show(),Mt.delegateRun(i.oCurrentSubScreen,"onShow"),Mt.delegateRun(i.oCurrentSubScreen,"onFocus",[],200),r.each(i.menu(),function(e){e.selected(o&&o.__rlSettingsData&&e.route===o.__rlSettingsData.Route)}),t("#rl-content .b-settings .b-content .content").scrollTop(0)),Mt.windowResize()})):xt.setHash(jt.link().settings(),!1,!0)},Tt.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Mt.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide()) +},e.fullNameRaw,t),jt.cache().removeFolderFromCacheList(e.fullNameRaw),e.name(t)),e.edited(!1)},mt.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},mt.prototype.onShow=function(){jt.data().foldersListError("")},mt.prototype.createFolder=function(){xt.showScreenPopup(k)},mt.prototype.systemFolder=function(){xt.showScreenPopup(_)},mt.prototype.deleteFolder=function(e){if(e&&e.canBeDeleted()&&e.deleteAccess()&&0===e.privateMessageCountAll()){this.folderForDeletion(null);var t=function(s){return e===s?!0:(s.subFolders.remove(t),!1)};e&&(jt.local().set(It.ClientSideKeyName.FoldersLashHash,""),jt.data().folderList.remove(t),jt.data().foldersDeleting(!0),jt.remote().folderDelete(function(e,t){jt.data().foldersDeleting(!1),It.StorageResultType.Success===e&&t&&t.Result||jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),jt.folders()},e.fullNameRaw),jt.cache().removeFolderFromCacheList(e.fullNameRaw))}else 0]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,r).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),s.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,o).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Mt.plainToHtml=function(e){return e.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Mt.resizeAndCrop=function(t,s,i){var o=new e.Image;o.onload=function(){var e=[0,0],t=document.createElement("canvas"),o=t.getContext("2d");t.width=s,t.height=s,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],o.fillStyle="#fff",o.fillRect(0,0,s,s),o.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,s,s),i(t.toDataURL("image/jpeg"))},o.src=t},Mt.computedPagenatorHelper=function(e,t){return function(){var s=0,i=0,o=2,n=[],a=e(),r=t(),l=function(e,t,s){var i={current:e===a,name:Mt.isUnd(s)?e.toString():s.toString(),custom:Mt.isUnd(s)?!1:!0,title:Mt.isUnd(s)?"":e.toString(),value:e.toString()};(Mt.isUnd(t)?0:!t)?n.unshift(i):n.push(i)};if(r>1||r>0&&a>r){for(a>r?(l(r),s=r,i=r):((3>=a||a>=r-2)&&(o+=2),l(a),s=a,i=a);o>0;)if(s-=1,i+=1,s>0&&(l(s,!1),o--),r>=i)l(i,!0),o--;else if(0>=s)break;3===s?l(2,!1):s>3&&l(Math.round((s-1)/2),!1,"..."),r-2===i?l(r-1,!0):r-2>i&&l(Math.round((r+i)/2),!0,"..."),s>1&&l(1,!1),r>i&&l(r,!0)}return n}},Mt.selectElement=function(t){if(e.getSelection){var s=e.getSelection();s.removeAllRanges();var i=document.createRange();i.selectNodeContents(t),s.addRange(i)}else if(document.selection){var o=document.body.createTextRange();o.moveToElementText(t),o.select()}},Mt.disableKeyFilter=function(){e.key&&(c.filter=function(){return jt.data().useKeyboardShortcuts()})},Mt.restoreKeyFilter=function(){e.key&&(c.filter=function(e){if(jt.data().useKeyboardShortcuts()){var t=e.target||e.srcElement,s=t?t.tagName:"";return s=s.toUpperCase(),!("INPUT"===s||"SELECT"===s||"TEXTAREA"===s||t&&"DIV"===s&&"editorHtmlArea"===t.className&&t.contentEditable)}return!1})},Mt.detectDropdownVisibility=r.debounce(function(){kt.dropdownVisibility(!!r.find(Ut,function(e){return e.hasClass("open")}))},50),Ot={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return Ot.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=Ot._utf8_encode(e);c>2,n=(3&t)<<4|s>>4,a=(15&s)<<2|i>>6,r=63&i,isNaN(s)?a=r=64:isNaN(i)&&(r=64),l=l+this._keyStr.charAt(o)+this._keyStr.charAt(n)+this._keyStr.charAt(a)+this._keyStr.charAt(r);return l},decode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c >4,s=(15&n)<<4|a>>2,i=(3&a)<<6|r,l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(s)),64!==r&&(l+=String.fromCharCode(i));return Ot._utf8_decode(l)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",s=0,i=e.length,o=0;i>s;s++)o=e.charCodeAt(s),128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128));return t},_utf8_decode:function(e){for(var t="",s=0,i=0,o=0,n=0;s i?(t+=String.fromCharCode(i),s++):i>191&&224>i?(o=e.charCodeAt(s+1),t+=String.fromCharCode((31&i)<<6|63&o),s+=2):(o=e.charCodeAt(s+1),n=e.charCodeAt(s+2),t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&n),s+=3);return t}},s.bindingHandlers.tooltip={init:function(e,i){if(!kt.bMobileDevice){var o=t(e),n=o.data("tooltip-class")||"",a=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:a,trigger:"hover",title:function(){return o.is(".disabled")||kt.dropdownVisibility()?"":''+Mt.i18n(s.utils.unwrapObservable(i()))+""}}).click(function(){o.tooltip("hide")}),kt.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}}},s.bindingHandlers.tooltip2={init:function(e,s){var i=t(e),o=i.data("tooltip-class")||"",n=i.data("tooltip-placement")||"top";i.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:n,title:function(){return i.is(".disabled")||kt.dropdownVisibility()?"":''+s()()+""}}).click(function(){i.tooltip("hide")}),kt.tooltipTrigger.subscribe(function(){i.tooltip("hide")})}},s.bindingHandlers.tooltip3={init:function(e){var s=t(e);s.tooltip({container:"body",trigger:"hover manual",title:function(){return s.data("tooltip3-data")||""}}),Kt.click(function(){s.tooltip("hide")}),kt.tooltipTrigger.subscribe(function(){s.tooltip("hide")})},update:function(e,i){var o=s.utils.unwrapObservable(i());""===o?t(e).data("tooltip3-data","").tooltip("hide"):t(e).data("tooltip3-data",o).tooltip("show")}},s.bindingHandlers.registrateBootstrapDropdown={init:function(e){Ut.push(t(e))}},s.bindingHandlers.openDropdownTrigger={update:function(e,i){if(s.utils.unwrapObservable(i())){var o=t(e);o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),Mt.detectDropdownVisibility()),i()(!1)}}},s.bindingHandlers.dropdownCloser={init:function(e){t(e).closest(".dropdown").on("click",".e-item",function(){t(e).dropdown("toggle")})}},s.bindingHandlers.popover={init:function(e,i){t(e).popover(s.utils.unwrapObservable(i()))}},s.bindingHandlers.csstext={init:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))},update:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.resizecrop={init:function(e){t(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,s){s()(),t(e).resizecrop({width:"100",height:"100"})}},s.bindingHandlers.onEnter={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&13===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.onEsc={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&27===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.clickOnTrue={update:function(e,i){s.utils.unwrapObservable(i())&&t(e).click()}},s.bindingHandlers.modal={init:function(e,i){t(e).toggleClass("fade",!kt.bMobileDevice).modal({keyboard:!1,show:s.utils.unwrapObservable(i())}).on("shown",function(){Mt.windowResize()}).find(".close").click(function(){i()(!1)})},update:function(e,i){t(e).modal(s.utils.unwrapObservable(i())?"show":"hide")}},s.bindingHandlers.i18nInit={init:function(e){Mt.i18nToNode(e)}},s.bindingHandlers.i18nUpdate={update:function(e,t){s.utils.unwrapObservable(t()),Mt.i18nToNode(e)}},s.bindingHandlers.link={update:function(e,i){t(e).attr("href",s.utils.unwrapObservable(i()))}},s.bindingHandlers.title={update:function(e,i){t(e).attr("title",s.utils.unwrapObservable(i()))}},s.bindingHandlers.textF={init:function(e,i){t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.initDom={init:function(e,t){t()(e)}},s.bindingHandlers.initResizeTrigger={init:function(e,i){var o=s.utils.unwrapObservable(i());t(e).css({height:o[1],"min-height":o[1]})},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=Mt.pInt(o[1]),a=0,r=t(e).offset().top;r>0&&(r+=Mt.pInt(o[2]),a=Gt.height()-r,a>n&&(n=a),t(e).css({height:n,"min-height":n}))}},s.bindingHandlers.appendDom={update:function(e,i){t(e).hide().empty().append(s.utils.unwrapObservable(i())).show()}},s.bindingHandlers.draggable={init:function(i,o,n){if(!kt.bMobileDevice){var a=100,r=3,l=n(),c=l&&l.droppableSelector?l.droppableSelector:"",u={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};c&&(u.drag=function(s){t(c).each(function(){var i=null,o=null,n=t(this),l=n.offset(),c=l.top+n.height();e.clearInterval(n.data("timerScroll")),n.data("timerScroll",!1),s.pageX>=l.left&&s.pageX<=l.left+n.width()&&(s.pageY>=c-a&&s.pageY<=c&&(i=function(){n.scrollTop(n.scrollTop()+r),Mt.windowResize()},n.data("timerScroll",e.setInterval(i,10)),i()),s.pageY>=l.top&&s.pageY<=l.top+a&&(o=function(){n.scrollTop(n.scrollTop()-r),Mt.windowResize()},n.data("timerScroll",e.setInterval(o,10)),o()))})},u.stop=function(){t(c).each(function(){e.clearInterval(t(this).data("timerScroll")),t(this).data("timerScroll",!1)})}),u.helper=function(e){return o()(e&&e.target?s.dataFor(e.target):null)},t(i).draggable(u).on("mousedown",function(){Mt.removeInFocus()})}}},s.bindingHandlers.droppable={init:function(e,s,i){if(!kt.bMobileDevice){var o=s(),n=i(),a=n&&n.droppableOver?n.droppableOver:null,r=n&&n.droppableOut?n.droppableOut:null,l={tolerance:"pointer",hoverClass:"droppableHover"};o&&(l.drop=function(e,t){o(e,t)},a&&(l.over=function(e,t){a(e,t)}),r&&(l.out=function(e,t){r(e,t)}),t(e).droppable(l))}}},s.bindingHandlers.nano={init:function(e){kt.bDisableNanoScroll||t(e).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},s.bindingHandlers.saveTrigger={init:function(e){var s=t(e);s.data("save-trigger-type",s.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===s.data("save-trigger-type")?s.append(' ').addClass("settings-saved-trigger"):s.addClass("settings-saved-trigger-input")},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=t(e);if("custom"===n.data("save-trigger-type"))switch(o.toString()){case"1":n.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":n.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":n.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:n.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(o.toString()){case"1":n.addClass("success").removeClass("error");break;case"0":n.addClass("error").removeClass("success");break;case"-2":break;default:n.removeClass("error success")}}},s.bindingHandlers.emailsTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:n,inputDelimiters:[",",";"],autoCompleteSource:function(e,t){jt.getAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new v,s.mailsoParse(t),s.clearDuplicateName(),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("EmailsTagsValue",e.target.value),o(e.target.value)},this)}),o.subscribe(function(e){i.data("EmailsTagsValue")!==e&&(i.val(e),i.data("EmailsTagsValue",e),i.inputosaurus("refresh"))}),o.focusTrigger&&o.focusTrigger.subscribe(function(e){e&&i.inputosaurus("focus")})}},s.bindingHandlers.contactTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:n,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(e,t){jt.getContactsTagsAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new T,s.name(t),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("ContactsTagsValue",e.target.value),o(e.target.value)},this)}),o.subscribe(function(e){i.data("ContactsTagsValue")!==e&&(i.val(e),i.data("ContactsTagsValue",e),i.inputosaurus("refresh"))}),o.focusTrigger&&o.focusTrigger.subscribe(function(e){e&&i.inputosaurus("focus")})}},s.bindingHandlers.command={init:function(e,i,o,n){var a=t(e),r=i();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");a.addClass("command"),s.bindingHandlers[a.is("form")?"submit":"click"].init.apply(n,arguments)},update:function(e,s){var i=!0,o=t(e),n=s();i=n.enabled(),o.toggleClass("command-not-enabled",!i),i&&(i=n.canExecute(),o.toggleClass("command-can-not-be-execute",!i)),o.toggleClass("command-disabled disable disabled",!i).toggleClass("no-disabled",!!i),(o.is("input")||o.is("button"))&&o.prop("disabled",!i)}},s.extenders.trimmer=function(e){var t=s.computed({read:e,write:function(t){e(Mt.trim(t.toString()))},owner:this});return t(e()),t},s.extenders.posInterer=function(e,t){var i=s.computed({read:e,write:function(s){var i=Mt.pInt(s.toString(),t);0>=i&&(i=t),i===e()&&""+i!=""+s&&e(i+1),e(i)}});return i(e()),i},s.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},s.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},s.extenders.falseTimeout=function(t,s){return t.iTimeout=0,t.subscribe(function(i){i&&(e.clearTimeout(t.iTimeout),t.iTimeout=e.setTimeout(function(){t(!1),t.iTimeout=0},Mt.pInt(s)))}),t},s.observable.fn.validateNone=function(){return this.hasError=s.observable(!1),this},s.observable.fn.validateEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateSimpleEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateFunc=function(e){return this.hasFuncError=s.observable(!1),Mt.isFunc(e)&&(this.subscribe(function(t){this.hasFuncError(!e(t))},this),this.valueHasMutated()),this},u.prototype.root=function(){return this.sBase},u.prototype.attachmentDownload=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.attachmentPreview=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+e},u.prototype.attachmentPreviewAsPlain=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},u.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},u.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},u.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},u.prototype.change=function(t){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+e.encodeURIComponent(t)+"/"},u.prototype.ajax=function(e){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+e},u.prototype.messageViewLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.messageDownloadLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},u.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},u.prototype.settings=function(e){var t=this.sBase+"settings";return Mt.isUnd(e)||""===e||(t+="/"+e),t},u.prototype.admin=function(e){var t=this.sBase;switch(e){case"AdminDomains":t+="domains";break;case"AdminSecurity":t+="security";break;case"AdminLicensing":t+="licensing"}return t},u.prototype.mailBox=function(e,t,s){t=Mt.isNormal(t)?Mt.pInt(t):1,s=Mt.pString(s);var i=this.sBase+"mailbox/";return""!==e&&(i+=encodeURI(e)),t>1&&(i=i.replace(/[\/]+$/,""),i+="/p"+t),""!==s&&(i=i.replace(/[\/]+$/,""),i+="/"+encodeURI(s)),i},u.prototype.phpInfo=function(){return this.sServer+"Info"},u.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},u.prototype.getUserPicUrlFromHash=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+e+"/"+this.sVersion+"/"},u.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},u.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},u.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},u.prototype.emptyFullContactPic=function(){return e.location.protocol+"//"+e.location.hostname+("80"==""+e.location.port||""==""+e.location.port?"":":"+e.location.port)+e.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},u.prototype.sound=function(e){return"rainloop/v/"+this.sVersion+"/static/sounds/"+e},u.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=Mt.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},u.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},u.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},u.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Dt.oViewModelsHooks={},Dt.oSimpleHooks={},Dt.regViewModelHook=function(e,t){t&&(t.__hookName=e)},Dt.addHook=function(e,t){Mt.isFunc(t)&&(Mt.isArray(Dt.oSimpleHooks[e])||(Dt.oSimpleHooks[e]=[]),Dt.oSimpleHooks[e].push(t))},Dt.runHook=function(e,t){Mt.isArray(Dt.oSimpleHooks[e])&&(t=t||[],r.each(Dt.oSimpleHooks[e],function(e){e.apply(null,t)}))},Dt.mainSettingsGet=function(e){return jt?jt.settingsGet(e):null},Dt.remoteRequest=function(e,t,s,i,o,n){jt&&jt.remote().defaultRequest(e,t,s,i,o,n)},Dt.settingsGet=function(e,t){var s=Dt.mainSettingsGet("Plugins");return s=s&&Mt.isUnd(s[e])?null:s[e],s?Mt.isUnd(s[t])?null:s[t]:null},d.prototype.blurTrigger=function(){if(this.fOnBlur){var t=this;e.clearTimeout(t.iBlurTimer),t.iBlurTimer=e.setTimeout(function(){t.fOnBlur()},200)}},d.prototype.focusTrigger=function(){this.fOnBlur&&e.clearTimeout(this.iBlurTimer)},d.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},d.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},d.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},d.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},d.prototype.modeToggle=function(e){this.editor&&(e?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},d.prototype.setHtml=function(e,t){this.editor&&(this.modeToggle(!0),this.editor.setData(e),t&&this.focus())},d.prototype.setPlain=function(e,t){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(e);this.editor.setData(e),t&&this.focus()}},d.prototype.init=function(){if(this.$element&&this.$element[0]){var t=this,s=kt.oHtmlEditorDefaultConfig,i=jt.settingsGet("Language"),o=!!jt.settingsGet("AllowHtmlEditorSourceButton");o&&s.toolbarGroups&&!s.toolbarGroups.__SourceInited&&(s.toolbarGroups.__SourceInited=!0,s.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),s.language=kt.oHtmlEditorLangsMap[i]||"en",e.CKEDITOR.env&&(e.CKEDITOR.env.isCompatible=!0),t.editor=e.CKEDITOR.appendTo(t.$element[0],s),t.editor.on("key",function(e){return e&&e.data&&9===e.data.keyCode?!1:void 0}),t.editor.on("blur",function(){t.blurTrigger()}),t.editor.on("mode",function(){t.blurTrigger(),t.fOnModeChange&&t.fOnModeChange("plain"!==t.editor.mode)}),t.editor.on("focus",function(){t.focusTrigger()}),t.fOnReady&&t.editor.on("instanceReady",function(){t.editor.setKeystroke(e.CKEDITOR.CTRL+65,"selectAll"),t.fOnReady(),t.__resizable=!0,t.resize()})}},d.prototype.focus=function(){this.editor&&this.editor.focus()},d.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},d.prototype.resize=function(){if(this.editor&&this.__resizable)try{this.editor.resize(this.$element.width(),this.$element.innerHeight())}catch(e){}},d.prototype.clear=function(e){this.setHtml("",e)},h.prototype.itemSelected=function(e){this.isListChecked()?e||(this.oCallbacks.onItemSelect||this.emptyFunction)(e||null):e&&(this.oCallbacks.onItemSelect||this.emptyFunction)(e)},h.prototype.goDown=function(e){this.newSelectPosition(It.EventKeyCode.Down,!1,e)},h.prototype.goUp=function(e){this.newSelectPosition(It.EventKeyCode.Up,!1,e)},h.prototype.init=function(e,i,o){if(this.oContentVisible=e,this.oContentScrollable=i,o=o||"all",this.oContentVisible&&this.oContentScrollable){var n=this;t(this.oContentVisible).on("selectstart",function(e){e&&e.preventDefault&&e.preventDefault()}).on("click",this.sItemSelector,function(e){n.actionClick(s.dataFor(this),e)}).on("click",this.sItemCheckedSelector,function(e){var t=s.dataFor(this);t&&(e&&e.shiftKey?n.actionClick(t,e):(n.focusedItem(t),t.checked(!t.checked())))}),c("enter",o,function(){return n.focusedItem()&&!n.focusedItem().selected()?(n.actionClick(n.focusedItem()),!1):!0}),c("ctrl+up, command+up, ctrl+down, command+down",o,function(){return!1}),c("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",o,function(e,t){if(e&&t&&t.shortcut){var s=0;switch(t.shortcut){case"up":case"shift+up":s=It.EventKeyCode.Up;break;case"down":case"shift+down":s=It.EventKeyCode.Down;break;case"insert":s=It.EventKeyCode.Insert;break;case"space":s=It.EventKeyCode.Space;break;case"home":s=It.EventKeyCode.Home;break;case"end":s=It.EventKeyCode.End;break;case"pageup":s=It.EventKeyCode.PageUp;break;case"pagedown":s=It.EventKeyCode.PageDown}if(s>0)return n.newSelectPosition(s,c.shift),!1}})}},h.prototype.autoSelect=function(e){this.bAutoSelect=!!e},h.prototype.getItemUid=function(e){var t="",s=this.oCallbacks.onItemGetUid||null;return s&&e&&(t=s(e)),t.toString()},h.prototype.newSelectPosition=function(e,t,s){var i=0,o=10,n=!1,a=!1,l=null,c=this.list(),u=c?c.length:0,d=this.focusedItem();if(u>0)if(d){if(d)if(It.EventKeyCode.Down===e||It.EventKeyCode.Up===e||It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e)r.each(c,function(t){if(!a)switch(e){case It.EventKeyCode.Up:d===t?a=!0:l=t;break;case It.EventKeyCode.Down:case It.EventKeyCode.Insert:n?(l=t,a=!0):d===t&&(n=!0)}});else if(It.EventKeyCode.Home===e||It.EventKeyCode.End===e)It.EventKeyCode.Home===e?l=c[0]:It.EventKeyCode.End===e&&(l=c[c.length-1]);else if(It.EventKeyCode.PageDown===e){for(;u>i;i++)if(d===c[i]){i+=o,i=i>u-1?u-1:i,l=c[i];break}}else if(It.EventKeyCode.PageUp===e)for(i=u;i>=0;i--)if(d===c[i]){i-=o,i=0>i?0:i,l=c[i];break}}else It.EventKeyCode.Down===e||It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e||It.EventKeyCode.Home===e||It.EventKeyCode.PageUp===e?l=c[0]:(It.EventKeyCode.Up===e||It.EventKeyCode.End===e||It.EventKeyCode.PageDown===e)&&(l=c[c.length-1]);l?(this.focusedItem(l),d&&(t?(It.EventKeyCode.Up===e||It.EventKeyCode.Down===e)&&d.checked(!d.checked()):(It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e)&&d.checked(!d.checked())),!this.bAutoSelect&&!s||this.isListChecked()||It.EventKeyCode.Space===e||this.selectedItem(l),this.scrollToFocused()):d&&(!t||It.EventKeyCode.Up!==e&&It.EventKeyCode.Down!==e?(It.EventKeyCode.Insert===e||It.EventKeyCode.Space===e)&&d.checked(!d.checked()):d.checked(!d.checked()),this.focusedItem(d)) +},h.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var e=20,s=t(this.sItemFocusedSelector,this.oContentScrollable),i=s.position(),o=this.oContentVisible.height(),n=s.outerHeight();return i&&(i.top<0||i.top+n>o)?(this.oContentScrollable.scrollTop(i.top<0?this.oContentScrollable.scrollTop()+i.top-e:this.oContentScrollable.scrollTop()+i.top-o+n+e),!0):!1},h.prototype.scrollToTop=function(e){return this.oContentVisible&&this.oContentScrollable?(e?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},h.prototype.eventClickFunction=function(e,t){var s=this.getItemUid(e),i=0,o=0,n=null,a="",r=!1,l=!1,c=[],u=!1;if(t&&t.shiftKey&&""!==s&&""!==this.sLastUid&&s!==this.sLastUid)for(c=this.list(),u=e.checked(),i=0,o=c.length;o>i;i++)n=c[i],a=this.getItemUid(n),r=!1,(a===this.sLastUid||a===s)&&(r=!0),r&&(l=!l),(l||r)&&n.checked(u);this.sLastUid=""===s?"":s},h.prototype.actionClick=function(e,t){if(e){var s=!0,i=this.getItemUid(e);t&&(!t.shiftKey||t.ctrlKey||t.altKey?!t.ctrlKey||t.shiftKey||t.altKey||(s=!1,this.focusedItem(e),this.selectedItem()&&e!==this.selectedItem()&&this.selectedItem().checked(!0),e.checked(!e.checked())):(s=!1,""===this.sLastUid&&(this.sLastUid=i),e.checked(!e.checked()),this.eventClickFunction(e,t),this.focusedItem(e))),s&&(this.focusedItem(e),this.selectedItem(e))}},h.prototype.on=function(e,t){this.oCallbacks[e]=t},p.supported=function(){return!0},p.prototype.set=function(e,s){var i=t.cookie(Lt.Values.ClientSideCookieIndexName),o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[e]=s,t.cookie(Lt.Values.ClientSideCookieIndexName,JSON.stringify(n),{expires:30}),o=!0}catch(a){}return o},p.prototype.get=function(e){var s=t.cookie(Lt.Values.ClientSideCookieIndexName),i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[e])?i[e]:null}catch(o){}return i},m.supported=function(){return!!e.localStorage},m.prototype.set=function(t,s){var i=e.localStorage[Lt.Values.ClientSideCookieIndexName]||null,o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[t]=s,e.localStorage[Lt.Values.ClientSideCookieIndexName]=JSON.stringify(n),o=!0}catch(a){}return o},m.prototype.get=function(t){var s=e.localStorage[Lt.Values.ClientSideCookieIndexName]||null,i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[t])?i[t]:null}catch(o){}return i},g.prototype.oDriver=null,g.prototype.set=function(e,t){return this.oDriver?this.oDriver.set("p"+e,t):!1},g.prototype.get=function(e){return this.oDriver?this.oDriver.get("p"+e):null},f.prototype.bootstart=function(){},b.prototype.sPosition="",b.prototype.sTemplate="",b.prototype.viewModelName="",b.prototype.viewModelDom=null,b.prototype.viewModelTemplate=function(){return this.sTemplate},b.prototype.viewModelPosition=function(){return this.sPosition},b.prototype.cancelCommand=b.prototype.closeCommand=function(){},b.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=jt.data().keyScope(),jt.data().keyScope(this.sDefaultKeyScope)},b.prototype.restoreKeyScope=function(){jt.data().keyScope(this.sCurrentKeyScope)},b.prototype.registerPopupKeyDown=function(){var e=this;Gt.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&It.EventKeyCode.Esc===t.keyCode)return Mt.delegateRun(e,"cancelCommand"),!1;if(It.EventKeyCode.Backspace===t.keyCode&&!Mt.inFocus())return!1}return!0})},y.prototype.oCross=null,y.prototype.sScreenName="",y.prototype.aViewModels=[],y.prototype.viewModels=function(){return this.aViewModels},y.prototype.screenName=function(){return this.sScreenName},y.prototype.routes=function(){return null},y.prototype.__cross=function(){return this.oCross},y.prototype.__start=function(){var e=this.routes(),t=null,s=null;Mt.isNonEmptyArray(e)&&(s=r.bind(this.onRoute||Mt.emptyFunction,this),t=i.create(),r.each(e,function(e){t.addRoute(e[0],s).rules=e[1]}),this.oCross=t)},S.constructorEnd=function(e){Mt.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},S.prototype.sDefaultScreenName="",S.prototype.oScreens={},S.prototype.oBoot=null,S.prototype.oCurrentScreen=null,S.prototype.hideLoading=function(){t("#rl-loading").hide()},S.prototype.routeOff=function(){o.changed.active=!1},S.prototype.routeOn=function(){o.changed.active=!0},S.prototype.setBoot=function(e){return Mt.isNormal(e)&&(this.oBoot=e),this},S.prototype.screen=function(e){return""===e||Mt.isUnd(this.oScreens[e])?null:this.oScreens[e]},S.prototype.buildViewModel=function(e,i){if(e&&!e.__builded){var o=new e(i),n=o.viewModelPosition(),a=t("#rl-content #rl-"+n.toLowerCase()),l=null;e.__builded=!0,e.__vm=o,o.data=jt.data(),o.viewModelName=e.__name,a&&1===a.length?(l=t("").addClass("rl-view-model").addClass("RL-"+o.viewModelTemplate()).hide(),l.appendTo(a),o.viewModelDom=l,e.__dom=l,"Popups"===n&&(o.cancelCommand=o.closeCommand=Mt.createCommand(o,function(){xt.hideScreenPopup(e)}),o.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),jt.popupVisibilityNames.push(this.viewModelName),o.viewModelDom.css("z-index",3e3+jt.popupVisibilityNames().length+10),Mt.delegateRun(this,"onFocus",[],500)):(Mt.delegateRun(this,"onHide"),this.restoreKeyScope(),jt.popupVisibilityNames.remove(this.viewModelName),o.viewModelDom.css("z-index",2e3),kt.tooltipTrigger(!kt.tooltipTrigger()),r.delay(function(){t.viewModelDom.hide()},300))},o)),Dt.runHook("view-model-pre-build",[e.__name,o,l]),s.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:o.viewModelTemplate()}}},o),Mt.delegateRun(o,"onBuild",[l]),o&&"Popups"===n&&o.registerPopupKeyDown(),Dt.runHook("view-model-post-build",[e.__name,o,l])):Mt.log("Cannot find view model position: "+n)}return e?e.__vm:null},S.prototype.applyExternal=function(e,t){e&&t&&s.applyBindings(e,t)},S.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),Dt.runHook("view-model-on-hide",[e.__name,e.__vm]))},S.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),Mt.delegateRun(e.__vm,"onShow",t||[]),Dt.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},S.prototype.screenOnRoute=function(e,t){var s=this,i=null,o=null;""===Mt.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(i=this.screen(e),i||(i=this.screen(this.sDefaultScreenName),i&&(t=e+"/"+t,e=this.sDefaultScreenName)),i&&i.__started&&(i.__builded||(i.__builded=!0,Mt.isNonEmptyArray(i.viewModels())&&r.each(i.viewModels(),function(e){this.buildViewModel(e,i)},this),Mt.delegateRun(i,"onBuild")),r.defer(function(){s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onHide"),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),Mt.delegateRun(e.__vm,"onHide"))})),s.oCurrentScreen=i,s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onShow"),Dt.runHook("screen-on-show",[s.oCurrentScreen.screenName(),s.oCurrentScreen]),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),Mt.delegateRun(e.__vm,"onShow"),Mt.delegateRun(e.__vm,"onFocus",[],200),Dt.runHook("view-model-on-show",[e.__name,e.__vm]))},s)),o=i.__cross(),o&&o.parse(t)})))},S.prototype.startScreens=function(e){t("#rl-content").css({visibility:"hidden"}),r.each(e,function(e){var t=new e,s=t?t.screenName():"";t&&""!==s&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=s),this.oScreens[s]=t)},this),r.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),Dt.runHook("screen-pre-start",[e.screenName(),e]),Mt.delegateRun(e,"onStart"),Dt.runHook("screen-post-start",[e.screenName(),e]))},this);var s=i.create();s.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,r.bind(this.screenOnRoute,this)),o.initialized.add(s.parse,s),o.changed.add(s.parse,s),o.init(),t("#rl-content").css({visibility:"visible"}),r.delay(function(){Bt.removeClass("rl-started-trigger").addClass("rl-started")},50)},S.prototype.setHash=function(e,t,s){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,s=Mt.isUnd(s)?!1:!!s,(Mt.isUnd(t)?1:!t)?(o.changed.active=!0,o[s?"replaceHash":"setHash"](e),o.setHash(e)):(o.changed.active=!1,o[s?"replaceHash":"setHash"](e),o.changed.active=!0)},S.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},xt=new S,v.newInstanceFromJson=function(e){var t=new v;return t.initByJson(e)?t:null},v.prototype.name="",v.prototype.email="",v.prototype.privateType=null,v.prototype.clear=function(){this.email="",this.name="",this.privateType=null},v.prototype.validate=function(){return""!==this.name||""!==this.email},v.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},v.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},v.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=It.EmailType.Facebook),null===this.privateType&&(this.privateType=It.EmailType.Default)),this.privateType},v.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},v.prototype.parse=function(e){this.clear(),e=Mt.trim(e);var t=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,s=t.exec(e);s?(this.name=s[1]||"",this.email=s[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},v.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=Mt.trim(e.Name),this.email=Mt.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},v.prototype.toLine=function(e,t,s){var i="";return""!==this.email&&(t=Mt.isUnd(t)?!1:!!t,s=Mt.isUnd(s)?!1:!!s,e&&""!==this.name?i=t?'")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(this.name)+"":s?Mt.encodeHtml(this.name):this.name:(i=this.email,""!==this.name?t?i=Mt.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(i)+""+Mt.encodeHtml(">"):(i='"'+this.name+'" <'+i+">",s&&(i=Mt.encodeHtml(i))):t&&(i=''+Mt.encodeHtml(this.email)+""))),i},v.prototype.mailsoParse=function(e){if(e=Mt.trim(e),""===e)return!1;for(var t=function(e,t,s){e+="";var i=e.length;return 0>t&&(t+=i),i="undefined"==typeof s?i:0>s?s+i:s+t,t>=e.length||0>t||t>i?!1:e.slice(t,i)},s=function(e,t,s,i){return 0>s&&(s+=e.length),i=void 0!==i?i:e.length,0>i&&(i=i+e.length-s),e.slice(0,s)+t.substr(0,i)+t.slice(i)+e.slice(s+i)},i="",o="",n="",a=!1,r=!1,l=!1,c=null,u=0,d=0,h=0;h 0&&0===i.length&&(i=t(e,0,h)),r=!0,u=h);break;case">":r&&(d=h,o=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,r=!1);break;case"(":a||r||l||(l=!0,u=h);break;case")":l&&(d=h,n=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,l=!1);break;case"\\":h++}h++}return 0===o.length&&(c=e.match(/[^@\s]+@\S+/i),c&&c[0]?o=c[0]:i=e),o.length>0&&0===i.length&&0===n.length&&(i=e.replace(o,"")),o=Mt.trim(o).replace(/^[<]+/,"").replace(/[>]+$/,""),i=Mt.trim(i).replace(/^["']+/,"").replace(/["']+$/,""),n=Mt.trim(n).replace(/^[(]+/,"").replace(/[)]+$/,""),i=i.replace(/\\\\(.)/,"$1"),n=n.replace(/\\\\(.)/,"$1"),this.name=i,this.email=o,this.clearDuplicateName(),!0},v.prototype.inputoTagLine=function(){return 0 +$/,""),t=!0),t},F.prototype.isImage=function(){return-1 o;o++)i.push(e[o].toLine(t,s));return i.join(", ")},E.initEmailsFromJson=function(e){var t=0,s=0,i=null,o=[];if(Mt.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)i=v.newInstanceFromJson(e[t]),i&&o.push(i);return o},E.replyHelper=function(e,t,s){if(e&&0 i;i++)Mt.isUnd(t[e[i].email])&&(t[e[i].email]=!0,s.push(e[i]))},E.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(It.MessagePriority.Normal),this.proxy=!1,this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isRtl(!1),this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(It.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(It.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},E.prototype.computeSenderEmail=function(){var e=jt.data().sentFolder(),t=jt.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===e||this.folderFullNameRaw===t?this.toEmailsString():this.fromEmailString())},E.prototype.initByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.folderFullNameRaw=e.Folder,this.uid=e.Uid,this.hash=e.Hash,this.requestHash=e.RequestHash,this.proxy=!!e.ExternalProxy,this.size(Mt.pInt(e.Size)),this.from=E.initEmailsFromJson(e.From),this.to=E.initEmailsFromJson(e.To),this.cc=E.initEmailsFromJson(e.Cc),this.bcc=E.initEmailsFromJson(e.Bcc),this.replyTo=E.initEmailsFromJson(e.ReplyTo),this.deliveredTo=E.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),this.dateTimeStampInUTC(Mt.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(E.emailsToLine(this.from,!0)),this.toEmailsString(E.emailsToLine(this.to,!0)),this.parentUid(Mt.pInt(e.ParentThread)),this.threads(Mt.isArray(e.Threads)?e.Threads:[]),this.threadsLen(Mt.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},E.prototype.initUpdateByMessageJson=function(e){var t=!1,s=It.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(s=Mt.pInt(e.Priority),this.priority(-1 t;t++)i=F.newInstanceFromJson(e["@Collection"][t]),i&&(""!==i.cidWithOutTags&&0 +$/,""),t=r.find(s,function(t){return e===t.cidWithOutTags})),t||null},E.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return Mt.isNonEmptyArray(s)&&(t=r.find(s,function(t){return e===t.contentLocation})),t||null},E.prototype.messageId=function(){return this.sMessageId},E.prototype.inReplyTo=function(){return this.sInReplyTo},E.prototype.references=function(){return this.sReferences},E.prototype.fromAsSingleEmail=function(){return Mt.isArray(this.from)&&this.from[0]?this.from[0].email:""},E.prototype.viewLink=function(){return jt.link().messageViewLink(this.requestHash)},E.prototype.downloadLink=function(){return jt.link().messageDownloadLink(this.requestHash)},E.prototype.replyEmails=function(e){var t=[],s=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,s,t),0===t.length&&E.replyHelper(this.from,s,t),t},E.prototype.replyAllEmails=function(e){var t=[],s=[],i=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,i,t),0===t.length&&E.replyHelper(this.from,i,t),E.replyHelper(this.to,i,t),E.replyHelper(this.cc,i,s),[t,s]},E.prototype.textBodyToString=function(){return this.body?this.body.html():""},E.prototype.attachmentsToStringLine=function(){var e=r.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0 =0&&o&&!n&&i.attr("src",o)}),s&&e.setTimeout(function(){i.print()},100))})},E.prototype.printMessage=function(){this.viewPopupMessage(!0)},E.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},E.prototype.populateByMessageListItem=function(e){return this.folderFullNameRaw=e.folderFullNameRaw,this.uid=e.uid,this.hash=e.hash,this.requestHash=e.requestHash,this.subject(e.subject()),this.size(e.size()),this.dateTimeStampInUTC(e.dateTimeStampInUTC()),this.priority(e.priority()),this.proxy=e.proxy,this.fromEmailString(e.fromEmailString()),this.toEmailsString(e.toEmailsString()),this.emails=e.emails,this.from=e.from,this.to=e.to,this.cc=e.cc,this.bcc=e.bcc,this.replyTo=e.replyTo,this.deliveredTo=e.deliveredTo,this.unseen(e.unseen()),this.flagged(e.flagged()),this.answered(e.answered()),this.forwarded(e.forwarded()),this.isReadReceipt(e.isReadReceipt()),this.selected(e.selected()),this.checked(e.checked()),this.hasAttachments(e.hasAttachments()),this.attachmentsMainType(e.attachmentsMainType()),this.moment(e.moment()),this.body=null,this.priority(It.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(e.parentUid()),this.threads(e.threads()),this.threadsLen(e.threadsLen()),this.computeSenderEmail(),this},E.prototype.showExternalImages=function(e){if(this.body&&this.body.data("rl-has-images")){var s="";e=Mt.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),s=this.proxy?"data-x-additional-src":"data-x-src",t("["+s+"]",this.body).each(function(){e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",t(this).attr(s)).removeAttr(s):t(this).attr("src",t(this).attr(s)).removeAttr(s)}),s=this.proxy?"data-x-additional-style-url":"data-x-style-url",t("["+s+"]",this.body).each(function(){var e=Mt.trim(t(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+t(this).attr(s)).removeAttr(s)}),e&&(t("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t(".RL-MailMessageView .messageView .messageItem .content")[0]}),Gt.resize()),Mt.windowResize(500)}},E.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=Mt.isUnd(e)?!1:e;var s=this;t("[data-x-src-cid]",this.body).each(function(){var i=s.findAttachmentByCid(t(this).attr("data-x-src-cid"));i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-src-location]",this.body).each(function(){var i=s.findAttachmentByContentLocation(t(this).attr("data-x-src-location"));i||(i=s.findAttachmentByCid(t(this).attr("data-x-src-location"))),i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-style-cid]",this.body).each(function(){var e="",i="",o=s.findAttachmentByCid(t(this).attr("data-x-style-cid"));o&&o.linkPreview&&(i=t(this).attr("data-x-style-cid-name"),""!==i&&(e=Mt.trim(t(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+i+": url('"+o.linkPreview()+"')")))}),e&&!function(e,t){r.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(t("img.lazy",s.body),t(".RL-MailMessageView .messageView .messageItem .content")[0]),Mt.windowResize(500)}},E.prototype.storeDataToDom=function(){this.body&&(this.body.data("rl-is-rtl",!!this.isRtl()),this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw),jt.data().capaOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser())))},E.prototype.storePgpVerifyDataToDom=function(){this.body&&jt.data().capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},E.prototype.fetchDataToDom=function(){this.body&&(this.isRtl(!!this.body.data("rl-is-rtl")),this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=Mt.pString(this.body.data("rl-plain-raw")),jt.data().capaOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(It.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},E.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var s=[],i=null,o=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",n=jt.data().findPublicKeysByEmail(o),a=null,l=null,c="";this.pgpSignedVerifyStatus(It.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{i=e.openpgp.cleartext.readArmored(this.plainRaw),i&&i.getText&&(this.pgpSignedVerifyStatus(n.length?It.SignedVerifyStatus.Unverified:It.SignedVerifyStatus.UnknownPublicKeys),s=i.verify(n),s&&0 ').text(c)).html(),zt.empty(),this.replacePlaneTextBody(c)))))}catch(u){}this.storePgpVerifyDataToDom()}},E.prototype.decryptPgpEncryptedMessage=function(s){if(this.isPgpEncrypted()){var i=[],o=null,n=null,a=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",l=jt.data().findPublicKeysByEmail(a),c=jt.data().findSelfPrivateKey(s),u=null,d=null,h="";this.pgpSignedVerifyStatus(It.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),c||this.pgpSignedVerifyStatus(It.SignedVerifyStatus.UnknownPrivateKey);try{o=e.openpgp.message.readArmored(this.plainRaw),o&&c&&o.decrypt&&(this.pgpSignedVerifyStatus(It.SignedVerifyStatus.Unverified),n=o.decrypt(c),n&&(i=n.verify(l),i&&0 ').text(h)).html(),zt.empty(),this.replacePlaneTextBody(h)))}catch(p){}this.storePgpVerifyDataToDom()}},E.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},E.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},N.newInstanceFromJson=function(e){var t=new N;return t.initByJson(e)?t.initComputed():null},N.prototype.initComputed=function(){return this.hasSubScribedSubfolders=s.computed(function(){return!!r.find(this.subFolders(),function(e){return e.subScribed()&&!e.isSystemFolder() })},this),this.canBeEdited=s.computed(function(){return It.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=s.computed(function(){var e=this.subScribed(),t=this.hasSubScribedSubfolders();return e||t&&(!this.existen||!this.selectable)},this),this.isSystemFolder=s.computed(function(){return It.FolderType.User!==this.type()},this),this.hidden=s.computed(function(){var e=this.isSystemFolder(),t=this.hasSubScribedSubfolders();return e&&!t||!this.selectable&&!t},this),this.selectableForFolderList=s.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=s.computed({read:this.privateMessageCountAll,write:function(e){Mt.isPosNumeric(e,!0)?this.privateMessageCountAll(e):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=s.computed({read:this.privateMessageCountUnread,write:function(e){Mt.isPosNumeric(e,!0)?this.privateMessageCountUnread(e):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=s.computed(function(){var e=this.messageCountAll(),t=this.messageCountUnread(),s=this.type();if(It.FolderType.Inbox===s&&jt.data().foldersInboxUnreadCount(t),e>0){if(It.FolderType.Draft===s)return""+e;if(t>0&&It.FolderType.Trash!==s&&It.FolderType.Archive!==s&&It.FolderType.SentItems!==s)return""+t}return""},this),this.canBeDeleted=s.computed(function(){var e=this.isSystemFolder();return!e&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=s.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){Mt.timeOutAction("folder-list-folder-visibility-change",function(){Gt.trigger("folder-list-folder-visibility-change")},100)}),this.localName=s.computed(function(){kt.langChangeTrigger();var e=this.type(),t=this.name();if(this.isSystemFolder())switch(e){case It.FolderType.Inbox:t=Mt.i18n("FOLDER_LIST/INBOX_NAME");break;case It.FolderType.SentItems:t=Mt.i18n("FOLDER_LIST/SENT_NAME");break;case It.FolderType.Draft:t=Mt.i18n("FOLDER_LIST/DRAFTS_NAME");break;case It.FolderType.Spam:t=Mt.i18n("FOLDER_LIST/SPAM_NAME");break;case It.FolderType.Trash:t=Mt.i18n("FOLDER_LIST/TRASH_NAME");break;case It.FolderType.Archive:t=Mt.i18n("FOLDER_LIST/ARCHIVE_NAME")}return t},this),this.manageFolderSystemName=s.computed(function(){kt.langChangeTrigger();var e="",t=this.type(),s=this.name();if(this.isSystemFolder())switch(t){case It.FolderType.Inbox:e="("+Mt.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case It.FolderType.SentItems:e="("+Mt.i18n("FOLDER_LIST/SENT_NAME")+")";break;case It.FolderType.Draft:e="("+Mt.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case It.FolderType.Spam:e="("+Mt.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case It.FolderType.Trash:e="("+Mt.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case It.FolderType.Archive:e="("+Mt.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==e&&"("+s+")"===e||"(inbox)"===e.toLowerCase())&&(e=""),e},this),this.collapsed=s.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(e){this.collapsedPrivate(e)},owner:this}),this.hasUnreadMessages=s.computed(function(){return 0 "},L.prototype.formattedNameForCompose=function(){var e=this.name();return""===e?this.email():e+" ("+this.email()+")"},L.prototype.formattedNameForEmail=function(){var e=this.name();return""===e?this.email():'"'+Mt.quoteName(e)+'" <'+this.email()+">"},I.prototype.removeSelf=function(){this.canBeDeleted()&&this.parentList.remove(this)},P.prototype.removeSelf=function(){this.canBeDeleted()&&this.parentList.remove(this)},M.prototype.addCondition=function(){this.conditions.push(new P(this.conditions,this.conditionsCanBeDeleted))},M.prototype.addAction=function(){this.actions.push(new I(this.actions,this.actionsCanBeDeleted))},M.prototype.parse=function(e){var t=!1;return e&&"Object/Filter"===e["@Object"]&&(this.name(Mt.pString(e.Name)),t=!0),t},D.prototype.index=0,D.prototype.id="",D.prototype.guid="",D.prototype.user="",D.prototype.email="",D.prototype.armor="",D.prototype.isPrivate=!1,Mt.extendAsViewModel("PopupsFolderClearViewModel",O),O.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},O.prototype.onShow=function(e){this.clearPopup(),e&&this.selectedFolder(e)},Mt.extendAsViewModel("PopupsFolderCreateViewModel",k),k.prototype.sNoParentText="",k.prototype.simpleFolderNameValidation=function(e){return/^[^\\\/]+$/g.test(Mt.trim(e))},k.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},k.prototype.onShow=function(){this.clearPopup()},k.prototype.onFocus=function(){this.folderName.focused(!0)},Mt.extendAsViewModel("PopupsFolderSystemViewModel",_),_.prototype.sChooseOnText="",_.prototype.sUnuseText="",_.prototype.onShow=function(e){var t="";switch(e=Mt.isUnd(e)?It.SetSystemFoldersNotification.None:e){case It.SetSystemFoldersNotification.Sent:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case It.SetSystemFoldersNotification.Draft:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case It.SetSystemFoldersNotification.Spam:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case It.SetSystemFoldersNotification.Trash:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case It.SetSystemFoldersNotification.Archive:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(t)},Mt.extendAsViewModel("PopupsComposeViewModel",U),U.prototype.openOpenPgpPopup=function(){if(this.capaOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var e=this;xt.showScreenPopup(q,[function(t){e.editor(function(e){e.setPlain(t)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},U.prototype.reloadDraftFolder=function(){var e=jt.data().draftFolder();""!==e&&(jt.cache().setFolderHash(e,""),jt.data().currentFolderFullNameRaw()===e?jt.reloadMessageList(!0):jt.folderInformation(e))},U.prototype.findIdentityIdByMessage=function(e,t){var s={},i="",o=function(e){return e&&e.email&&s[e.email]?(i=s[e.email],!0):!1};if(this.bCapaAdditionalIdentities&&r.each(this.identities(),function(e){s[e.email()]=e.id}),s[jt.data().accountEmail()]=jt.data().accountEmail(),t)switch(e){case It.ComposeType.Empty:i=jt.data().accountEmail();break;case It.ComposeType.Reply:case It.ComposeType.ReplyAll:case It.ComposeType.Forward:case It.ComposeType.ForwardAsAttachment:r.find(r.union(t.to,t.cc,t.bcc,t.deliveredTo),o);break;case It.ComposeType.Draft:r.find(r.union(t.from,t.replyTo),o)}else i=jt.data().accountEmail();return i},U.prototype.selectIdentity=function(e){e&&this.currentIdentityID(e.optValue)},U.prototype.formattedFrom=function(e){var t=jt.data().displayName(),s=jt.data().accountEmail();return""===t?s:(Mt.isUnd(e)?1:!e)?t+" ("+s+")":'"'+Mt.quoteName(t)+'" <'+s+">"},U.prototype.sendMessageResponse=function(t,s){var i=!1,o="";this.sending(!1),It.StorageResultType.Success===t&&s&&s.Result&&(i=!0,this.modalVisibility()&&Mt.delegateRun(this,"closeCommand")),this.modalVisibility()&&!i&&(s&&It.Notification.CantSaveMessage===s.ErrorCode?(this.sendSuccessButSaveError(!0),e.alert(Mt.trim(Mt.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(o=Mt.getNotification(s&&s.ErrorCode?s.ErrorCode:It.Notification.CantSendMessage,s&&s.ErrorMessage?s.ErrorMessage:""),this.sendError(!0),e.alert(o||Mt.getNotification(It.Notification.CantSendMessage)))),this.reloadDraftFolder()},U.prototype.saveMessageResponse=function(t,s){var i=!1,o=null;this.saving(!1),It.StorageResultType.Success===t&&s&&s.Result&&s.Result.NewFolder&&s.Result.NewUid&&(this.bFromDraft&&(o=jt.data().message(),o&&this.draftFolder()===o.folderFullNameRaw&&this.draftUid()===o.uid&&jt.data().message(null)),this.draftFolder(s.Result.NewFolder),this.draftUid(s.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new e.Date).getTime()/1e3)),this.savedOrSendingText(0 s;s++)o.push(e[s].toLine(!!t));return o.join(", ")};if(s=s||null,s&&Mt.isNormal(s)&&(C=Mt.isArray(s)&&1===s.length?s[0]:Mt.isArray(s)?null:s),null!==f&&(g[f]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,C))),this.reset(),Mt.isNonEmptyArray(i)&&this.to(T(i)),""!==w&&C){switch(c=C.fullFormatDateValue(),u=C.subject(),v=C.aDraftInfo,d=t(C.body).clone(),Mt.removeBlockquoteSwitcher(d),h=d.html(),w){case It.ComposeType.Empty:break;case It.ComposeType.Reply:this.to(T(C.replyEmails(g))),this.subject(Mt.replySubjectAdd("Re",u)),this.prepearMessageAttachments(C,w),this.aDraftInfo=["reply",C.uid,C.folderFullNameRaw],this.sInReplyTo=C.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+C.sReferences);break;case It.ComposeType.ReplyAll:m=C.replyAllEmails(g),this.to(T(m[0])),this.cc(T(m[1])),this.subject(Mt.replySubjectAdd("Re",u)),this.prepearMessageAttachments(C,w),this.aDraftInfo=["reply",C.uid,C.folderFullNameRaw],this.sInReplyTo=C.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+C.references());break;case It.ComposeType.Forward:this.subject(Mt.replySubjectAdd("Fwd",u)),this.prepearMessageAttachments(C,w),this.aDraftInfo=["forward",C.uid,C.folderFullNameRaw],this.sInReplyTo=C.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+C.sReferences);break;case It.ComposeType.ForwardAsAttachment:this.subject(Mt.replySubjectAdd("Fwd",u)),this.prepearMessageAttachments(C,w),this.aDraftInfo=["forward",C.uid,C.folderFullNameRaw],this.sInReplyTo=C.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+C.sReferences);break;case It.ComposeType.Draft:this.to(T(C.to)),this.cc(T(C.cc)),this.bcc(T(C.bcc)),this.bFromDraft=!0,this.draftFolder(C.folderFullNameRaw),this.draftUid(C.uid),this.subject(u),this.prepearMessageAttachments(C,w),this.aDraftInfo=Mt.isNonEmptyArray(v)&&3===v.length?v:null,this.sInReplyTo=C.sInReplyTo,this.sReferences=C.sReferences;break;case It.ComposeType.EditAsNew:this.to(T(C.to)),this.cc(T(C.cc)),this.bcc(T(C.bcc)),this.subject(u),this.prepearMessageAttachments(C,w),this.aDraftInfo=Mt.isNonEmptyArray(v)&&3===v.length?v:null,this.sInReplyTo=C.sInReplyTo,this.sReferences=C.sReferences}switch(w){case It.ComposeType.Reply:case It.ComposeType.ReplyAll:n=C.fromToLine(!1,!0),p=Mt.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:c,EMAIL:n}),h="
"+p+":";break;case It.ComposeType.Forward:n=C.fromToLine(!1,!0),a=C.toToLine(!1,!0),l=C.ccToLine(!1,!0),h=""+h+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+n+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+a+(0"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+l:"")+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Mt.encodeHtml(c)+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Mt.encodeHtml(u)+"
"+h;break;case It.ComposeType.ForwardAsAttachment:h=""}y&&""!==b&&It.ComposeType.EditAsNew!==w&&It.ComposeType.Draft!==w&&(h=this.convertSignature(b,T(C.from,!0))+"
"+h),this.editor(function(e){e.setHtml(h,!1),C.isHtml()||e.modeToggle(!1)})}else It.ComposeType.Empty===w?(h=this.convertSignature(b),this.editor(function(e){e.setHtml(h,!1),It.EditorDefaultType.Html!==jt.data().editorDefaultType()&&e.modeToggle(!1)})):Mt.isNonEmptyArray(s)&&r.each(s,function(e){o.addMessageAsAttachment(e)});S=this.getAttachmentsDownloadsForUpload(),Mt.isNonEmptyArray(S)&&jt.remote().messageUploadAttachments(function(e,t){if(It.StorageResultType.Success===e&&t&&t.Result){var s=null,i="";if(!o.viewModelVisibility())for(i in t.Result)t.Result.hasOwnProperty(i)&&(s=o.getAttachmentById(t.Result[i]),s&&s.tempName(i))}else o.setMessageAttachmentFailedDowbloadText()},S),this.triggerForResize()},U.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},U.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},U.prototype.tryToClosePopup=function(){var e=this;xt.showScreenPopup(Y,[Mt.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){e.modalVisibility()&&Mt.delegateRun(e,"closeCommand")}])},U.prototype.onBuild=function(){this.initUploader();var e=this,s=null;c("ctrl+q, command+q",It.KeyState.Compose,function(){return e.identitiesDropdownTrigger(!0),!1}),c("ctrl+s, command+s",It.KeyState.Compose,function(){return e.saveCommand(),!1}),c("ctrl+enter, command+enter",It.KeyState.Compose,function(){return e.sendCommand(),!1}),c("esc",It.KeyState.Compose,function(){return e.tryToClosePopup(),!1}),Gt.on("resize",function(){e.triggerForResize()}),this.dropboxEnabled()&&(s=document.createElement("script"),s.type="text/javascript",s.src="https://www.dropbox.com/static/api/1/dropins.js",t(s).attr("id","dropboxjs").attr("data-app-key",jt.settingsGet("DropboxApiKey")),document.body.appendChild(s))},U.prototype.getAttachmentById=function(e){for(var t=this.attachments(),s=0,i=t.length;i>s;s++)if(t[s]&&e===t[s].id)return t[s];return null},U.prototype.initUploader=function(){if(this.composeUploaderButton()){var e={},t=Mt.pInt(jt.settingsGet("AttachmentLimit")),s=new a({action:jt.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});s?(s.on("onDragEnter",r.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",r.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",r.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",r.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",r.bind(function(t,s,i){var o=null;Mt.isUnd(e[t])?(o=this.getAttachmentById(t),o&&(e[t]=o)):o=e[t],o&&o.progress(" - "+Math.floor(s/i*100)+"%")},this)).on("onSelect",r.bind(function(e,i){this.dragAndDropOver(!1);var o=this,n=Mt.isUnd(i.FileName)?"":i.FileName.toString(),a=Mt.isNormal(i.Size)?Mt.pInt(i.Size):null,r=new A(e,n,a);return r.cancel=function(e){return function(){o.attachments.remove(function(t){return t&&t.id===e}),s&&s.cancel(e)}}(e),this.attachments.push(r),a>0&&t>0&&a>t?(r.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",r.bind(function(t){var s=null;Mt.isUnd(e[t])?(s=this.getAttachmentById(t),s&&(e[t]=s)):s=e[t],s&&(s.waiting(!1),s.uploading(!0))},this)).on("onComplete",r.bind(function(t,s,i){var o="",n=null,a=null,r=this.getAttachmentById(t);a=s&&i&&i.Result&&i.Result.Attachment?i.Result.Attachment:null,n=i&&i.Result&&i.Result.ErrorCode?i.Result.ErrorCode:null,null!==n?o=Mt.getUploadErrorDescByCode(n):a||(o=Mt.i18n("UPLOAD/ERROR_UNKNOWN")),r&&(""!==o&&00&&i>0&&n>i?(o.uploading(!1),o.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(jt.remote().composeUploadExternals(function(e,t){var s=!1;o.uploading(!1),It.StorageResultType.Success===e&&t&&t.Result&&t.Result[o.id]&&(s=!0,o.tempName(t.Result[o.id])),s||o.error(Mt.getUploadErrorDescByCode(It.UploadErrorCode.FileNoUploaded))},[e.link]),!0)},U.prototype.prepearMessageAttachments=function(e,t){if(e){var s=this,i=Mt.isNonEmptyArray(e.attachments())?e.attachments():[],o=0,n=i.length,a=null,r=null,l=!1,c=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}};if(It.ComposeType.ForwardAsAttachment===t)this.addMessageAsAttachment(e);else for(;n>o;o++){switch(r=i[o],l=!1,t){case It.ComposeType.Reply:case It.ComposeType.ReplyAll:l=r.isLinked;break;case It.ComposeType.Forward:case It.ComposeType.Draft:case It.ComposeType.EditAsNew:l=!0}l&&(a=new A(r.download,r.fileName,r.estimatedSize,r.isInline,r.isLinked,r.cid,r.contentLocation),a.fromMessage=!0,a.cancel=c(r.download),a.waiting(!1).uploading(!0),this.attachments.push(a))}}},U.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(e){return e&&e.isLinked})},U.prototype.setMessageAttachmentFailedDowbloadText=function(){r.each(this.attachments(),function(e){e&&e.fromMessage&&e.waiting(!1).uploading(!1).error(Mt.getUploadErrorDescByCode(It.UploadErrorCode.FileNoUploaded))},this)},U.prototype.isEmptyForm=function(e){e=Mt.isUnd(e)?!0:!!e;var t=e?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&t&&(!this.oEditor||""===this.oEditor.getData())},U.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},U.prototype.getAttachmentsDownloadsForUpload=function(){return r.map(r.filter(this.attachments(),function(e){return e&&""===e.tempName()}),function(e){return e.id})},U.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Mt.extendAsViewModel("PopupsContactsViewModel",x),x.prototype.getPropertyPlceholder=function(e){var t="";switch(e){case It.ContactPropertyType.LastName:t="CONTACTS/PLACEHOLDER_ENTER_LAST_NAME";break;case It.ContactPropertyType.FirstName:t="CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME";break;case It.ContactPropertyType.Nick:t="CONTACTS/PLACEHOLDER_ENTER_NICK_NAME"}return t},x.prototype.addNewProperty=function(e,t){this.viewProperties.push(new w(e,t||"","",!0,this.getPropertyPlceholder(e)))},x.prototype.addNewOrFocusProperty=function(e,t){var s=r.find(this.viewProperties(),function(t){return e===t.type()});s?s.focused(!0):this.addNewProperty(e,t)},x.prototype.addNewTag=function(){this.viewTags.visibility(!0),this.viewTags.focusTrigger(!0)},x.prototype.addNewEmail=function(){this.addNewProperty(It.ContactPropertyType.Email,"Home")},x.prototype.addNewPhone=function(){this.addNewProperty(It.ContactPropertyType.Phone,"Mobile")},x.prototype.addNewWeb=function(){this.addNewProperty(It.ContactPropertyType.Web)},x.prototype.addNewNickname=function(){this.addNewOrFocusProperty(It.ContactPropertyType.Nick)},x.prototype.addNewNotes=function(){this.addNewOrFocusProperty(It.ContactPropertyType.Note)},x.prototype.addNewBirthday=function(){this.addNewOrFocusProperty(It.ContactPropertyType.Birthday)},x.prototype.exportVcf=function(){jt.download(jt.link().exportContactsVcf())},x.prototype.exportCsv=function(){jt.download(jt.link().exportContactsCsv())},x.prototype.initUploader=function(){if(this.importUploaderButton()){var t=new a({action:jt.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});t&&t.on("onStart",r.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",r.bind(function(t,s,i){this.contacts.importing(!1),this.reloadContactList(),t&&s&&i&&i.Result||e.alert(Mt.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},x.prototype.removeCheckedOrSelectedContactsFromList=function(){var e=this,t=this.contacts,s=this.currentContact(),i=this.contacts().length,o=this.contactsCheckedOrSelected();0 =i&&(this.bDropPageAfterDelete=!0),r.delay(function(){r.each(o,function(e){t.remove(e)})},500))},x.prototype.deleteSelectedContacts=function(){0 0?i:0),Mt.isNonEmptyArray(s.Result.Tags)&&(n=r.map(s.Result.Tags,function(e){var t=new T;return t.parse(e)?t:null}),n=r.compact(n))),t.contactsCount(i),t.contacts(o),t.contactTags(n),t.contacts.loading(!1),t.viewClearSearch(""!==t.search())},s,Lt.Defaults.ContactsPerPage,this.search())},x.prototype.onBuild=function(e){this.oContentVisible=t(".b-list-content",e),this.oContentScrollable=t(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,It.KeyState.ContactList);var i=this;c("delete",It.KeyState.ContactList,function(){return i.deleteCommand(),!1}),e.on("click",".e-pagenator .e-page",function(){var e=s.dataFor(this);e&&(i.contactsPage(Mt.pInt(e.value)),i.reloadContactList())}),this.initUploader()},x.prototype.onShow=function(){xt.routeOff(),this.reloadContactList(!0)},x.prototype.onHide=function(){xt.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},Mt.extendAsViewModel("PopupsAdvancedSearchViewModel",V),V.prototype.buildSearchStringValue=function(e){return-1 li"),o=s&&("tab"===s.shortcut||"right"===s.shortcut),n=i.index(i.filter(".active"));return!o&&n>0?n--:o&&n -1&&r.eq(n).removeClass("focused"),38===a&&n>0?n--:40===a&&n o)?(this.oContentScrollable.scrollTop(i.top<0?this.oContentScrollable.scrollTop()+i.top-e:this.oContentScrollable.scrollTop()+i.top-o+n+e),!0):!1},et.prototype.messagesDrop=function(e,t){if(e&&t&&t.helper){var s=t.helper.data("rl-folder"),i=Bt.hasClass("rl-ctrl-key-pressed"),o=t.helper.data("rl-uids");Mt.isNormal(s)&&""!==s&&Mt.isArray(o)&&jt.moveMessagesToFolder(s,o,e.fullNameRaw,i)}},et.prototype.composeClick=function(){xt.showScreenPopup(U)},et.prototype.createFolder=function(){xt.showScreenPopup(k)},et.prototype.configureFolders=function(){xt.setHash(jt.link().settings("folders"))},et.prototype.contactsClick=function(){this.allowContacts&&xt.showScreenPopup(x)},Mt.extendAsViewModel("MailBoxMessageListViewModel",tt),tt.prototype.emptySubjectValue="",tt.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue),this.inputMessageListSearchFocus(!1)},tt.prototype.printableMessageCountForDeletion=function(){var e=this.messageListCheckedOrSelectedUidsWithSubMails().length;return e>1?" ("+(100>e?e:"99+")+")":""},tt.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},tt.prototype.moveSelectedMessagesToFolder=function(e,t){return this.canBeMoved()&&jt.moveMessagesToFolder(jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),e,t),!1},tt.prototype.dragAndDronHelper=function(e){e&&e.checked(!0);var t=Mt.draggeblePlace(),s=jt.data().messageListCheckedOrSelectedUidsWithSubMails();return t.data("rl-folder",jt.data().currentFolderFullNameRaw()),t.data("rl-uids",s),t.find(".text").text(""+s.length),r.defer(function(){var e=jt.data().messageListCheckedOrSelectedUidsWithSubMails();t.data("rl-uids",e),t.find(".text").text(""+e.length)}),t},tt.prototype.onMessageResponse=function(e,t,s){var i=jt.data();i.hideMessageBodies(),i.messageLoading(!1),It.StorageResultType.Success===e&&t&&t.Result?i.setMessage(t,s):It.StorageResultType.Unload===e?(i.message(null),i.messageError("")):It.StorageResultType.Abort!==e&&(i.message(null),i.messageError(Mt.getNotification(t&&t.ErrorCode?t.ErrorCode:It.Notification.UnknownError)))},tt.prototype.populateMessageBody=function(e){e&&(jt.remote().message(this.onMessageResponse,e.folderFullNameRaw,e.uid)?jt.data().messageLoading(!0):Mt.log("Error: Unknown message request: "+e.folderFullNameRaw+" ~ "+e.uid+" [e-101]"))},tt.prototype.setAction=function(e,t,s){var i=[],o=null,n=jt.cache(),a=0;if(Mt.isUnd(s)&&(s=jt.data().messageListChecked()),i=r.map(s,function(e){return e.uid}),""!==e&&0 0?100>e?e:"99+":""},st.prototype.verifyPgpSignedClearMessage=function(e){e&&e.verifyPgpSignedClearMessage()},st.prototype.decryptPgpEncryptedMessage=function(e){e&&e.decryptPgpEncryptedMessage(this.viewPgpPassword())},st.prototype.readReceipt=function(e){e&&""!==e.readReceipt()&&(jt.remote().sendReadReceiptMessage(Mt.emptyFunction,e.folderFullNameRaw,e.uid,e.readReceipt(),Mt.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:e.subject()}),Mt.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":jt.data().accountEmail()})),e.isReadReceipt(!0),jt.cache().storeMessageFlagsToCache(e),jt.reloadFlagsCurrentMessageListAndMessageFromCache())},Mt.extendAsViewModel("SettingsMenuViewModel",it),it.prototype.link=function(e){return jt.link().settings(e)},it.prototype.backToMailBoxClick=function(){xt.setHash(jt.link().inbox())},Mt.extendAsViewModel("SettingsPaneViewModel",ot),ot.prototype.onBuild=function(){var e=this;c("esc",It.KeyState.Settings,function(){e.backToMailBoxClick()})},ot.prototype.onShow=function(){jt.data().message(null)},ot.prototype.backToMailBoxClick=function(){xt.setHash(jt.link().inbox())},Mt.addSettingsViewModel(nt,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),nt.prototype.toggleLayout=function(){this.layout(It.Layout.NoPreview===this.layout()?It.Layout.SidePreview:It.Layout.NoPreview)},nt.prototype.onBuild=function(){var e=this;r.delay(function(){var s=jt.data(),i=Mt.settingsSaveHelperSimpleFunction(e.mppTrigger,e);s.language.subscribe(function(s){e.languageTrigger(It.SaveSettingsStep.Animate),t.ajax({url:jt.link().langLink(s),dataType:"script",cache:!0}).done(function(){Mt.i18nToDoc(),e.languageTrigger(It.SaveSettingsStep.TrueResult)}).fail(function(){e.languageTrigger(It.SaveSettingsStep.FalseResult)}).always(function(){r.delay(function(){e.languageTrigger(It.SaveSettingsStep.Idle)},1e3)}),jt.remote().saveSettings(Mt.emptyFunction,{Language:s})}),s.editorDefaultType.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{EditorDefaultType:e})}),s.messagesPerPage.subscribe(function(e){jt.remote().saveSettings(i,{MPP:e})}),s.showImages.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{ShowImages:e?"1":"0"})}),s.interfaceAnimation.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{InterfaceAnimation:e})}),s.useDesktopNotifications.subscribe(function(e){Mt.timeOutAction("SaveDesktopNotifications",function(){jt.remote().saveSettings(Mt.emptyFunction,{DesktopNotifications:e?"1":"0"})},3e3)}),s.replySameFolder.subscribe(function(e){Mt.timeOutAction("SaveReplySameFolder",function(){jt.remote().saveSettings(Mt.emptyFunction,{ReplySameFolder:e?"1":"0"})},3e3)}),s.useThreads.subscribe(function(e){s.messageList([]),jt.remote().saveSettings(Mt.emptyFunction,{UseThreads:e?"1":"0"})}),s.layout.subscribe(function(e){s.messageList([]),jt.remote().saveSettings(Mt.emptyFunction,{Layout:e})}),s.useCheckboxesInList.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{UseCheckboxesInList:e?"1":"0"})})},50)},nt.prototype.onShow=function(){jt.data().desktopNotifications.valueHasMutated()},nt.prototype.selectLanguage=function(){xt.showScreenPopup(z)},Mt.addSettingsViewModel(at,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),at.prototype.onBuild=function(){jt.data().contactsAutosave.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{ContactsAutosave:e?"1":"0"})})},Mt.addSettingsViewModel(rt,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),rt.prototype.addNewAccount=function(){xt.showScreenPopup(H)},rt.prototype.deleteAccount=function(t){if(t&&t.deleteAccess()){this.accountForDeletion(null);var s=function(e){return t===e};t&&(this.accounts.remove(s),jt.remote().accountDelete(function(t,s){It.StorageResultType.Success===t&&s&&s.Result&&s.Reload?(xt.routeOff(),xt.setHash(jt.link().root(),!0),xt.routeOff(),r.defer(function(){e.location.reload()})):jt.accountsAndIdentities()},t.email))}},Mt.addSettingsViewModel(lt,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),lt.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=jt.data().signature();this.editor=new d(e.signatureDom(),function(){jt.data().signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},lt.prototype.onBuild=function(){var e=this;r.delay(function(){var t=jt.data(),s=Mt.settingsSaveHelperSimpleFunction(e.displayNameTrigger,e),i=Mt.settingsSaveHelperSimpleFunction(e.replyTrigger,e),o=Mt.settingsSaveHelperSimpleFunction(e.signatureTrigger,e);t.displayName.subscribe(function(e){jt.remote().saveSettings(s,{DisplayName:e})}),t.replyTo.subscribe(function(e){jt.remote().saveSettings(i,{ReplyTo:e})}),t.signature.subscribe(function(e){jt.remote().saveSettings(o,{Signature:e})}),t.signatureToAll.subscribe(function(e){jt.remote().saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},Mt.addSettingsViewModel(ct,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),ct.prototype.addNewIdentity=function(){xt.showScreenPopup(j)},ct.prototype.editIdentity=function(e){xt.showScreenPopup(j,[e])},ct.prototype.deleteIdentity=function(e){if(e&&e.deleteAccess()){this.identityForDeletion(null);var t=function(t){return e===t};e&&(this.identities.remove(t),jt.remote().identityDelete(function(){jt.accountsAndIdentities()},e.id))}},ct.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=jt.data().signature();this.editor=new d(e.signatureDom(),function(){jt.data().signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},ct.prototype.onBuild=function(e){var t=this;e.on("click",".identity-item .e-action",function(){var e=s.dataFor(this);e&&t.editIdentity(e)}),r.delay(function(){var e=jt.data(),s=Mt.settingsSaveHelperSimpleFunction(t.displayNameTrigger,t),i=Mt.settingsSaveHelperSimpleFunction(t.replyTrigger,t),o=Mt.settingsSaveHelperSimpleFunction(t.signatureTrigger,t);e.displayName.subscribe(function(e){jt.remote().saveSettings(s,{DisplayName:e})}),e.replyTo.subscribe(function(e){jt.remote().saveSettings(i,{ReplyTo:e})}),e.signature.subscribe(function(e){jt.remote().saveSettings(o,{Signature:e})}),e.signatureToAll.subscribe(function(e){jt.remote().saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},Mt.addSettingsViewModel(ut,"SettingsFilters","SETTINGS_LABELS/LABEL_FILTERS_NAME","filters"),ut.prototype.deleteFilter=function(e){this.filters.remove(e)},ut.prototype.addFilter=function(){var e=new M;e.addCondition(),e.addAction(),this.filters.push(e)},Mt.addSettingsViewModel(dt,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),dt.prototype.showSecret=function(){this.secreting(!0),jt.remote().showTwoFactorSecret(this.onSecretResult)},dt.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},dt.prototype.createTwoFactor=function(){this.processing(!0),jt.remote().createTwoFactor(this.onResult)},dt.prototype.enableTwoFactor=function(){this.processing(!0),jt.remote().enableTwoFactor(this.onResult,this.viewEnable())},dt.prototype.testTwoFactor=function(){xt.showScreenPopup(W)},dt.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),jt.remote().clearTwoFactor(this.onResult)},dt.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},dt.prototype.onResult=function(e,t){if(this.processing(!1),this.clearing(!1),It.StorageResultType.Success===e&&t&&t.Result?(this.viewUser(Mt.pString(t.Result.User)),this.viewEnable(!!t.Result.Enable),this.twoFactorStatus(!!t.Result.IsSet),this.viewSecret(Mt.pString(t.Result.Secret)),this.viewBackupCodes(Mt.pString(t.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Mt.pString(t.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var s=this;this.viewEnable.subscribe(function(e){this.viewEnable.subs&&jt.remote().enableTwoFactor(function(e,t){It.StorageResultType.Success===e&&t&&t.Result||(s.viewEnable.subs=!1,s.viewEnable(!1),s.viewEnable.subs=!0)},e)},this)}},dt.prototype.onSecretResult=function(e,t){this.secreting(!1),It.StorageResultType.Success===e&&t&&t.Result?(this.viewSecret(Mt.pString(t.Result.Secret)),this.viewUrl(Mt.pString(t.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},dt.prototype.onBuild=function(){this.processing(!0),jt.remote().getTwoFactor(this.onResult)},Mt.addSettingsViewModel(ht,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Mt.addSettingsViewModel(pt,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),pt.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},pt.prototype.onChangePasswordResponse=function(e,t){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),It.StorageResultType.Success===e&&t&&t.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(t&&It.Notification.CurrentPasswordIncorrect===t.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(Mt.getNotification(t&&t.ErrorCode?t.ErrorCode:It.Notification.CouldNotSaveNewPassword)))},Mt.addSettingsViewModel(mt,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),mt.prototype.folderEditOnEnter=function(e){var t=e?Mt.trim(e.nameForEdit()):"";""!==t&&e.name()!==t&&(jt.local().set(It.ClientSideKeyName.FoldersLashHash,""),jt.data().foldersRenaming(!0),jt.remote().folderRename(function(e,t){jt.data().foldersRenaming(!1),It.StorageResultType.Success===e&&t&&t.Result||jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),jt.folders() -},e.fullNameRaw,t),jt.cache().removeFolderFromCacheList(e.fullNameRaw),e.name(t)),e.edited(!1)},mt.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},mt.prototype.onShow=function(){jt.data().foldersListError("")},mt.prototype.createFolder=function(){xt.showScreenPopup(k)},mt.prototype.systemFolder=function(){xt.showScreenPopup(_)},mt.prototype.deleteFolder=function(e){if(e&&e.canBeDeleted()&&e.deleteAccess()&&0===e.privateMessageCountAll()){this.folderForDeletion(null);var t=function(s){return e===s?!0:(s.subFolders.remove(t),!1)};e&&(jt.local().set(It.ClientSideKeyName.FoldersLashHash,""),jt.data().folderList.remove(t),jt.data().foldersDeleting(!0),jt.remote().folderDelete(function(e,t){jt.data().foldersDeleting(!1),It.StorageResultType.Success===e&&t&&t.Result||jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),jt.folders()},e.fullNameRaw),jt.cache().removeFolderFromCacheList(e.fullNameRaw))}else 0 0&&(s=this.messagesBodiesDom(),s&&(s.find(".rl-cache-class").each(function(){var s=t(this);i>s.data("rl-cache-count")&&(s.addClass("rl-cache-purge"),e++)}),e>0&&r.delay(function(){s.find(".rl-cache-purge").remove()},300)))},yt.prototype.populateDataOnStart=function(){bt.prototype.populateDataOnStart.call(this),this.accountEmail(jt.settingsGet("Email")),this.accountIncLogin(jt.settingsGet("IncLogin")),this.accountOutLogin(jt.settingsGet("OutLogin")),this.projectHash(jt.settingsGet("ProjectHash")),this.displayName(jt.settingsGet("DisplayName")),this.replyTo(jt.settingsGet("ReplyTo")),this.signature(jt.settingsGet("Signature")),this.signatureToAll(!!jt.settingsGet("SignatureToAll")),this.enableTwoFactor(!!jt.settingsGet("EnableTwoFactor")),this.lastFoldersHash=jt.local().get(It.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!jt.settingsGet("RemoteSuggestions"),this.devEmail=jt.settingsGet("DevEmail"),this.devPassword=jt.settingsGet("DevPassword")},yt.prototype.initUidNextAndNewMessages=function(t,s,i){if("INBOX"===t&&Mt.isNormal(s)&&""!==s){if(Mt.isArray(i)&&0 3)l(jt.link().notificationMailIcon(),jt.data().accountEmail(),Mt.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:a}));else for(;a>n;n++)l(jt.link().notificationMailIcon(),E.emailsToLine(E.initEmailsFromJson(i[n].From),!1),i[n].Subject)}jt.cache().setFolderUidNext(t,s)}},yt.prototype.folderResponseParseRec=function(e,t){var s=0,i=0,o=null,n=null,a="",r=[],l=[];for(s=0,i=t.length;i>s;s++)o=t[s],o&&(a=o.FullNameRaw,n=jt.cache().getFolderFromCacheList(a),n||(n=N.newInstanceFromJson(o),n&&(jt.cache().setFolderToCacheList(a,n),jt.cache().setFolderFullNameRaw(n.fullNameHash,a))),n&&(n.collapsed(!Mt.isFolderExpanded(n.fullNameHash)),o.Extended&&(o.Extended.Hash&&jt.cache().setFolderHash(n.fullNameRaw,o.Extended.Hash),Mt.isNormal(o.Extended.MessageCount)&&n.messageCountAll(o.Extended.MessageCount),Mt.isNormal(o.Extended.MessageUnseenCount)&&n.messageCountUnread(o.Extended.MessageUnseenCount)),r=o.SubFolders,r&&"Collection/FolderCollection"===r["@Object"]&&r["@Collection"]&&Mt.isArray(r["@Collection"])&&n.subFolders(this.folderResponseParseRec(e,r["@Collection"])),l.push(n)));return l},yt.prototype.setFolders=function(e){var t=[],s=!1,i=jt.data(),o=function(e){return""===e||Lt.Values.UnuseOptionValue===e||null!==jt.cache().getFolderFromCacheList(e)?e:""};e&&e.Result&&"Collection/FolderCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])&&(Mt.isUnd(e.Result.Namespace)||(i.namespace=e.Result.Namespace),this.threading(!!jt.settingsGet("UseImapThread")&&e.Result.IsThreadsSupported&&!0),t=this.folderResponseParseRec(i.namespace,e.Result["@Collection"]),i.folderList(t),e.Result.SystemFolders&&""==""+jt.settingsGet("SentFolder")+jt.settingsGet("DraftFolder")+jt.settingsGet("SpamFolder")+jt.settingsGet("TrashFolder")+jt.settingsGet("ArchiveFolder")+jt.settingsGet("NullFolder")&&(jt.settingsSet("SentFolder",e.Result.SystemFolders[2]||null),jt.settingsSet("DraftFolder",e.Result.SystemFolders[3]||null),jt.settingsSet("SpamFolder",e.Result.SystemFolders[4]||null),jt.settingsSet("TrashFolder",e.Result.SystemFolders[5]||null),jt.settingsSet("ArchiveFolder",e.Result.SystemFolders[12]||null),s=!0),i.sentFolder(o(jt.settingsGet("SentFolder"))),i.draftFolder(o(jt.settingsGet("DraftFolder"))),i.spamFolder(o(jt.settingsGet("SpamFolder"))),i.trashFolder(o(jt.settingsGet("TrashFolder"))),i.archiveFolder(o(jt.settingsGet("ArchiveFolder"))),s&&jt.remote().saveSystemFolders(Mt.emptyFunction,{SentFolder:i.sentFolder(),DraftFolder:i.draftFolder(),SpamFolder:i.spamFolder(),TrashFolder:i.trashFolder(),ArchiveFolder:i.archiveFolder(),NullFolder:"NullFolder"}),jt.local().set(It.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},yt.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},yt.prototype.getNextFolderNames=function(e){e=Mt.isUnd(e)?!1:!!e;var t=[],s=10,i=n().unix(),o=i-300,a=[],l=function(t){r.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&o>t.interval&&(!e||t.subScribed())&&a.push([t.interval,t.fullNameRaw]),t&&0 t[0]?1:0}),r.find(a,function(e){var o=jt.cache().getFolderFromCacheList(e[1]);return o&&(o.interval=i,t.push(e[1])),s<=t.length}),r.uniq(t)},yt.prototype.removeMessagesFromList=function(e,t,s,i){s=Mt.isNormal(s)?s:"",i=Mt.isUnd(i)?!1:!!i,t=r.map(t,function(e){return Mt.pInt(e)});var o=0,n=jt.data(),a=jt.cache(),l=n.messageList(),c=jt.cache().getFolderFromCacheList(e),u=""===s?null:a.getFolderFromCacheList(s||""),d=n.currentFolderFullNameRaw(),h=n.message(),p=d===e?r.filter(l,function(e){return e&&-1 0&&c.messageCountUnread(0<=c.messageCountUnread()-o?c.messageCountUnread()-o:0)),u&&(u.messageCountAll(u.messageCountAll()+t.length),o>0&&u.messageCountUnread(u.messageCountUnread()+o),u.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),a.data("rl-cache-count",++kt.iMessageBodyCacheCount),Mt.isNormal(e.Result.Html)&&""!==e.Result.Html?(i=!0,a.html(e.Result.Html.toString()).addClass("b-text-part html")):Mt.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(i=!1,c=e.Result.Plain.toString(),(p.isPgpSigned()||p.isPgpEncrypted())&&jt.data().capaOpenPGP()&&Mt.isNormal(e.Result.PlainRaw)&&(p.plainRaw=Mt.pString(e.Result.PlainRaw),d=/---BEGIN PGP MESSAGE---/.test(p.plainRaw),d||(u=/-----BEGIN PGP SIGNED MESSAGE-----/.test(p.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(p.plainRaw)),zt.empty(),u&&p.isPgpSigned()?c=zt.append(t('').text(p.plainRaw)).html():d&&p.isPgpEncrypted()&&(c=zt.append(t('').text(p.plainRaw)).html()),zt.empty(),p.isPgpSigned(u),p.isPgpEncrypted(d)),a.html(c).addClass("b-text-part plain")):i=!1,p.isHtml(!!i),p.hasImages(!!o),p.pgpSignedVerifyStatus(It.SignedVerifyStatus.None),p.pgpSignedVerifyUser(""),e.Result.Rtl&&(p.isRtl(!0),a.addClass("rtl-text-part")),p.body=a,p.body&&h.append(p.body),p.storeDataToDom(),n&&p.showInternalImages(!0),p.hasImages()&&this.showImages()&&p.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(p.body),this.hideMessageBodies(),p.body.show(),a&&Mt.initBlockquoteSwitcher(a)),jt.cache().initMessageFlagsFromCache(p),p.unseen()&&jt.setMessageSeen(p),Mt.windowResize())},yt.prototype.calculateMessageListHash=function(e){return r.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},yt.prototype.setMessageList=function(e,t){if(e&&e.Result&&"Collection/MessageCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])){var s=jt.data(),i=jt.cache(),o=null,a=0,r=0,l=0,c=0,u=[],d=n().unix(),h=s.staticMessageList,p=null,m=null,g=null,f=0,b=!1;for(l=Mt.pInt(e.Result.MessageResultCount),c=Mt.pInt(e.Result.Offset),Mt.isNonEmptyArray(e.Result.LastCollapsedThreadUids)&&(o=e.Result.LastCollapsedThreadUids),g=jt.cache().getFolderFromCacheList(Mt.isNormal(e.Result.Folder)?e.Result.Folder:""),g&&!t&&(g.interval=d,jt.cache().setFolderHash(e.Result.Folder,e.Result.FolderHash),Mt.isNormal(e.Result.MessageCount)&&g.messageCountAll(e.Result.MessageCount),Mt.isNormal(e.Result.MessageUnseenCount)&&(Mt.pInt(g.messageCountUnread())!==Mt.pInt(e.Result.MessageUnseenCount)&&(b=!0),g.messageCountUnread(e.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(g.fullNameRaw,e.Result.UidNext,e.Result.NewMessages)),b&&g&&jt.cache().clearMessageFlagsFromCacheByFolder(g.fullNameRaw),a=0,r=e.Result["@Collection"].length;r>a;a++)p=e.Result["@Collection"][a],p&&"Object/Message"===p["@Object"]&&(m=h[a],m&&m.initByJson(p)||(m=E.newInstanceFromJson(p)),m&&(i.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=f&&(f++,m.newForAnimation(!0)),m.deleted(!1),t?jt.cache().initMessageFlagsFromCache(m):jt.cache().storeMessageFlagsToCache(m),m.lastInCollapsedThread(o&&-1 (new e.Date).getTime()-d),p&&l.oRequests[p]&&(l.oRequests[p].__aborted&&(o="abort"),l.oRequests[p]=null),l.defaultResponse(s,p,o,t,n,i)}),p&&0 0?(this.defaultRequest(e,"Message",{},null,"Message/"+Ot.urlsafe_encode([t,s,jt.data().projectHash(),jt.data().threading()&&jt.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},vt.prototype.composeUploadExternals=function(e,t){this.defaultRequest(e,"ComposeUploadExternals",{Externals:t},999e3)},vt.prototype.folderInformation=function(e,t,s){var i=!0,o=jt.cache(),n=[];Mt.isArray(s)&&0 0&&(s=this.messagesBodiesDom(),s&&(s.find(".rl-cache-class").each(function(){var s=t(this);i>s.data("rl-cache-count")&&(s.addClass("rl-cache-purge"),e++)}),e>0&&r.delay(function(){s.find(".rl-cache-purge").remove()},300)))},yt.prototype.populateDataOnStart=function(){bt.prototype.populateDataOnStart.call(this),this.accountEmail(jt.settingsGet("Email")),this.accountIncLogin(jt.settingsGet("IncLogin")),this.accountOutLogin(jt.settingsGet("OutLogin")),this.projectHash(jt.settingsGet("ProjectHash")),this.displayName(jt.settingsGet("DisplayName")),this.replyTo(jt.settingsGet("ReplyTo")),this.signature(jt.settingsGet("Signature")),this.signatureToAll(!!jt.settingsGet("SignatureToAll")),this.enableTwoFactor(!!jt.settingsGet("EnableTwoFactor")),this.lastFoldersHash=jt.local().get(It.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!jt.settingsGet("RemoteSuggestions"),this.devEmail=jt.settingsGet("DevEmail"),this.devPassword=jt.settingsGet("DevPassword")},yt.prototype.initUidNextAndNewMessages=function(t,s,i){if("INBOX"===t&&Mt.isNormal(s)&&""!==s){if(Mt.isArray(i)&&0 3)l(jt.link().notificationMailIcon(),jt.data().accountEmail(),Mt.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:a}));else for(;a>n;n++)l(jt.link().notificationMailIcon(),E.emailsToLine(E.initEmailsFromJson(i[n].From),!1),i[n].Subject)}jt.cache().setFolderUidNext(t,s)}},yt.prototype.folderResponseParseRec=function(e,t){var s=0,i=0,o=null,n=null,a="",r=[],l=[];for(s=0,i=t.length;i>s;s++)o=t[s],o&&(a=o.FullNameRaw,n=jt.cache().getFolderFromCacheList(a),n||(n=N.newInstanceFromJson(o),n&&(jt.cache().setFolderToCacheList(a,n),jt.cache().setFolderFullNameRaw(n.fullNameHash,a))),n&&(n.collapsed(!Mt.isFolderExpanded(n.fullNameHash)),o.Extended&&(o.Extended.Hash&&jt.cache().setFolderHash(n.fullNameRaw,o.Extended.Hash),Mt.isNormal(o.Extended.MessageCount)&&n.messageCountAll(o.Extended.MessageCount),Mt.isNormal(o.Extended.MessageUnseenCount)&&n.messageCountUnread(o.Extended.MessageUnseenCount)),r=o.SubFolders,r&&"Collection/FolderCollection"===r["@Object"]&&r["@Collection"]&&Mt.isArray(r["@Collection"])&&n.subFolders(this.folderResponseParseRec(e,r["@Collection"])),l.push(n)));return l},yt.prototype.setFolders=function(e){var t=[],s=!1,i=jt.data(),o=function(e){return""===e||Lt.Values.UnuseOptionValue===e||null!==jt.cache().getFolderFromCacheList(e)?e:""};e&&e.Result&&"Collection/FolderCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])&&(Mt.isUnd(e.Result.Namespace)||(i.namespace=e.Result.Namespace),this.threading(!!jt.settingsGet("UseImapThread")&&e.Result.IsThreadsSupported&&!0),t=this.folderResponseParseRec(i.namespace,e.Result["@Collection"]),i.folderList(t),e.Result.SystemFolders&&""==""+jt.settingsGet("SentFolder")+jt.settingsGet("DraftFolder")+jt.settingsGet("SpamFolder")+jt.settingsGet("TrashFolder")+jt.settingsGet("ArchiveFolder")+jt.settingsGet("NullFolder")&&(jt.settingsSet("SentFolder",e.Result.SystemFolders[2]||null),jt.settingsSet("DraftFolder",e.Result.SystemFolders[3]||null),jt.settingsSet("SpamFolder",e.Result.SystemFolders[4]||null),jt.settingsSet("TrashFolder",e.Result.SystemFolders[5]||null),jt.settingsSet("ArchiveFolder",e.Result.SystemFolders[12]||null),s=!0),i.sentFolder(o(jt.settingsGet("SentFolder"))),i.draftFolder(o(jt.settingsGet("DraftFolder"))),i.spamFolder(o(jt.settingsGet("SpamFolder"))),i.trashFolder(o(jt.settingsGet("TrashFolder"))),i.archiveFolder(o(jt.settingsGet("ArchiveFolder"))),s&&jt.remote().saveSystemFolders(Mt.emptyFunction,{SentFolder:i.sentFolder(),DraftFolder:i.draftFolder(),SpamFolder:i.spamFolder(),TrashFolder:i.trashFolder(),ArchiveFolder:i.archiveFolder(),NullFolder:"NullFolder"}),jt.local().set(It.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},yt.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},yt.prototype.getNextFolderNames=function(e){e=Mt.isUnd(e)?!1:!!e;var t=[],s=10,i=n().unix(),o=i-300,a=[],l=function(t){r.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&o>t.interval&&(!e||t.subScribed())&&a.push([t.interval,t.fullNameRaw]),t&&0 t[0]?1:0}),r.find(a,function(e){var o=jt.cache().getFolderFromCacheList(e[1]);return o&&(o.interval=i,t.push(e[1])),s<=t.length}),r.uniq(t)},yt.prototype.removeMessagesFromList=function(e,t,s,i){s=Mt.isNormal(s)?s:"",i=Mt.isUnd(i)?!1:!!i,t=r.map(t,function(e){return Mt.pInt(e)});var o=0,n=jt.data(),a=jt.cache(),l=n.messageList(),c=jt.cache().getFolderFromCacheList(e),u=""===s?null:a.getFolderFromCacheList(s||""),d=n.currentFolderFullNameRaw(),h=n.message(),p=d===e?r.filter(l,function(e){return e&&-1 0&&c.messageCountUnread(0<=c.messageCountUnread()-o?c.messageCountUnread()-o:0)),u&&(u.messageCountAll(u.messageCountAll()+t.length),o>0&&u.messageCountUnread(u.messageCountUnread()+o),u.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),a.data("rl-cache-count",++kt.iMessageBodyCacheCount),Mt.isNormal(e.Result.Html)&&""!==e.Result.Html?(i=!0,a.html(e.Result.Html.toString()).addClass("b-text-part html")):Mt.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(i=!1,c=e.Result.Plain.toString(),(p.isPgpSigned()||p.isPgpEncrypted())&&jt.data().capaOpenPGP()&&Mt.isNormal(e.Result.PlainRaw)&&(p.plainRaw=Mt.pString(e.Result.PlainRaw),d=/---BEGIN PGP MESSAGE---/.test(p.plainRaw),d||(u=/-----BEGIN PGP SIGNED MESSAGE-----/.test(p.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(p.plainRaw)),zt.empty(),u&&p.isPgpSigned()?c=zt.append(t('').text(p.plainRaw)).html():d&&p.isPgpEncrypted()&&(c=zt.append(t('').text(p.plainRaw)).html()),zt.empty(),p.isPgpSigned(u),p.isPgpEncrypted(d)),a.html(c).addClass("b-text-part plain")):i=!1,p.isHtml(!!i),p.hasImages(!!o),p.pgpSignedVerifyStatus(It.SignedVerifyStatus.None),p.pgpSignedVerifyUser(""),e.Result.Rtl&&(p.isRtl(!0),a.addClass("rtl-text-part")),p.body=a,p.body&&h.append(p.body),p.storeDataToDom(),n&&p.showInternalImages(!0),p.hasImages()&&this.showImages()&&p.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(p.body),this.hideMessageBodies(),p.body.show(),a&&Mt.initBlockquoteSwitcher(a)),jt.cache().initMessageFlagsFromCache(p),p.unseen()&&jt.setMessageSeen(p),Mt.windowResize())},yt.prototype.calculateMessageListHash=function(e){return r.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},yt.prototype.setMessageList=function(e,t){if(e&&e.Result&&"Collection/MessageCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])){var s=jt.data(),i=jt.cache(),o=null,a=0,r=0,l=0,c=0,u=[],d=n().unix(),h=s.staticMessageList,p=null,m=null,g=null,f=0,b=!1;for(l=Mt.pInt(e.Result.MessageResultCount),c=Mt.pInt(e.Result.Offset),Mt.isNonEmptyArray(e.Result.LastCollapsedThreadUids)&&(o=e.Result.LastCollapsedThreadUids),g=jt.cache().getFolderFromCacheList(Mt.isNormal(e.Result.Folder)?e.Result.Folder:""),g&&!t&&(g.interval=d,jt.cache().setFolderHash(e.Result.Folder,e.Result.FolderHash),Mt.isNormal(e.Result.MessageCount)&&g.messageCountAll(e.Result.MessageCount),Mt.isNormal(e.Result.MessageUnseenCount)&&(Mt.pInt(g.messageCountUnread())!==Mt.pInt(e.Result.MessageUnseenCount)&&(b=!0),g.messageCountUnread(e.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(g.fullNameRaw,e.Result.UidNext,e.Result.NewMessages)),b&&g&&jt.cache().clearMessageFlagsFromCacheByFolder(g.fullNameRaw),a=0,r=e.Result["@Collection"].length;r>a;a++)p=e.Result["@Collection"][a],p&&"Object/Message"===p["@Object"]&&(m=h[a],m&&m.initByJson(p)||(m=E.newInstanceFromJson(p)),m&&(i.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=f&&(f++,m.newForAnimation(!0)),m.deleted(!1),t?jt.cache().initMessageFlagsFromCache(m):jt.cache().storeMessageFlagsToCache(m),m.lastInCollapsedThread(o&&-1 (new e.Date).getTime()-d),p&&l.oRequests[p]&&(l.oRequests[p].__aborted&&(o="abort"),l.oRequests[p]=null),l.defaultResponse(s,p,o,t,n,i)}),p&&0 0?(this.defaultRequest(e,"Message",{},null,"Message/"+Ot.urlsafe_encode([t,s,jt.data().projectHash(),jt.data().threading()&&jt.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},vt.prototype.composeUploadExternals=function(e,t){this.defaultRequest(e,"ComposeUploadExternals",{Externals:t},999e3)},vt.prototype.folderInformation=function(e,t,s){var i=!0,o=jt.cache(),n=[];Mt.isArray(s)&&0