]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},X.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},X.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},X.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:X.isUnd(c)?a.toString():c.toString(),custom:X.isUnd(c)?!1:!0,title:X.isUnd(c)?"":a.toString(),value:a.toString()};(X.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},X.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},X.disableKeyFilter=function(){a.key&&(key.filter=function(){return ib.data().useKeyboardShortcuts()})},X.restoreKeyFilter=function(){a.key&&(key.filter=function(a){if(ib.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},X.detectDropdownVisibility=f.debounce(function(){$.dropdownVisibility(!!f.find(ab,function(a){return a.hasClass("open")}))},50),Z={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Z.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Z._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Z._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!$.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||$.dropdownVisibility()?"":''+X.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),$.tooltipTrigger.subscribe(function(){e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||$.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),$.tooltipTrigger.subscribe(function(){d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),gb.click(function(){c.tooltip("hide")}),$.tooltipTrigger.subscribe(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){ab.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),X.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!X.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!X.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!$.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){X.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){X.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),X.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=X.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=X.pInt(e[2]),g=fb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!$.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),X.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),X.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null)},b(d).draggable(k).on("mousedown",function(){X.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!$.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){$.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:g,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){ib.getAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=X.trim(a),c=null;return""!==b?(c=new o,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:g,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){ib.getContactsTagsAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1) -}))})},parseHook:function(a){return f.map(a,function(a){var b=X.trim(a),c=null;return""!==b?(c=new p,c.name(b),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(X.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},X.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=X.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=X.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),X.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},g.prototype.root=function(){return this.sBase},g.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},g.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},g.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},g.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},g.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},g.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},g.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},g.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},g.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},g.prototype.settings=function(a){var b=this.sBase+"settings";return X.isUnd(a)||""===a||(b+="/"+a),b},g.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},g.prototype.mailBox=function(a,b,c){b=X.isNormal(b)?X.pInt(b):1,c=X.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},g.prototype.phpInfo=function(){return this.sServer+"Info"},g.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},g.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},g.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},g.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},g.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.emptyFullContactPic=function(){return a.location.protocol+"//"+a.location.hostname+("80"==""+a.location.port||""==""+a.location.port?"":":"+a.location.port)+a.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a},g.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=X.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},g.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Y.oViewModelsHooks={},Y.oSimpleHooks={},Y.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Y.addHook=function(a,b){X.isFunc(b)&&(X.isArray(Y.oSimpleHooks[a])||(Y.oSimpleHooks[a]=[]),Y.oSimpleHooks[a].push(b))},Y.runHook=function(a,b){X.isArray(Y.oSimpleHooks[a])&&(b=b||[],f.each(Y.oSimpleHooks[a],function(a){a.apply(null,b)}))},Y.mainSettingsGet=function(a){return ib?ib.settingsGet(a):null},Y.remoteRequest=function(a,b,c,d,e,f){ib&&ib.remote().defaultRequest(a,b,c,d,e,f)},Y.settingsGet=function(a,b){var c=Y.mainSettingsGet("Plugins");return c=c&&X.isUnd(c[a])?null:c[a],c?X.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(U.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(U.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(U.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.isUnd(d[a])?d[a]:null}catch(e){}return d},i.supported=function(){return!!a.localStorage},i.prototype.set=function(b,c){var d=a.localStorage[U.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[U.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[U.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.isUnd(d[b])?d[b]:null}catch(e){}return d},j.prototype.oDriver=null,j.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},j.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},k.prototype.bootstart=function(){},l.prototype.sPosition="",l.prototype.sTemplate="",l.prototype.viewModelName="",l.prototype.viewModelDom=null,l.prototype.viewModelTemplate=function(){return this.sTemplate},l.prototype.viewModelPosition=function(){return this.sPosition},l.prototype.cancelCommand=l.prototype.closeCommand=function(){},l.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=ib.data().keyScope(),ib.data().keyScope(this.sDefaultKeyScope)},l.prototype.restoreKeyScope=function(){ib.data().keyScope(this.sCurrentKeyScope)},l.prototype.registerPopupKeyDown=function(){var a=this;fb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&V.EventKeyCode.Esc===b.keyCode)return X.delegateRun(a,"cancelCommand"),!1;if(V.EventKeyCode.Backspace===b.keyCode&&!X.inFocus())return!1}return!0})},m.prototype.oCross=null,m.prototype.sScreenName="",m.prototype.aViewModels=[],m.prototype.viewModels=function(){return this.aViewModels},m.prototype.screenName=function(){return this.sScreenName},m.prototype.routes=function(){return null},m.prototype.__cross=function(){return this.oCross},m.prototype.__start=function(){var a=this.routes(),b=null,c=null;X.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||X.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.constructorEnd=function(a){X.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.hideLoading=function(){b("#rl-loading").hide()},n.prototype.routeOff=function(){e.changed.active=!1},n.prototype.routeOn=function(){e.changed.active=!0},n.prototype.setBoot=function(a){return X.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||X.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),g=e.viewModelPosition(),h=b("#rl-content #rl-"+g.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=ib.data(),e.viewModelName=a.__name,h&&1===h.length?(i=b("").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide(),i.appendTo(h),e.viewModelDom=i,a.__dom=i,"Popups"===g&&(e.cancelCommand=e.closeCommand=X.createCommand(e,function(){bb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),ib.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+ib.popupVisibilityNames().length+10),X.delegateRun(this,"onFocus",[],500)):(X.delegateRun(this,"onHide"),this.restoreKeyScope(),ib.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),$.tooltipTrigger(!$.tooltipTrigger()),f.delay(function(){b.viewModelDom.hide()},300))},e)),Y.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindingAccessorsToNode(i[0],{i18nInit:!0,template:function(){return{name:e.viewModelTemplate()}}},e),X.delegateRun(e,"onBuild",[i]),e&&"Popups"===g&&e.registerPopupKeyDown(),Y.runHook("view-model-post-build",[a.__name,e,i])):X.log("Cannot find view model position: "+g)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Y.runHook("view-model-on-hide",[a.__name,a.__vm]))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),X.delegateRun(a.__vm,"onShow",b||[]),Y.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===X.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,X.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),X.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onHide"),X.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),X.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onShow"),Y.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),X.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),X.delegateRun(a.__vm,"onShow"),X.delegateRun(a.__vm,"onFocus",[],200),Y.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),Y.runHook("screen-pre-start",[a.screenName(),a]),X.delegateRun(a,"onStart"),Y.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),f.delay(function(){eb.removeClass("rl-started-trigger").addClass("rl-started")},50)},n.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=X.isUnd(c)?!1:!!c,(X.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},n.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},bb=new n,o.newInstanceFromJson=function(a){var b=new o;return b.initByJson(a)?b:null},o.prototype.name="",o.prototype.email="",o.prototype.privateType=null,o.prototype.clear=function(){this.email="",this.name="",this.privateType=null},o.prototype.validate=function(){return""!==this.name||""!==this.email},o.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},o.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},o.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=V.EmailType.Facebook),null===this.privateType&&(this.privateType=V.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){this.clear(),a=X.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},o.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=X.trim(a.Name),this.email=X.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=X.isUnd(b)?!1:!!b,c=X.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+X.encodeHtml(this.name)+"":c?X.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=X.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+X.encodeHtml(d)+""+X.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=X.encodeHtml(d))):b&&(d=''+X.encodeHtml(this.email)+""))),d},o.prototype.mailsoParse=function(a){if(a=X.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m 0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=X.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=X.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=X.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},o.prototype.inputoTagLine=function(){return 0 (new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0
]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},X.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},X.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},X.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:X.isUnd(c)?a.toString():c.toString(),custom:X.isUnd(c)?!1:!0,title:X.isUnd(c)?"":a.toString(),value:a.toString()};(X.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},X.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},X.disableKeyFilter=function(){a.key&&(key.filter=function(){return ib.data().useKeyboardShortcuts()})},X.restoreKeyFilter=function(){a.key&&(key.filter=function(a){if(ib.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},X.detectDropdownVisibility=f.debounce(function(){$.dropdownVisibility(!!f.find(ab,function(a){return a.hasClass("open")}))},50),Z={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Z.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Z._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Z._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!$.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||$.dropdownVisibility()?"":''+X.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),$.tooltipTrigger.subscribe(function(){e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||$.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),$.tooltipTrigger.subscribe(function(){d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),gb.click(function(){c.tooltip("hide")}),$.tooltipTrigger.subscribe(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){ab.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),X.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!X.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!X.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!$.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){X.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){X.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),X.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=X.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=X.pInt(e[2]),g=fb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!$.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),X.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),X.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null)},b(d).draggable(k).on("mousedown",function(){X.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!$.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){$.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:g,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){ib.getAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=X.trim(a),c=null;return""!==b?(c=new o,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:g,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){ib.getContactsTagsAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1) +}))})},parseHook:function(a){return f.map(a,function(a){var b=X.trim(a),c=null;return""!==b?(c=new p,c.name(b),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(X.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},X.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=X.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=X.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),X.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},g.prototype.root=function(){return this.sBase},g.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},g.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},g.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},g.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},g.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},g.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},g.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},g.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},g.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},g.prototype.settings=function(a){var b=this.sBase+"settings";return X.isUnd(a)||""===a||(b+="/"+a),b},g.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},g.prototype.mailBox=function(a,b,c){b=X.isNormal(b)?X.pInt(b):1,c=X.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},g.prototype.phpInfo=function(){return this.sServer+"Info"},g.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},g.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},g.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},g.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},g.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.emptyFullContactPic=function(){return a.location.protocol+"//"+a.location.hostname+("80"==""+a.location.port||""==""+a.location.port?"":":"+a.location.port)+a.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a},g.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=X.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},g.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Y.oViewModelsHooks={},Y.oSimpleHooks={},Y.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Y.addHook=function(a,b){X.isFunc(b)&&(X.isArray(Y.oSimpleHooks[a])||(Y.oSimpleHooks[a]=[]),Y.oSimpleHooks[a].push(b))},Y.runHook=function(a,b){X.isArray(Y.oSimpleHooks[a])&&(b=b||[],f.each(Y.oSimpleHooks[a],function(a){a.apply(null,b)}))},Y.mainSettingsGet=function(a){return ib?ib.settingsGet(a):null},Y.remoteRequest=function(a,b,c,d,e,f){ib&&ib.remote().defaultRequest(a,b,c,d,e,f)},Y.settingsGet=function(a,b){var c=Y.mainSettingsGet("Plugins");return c=c&&X.isUnd(c[a])?null:c[a],c?X.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(U.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(U.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(U.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.isUnd(d[a])?d[a]:null}catch(e){}return d},i.supported=function(){return!!a.localStorage},i.prototype.set=function(b,c){var d=a.localStorage[U.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[U.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[U.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.isUnd(d[b])?d[b]:null}catch(e){}return d},j.prototype.oDriver=null,j.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},j.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},k.prototype.bootstart=function(){},l.prototype.sPosition="",l.prototype.sTemplate="",l.prototype.viewModelName="",l.prototype.viewModelDom=null,l.prototype.viewModelTemplate=function(){return this.sTemplate},l.prototype.viewModelPosition=function(){return this.sPosition},l.prototype.cancelCommand=l.prototype.closeCommand=function(){},l.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=ib.data().keyScope(),ib.data().keyScope(this.sDefaultKeyScope)},l.prototype.restoreKeyScope=function(){ib.data().keyScope(this.sCurrentKeyScope)},l.prototype.registerPopupKeyDown=function(){var a=this;fb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&V.EventKeyCode.Esc===b.keyCode)return X.delegateRun(a,"cancelCommand"),!1;if(V.EventKeyCode.Backspace===b.keyCode&&!X.inFocus())return!1}return!0})},m.prototype.oCross=null,m.prototype.sScreenName="",m.prototype.aViewModels=[],m.prototype.viewModels=function(){return this.aViewModels},m.prototype.screenName=function(){return this.sScreenName},m.prototype.routes=function(){return null},m.prototype.__cross=function(){return this.oCross},m.prototype.__start=function(){var a=this.routes(),b=null,c=null;X.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||X.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.constructorEnd=function(a){X.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.hideLoading=function(){b("#rl-loading").hide()},n.prototype.routeOff=function(){e.changed.active=!1},n.prototype.routeOn=function(){e.changed.active=!0},n.prototype.setBoot=function(a){return X.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||X.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),g=e.viewModelPosition(),h=b("#rl-content #rl-"+g.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=ib.data(),e.viewModelName=a.__name,h&&1===h.length?(i=b("").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide(),i.appendTo(h),e.viewModelDom=i,a.__dom=i,"Popups"===g&&(e.cancelCommand=e.closeCommand=X.createCommand(e,function(){bb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),ib.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+ib.popupVisibilityNames().length+10),X.delegateRun(this,"onFocus",[],500)):(X.delegateRun(this,"onHide"),this.restoreKeyScope(),ib.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),$.tooltipTrigger(!$.tooltipTrigger()),f.delay(function(){b.viewModelDom.hide()},300))},e)),Y.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindingAccessorsToNode(i[0],{i18nInit:!0,template:function(){return{name:e.viewModelTemplate()}}},e),X.delegateRun(e,"onBuild",[i]),e&&"Popups"===g&&e.registerPopupKeyDown(),Y.runHook("view-model-post-build",[a.__name,e,i])):X.log("Cannot find view model position: "+g)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Y.runHook("view-model-on-hide",[a.__name,a.__vm]))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),X.delegateRun(a.__vm,"onShow",b||[]),Y.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===X.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,X.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),X.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onHide"),X.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),X.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onShow"),Y.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),X.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),X.delegateRun(a.__vm,"onShow"),X.delegateRun(a.__vm,"onFocus",[],200),Y.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),Y.runHook("screen-pre-start",[a.screenName(),a]),X.delegateRun(a,"onStart"),Y.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),f.delay(function(){eb.removeClass("rl-started-trigger").addClass("rl-started")},50)},n.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=X.isUnd(c)?!1:!!c,(X.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},n.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},bb=new n,o.newInstanceFromJson=function(a){var b=new o;return b.initByJson(a)?b:null},o.prototype.name="",o.prototype.email="",o.prototype.privateType=null,o.prototype.clear=function(){this.email="",this.name="",this.privateType=null},o.prototype.validate=function(){return""!==this.name||""!==this.email},o.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},o.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},o.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=V.EmailType.Facebook),null===this.privateType&&(this.privateType=V.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){this.clear(),a=X.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},o.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=X.trim(a.Name),this.email=X.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=X.isUnd(b)?!1:!!b,c=X.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+X.encodeHtml(this.name)+"":c?X.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=X.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+X.encodeHtml(d)+""+X.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=X.encodeHtml(d))):b&&(d=''+X.encodeHtml(this.email)+""))),d},o.prototype.mailsoParse=function(a){if(a=X.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m 0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=X.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=X.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=X.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},o.prototype.inputoTagLine=function(){return 0 (new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0
]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Fb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Fb.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},Fb.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:Fb.isUnd(c)?a.toString():c.toString(),custom:Fb.isUnd(c)?!1:!0,title:Fb.isUnd(c)?"":a.toString(),value:a.toString()};(Fb.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},Fb.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},Fb.disableKeyFilter=function(){a.key&&(j.filter=function(){return Sb.data().useKeyboardShortcuts()})},Fb.restoreKeyFilter=function(){a.key&&(j.filter=function(a){if(Sb.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},Fb.detectDropdownVisibility=h.debounce(function(){Ib.dropdownVisibility(!!h.find(Kb,function(a){return a.hasClass("open")}))},50),Hb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Hb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Hb._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Hb._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!Ib.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Ib.dropdownVisibility()?"":''+Fb.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Ib.tooltipTrigger.subscribe(function(){e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Ib.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Ib.tooltipTrigger.subscribe(function(){d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),Qb.click(function(){c.tooltip("hide")}),Ib.tooltipTrigger.subscribe(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){Kb.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),Fb.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!Fb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!Fb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Ib.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){Fb.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Fb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Fb.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=Fb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Fb.pInt(e[2]),g=Pb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!Ib.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),Fb.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),Fb.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null)},b(d).draggable(k).on("mousedown",function(){Fb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Ib.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){Ib.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:f,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Sb.getAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=Fb.trim(a),c=null;return""!==b?(c=new u,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:f,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){Sb.getContactsTagsAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=Fb.trim(a),c=null;return""!==b?(c=new x,c.name(b),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(Fb.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},Fb.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Fb.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Fb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Fb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},k.prototype.root=function(){return this.sBase},k.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},k.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},k.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},k.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},k.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},k.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},k.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},k.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},k.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},k.prototype.settings=function(a){var b=this.sBase+"settings";return Fb.isUnd(a)||""===a||(b+="/"+a),b},k.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},k.prototype.mailBox=function(a,b,c){b=Fb.isNormal(b)?Fb.pInt(b):1,c=Fb.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},k.prototype.phpInfo=function(){return this.sServer+"Info"},k.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},k.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},k.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},k.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},k.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.emptyFullContactPic=function(){return a.location.protocol+"//"+a.location.hostname+("80"==""+a.location.port||""==""+a.location.port?"":":"+a.location.port)+a.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a},k.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=Fb.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},k.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},k.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},k.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Gb.oViewModelsHooks={},Gb.oSimpleHooks={},Gb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Gb.addHook=function(a,b){Fb.isFunc(b)&&(Fb.isArray(Gb.oSimpleHooks[a])||(Gb.oSimpleHooks[a]=[]),Gb.oSimpleHooks[a].push(b))},Gb.runHook=function(a,b){Fb.isArray(Gb.oSimpleHooks[a])&&(b=b||[],h.each(Gb.oSimpleHooks[a],function(a){a.apply(null,b)}))},Gb.mainSettingsGet=function(a){return Sb?Sb.settingsGet(a):null},Gb.remoteRequest=function(a,b,c,d,e,f){Sb&&Sb.remote().defaultRequest(a,b,c,d,e,f)},Gb.settingsGet=function(a,b){var c=Gb.mainSettingsGet("Plugins");return c=c&&Fb.isUnd(c[a])?null:c[a],c?Fb.isUnd(c[b])?null:c[b]:null},l.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},l.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},l.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},l.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},l.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},l.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},l.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},l.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},l.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},l.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Ib.oHtmlEditorDefaultConfig,d=Sb.settingsGet("Language"),e=!!Sb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Ib.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("key",function(a){return a&&a.data&&9===a.data.keyCode?!1:void 0}),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},l.prototype.focus=function(){this.editor&&this.editor.focus()},l.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},l.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},l.prototype.clear=function(a){this.setHtml("",a)},m.prototype.itemSelected=function(a){this.isListChecked()?a||(this.oCallbacks.onItemSelect||this.emptyFunction)(a||null):a&&(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},m.prototype.goDown=function(a){this.newSelectPosition(Db.EventKeyCode.Down,!1,a)},m.prototype.goUp=function(a){this.newSelectPosition(Db.EventKeyCode.Up,!1,a)},m.prototype.init=function(a,d,e){if(this.oContentVisible=a,this.oContentScrollable=d,e=e||"all",this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.focusedItem(b),b.checked(!b.checked())))}),j("enter",e,function(){return f.focusedItem()&&!f.focusedItem().selected()?(f.actionClick(f.focusedItem()),!1):!0}),j("ctrl+up, command+up, ctrl+down, command+down",e,function(){return!1}),j("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",e,function(a,b){if(a&&b&&b.shortcut){var c=0;switch(b.shortcut){case"up":case"shift+up":c=Db.EventKeyCode.Up;break;case"down":case"shift+down":c=Db.EventKeyCode.Down;break;case"insert":c=Db.EventKeyCode.Insert;break;case"space":c=Db.EventKeyCode.Space;break;case"home":c=Db.EventKeyCode.Home;break;case"end":c=Db.EventKeyCode.End;break;case"pageup":c=Db.EventKeyCode.PageUp;break;case"pagedown":c=Db.EventKeyCode.PageDown}if(c>0)return f.newSelectPosition(c,j.shift),!1}})}},m.prototype.autoSelect=function(a){this.bAutoSelect=!!a},m.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},m.prototype.newSelectPosition=function(a,b,c){var d=0,e=10,f=!1,g=!1,i=null,j=this.list(),k=j?j.length:0,l=this.focusedItem();if(k>0)if(l){if(l)if(Db.EventKeyCode.Down===a||Db.EventKeyCode.Up===a||Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a)h.each(j,function(b){if(!g)switch(a){case Db.EventKeyCode.Up:l===b?g=!0:i=b;break;case Db.EventKeyCode.Down:case Db.EventKeyCode.Insert:f?(i=b,g=!0):l===b&&(f=!0)}});else if(Db.EventKeyCode.Home===a||Db.EventKeyCode.End===a)Db.EventKeyCode.Home===a?i=j[0]:Db.EventKeyCode.End===a&&(i=j[j.length-1]);else if(Db.EventKeyCode.PageDown===a){for(;k>d;d++)if(l===j[d]){d+=e,d=d>k-1?k-1:d,i=j[d];break}}else if(Db.EventKeyCode.PageUp===a)for(d=k;d>=0;d--)if(l===j[d]){d-=e,d=0>d?0:d,i=j[d];break}}else Db.EventKeyCode.Down===a||Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a||Db.EventKeyCode.Home===a||Db.EventKeyCode.PageUp===a?i=j[0]:(Db.EventKeyCode.Up===a||Db.EventKeyCode.End===a||Db.EventKeyCode.PageDown===a)&&(i=j[j.length-1]);i?(this.focusedItem(i),l&&(b?(Db.EventKeyCode.Up===a||Db.EventKeyCode.Down===a)&&l.checked(!l.checked()):(Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a)&&l.checked(!l.checked())),!this.bAutoSelect&&!c||this.isListChecked()||Db.EventKeyCode.Space===a||this.selectedItem(i),this.scrollToFocused()):l&&(!b||Db.EventKeyCode.Up!==a&&Db.EventKeyCode.Down!==a?(Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a)&&l.checked(!l.checked()):l.checked(!l.checked()),this.focusedItem(l))},m.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemFocusedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(d.top<0?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-a):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},m.prototype.scrollToTop=function(a){return this.oContentVisible&&this.oContentScrollable?(a?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},m.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},m.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a); -b&&(!b.shiftKey||b.ctrlKey||b.altKey?!b.ctrlKey||b.shiftKey||b.altKey||(c=!1,this.focusedItem(a),this.selectedItem()&&a!==this.selectedItem()&&this.selectedItem().checked(!0),a.checked(!a.checked())):(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b),this.focusedItem(a))),c&&(this.focusedItem(a),this.selectedItem(a))}},m.prototype.on=function(a,b){this.oCallbacks[a]=b},n.supported=function(){return!0},n.prototype.set=function(a,c){var d=b.cookie(Cb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(Cb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},n.prototype.get=function(a){var c=b.cookie(Cb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Fb.isUnd(d[a])?d[a]:null}catch(e){}return d},o.supported=function(){return!!a.localStorage},o.prototype.set=function(b,c){var d=a.localStorage[Cb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[Cb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},o.prototype.get=function(b){var c=a.localStorage[Cb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Fb.isUnd(d[b])?d[b]:null}catch(e){}return d},p.prototype.oDriver=null,p.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},p.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},q.prototype.bootstart=function(){},r.prototype.sPosition="",r.prototype.sTemplate="",r.prototype.viewModelName="",r.prototype.viewModelDom=null,r.prototype.viewModelTemplate=function(){return this.sTemplate},r.prototype.viewModelPosition=function(){return this.sPosition},r.prototype.cancelCommand=r.prototype.closeCommand=function(){},r.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=Sb.data().keyScope(),Sb.data().keyScope(this.sDefaultKeyScope)},r.prototype.restoreKeyScope=function(){Sb.data().keyScope(this.sCurrentKeyScope)},r.prototype.registerPopupKeyDown=function(){var a=this;Pb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&Db.EventKeyCode.Esc===b.keyCode)return Fb.delegateRun(a,"cancelCommand"),!1;if(Db.EventKeyCode.Backspace===b.keyCode&&!Fb.inFocus())return!1}return!0})},s.prototype.oCross=null,s.prototype.sScreenName="",s.prototype.aViewModels=[],s.prototype.viewModels=function(){return this.aViewModels},s.prototype.screenName=function(){return this.sScreenName},s.prototype.routes=function(){return null},s.prototype.__cross=function(){return this.oCross},s.prototype.__start=function(){var a=this.routes(),b=null,c=null;Fb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Fb.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},t.constructorEnd=function(a){Fb.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},t.prototype.sDefaultScreenName="",t.prototype.oScreens={},t.prototype.oBoot=null,t.prototype.oCurrentScreen=null,t.prototype.hideLoading=function(){b("#rl-loading").hide()},t.prototype.routeOff=function(){e.changed.active=!1},t.prototype.routeOn=function(){e.changed.active=!0},t.prototype.setBoot=function(a){return Fb.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Fb.isUnd(this.oScreens[a])?null:this.oScreens[a]},t.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=Sb.data(),e.viewModelName=a.__name,g&&1===g.length?(i=b("").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide(),i.appendTo(g),e.viewModelDom=i,a.__dom=i,"Popups"===f&&(e.cancelCommand=e.closeCommand=Fb.createCommand(e,function(){Lb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),Sb.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+Sb.popupVisibilityNames().length+10),Fb.delegateRun(this,"onFocus",[],500)):(Fb.delegateRun(this,"onHide"),this.restoreKeyScope(),Sb.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),Ib.tooltipTrigger(!Ib.tooltipTrigger()),h.delay(function(){b.viewModelDom.hide()},300))},e)),Gb.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindingAccessorsToNode(i[0],{i18nInit:!0,template:function(){return{name:e.viewModelTemplate()}}},e),Fb.delegateRun(e,"onBuild",[i]),e&&"Popups"===f&&e.registerPopupKeyDown(),Gb.runHook("view-model-post-build",[a.__name,e,i])):Fb.log("Cannot find view model position: "+f)}return a?a.__vm:null},t.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},t.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Gb.runHook("view-model-on-hide",[a.__name,a.__vm]))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),Fb.delegateRun(a.__vm,"onShow",b||[]),Gb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Fb.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,Fb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Fb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Fb.delegateRun(c.oCurrentScreen,"onHide"),Fb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),Fb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Fb.delegateRun(c.oCurrentScreen,"onShow"),Gb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Fb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),Fb.delegateRun(a.__vm,"onShow"),Fb.delegateRun(a.__vm,"onFocus",[],200),Gb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},t.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),h.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),h.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),Gb.runHook("screen-pre-start",[a.screenName(),a]),Fb.delegateRun(a,"onStart"),Gb.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),h.delay(function(){Ob.removeClass("rl-started-trigger").addClass("rl-started")},50)},t.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=Fb.isUnd(c)?!1:!!c,(Fb.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},t.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},Lb=new t,u.newInstanceFromJson=function(a){var b=new u;return b.initByJson(a)?b:null},u.prototype.name="",u.prototype.email="",u.prototype.privateType=null,u.prototype.clear=function(){this.email="",this.name="",this.privateType=null},u.prototype.validate=function(){return""!==this.name||""!==this.email},u.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},u.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},u.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=Db.EmailType.Facebook),null===this.privateType&&(this.privateType=Db.EmailType.Default)),this.privateType},u.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},u.prototype.parse=function(a){this.clear(),a=Fb.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},u.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=Fb.trim(a.Name),this.email=Fb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Fb.isUnd(b)?!1:!!b,c=Fb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+Fb.encodeHtml(this.name)+"":c?Fb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Fb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Fb.encodeHtml(d)+""+Fb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Fb.encodeHtml(d))):b&&(d=''+Fb.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=Fb.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m 0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=Fb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Fb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Fb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},u.prototype.inputoTagLine=function(){return 0 +$/,""),b=!0),b},y.prototype.isImage=function(){return-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},A.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(Fb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=u.newInstanceFromJson(a[b]),d&&e.push(d);return e},A.replyHelper=function(a,b,c){if(a&&0 d;d++)Fb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},A.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(Db.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(Db.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(Db.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)},A.prototype.computeSenderEmail=function(){var a=Sb.data().sentFolder(),b=Sb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},A.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.hash=a.Hash,this.requestHash=a.RequestHash,this.size(Fb.pInt(a.Size)),this.from=A.initEmailsFromJson(a.From),this.to=A.initEmailsFromJson(a.To),this.cc=A.initEmailsFromJson(a.Cc),this.bcc=A.initEmailsFromJson(a.Bcc),this.replyTo=A.initEmailsFromJson(a.ReplyTo),this.deliveredTo=A.initEmailsFromJson(a.DeliveredTo),this.subject(a.Subject),this.dateTimeStampInUTC(Fb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(A.emailsToLine(this.from,!0)),this.toEmailsString(A.emailsToLine(this.to,!0)),this.parentUid(Fb.pInt(a.ParentThread)),this.threads(Fb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Fb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},A.prototype.initUpdateByMessageJson=function(a){var b=!1,c=Db.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Fb.pInt(a.Priority),this.priority(-1 b;b++)d=y.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0 +$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},A.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return Fb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},A.prototype.messageId=function(){return this.sMessageId},A.prototype.inReplyTo=function(){return this.sInReplyTo},A.prototype.references=function(){return this.sReferences},A.prototype.fromAsSingleEmail=function(){return Fb.isArray(this.from)&&this.from[0]?this.from[0].email:""},A.prototype.viewLink=function(){return Sb.link().messageViewLink(this.requestHash)},A.prototype.downloadLink=function(){return Sb.link().messageDownloadLink(this.requestHash)},A.prototype.replyEmails=function(a){var b=[],c=Fb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,c,b),0===b.length&&A.replyHelper(this.from,c,b),b},A.prototype.replyAllEmails=function(a){var b=[],c=[],d=Fb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,d,b),0===b.length&&A.replyHelper(this.from,d,b),A.replyHelper(this.to,d,b),A.replyHelper(this.cc,d,c),[b,c]},A.prototype.textBodyToString=function(){return this.body?this.body.html():""},A.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0 =0&&e&&!f&&d.attr("src",e)}),c&&a.setTimeout(function(){d.print()},100))})},A.prototype.printMessage=function(){this.viewPopupMessage(!0)},A.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},A.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.hash=a.hash,this.requestHash=a.requestHash,this.subject(a.subject()),this.size(a.size()),this.dateTimeStampInUTC(a.dateTimeStampInUTC()),this.priority(a.priority()),this.fromEmailString(a.fromEmailString()),this.toEmailsString(a.toEmailsString()),this.emails=a.emails,this.from=a.from,this.to=a.to,this.cc=a.cc,this.bcc=a.bcc,this.replyTo=a.replyTo,this.deliveredTo=a.deliveredTo,this.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),this.isReadReceipt(a.isReadReceipt()),this.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(Db.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(a.parentUid()),this.threads(a.threads()),this.threadsLen(a.threadsLen()),this.computeSenderEmail(),this},A.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=Fb.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),b("[data-x-src]",this.body).each(function(){a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",b(this).attr("data-x-src")).removeAttr("data-x-src"):b(this).attr("src",b(this).attr("data-x-src")).removeAttr("data-x-src")}),b("[data-x-style-url]",this.body).each(function(){var a=Fb.trim(b(this).attr("style"));a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+b(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(b("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b(".RL-MailMessageView .messageView .messageItem .content")[0]}),Pb.resize()),Fb.windowResize(500))},A.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),a=Fb.isUnd(a)?!1:a;var c=this;b("[data-x-src-cid]",this.body).each(function(){var d=c.findAttachmentByCid(b(this).attr("data-x-src-cid"));d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-src-location]",this.body).each(function(){var d=c.findAttachmentByContentLocation(b(this).attr("data-x-src-location"));d||(d=c.findAttachmentByCid(b(this).attr("data-x-src-location"))),d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-style-cid]",this.body).each(function(){var a="",d="",e=c.findAttachmentByCid(b(this).attr("data-x-style-cid"));e&&e.linkPreview&&(d=b(this).attr("data-x-style-cid-name"),""!==d&&(a=Fb.trim(b(this).attr("style")),a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+d+": url('"+e.linkPreview()+"')")))}),a&&!function(a,b){h.delay(function(){a.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b})},300)}(b("img.lazy",c.body),b(".RL-MailMessageView .messageView .messageItem .content")[0]),Fb.windowResize(500)}},A.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),Sb.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())))},A.prototype.storePgpVerifyDataToDom=function(){this.body&&Sb.data().capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},A.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=Fb.pString(this.body.data("rl-plain-raw")),Sb.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(Db.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},A.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var c=[],d=null,e=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",f=Sb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?Db.SignedVerifyStatus.Unverified:Db.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0 ').text(j)).html(),Tb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},A.prototype.decryptPgpEncryptedMessage=function(c){if(this.isPgpEncrypted()){var d=[],e=null,f=null,g=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",i=Sb.data().findPublicKeysByEmail(g),j=Sb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0 ').text(m)).html(),Tb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},A.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},B.newInstanceFromJson=function(a){var b=new B;return b.initByJson(a)?b.initComputed():null},B.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()&&!a.isSystemFolder()})},this),this.canBeEdited=c.computed(function(){return Db.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=c.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this),this.isSystemFolder=c.computed(function(){return Db.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return a&&!b||!this.selectable&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){Fb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Fb.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated() -},owner:this}),this.printableUnreadCount=c.computed(function(){var a=this.messageCountAll(),b=this.messageCountUnread(),c=this.type();if(Db.FolderType.Inbox===c&&Sb.data().foldersInboxUnreadCount(b),a>0){if(Db.FolderType.Draft===c)return""+a;if(b>0&&Db.FolderType.Trash!==c&&Db.FolderType.Archive!==c&&Db.FolderType.SentItems!==c)return""+b}return""},this),this.canBeDeleted=c.computed(function(){var a=this.isSystemFolder();return!a&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=c.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){Fb.timeOutAction("folder-list-folder-visibility-change",function(){Pb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Ib.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case Db.FolderType.Inbox:b=Fb.i18n("FOLDER_LIST/INBOX_NAME");break;case Db.FolderType.SentItems:b=Fb.i18n("FOLDER_LIST/SENT_NAME");break;case Db.FolderType.Draft:b=Fb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case Db.FolderType.Spam:b=Fb.i18n("FOLDER_LIST/SPAM_NAME");break;case Db.FolderType.Trash:b=Fb.i18n("FOLDER_LIST/TRASH_NAME");break;case Db.FolderType.Archive:b=Fb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Ib.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case Db.FolderType.Inbox:a="("+Fb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case Db.FolderType.SentItems:a="("+Fb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case Db.FolderType.Draft:a="("+Fb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case Db.FolderType.Spam:a="("+Fb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case Db.FolderType.Trash:a="("+Fb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case Db.FolderType.Archive:a="("+Fb.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this.hasUnreadMessages=c.computed(function(){return 0 "},D.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},D.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+Fb.quoteName(a)+'" <'+this.email()+">"},F.prototype.deleteCondition=function(a){this.conditions.remove(a)},F.prototype.addCondition=function(){this.conditions.push(new E)},F.prototype.parse=function(a){var b=!1;return a&&"Object/Filter"===a["@Object"]&&(this.name(Fb.pString(a.Name)),b=!0),b},G.prototype.index=0,G.prototype.id="",G.prototype.guid="",G.prototype.user="",G.prototype.email="",G.prototype.armor="",G.prototype.isPrivate=!1,Fb.extendAsViewModel("PopupsFolderClearViewModel",H),H.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},H.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Fb.extendAsViewModel("PopupsFolderCreateViewModel",I),I.prototype.sNoParentText="",I.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Fb.trim(a))},I.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},I.prototype.onShow=function(){this.clearPopup()},I.prototype.onFocus=function(){this.folderName.focused(!0)},Fb.extendAsViewModel("PopupsFolderSystemViewModel",J),J.prototype.sChooseOnText="",J.prototype.sUnuseText="",J.prototype.onShow=function(a){var b="";switch(a=Fb.isUnd(a)?Db.SetSystemFoldersNotification.None:a){case Db.SetSystemFoldersNotification.Sent:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case Db.SetSystemFoldersNotification.Draft:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case Db.SetSystemFoldersNotification.Spam:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case Db.SetSystemFoldersNotification.Trash:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case Db.SetSystemFoldersNotification.Archive:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Fb.extendAsViewModel("PopupsComposeViewModel",K),K.prototype.openOpenPgpPopup=function(){if(this.capaOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Lb.showScreenPopup(R,[function(b){a.editor(function(a){a.setPlain(b)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},K.prototype.reloadDraftFolder=function(){var a=Sb.data().draftFolder();""!==a&&(Sb.cache().setFolderHash(a,""),Sb.data().currentFolderFullNameRaw()===a?Sb.reloadMessageList(!0):Sb.folderInformation(a))},K.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};if(this.bCapaAdditionalIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Sb.data().accountEmail()]=Sb.data().accountEmail(),b)switch(a){case Db.ComposeType.Empty:d=Sb.data().accountEmail();break;case Db.ComposeType.Reply:case Db.ComposeType.ReplyAll:case Db.ComposeType.Forward:case Db.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc,b.deliveredTo),e);break;case Db.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Sb.data().accountEmail();return d},K.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},K.prototype.formattedFrom=function(a){var b=Sb.data().displayName(),c=Sb.data().accountEmail();return""===b?c:(Fb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Fb.quoteName(b)+'" <'+c+">"},K.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),Db.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Fb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&Db.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Fb.trim(Fb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Fb.getNotification(c&&c.ErrorCode?c.ErrorCode:Db.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Fb.getNotification(Db.Notification.CantSendMessage)))),this.reloadDraftFolder()},K.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),Db.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Sb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Sb.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0 c;c++)e.push(a[c].toLine(!!b));return e.join(", ")};if(c=c||null,c&&Fb.isNormal(c)&&(v=Fb.isArray(c)&&1===c.length?c[0]:Fb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Fb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Fb.removeBlockquoteSwitcher(l),m=l.html(),w){case Db.ComposeType.Empty:break;case Db.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Fb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.sReferences);break;case Db.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Fb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.references());break;case Db.ComposeType.Forward:this.subject(Fb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.sReferences);break;case Db.ComposeType.ForwardAsAttachment:this.subject(Fb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.sReferences);break;case Db.ComposeType.Draft:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.bFromDraft=!0,this.draftFolder(v.folderFullNameRaw),this.draftUid(v.uid),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Fb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case Db.ComposeType.EditAsNew:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Fb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case Db.ComposeType.Reply:case Db.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Fb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case Db.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m=""+m+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Fb.encodeHtml(j)+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Fb.encodeHtml(k)+"
"+m;break;case Db.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&Db.ComposeType.EditAsNew!==w&&Db.ComposeType.Draft!==w&&(m=this.convertSignature(r,x(v.from,!0))+"
"+m),this.editor(function(a){a.setHtml(m,!1),v.isHtml()||a.modeToggle(!1)})}else Db.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),Db.EditorDefaultType.Html!==Sb.data().editorDefaultType()&&a.modeToggle(!1)})):Fb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Fb.isNonEmptyArray(t)&&Sb.remote().messageUploadAttachments(function(a,b){if(Db.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},t),this.triggerForResize()},K.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},K.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},K.prototype.tryToClosePopup=function(){var a=this;Lb.showScreenPopup(V,[Fb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Fb.delegateRun(a,"closeCommand")}])},K.prototype.onBuild=function(){this.initUploader();var a=this,c=null;j("ctrl+q, command+q",Db.KeyState.Compose,function(){return a.identitiesDropdownTrigger(!0),!1}),j("ctrl+s, command+s",Db.KeyState.Compose,function(){return a.saveCommand(),!1}),j("ctrl+enter, command+enter",Db.KeyState.Compose,function(){return a.sendCommand(),!1}),j("esc",Db.KeyState.Compose,function(){return a.tryToClosePopup(),!1}),Pb.on("resize",function(){a.triggerForResize()}),this.dropboxEnabled()&&(c=document.createElement("script"),c.type="text/javascript",c.src="https://www.dropbox.com/static/api/1/dropins.js",b(c).attr("id","dropboxjs").attr("data-app-key",Sb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},K.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;d>c;c++)if(b[c]&&a===b[c].id)return b[c];return null},K.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=Fb.pInt(Sb.settingsGet("AttachmentLimit")),c=new g({action:Sb.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});c?(c.on("onDragEnter",h.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",h.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",h.bind(function(b,c,d){var e=null;Fb.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this)).on("onSelect",h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=Fb.isUnd(d.FileName)?"":d.FileName.toString(),g=Fb.isNormal(d.Size)?Fb.pInt(d.Size):null,h=new z(a,f,g);return h.cancel=function(a){return function(){e.attachments.remove(function(b){return b&&b.id===a}),c&&c.cancel(a)}}(a),this.attachments.push(h),g>0&&b>0&&g>b?(h.error(Fb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Fb.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this)).on("onComplete",h.bind(function(b,c,d){var e="",f=null,g=null,h=this.getAttachmentById(b);g=c&&d&&d.Result&&d.Result.Attachment?d.Result.Attachment:null,f=d&&d.Result&&d.Result.ErrorCode?d.Result.ErrorCode:null,null!==f?e=Fb.getUploadErrorDescByCode(f):g||(e=Fb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Fb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Sb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),Db.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Fb.getUploadErrorDescByCode(Db.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},K.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Fb.isNonEmptyArray(a.attachments())?a.attachments():[],e=0,f=d.length,g=null,h=null,i=!1,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(Db.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case Db.ComposeType.Reply:case Db.ComposeType.ReplyAll:i=h.isLinked;break;case Db.ComposeType.Forward:case Db.ComposeType.Draft:case Db.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new z(h.download,h.fileName,h.estimatedSize,h.isInline,h.isLinked,h.cid,h.contentLocation),g.fromMessage=!0,g.cancel=j(h.download),g.waiting(!1).uploading(!0),this.attachments.push(g))}}},K.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},K.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(Fb.getUploadErrorDescByCode(Db.UploadErrorCode.FileNoUploaded))},this)},K.prototype.isEmptyForm=function(a){a=Fb.isUnd(a)?!0:!!a;var b=a?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&b&&(!this.oEditor||""===this.oEditor.getData())},K.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)},K.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},K.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Fb.extendAsViewModel("PopupsContactsViewModel",L),L.prototype.getPropertyPlceholder=function(a){var b="";switch(a){case Db.ContactPropertyType.LastName:b="CONTACTS/PLACEHOLDER_ENTER_LAST_NAME";break;case Db.ContactPropertyType.FirstName:b="CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME";break;case Db.ContactPropertyType.Nick:b="CONTACTS/PLACEHOLDER_ENTER_NICK_NAME"}return b},L.prototype.addNewProperty=function(a,b){this.viewProperties.push(new w(a,b||"","",!0,this.getPropertyPlceholder(a)))},L.prototype.addNewOrFocusProperty=function(a,b){var c=h.find(this.viewProperties(),function(b){return a===b.type()});c?c.focused(!0):this.addNewProperty(a,b)},L.prototype.addNewTag=function(){this.viewTags.visibility(!0),this.viewTags.focusTrigger(!0)},L.prototype.addNewEmail=function(){this.addNewProperty(Db.ContactPropertyType.Email,"Home")},L.prototype.addNewPhone=function(){this.addNewProperty(Db.ContactPropertyType.Phone,"Mobile")},L.prototype.addNewWeb=function(){this.addNewProperty(Db.ContactPropertyType.Web)},L.prototype.addNewNickname=function(){this.addNewOrFocusProperty(Db.ContactPropertyType.Nick)},L.prototype.addNewNotes=function(){this.addNewOrFocusProperty(Db.ContactPropertyType.Note)},L.prototype.addNewBirthday=function(){this.addNewOrFocusProperty(Db.ContactPropertyType.Birthday)},L.prototype.exportVcf=function(){Sb.download(Sb.link().exportContactsVcf())},L.prototype.exportCsv=function(){Sb.download(Sb.link().exportContactsCsv())},L.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Sb.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});b&&b.on("onStart",h.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",h.bind(function(b,c,d){this.contacts.importing(!1),this.reloadContactList(),b&&c&&d&&d.Result||a.alert(Fb.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},L.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contacts().length,e=this.contactsCheckedOrSelected();0 =d&&(this.bDropPageAfterDelete=!0),h.delay(function(){h.each(e,function(a){b.remove(a)})},500))},L.prototype.deleteSelectedContacts=function(){0 0?d:0),Fb.isNonEmptyArray(c.Result.Tags)&&(f=h.map(c.Result.Tags,function(a){var b=new x;return b.parse(a)?b:null}),f=h.compact(f))),b.contactsCount(d),b.contacts(e),b.contactTags(f),b.contacts.loading(!1),b.viewClearSearch(""!==b.search())},c,Cb.Defaults.ContactsPerPage,this.search())},L.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,Db.KeyState.ContactList);var d=this;j("delete",Db.KeyState.ContactList,function(){return d.deleteCommand(),!1}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Fb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},L.prototype.onShow=function(){Lb.routeOff(),this.reloadContactList(!0)},L.prototype.onHide=function(){Lb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},Fb.extendAsViewModel("PopupsAdvancedSearchViewModel",M),M.prototype.buildSearchStringValue=function(a){return-1 li"),e=c&&("tab"===c.shortcut||"right"===c.shortcut),f=d.index(d.filter(".active"));return!e&&f>0?f--:e&&f -1&&g.eq(e).removeClass("focused"),38===f&&e>0?e--:40===f&&e 1?" ("+(100>a?a:"99+")+")":""},ab.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},ab.prototype.moveSelectedMessagesToFolder=function(a,b){return this.canBeMoved()&&Sb.moveMessagesToFolder(Sb.data().currentFolderFullNameRaw(),Sb.data().messageListCheckedOrSelectedUidsWithSubMails(),a,b),!1},ab.prototype.dragAndDronHelper=function(a){a&&a.checked(!0);var b=Fb.draggeblePlace(),c=Sb.data().messageListCheckedOrSelectedUidsWithSubMails();return b.data("rl-folder",Sb.data().currentFolderFullNameRaw()),b.data("rl-uids",c),b.find(".text").text(""+c.length),h.defer(function(){var a=Sb.data().messageListCheckedOrSelectedUidsWithSubMails();b.data("rl-uids",a),b.find(".text").text(""+a.length)}),b},ab.prototype.onMessageResponse=function(a,b,c){var d=Sb.data();d.hideMessageBodies(),d.messageLoading(!1),Db.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):Db.StorageResultType.Unload===a?(d.message(null),d.messageError("")):Db.StorageResultType.Abort!==a&&(d.message(null),d.messageError(b&&b.ErrorCode?Fb.getNotification(b.ErrorCode):Fb.getNotification(Db.Notification.UnknownError)))},ab.prototype.populateMessageBody=function(a){a&&(Sb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Sb.data().messageLoading(!0):Fb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},ab.prototype.setAction=function(a,b,c){var d=[],e=null,f=Sb.cache(),g=0;if(Fb.isUnd(c)&&(c=Sb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0 0?100>a?a:"99+":""},bb.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},bb.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage(this.viewPgpPassword())},bb.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Sb.remote().sendReadReceiptMessage(Fb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),Fb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),Fb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":Sb.data().accountEmail()})),a.isReadReceipt(!0),Sb.cache().storeMessageFlagsToCache(a),Sb.reloadFlagsCurrentMessageListAndMessageFromCache())},Fb.extendAsViewModel("SettingsMenuViewModel",cb),cb.prototype.link=function(a){return Sb.link().settings(a)},cb.prototype.backToMailBoxClick=function(){Lb.setHash(Sb.link().inbox())},Fb.extendAsViewModel("SettingsPaneViewModel",db),db.prototype.onBuild=function(){var a=this;j("esc",Db.KeyState.Settings,function(){a.backToMailBoxClick()})},db.prototype.onShow=function(){Sb.data().message(null)},db.prototype.backToMailBoxClick=function(){Lb.setHash(Sb.link().inbox())},Fb.addSettingsViewModel(eb,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),eb.prototype.toggleLayout=function(){this.layout(Db.Layout.NoPreview===this.layout()?Db.Layout.SidePreview:Db.Layout.NoPreview)},eb.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Sb.data(),d=Fb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(Db.SaveSettingsStep.Animate),b.ajax({url:Sb.link().langLink(c),dataType:"script",cache:!0}).done(function(){Fb.i18nToDoc(),a.languageTrigger(Db.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(Db.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(Db.SaveSettingsStep.Idle)},1e3)}),Sb.remote().saveSettings(Fb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Sb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){Fb.timeOutAction("SaveDesktopNotifications",function(){Sb.remote().saveSettings(Fb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){Fb.timeOutAction("SaveReplySameFolder",function(){Sb.remote().saveSettings(Fb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Sb.remote().saveSettings(Fb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Sb.remote().saveSettings(Fb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},eb.prototype.onShow=function(){Sb.data().desktopNotifications.valueHasMutated()},eb.prototype.selectLanguage=function(){Lb.showScreenPopup(T)},Fb.addSettingsViewModel(fb,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),fb.prototype.onBuild=function(){Sb.data().contactsAutosave.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},Fb.addSettingsViewModel(gb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),gb.prototype.addNewAccount=function(){Lb.showScreenPopup(N)},gb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Sb.remote().accountDelete(function(b,c){Db.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Lb.routeOff(),Lb.setHash(Sb.link().root(),!0),Lb.routeOff(),h.defer(function(){a.location.reload()})):Sb.accountsAndIdentities()},b.email))}},Fb.addSettingsViewModel(hb,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),hb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Sb.data().signature();this.editor=new l(a.signatureDom(),function(){Sb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},hb.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Sb.data(),c=Fb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=Fb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=Fb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Sb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Sb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Sb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Sb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Fb.addSettingsViewModel(ib,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),ib.prototype.addNewIdentity=function(){Lb.showScreenPopup(S)},ib.prototype.editIdentity=function(a){Lb.showScreenPopup(S,[a])},ib.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Sb.remote().identityDelete(function(){Sb.accountsAndIdentities()},a.id))}},ib.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Sb.data().signature();this.editor=new l(a.signatureDom(),function(){Sb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},ib.prototype.onBuild=function(a){var b=this;a.on("click",".identity-item .e-action",function(){var a=c.dataFor(this);a&&b.editIdentity(a)}),h.delay(function(){var a=Sb.data(),c=Fb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=Fb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=Fb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Sb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Sb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Sb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Sb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Fb.addSettingsViewModel(jb,"SettingsFilters","SETTINGS_LABELS/LABEL_FILTERS_NAME","filters"),jb.prototype.deleteFilter=function(a){this.filters.remove(a)},jb.prototype.addFilter=function(){var a=new F;a.addCondition(),this.filters.push(a)},Fb.addSettingsViewModel(kb,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),kb.prototype.showSecret=function(){this.secreting(!0),Sb.remote().showTwoFactorSecret(this.onSecretResult)},kb.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},kb.prototype.createTwoFactor=function(){this.processing(!0),Sb.remote().createTwoFactor(this.onResult)},kb.prototype.enableTwoFactor=function(){this.processing(!0),Sb.remote().enableTwoFactor(this.onResult,this.viewEnable())},kb.prototype.testTwoFactor=function(){Lb.showScreenPopup(U)},kb.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),Sb.remote().clearTwoFactor(this.onResult)},kb.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},kb.prototype.onResult=function(a,b){if(this.processing(!1),this.clearing(!1),Db.StorageResultType.Success===a&&b&&b.Result?(this.viewUser(Fb.pString(b.Result.User)),this.viewEnable(!!b.Result.Enable),this.twoFactorStatus(!!b.Result.IsSet),this.viewSecret(Fb.pString(b.Result.Secret)),this.viewBackupCodes(Fb.pString(b.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Fb.pString(b.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var c=this;this.viewEnable.subscribe(function(a){this.viewEnable.subs&&Sb.remote().enableTwoFactor(function(a,b){Db.StorageResultType.Success===a&&b&&b.Result||(c.viewEnable.subs=!1,c.viewEnable(!1),c.viewEnable.subs=!0)},a)},this)}},kb.prototype.onSecretResult=function(a,b){this.secreting(!1),Db.StorageResultType.Success===a&&b&&b.Result?(this.viewSecret(Fb.pString(b.Result.Secret)),this.viewUrl(Fb.pString(b.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},kb.prototype.onBuild=function(){this.processing(!0),Sb.remote().getTwoFactor(this.onResult)},Fb.addSettingsViewModel(lb,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Fb.addSettingsViewModel(mb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),mb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},mb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),Db.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(b&&Db.Notification.CurrentPasswordIncorrect===b.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(b&&b.ErrorCode?Fb.getNotification(b.ErrorCode):Fb.getNotification(Db.Notification.CouldNotSaveNewPassword)))},Fb.addSettingsViewModel(nb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),nb.prototype.folderEditOnEnter=function(a){var b=a?Fb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Sb.local().set(Db.ClientSideKeyName.FoldersLashHash,""),Sb.data().foldersRenaming(!0),Sb.remote().folderRename(function(a,b){Sb.data().foldersRenaming(!1),Db.StorageResultType.Success===a&&b&&b.Result||Sb.data().foldersListError(b&&b.ErrorCode?Fb.getNotification(b.ErrorCode):Fb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Sb.folders()},a.fullNameRaw,b),Sb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},nb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},nb.prototype.onShow=function(){Sb.data().foldersListError("")},nb.prototype.createFolder=function(){Lb.showScreenPopup(I)},nb.prototype.systemFolder=function(){Lb.showScreenPopup(J)},nb.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){return a===c?!0:(c.subFolders.remove(b),!1)};a&&(Sb.local().set(Db.ClientSideKeyName.FoldersLashHash,""),Sb.data().folderList.remove(b),Sb.data().foldersDeleting(!0),Sb.remote().folderDelete(function(a,b){Sb.data().foldersDeleting(!1),Db.StorageResultType.Success===a&&b&&b.Result||Sb.data().foldersListError(b&&b.ErrorCode?Fb.getNotification(b.ErrorCode):Fb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Sb.folders()},a.fullNameRaw),Sb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 =a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){Lb.setHash(Sb.link().mailBox(this.currentFolderFullNameHash(),1,Fb.trim(a.toString())))},owner:this}),this.messageListError=c.observable(""),this.messageListLoading=c.observable(!1),this.messageListIsNotCompleted=c.observable(!1),this.messageListCompleteLoadingThrottle=c.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=c.computed(function(){var a=this.messageListLoading(),b=this.messageListIsNotCompleted();return a||b},this),this.messageListCompleteLoading.subscribe(function(a){this.messageListCompleteLoadingThrottle(a)},this),this.messageList.subscribe(h.debounce(function(a){h.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500)),this.staticMessageList=new A,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.message.focused=c.observable(!1),this.message.subscribe(function(b){b?Db.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.hideMessageBodies(),Db.Layout.NoPreview===Sb.data().layout()&&-1 0?Math.ceil(b/a*100):0},this),this.capaOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(a){return!(!a||a.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(a){return!(!a||!a.isPrivate)}),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(Db.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function sb(){this.oRequests={}}function tb(){sb.call(this),this.oRequests={}}function ub(){this.oEmailsPicsHashes={},this.oServices={},this.bCapaGravatar=Sb.capa(Db.Capa.Gravatar)}function vb(){ub.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function wb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function xb(){s.call(this,"login",[X])}function yb(){s.call(this,"mailbox",[Z,_,ab,bb]),this.oLastRoute={}}function zb(){wb.call(this,[$,cb,db]),Fb.initOnStartOrLangChange(function(){this.sSettingsTitle=Fb.i18n("TITLES/SETTINGS")},this,function(){Sb.setTitle(this.sSettingsTitle)})}function Ab(){q.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=c.observableArray([]),this.popupVisibility=c.computed(function(){return 0 ').appendTo("body"),Pb.on("error",function(a){Sb&&a&&a.originalEvent&&a.originalEvent.message&&-1===Fb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Sb.remote().jsError(Fb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Ob.attr("class"),Fb.microtime()-Ib.now)}),Qb.on("keydown",function(a){a&&a.ctrlKey&&Ob.addClass("rl-ctrl-key-pressed")}).on("keyup",function(a){a&&!a.ctrlKey&&Ob.removeClass("rl-ctrl-key-pressed")})}function Bb(){Ab.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=h.debounce(this.messagesMoveTrigger,500),a.setInterval(function(){Sb.pub("interval.30s")},3e4),a.setInterval(function(){Sb.pub("interval.1m")},6e4),a.setInterval(function(){Sb.pub("interval.2m")},12e4),a.setInterval(function(){Sb.pub("interval.3m")},18e4),a.setInterval(function(){Sb.pub("interval.5m")},3e5),a.setInterval(function(){Sb.pub("interval.10m")},6e5),a.setTimeout(function(){a.setInterval(function(){Sb.pub("interval.10m-after5m")},6e5)},3e5),b.wakeUp(function(){Sb.remote().jsVersion(function(b,c){Db.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Sb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Sb.settingsGet("Version"))},{},36e5)}var Cb={},Db={},Eb={},Fb={},Gb={},Hb={},Ib={},Jb={settings:[],"settings-removed":[],"settings-disabled":[]},Kb=[],Lb=null,Mb=a.rainloopAppData||{},Nb=a.rainloopI18N||{},Ob=b("html"),Pb=b(a),Qb=b(a.document),Rb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Sb=null,Tb=b("");Ib.now=(new Date).getTime(),Ib.momentTrigger=c.observable(!0),Ib.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),Ib.tooltipTrigger=c.observable(!1).extend({rateLimit:0}),Ib.langChangeTrigger=c.observable(!0),Ib.iAjaxErrorCount=0,Ib.iTokenErrorCount=0,Ib.iMessageBodyCacheCount=0,Ib.bUnload=!1,Ib.sUserAgent=(navigator.userAgent||"").toLowerCase(),Ib.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},Fb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=Fb.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},Fb.timeOutAction=function(){var b={};return function(c,d,e){Fb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),Fb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),Fb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Ib.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),Fb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},Fb.i18n=function(a,b,c){var d="",e=Fb.isUnd(Nb[a])?Fb.isUnd(c)?a:c:Nb[a];if(!Fb.isUnd(b)&&!Fb.isNull(b))for(d in b)Fb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},Fb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(Fb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(Fb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",Fb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",Fb.i18n(c)))})})},Fb.i18nToDoc=function(){a.rainloopI18N&&(Nb=a.rainloopI18N||{},Fb.i18nToNode(Qb),Ib.langChangeTrigger(!Ib.langChangeTrigger())),a.rainloopI18N={}},Fb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Ib.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Ib.langChangeTrigger.subscribe(a,b)},Fb.inFocus=function(){return document.activeElement?(Fb.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=b(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},Fb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);a.is("input,textarea")&&document.activeElement.blur()}},Fb.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},Fb.replySubjectAdd=function(b,c,d){var e=null,f=Fb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||Fb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||Fb.isUnd(e[1])||Fb.isUnd(e[2])||Fb.isUnd(e[3])?b+": "+c:e[1]+(Fb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(Fb.isUnd(d)?!0:d)?Fb.fixLongSubject(f):f},Fb.fixLongSubject=function(a){var b=0,c=null;a=Fb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||Fb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=Fb.isUnd(c[2])?1:0+Fb.pInt(c[2]),b+=Fb.isUnd(c[4])?1:0+Fb.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},Fb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Fb.friendlySize=function(a){return a=Fb.pInt(a),a>=1073741824?Fb.roundNumber(a/1073741824,1)+"GB":a>=1048576?Fb.roundNumber(a/1048576,1)+"MB":a>=1024?Fb.roundNumber(a/1024,0)+"KB":a+"B"},Fb.log=function(b){a.console&&a.console.log&&a.console.log(b)},Fb.getNotification=function(a,b){return a=Fb.pInt(a),Db.Notification.ClientViewError===a&&b?b:Fb.isUnd(Eb[a])?"":Eb[a]},Fb.initNotificationLanguage=function(){Eb[Db.Notification.InvalidToken]=Fb.i18n("NOTIFICATIONS/INVALID_TOKEN"),Eb[Db.Notification.AuthError]=Fb.i18n("NOTIFICATIONS/AUTH_ERROR"),Eb[Db.Notification.AccessError]=Fb.i18n("NOTIFICATIONS/ACCESS_ERROR"),Eb[Db.Notification.ConnectionError]=Fb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Eb[Db.Notification.CaptchaError]=Fb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Eb[Db.Notification.SocialFacebookLoginAccessDisable]=Fb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Eb[Db.Notification.SocialTwitterLoginAccessDisable]=Fb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Eb[Db.Notification.SocialGoogleLoginAccessDisable]=Fb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Eb[Db.Notification.DomainNotAllowed]=Fb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Eb[Db.Notification.AccountNotAllowed]=Fb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Eb[Db.Notification.AccountTwoFactorAuthRequired]=Fb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Eb[Db.Notification.AccountTwoFactorAuthError]=Fb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Eb[Db.Notification.CouldNotSaveNewPassword]=Fb.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Eb[Db.Notification.CurrentPasswordIncorrect]=Fb.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Eb[Db.Notification.NewPasswordShort]=Fb.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Eb[Db.Notification.NewPasswordWeak]=Fb.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Eb[Db.Notification.NewPasswordForbidden]=Fb.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Eb[Db.Notification.ContactsSyncError]=Fb.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Eb[Db.Notification.CantGetMessageList]=Fb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Eb[Db.Notification.CantGetMessage]=Fb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Eb[Db.Notification.CantDeleteMessage]=Fb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Eb[Db.Notification.CantMoveMessage]=Fb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Eb[Db.Notification.CantCopyMessage]=Fb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Eb[Db.Notification.CantSaveMessage]=Fb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Eb[Db.Notification.CantSendMessage]=Fb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Eb[Db.Notification.InvalidRecipients]=Fb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Eb[Db.Notification.CantCreateFolder]=Fb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Eb[Db.Notification.CantRenameFolder]=Fb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Eb[Db.Notification.CantDeleteFolder]=Fb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Eb[Db.Notification.CantDeleteNonEmptyFolder]=Fb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Eb[Db.Notification.CantSubscribeFolder]=Fb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Eb[Db.Notification.CantUnsubscribeFolder]=Fb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Eb[Db.Notification.CantSaveSettings]=Fb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Eb[Db.Notification.CantSavePluginSettings]=Fb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Eb[Db.Notification.DomainAlreadyExists]=Fb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Eb[Db.Notification.CantInstallPackage]=Fb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Eb[Db.Notification.CantDeletePackage]=Fb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Eb[Db.Notification.InvalidPluginPackage]=Fb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Eb[Db.Notification.UnsupportedPluginPackage]=Fb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Eb[Db.Notification.LicensingServerIsUnavailable]=Fb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Eb[Db.Notification.LicensingExpired]=Fb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Eb[Db.Notification.LicensingBanned]=Fb.i18n("NOTIFICATIONS/LICENSING_BANNED"),Eb[Db.Notification.DemoSendMessageError]=Fb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Eb[Db.Notification.AccountAlreadyExists]=Fb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Eb[Db.Notification.MailServerError]=Fb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Eb[Db.Notification.UnknownNotification]=Fb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Eb[Db.Notification.UnknownError]=Fb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Fb.getUploadErrorDescByCode=function(a){var b="";switch(Fb.pInt(a)){case Db.UploadErrorCode.FileIsTooBig:b=Fb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Db.UploadErrorCode.FilePartiallyUploaded:b=Fb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Db.UploadErrorCode.FileNoUploaded:b=Fb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Db.UploadErrorCode.MissingTempFolder:b=Fb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Db.UploadErrorCode.FileOnSaveingError:b=Fb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Db.UploadErrorCode.FileType:b=Fb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=Fb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},Fb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=Fb.pInt(d),0>=d?a[b].apply(a,Fb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,Fb.isArray(c)?c:[])},d))},Fb.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===Db.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===Db.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},Fb.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=Fb.isUnd(d)?!0:d,e.canExecute=c.computed(Fb.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},Fb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(Db.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(Db.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Ib.sAnimationType=Db.InterfaceAnimation.Full,b.capaThemes=c.observable(!1),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(Db.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return Db.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Ib.bMobileDevice||a===Db.InterfaceAnimation.None)Ob.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Ib.sAnimationType=Db.InterfaceAnimation.None;else switch(a){case Db.InterfaceAnimation.Full:Ob.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Ib.sAnimationType=a;break;case Db.InterfaceAnimation.Normal:Ob.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Ib.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=Db.DesktopNotifications.NotSupported;if(Rb&&Rb.permission)switch(Rb.permission.toLowerCase()){case"granted":c=Db.DesktopNotifications.Allowed;break;case"denied":c=Db.DesktopNotifications.Denied;break;case"default":c=Db.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&Db.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();Db.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):Db.DesktopNotifications.NotAllowed===c?Rb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),Db.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1 =b.diff(c,"hours")?d:b.format("L")===c.format("L")?Fb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?Fb.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},Fb.isFolderExpanded=function(a){var b=Sb.local().get(Db.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},Fb.setExpandedFolder=function(a,b){var c=Sb.local().get(Db.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Sb.local().set(Db.ClientSideKeyName.ExpandedFolders,c)},Fb.initLayoutResizer=function(a,c,d){var e=60,f=155,g=b(a),h=b(c),i=Sb.local().get(d)||null,j=function(a){a&&(g.css({width:""+a+"px"}),h.css({left:""+a+"px"}))},k=function(a){if(a)g.resizable("disable"),j(e);else{g.resizable("enable");var b=Fb.pInt(Sb.local().get(d))||f;j(b>f?b:f)}},l=function(a,b){b&&b.size&&b.size.width&&(Sb.local().set(d,b.size.width),h.css({left:""+b.size.width+"px"}))};null!==i&&j(i>f?i:f),g.resizable({helper:"ui-resizable-helper",minWidth:f,maxWidth:350,handles:"e",stop:l}),Sb.sub("left-panel.off",function(){k(!0)}),Sb.sub("left-panel.on",function(){k(!1)})},Fb.initBlockquoteSwitcher=function(a){if(a){var c=b("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===b(this).parent().closest("blockquote",a).length});c&&0 100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),Fb.windowResize()}).after("
").before("
"))})}},Fb.removeBlockquoteSwitcher=function(a){a&&(b(a).find("blockquote.rl-bq-switcher").each(function(){b(this).removeClass("rl-bq-switcher hidden-bq")}),b(a).find(".rlBlockquoteSwitcher").each(function(){b(this).remove()}))},Fb.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},Fb.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,Gb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},Fb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Jb.settings.push(a)},Fb.removeSettingsViewModel=function(a){Jb["settings-removed"].push(a)},Fb.disableSettingsViewModel=function(a){Jb["settings-disabled"].push(a)},Fb.convertThemeName=function(a){return"@custom"===a.substr(-7)&&(a=Fb.trim(a.substring(0,a.length-7))),Fb.trim(a.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Fb.quoteName=function(a){return a.replace(/["]/g,'\\"')},Fb.microtime=function(){return(new Date).getTime()},Fb.convertLangName=function(a,b){return Fb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a) +},Fb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=Fb.isUnd(a)?32:Fb.pInt(a);b.length>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;c d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o /g,">").replace(/")},Fb.draggeblePlace=function(){return b(' ').appendTo("#rl-hidden")},Fb.defautOptionsAfterRender=function(a,c){c&&!Fb.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},Fb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+Fb.fakeMd5()+"__",j=b("#"+d);a[i]=function(){if(h&&h.document.body&&j&&j[0]){var d=b(h.document.body);b("#rl-content",d).html(j.html()),b("html",h.document).addClass("external "+b("html").attr("class")),Fb.i18nToNode(d),t.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+Fb.encodeHtml(e)+' '),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},Fb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=Fb.isUnd(d)?1e3:Fb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?Db.SaveSettingsStep.TrueResult:Db.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,Db.SaveSettingsStep.Idle)},d)}},Fb.settingsSaveHelperSimpleFunction=function(a,b){return Fb.settingsSaveHelperFunction(null,a,b,1e3)},Fb.htmlToPlain=function(a){var c="",d="> ",e=function(){if(arguments&&1\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1 ]*>(.|[\s\S\r\n]*)<\/div>/gim,f),a="\n"+b.trim(a)+"\n"),a}return""},g=function(){return arguments&&1 /g,">"):""},h=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,f).replace(/").addClass("rl-settings-view-model").hide(),i.appendTo(g),e.data=Sb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindingAccessorsToNode(i[0],{i18nInit:!0,template:function(){return{name:f.__rlSettingsData.Template}}},e),Fb.delegateRun(e,"onBuild",[i])):Fb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Fb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Fb.delegateRun(d.oCurrentSubScreen,"onShow"),Fb.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),h.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),Fb.windowResize()})):Lb.setHash(Sb.link().settings(),!1,!0)},wb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Fb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},wb.prototype.onBuild=function(){h.each(Jb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Jb["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!h.find(Jb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},wb.prototype.routes=function(){var a=h.find(Jb.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",c={subname:/^(.*)$/,normalize_:function(a,c){return c.subname=Fb.isUnd(c.subname)?b:Fb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(xb.prototype,s.prototype),xb.prototype.onShow=function(){Sb.setTitle("")},h.extend(yb.prototype,s.prototype),yb.prototype.oLastRoute={},yb.prototype.setNewTitle=function(){var a=Sb.data().accountEmail(),b=Sb.data().foldersInboxUnreadCount();Sb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Fb.i18n("TITLES/MAILBOX"))},yb.prototype.onShow=function(){this.setNewTitle(),Sb.data().keyScope(Db.KeyState.MessageList)},yb.prototype.onRoute=function(a,b,c,d){if(Fb.isUnd(d)?1:!d){var e=Sb.data(),f=Sb.cache().getFolderFullNameRaw(a),g=Sb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),Db.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Sb.reloadMessageList())}else Db.Layout.NoPreview!==Sb.data().layout()||Sb.data().message()||Sb.historyBack()},yb.prototype.onStart=function(){var a=Sb.data(),b=function(){Fb.windowResize()};(Sb.capa(Db.Capa.AdditionalAccounts)||Sb.capa(Db.Capa.AdditionalIdentities))&&Sb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Sb.folderInformation("INBOX") -},1e3),h.delay(function(){Sb.quota()},5e3),h.delay(function(){Sb.remote().appDelayStart(Fb.emptyFunction)},35e3),Ob.toggleClass("rl-no-preview-pane",Db.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Ob.toggleClass("rl-no-preview-pane",Db.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},yb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Fb.pString(b[0]),b[1]=Fb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Fb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2]),!1]},c=function(a,b){return b[0]=Fb.pString(b[0]),b[1]=Fb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:c}],[/^message-preview$/,{normalize_:a}],[/^([^\/]*)$/,{normalize_:b}]]},h.extend(zb.prototype,wb.prototype),zb.prototype.onShow=function(){Sb.setTitle(this.sSettingsTitle),Sb.data().keyScope(Db.KeyState.Settings)},h.extend(Ab.prototype,q.prototype),Ab.prototype.oSettings=null,Ab.prototype.oPlugins=null,Ab.prototype.oLocal=null,Ab.prototype.oLink=null,Ab.prototype.oSubs={},Ab.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):(Ib.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},Ab.prototype.link=function(){return null===this.oLink&&(this.oLink=new k),this.oLink},Ab.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},Ab.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Fb.isNormal(Mb)?Mb:{}),Fb.isUnd(this.oSettings[a])?null:this.oSettings[a]},Ab.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Fb.isNormal(Mb)?Mb:{}),this.oSettings[a]=b},Ab.prototype.setTitle=function(b){b=(Fb.isNormal(b)&&0]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Fb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Fb.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},Fb.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:Fb.isUnd(c)?a.toString():c.toString(),custom:Fb.isUnd(c)?!1:!0,title:Fb.isUnd(c)?"":a.toString(),value:a.toString()};(Fb.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},Fb.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},Fb.disableKeyFilter=function(){a.key&&(j.filter=function(){return Sb.data().useKeyboardShortcuts()})},Fb.restoreKeyFilter=function(){a.key&&(j.filter=function(a){if(Sb.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},Fb.detectDropdownVisibility=h.debounce(function(){Ib.dropdownVisibility(!!h.find(Kb,function(a){return a.hasClass("open")}))},50),Hb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Hb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Hb._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Hb._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!Ib.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Ib.dropdownVisibility()?"":''+Fb.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Ib.tooltipTrigger.subscribe(function(){e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Ib.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Ib.tooltipTrigger.subscribe(function(){d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),Qb.click(function(){c.tooltip("hide")}),Ib.tooltipTrigger.subscribe(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){Kb.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),Fb.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!Fb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!Fb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Ib.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){Fb.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Fb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Fb.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=Fb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Fb.pInt(e[2]),g=Pb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!Ib.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),Fb.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),Fb.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null)},b(d).draggable(k).on("mousedown",function(){Fb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Ib.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){Ib.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:f,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Sb.getAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=Fb.trim(a),c=null;return""!==b?(c=new u,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:f,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){Sb.getContactsTagsAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=Fb.trim(a),c=null;return""!==b?(c=new x,c.name(b),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(Fb.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},Fb.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Fb.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Fb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Fb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},k.prototype.root=function(){return this.sBase},k.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},k.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},k.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},k.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},k.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},k.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},k.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},k.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},k.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},k.prototype.settings=function(a){var b=this.sBase+"settings";return Fb.isUnd(a)||""===a||(b+="/"+a),b},k.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},k.prototype.mailBox=function(a,b,c){b=Fb.isNormal(b)?Fb.pInt(b):1,c=Fb.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},k.prototype.phpInfo=function(){return this.sServer+"Info"},k.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},k.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},k.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},k.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},k.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.emptyFullContactPic=function(){return a.location.protocol+"//"+a.location.hostname+("80"==""+a.location.port||""==""+a.location.port?"":":"+a.location.port)+a.location.pathname+"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a},k.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=Fb.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},k.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},k.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},k.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Gb.oViewModelsHooks={},Gb.oSimpleHooks={},Gb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Gb.addHook=function(a,b){Fb.isFunc(b)&&(Fb.isArray(Gb.oSimpleHooks[a])||(Gb.oSimpleHooks[a]=[]),Gb.oSimpleHooks[a].push(b))},Gb.runHook=function(a,b){Fb.isArray(Gb.oSimpleHooks[a])&&(b=b||[],h.each(Gb.oSimpleHooks[a],function(a){a.apply(null,b)}))},Gb.mainSettingsGet=function(a){return Sb?Sb.settingsGet(a):null},Gb.remoteRequest=function(a,b,c,d,e,f){Sb&&Sb.remote().defaultRequest(a,b,c,d,e,f)},Gb.settingsGet=function(a,b){var c=Gb.mainSettingsGet("Plugins");return c=c&&Fb.isUnd(c[a])?null:c[a],c?Fb.isUnd(c[b])?null:c[b]:null},l.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},l.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},l.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},l.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},l.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},l.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},l.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},l.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},l.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},l.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Ib.oHtmlEditorDefaultConfig,d=Sb.settingsGet("Language"),e=!!Sb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Ib.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("key",function(a){return a&&a.data&&9===a.data.keyCode?!1:void 0}),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},l.prototype.focus=function(){this.editor&&this.editor.focus()},l.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},l.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},l.prototype.clear=function(a){this.setHtml("",a)},m.prototype.itemSelected=function(a){this.isListChecked()?a||(this.oCallbacks.onItemSelect||this.emptyFunction)(a||null):a&&(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},m.prototype.goDown=function(a){this.newSelectPosition(Db.EventKeyCode.Down,!1,a)},m.prototype.goUp=function(a){this.newSelectPosition(Db.EventKeyCode.Up,!1,a)},m.prototype.init=function(a,d,e){if(this.oContentVisible=a,this.oContentScrollable=d,e=e||"all",this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.focusedItem(b),b.checked(!b.checked())))}),j("enter",e,function(){return f.focusedItem()&&!f.focusedItem().selected()?(f.actionClick(f.focusedItem()),!1):!0}),j("ctrl+up, command+up, ctrl+down, command+down",e,function(){return!1}),j("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",e,function(a,b){if(a&&b&&b.shortcut){var c=0;switch(b.shortcut){case"up":case"shift+up":c=Db.EventKeyCode.Up;break;case"down":case"shift+down":c=Db.EventKeyCode.Down;break;case"insert":c=Db.EventKeyCode.Insert;break;case"space":c=Db.EventKeyCode.Space;break;case"home":c=Db.EventKeyCode.Home;break;case"end":c=Db.EventKeyCode.End;break;case"pageup":c=Db.EventKeyCode.PageUp;break;case"pagedown":c=Db.EventKeyCode.PageDown}if(c>0)return f.newSelectPosition(c,j.shift),!1}})}},m.prototype.autoSelect=function(a){this.bAutoSelect=!!a},m.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},m.prototype.newSelectPosition=function(a,b,c){var d=0,e=10,f=!1,g=!1,i=null,j=this.list(),k=j?j.length:0,l=this.focusedItem();if(k>0)if(l){if(l)if(Db.EventKeyCode.Down===a||Db.EventKeyCode.Up===a||Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a)h.each(j,function(b){if(!g)switch(a){case Db.EventKeyCode.Up:l===b?g=!0:i=b;break;case Db.EventKeyCode.Down:case Db.EventKeyCode.Insert:f?(i=b,g=!0):l===b&&(f=!0)}});else if(Db.EventKeyCode.Home===a||Db.EventKeyCode.End===a)Db.EventKeyCode.Home===a?i=j[0]:Db.EventKeyCode.End===a&&(i=j[j.length-1]);else if(Db.EventKeyCode.PageDown===a){for(;k>d;d++)if(l===j[d]){d+=e,d=d>k-1?k-1:d,i=j[d];break}}else if(Db.EventKeyCode.PageUp===a)for(d=k;d>=0;d--)if(l===j[d]){d-=e,d=0>d?0:d,i=j[d];break}}else Db.EventKeyCode.Down===a||Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a||Db.EventKeyCode.Home===a||Db.EventKeyCode.PageUp===a?i=j[0]:(Db.EventKeyCode.Up===a||Db.EventKeyCode.End===a||Db.EventKeyCode.PageDown===a)&&(i=j[j.length-1]);i?(this.focusedItem(i),l&&(b?(Db.EventKeyCode.Up===a||Db.EventKeyCode.Down===a)&&l.checked(!l.checked()):(Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a)&&l.checked(!l.checked())),!this.bAutoSelect&&!c||this.isListChecked()||Db.EventKeyCode.Space===a||this.selectedItem(i),this.scrollToFocused()):l&&(!b||Db.EventKeyCode.Up!==a&&Db.EventKeyCode.Down!==a?(Db.EventKeyCode.Insert===a||Db.EventKeyCode.Space===a)&&l.checked(!l.checked()):l.checked(!l.checked()),this.focusedItem(l))},m.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemFocusedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(this.oContentScrollable.scrollTop(d.top<0?this.oContentScrollable.scrollTop()+d.top-a:this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},m.prototype.scrollToTop=function(a){return this.oContentVisible&&this.oContentScrollable?(a?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},m.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},m.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(!b.shiftKey||b.ctrlKey||b.altKey?!b.ctrlKey||b.shiftKey||b.altKey||(c=!1,this.focusedItem(a),this.selectedItem()&&a!==this.selectedItem()&&this.selectedItem().checked(!0),a.checked(!a.checked())):(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b),this.focusedItem(a))),c&&(this.focusedItem(a),this.selectedItem(a)) +}},m.prototype.on=function(a,b){this.oCallbacks[a]=b},n.supported=function(){return!0},n.prototype.set=function(a,c){var d=b.cookie(Cb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(Cb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},n.prototype.get=function(a){var c=b.cookie(Cb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Fb.isUnd(d[a])?d[a]:null}catch(e){}return d},o.supported=function(){return!!a.localStorage},o.prototype.set=function(b,c){var d=a.localStorage[Cb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[Cb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},o.prototype.get=function(b){var c=a.localStorage[Cb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Fb.isUnd(d[b])?d[b]:null}catch(e){}return d},p.prototype.oDriver=null,p.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},p.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},q.prototype.bootstart=function(){},r.prototype.sPosition="",r.prototype.sTemplate="",r.prototype.viewModelName="",r.prototype.viewModelDom=null,r.prototype.viewModelTemplate=function(){return this.sTemplate},r.prototype.viewModelPosition=function(){return this.sPosition},r.prototype.cancelCommand=r.prototype.closeCommand=function(){},r.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=Sb.data().keyScope(),Sb.data().keyScope(this.sDefaultKeyScope)},r.prototype.restoreKeyScope=function(){Sb.data().keyScope(this.sCurrentKeyScope)},r.prototype.registerPopupKeyDown=function(){var a=this;Pb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&Db.EventKeyCode.Esc===b.keyCode)return Fb.delegateRun(a,"cancelCommand"),!1;if(Db.EventKeyCode.Backspace===b.keyCode&&!Fb.inFocus())return!1}return!0})},s.prototype.oCross=null,s.prototype.sScreenName="",s.prototype.aViewModels=[],s.prototype.viewModels=function(){return this.aViewModels},s.prototype.screenName=function(){return this.sScreenName},s.prototype.routes=function(){return null},s.prototype.__cross=function(){return this.oCross},s.prototype.__start=function(){var a=this.routes(),b=null,c=null;Fb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Fb.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},t.constructorEnd=function(a){Fb.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},t.prototype.sDefaultScreenName="",t.prototype.oScreens={},t.prototype.oBoot=null,t.prototype.oCurrentScreen=null,t.prototype.hideLoading=function(){b("#rl-loading").hide()},t.prototype.routeOff=function(){e.changed.active=!1},t.prototype.routeOn=function(){e.changed.active=!0},t.prototype.setBoot=function(a){return Fb.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Fb.isUnd(this.oScreens[a])?null:this.oScreens[a]},t.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=Sb.data(),e.viewModelName=a.__name,g&&1===g.length?(i=b("").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide(),i.appendTo(g),e.viewModelDom=i,a.__dom=i,"Popups"===f&&(e.cancelCommand=e.closeCommand=Fb.createCommand(e,function(){Lb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),Sb.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+Sb.popupVisibilityNames().length+10),Fb.delegateRun(this,"onFocus",[],500)):(Fb.delegateRun(this,"onHide"),this.restoreKeyScope(),Sb.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),Ib.tooltipTrigger(!Ib.tooltipTrigger()),h.delay(function(){b.viewModelDom.hide()},300))},e)),Gb.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindingAccessorsToNode(i[0],{i18nInit:!0,template:function(){return{name:e.viewModelTemplate()}}},e),Fb.delegateRun(e,"onBuild",[i]),e&&"Popups"===f&&e.registerPopupKeyDown(),Gb.runHook("view-model-post-build",[a.__name,e,i])):Fb.log("Cannot find view model position: "+f)}return a?a.__vm:null},t.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},t.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Gb.runHook("view-model-on-hide",[a.__name,a.__vm]))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),Fb.delegateRun(a.__vm,"onShow",b||[]),Gb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Fb.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,Fb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Fb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Fb.delegateRun(c.oCurrentScreen,"onHide"),Fb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),Fb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Fb.delegateRun(c.oCurrentScreen,"onShow"),Gb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Fb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),Fb.delegateRun(a.__vm,"onShow"),Fb.delegateRun(a.__vm,"onFocus",[],200),Gb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},t.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),h.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),h.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),Gb.runHook("screen-pre-start",[a.screenName(),a]),Fb.delegateRun(a,"onStart"),Gb.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),h.delay(function(){Ob.removeClass("rl-started-trigger").addClass("rl-started")},50)},t.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=Fb.isUnd(c)?!1:!!c,(Fb.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},t.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},Lb=new t,u.newInstanceFromJson=function(a){var b=new u;return b.initByJson(a)?b:null},u.prototype.name="",u.prototype.email="",u.prototype.privateType=null,u.prototype.clear=function(){this.email="",this.name="",this.privateType=null},u.prototype.validate=function(){return""!==this.name||""!==this.email},u.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},u.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},u.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=Db.EmailType.Facebook),null===this.privateType&&(this.privateType=Db.EmailType.Default)),this.privateType},u.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},u.prototype.parse=function(a){this.clear(),a=Fb.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},u.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=Fb.trim(a.Name),this.email=Fb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Fb.isUnd(b)?!1:!!b,c=Fb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+Fb.encodeHtml(this.name)+"":c?Fb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Fb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Fb.encodeHtml(d)+""+Fb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Fb.encodeHtml(d))):b&&(d=''+Fb.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=Fb.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m 0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=Fb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Fb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Fb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},u.prototype.inputoTagLine=function(){return 0 +$/,""),b=!0),b},y.prototype.isImage=function(){return-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},A.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(Fb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=u.newInstanceFromJson(a[b]),d&&e.push(d);return e},A.replyHelper=function(a,b,c){if(a&&0 d;d++)Fb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},A.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(Db.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(Db.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(Db.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)},A.prototype.computeSenderEmail=function(){var a=Sb.data().sentFolder(),b=Sb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},A.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.hash=a.Hash,this.requestHash=a.RequestHash,this.size(Fb.pInt(a.Size)),this.from=A.initEmailsFromJson(a.From),this.to=A.initEmailsFromJson(a.To),this.cc=A.initEmailsFromJson(a.Cc),this.bcc=A.initEmailsFromJson(a.Bcc),this.replyTo=A.initEmailsFromJson(a.ReplyTo),this.deliveredTo=A.initEmailsFromJson(a.DeliveredTo),this.subject(a.Subject),this.dateTimeStampInUTC(Fb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(A.emailsToLine(this.from,!0)),this.toEmailsString(A.emailsToLine(this.to,!0)),this.parentUid(Fb.pInt(a.ParentThread)),this.threads(Fb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Fb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},A.prototype.initUpdateByMessageJson=function(a){var b=!1,c=Db.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Fb.pInt(a.Priority),this.priority(-1 b;b++)d=y.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0 +$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},A.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return Fb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},A.prototype.messageId=function(){return this.sMessageId},A.prototype.inReplyTo=function(){return this.sInReplyTo},A.prototype.references=function(){return this.sReferences},A.prototype.fromAsSingleEmail=function(){return Fb.isArray(this.from)&&this.from[0]?this.from[0].email:""},A.prototype.viewLink=function(){return Sb.link().messageViewLink(this.requestHash)},A.prototype.downloadLink=function(){return Sb.link().messageDownloadLink(this.requestHash)},A.prototype.replyEmails=function(a){var b=[],c=Fb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,c,b),0===b.length&&A.replyHelper(this.from,c,b),b},A.prototype.replyAllEmails=function(a){var b=[],c=[],d=Fb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,d,b),0===b.length&&A.replyHelper(this.from,d,b),A.replyHelper(this.to,d,b),A.replyHelper(this.cc,d,c),[b,c]},A.prototype.textBodyToString=function(){return this.body?this.body.html():""},A.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0 =0&&e&&!f&&d.attr("src",e)}),c&&a.setTimeout(function(){d.print()},100))})},A.prototype.printMessage=function(){this.viewPopupMessage(!0)},A.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},A.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.hash=a.hash,this.requestHash=a.requestHash,this.subject(a.subject()),this.size(a.size()),this.dateTimeStampInUTC(a.dateTimeStampInUTC()),this.priority(a.priority()),this.fromEmailString(a.fromEmailString()),this.toEmailsString(a.toEmailsString()),this.emails=a.emails,this.from=a.from,this.to=a.to,this.cc=a.cc,this.bcc=a.bcc,this.replyTo=a.replyTo,this.deliveredTo=a.deliveredTo,this.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),this.isReadReceipt(a.isReadReceipt()),this.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(Db.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(a.parentUid()),this.threads(a.threads()),this.threadsLen(a.threadsLen()),this.computeSenderEmail(),this},A.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=Fb.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),b("[data-x-src]",this.body).each(function(){a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",b(this).attr("data-x-src")).removeAttr("data-x-src"):b(this).attr("src",b(this).attr("data-x-src")).removeAttr("data-x-src")}),b("[data-x-style-url]",this.body).each(function(){var a=Fb.trim(b(this).attr("style"));a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+b(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(b("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b(".RL-MailMessageView .messageView .messageItem .content")[0]}),Pb.resize()),Fb.windowResize(500))},A.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),a=Fb.isUnd(a)?!1:a;var c=this;b("[data-x-src-cid]",this.body).each(function(){var d=c.findAttachmentByCid(b(this).attr("data-x-src-cid"));d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-src-location]",this.body).each(function(){var d=c.findAttachmentByContentLocation(b(this).attr("data-x-src-location"));d||(d=c.findAttachmentByCid(b(this).attr("data-x-src-location"))),d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-style-cid]",this.body).each(function(){var a="",d="",e=c.findAttachmentByCid(b(this).attr("data-x-style-cid"));e&&e.linkPreview&&(d=b(this).attr("data-x-style-cid-name"),""!==d&&(a=Fb.trim(b(this).attr("style")),a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+d+": url('"+e.linkPreview()+"')")))}),a&&!function(a,b){h.delay(function(){a.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b})},300)}(b("img.lazy",c.body),b(".RL-MailMessageView .messageView .messageItem .content")[0]),Fb.windowResize(500)}},A.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),Sb.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())))},A.prototype.storePgpVerifyDataToDom=function(){this.body&&Sb.data().capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},A.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=Fb.pString(this.body.data("rl-plain-raw")),Sb.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(Db.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},A.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var c=[],d=null,e=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",f=Sb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?Db.SignedVerifyStatus.Unverified:Db.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0 ').text(j)).html(),Tb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},A.prototype.decryptPgpEncryptedMessage=function(c){if(this.isPgpEncrypted()){var d=[],e=null,f=null,g=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",i=Sb.data().findPublicKeysByEmail(g),j=Sb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(Db.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0 ').text(m)).html(),Tb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},A.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},B.newInstanceFromJson=function(a){var b=new B;return b.initByJson(a)?b.initComputed():null},B.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()&&!a.isSystemFolder()})},this),this.canBeEdited=c.computed(function(){return Db.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=c.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this),this.isSystemFolder=c.computed(function(){return Db.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return a&&!b||!this.selectable&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){Fb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Fb.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=c.computed(function(){var a=this.messageCountAll(),b=this.messageCountUnread(),c=this.type();if(Db.FolderType.Inbox===c&&Sb.data().foldersInboxUnreadCount(b),a>0){if(Db.FolderType.Draft===c)return""+a;if(b>0&&Db.FolderType.Trash!==c&&Db.FolderType.Archive!==c&&Db.FolderType.SentItems!==c)return""+b}return""},this),this.canBeDeleted=c.computed(function(){var a=this.isSystemFolder(); +return!a&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=c.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){Fb.timeOutAction("folder-list-folder-visibility-change",function(){Pb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Ib.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case Db.FolderType.Inbox:b=Fb.i18n("FOLDER_LIST/INBOX_NAME");break;case Db.FolderType.SentItems:b=Fb.i18n("FOLDER_LIST/SENT_NAME");break;case Db.FolderType.Draft:b=Fb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case Db.FolderType.Spam:b=Fb.i18n("FOLDER_LIST/SPAM_NAME");break;case Db.FolderType.Trash:b=Fb.i18n("FOLDER_LIST/TRASH_NAME");break;case Db.FolderType.Archive:b=Fb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Ib.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case Db.FolderType.Inbox:a="("+Fb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case Db.FolderType.SentItems:a="("+Fb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case Db.FolderType.Draft:a="("+Fb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case Db.FolderType.Spam:a="("+Fb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case Db.FolderType.Trash:a="("+Fb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case Db.FolderType.Archive:a="("+Fb.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this.hasUnreadMessages=c.computed(function(){return 0 "},D.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},D.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+Fb.quoteName(a)+'" <'+this.email()+">"},F.prototype.deleteCondition=function(a){this.conditions.remove(a)},F.prototype.addCondition=function(){this.conditions.push(new E)},F.prototype.parse=function(a){var b=!1;return a&&"Object/Filter"===a["@Object"]&&(this.name(Fb.pString(a.Name)),b=!0),b},G.prototype.index=0,G.prototype.id="",G.prototype.guid="",G.prototype.user="",G.prototype.email="",G.prototype.armor="",G.prototype.isPrivate=!1,Fb.extendAsViewModel("PopupsFolderClearViewModel",H),H.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},H.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Fb.extendAsViewModel("PopupsFolderCreateViewModel",I),I.prototype.sNoParentText="",I.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Fb.trim(a))},I.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},I.prototype.onShow=function(){this.clearPopup()},I.prototype.onFocus=function(){this.folderName.focused(!0)},Fb.extendAsViewModel("PopupsFolderSystemViewModel",J),J.prototype.sChooseOnText="",J.prototype.sUnuseText="",J.prototype.onShow=function(a){var b="";switch(a=Fb.isUnd(a)?Db.SetSystemFoldersNotification.None:a){case Db.SetSystemFoldersNotification.Sent:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case Db.SetSystemFoldersNotification.Draft:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case Db.SetSystemFoldersNotification.Spam:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case Db.SetSystemFoldersNotification.Trash:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case Db.SetSystemFoldersNotification.Archive:b=Fb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Fb.extendAsViewModel("PopupsComposeViewModel",K),K.prototype.openOpenPgpPopup=function(){if(this.capaOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Lb.showScreenPopup(R,[function(b){a.editor(function(a){a.setPlain(b)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},K.prototype.reloadDraftFolder=function(){var a=Sb.data().draftFolder();""!==a&&(Sb.cache().setFolderHash(a,""),Sb.data().currentFolderFullNameRaw()===a?Sb.reloadMessageList(!0):Sb.folderInformation(a))},K.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};if(this.bCapaAdditionalIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Sb.data().accountEmail()]=Sb.data().accountEmail(),b)switch(a){case Db.ComposeType.Empty:d=Sb.data().accountEmail();break;case Db.ComposeType.Reply:case Db.ComposeType.ReplyAll:case Db.ComposeType.Forward:case Db.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc,b.deliveredTo),e);break;case Db.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Sb.data().accountEmail();return d},K.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},K.prototype.formattedFrom=function(a){var b=Sb.data().displayName(),c=Sb.data().accountEmail();return""===b?c:(Fb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Fb.quoteName(b)+'" <'+c+">"},K.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),Db.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Fb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&Db.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Fb.trim(Fb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Fb.getNotification(c&&c.ErrorCode?c.ErrorCode:Db.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Fb.getNotification(Db.Notification.CantSendMessage)))),this.reloadDraftFolder()},K.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),Db.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Sb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Sb.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0 c;c++)e.push(a[c].toLine(!!b));return e.join(", ")};if(c=c||null,c&&Fb.isNormal(c)&&(v=Fb.isArray(c)&&1===c.length?c[0]:Fb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Fb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Fb.removeBlockquoteSwitcher(l),m=l.html(),w){case Db.ComposeType.Empty:break;case Db.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Fb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.sReferences);break;case Db.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Fb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.references());break;case Db.ComposeType.Forward:this.subject(Fb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.sReferences);break;case Db.ComposeType.ForwardAsAttachment:this.subject(Fb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Fb.trim(this.sInReplyTo+" "+v.sReferences);break;case Db.ComposeType.Draft:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.bFromDraft=!0,this.draftFolder(v.folderFullNameRaw),this.draftUid(v.uid),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Fb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case Db.ComposeType.EditAsNew:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=Fb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case Db.ComposeType.Reply:case Db.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Fb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case Db.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m=""+m+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Fb.encodeHtml(j)+"
"+Fb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Fb.encodeHtml(k)+"
"+m;break;case Db.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&Db.ComposeType.EditAsNew!==w&&Db.ComposeType.Draft!==w&&(m=this.convertSignature(r,x(v.from,!0))+"
"+m),this.editor(function(a){a.setHtml(m,!1),v.isHtml()||a.modeToggle(!1)})}else Db.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),Db.EditorDefaultType.Html!==Sb.data().editorDefaultType()&&a.modeToggle(!1)})):Fb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Fb.isNonEmptyArray(t)&&Sb.remote().messageUploadAttachments(function(a,b){if(Db.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},t),this.triggerForResize()},K.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},K.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},K.prototype.tryToClosePopup=function(){var a=this;Lb.showScreenPopup(V,[Fb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Fb.delegateRun(a,"closeCommand")}])},K.prototype.onBuild=function(){this.initUploader();var a=this,c=null;j("ctrl+q, command+q",Db.KeyState.Compose,function(){return a.identitiesDropdownTrigger(!0),!1}),j("ctrl+s, command+s",Db.KeyState.Compose,function(){return a.saveCommand(),!1}),j("ctrl+enter, command+enter",Db.KeyState.Compose,function(){return a.sendCommand(),!1}),j("esc",Db.KeyState.Compose,function(){return a.tryToClosePopup(),!1}),Pb.on("resize",function(){a.triggerForResize()}),this.dropboxEnabled()&&(c=document.createElement("script"),c.type="text/javascript",c.src="https://www.dropbox.com/static/api/1/dropins.js",b(c).attr("id","dropboxjs").attr("data-app-key",Sb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},K.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;d>c;c++)if(b[c]&&a===b[c].id)return b[c];return null},K.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=Fb.pInt(Sb.settingsGet("AttachmentLimit")),c=new g({action:Sb.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});c?(c.on("onDragEnter",h.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",h.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",h.bind(function(b,c,d){var e=null;Fb.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this)).on("onSelect",h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=Fb.isUnd(d.FileName)?"":d.FileName.toString(),g=Fb.isNormal(d.Size)?Fb.pInt(d.Size):null,h=new z(a,f,g);return h.cancel=function(a){return function(){e.attachments.remove(function(b){return b&&b.id===a}),c&&c.cancel(a)}}(a),this.attachments.push(h),g>0&&b>0&&g>b?(h.error(Fb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Fb.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this)).on("onComplete",h.bind(function(b,c,d){var e="",f=null,g=null,h=this.getAttachmentById(b);g=c&&d&&d.Result&&d.Result.Attachment?d.Result.Attachment:null,f=d&&d.Result&&d.Result.ErrorCode?d.Result.ErrorCode:null,null!==f?e=Fb.getUploadErrorDescByCode(f):g||(e=Fb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Fb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Sb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),Db.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Fb.getUploadErrorDescByCode(Db.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},K.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Fb.isNonEmptyArray(a.attachments())?a.attachments():[],e=0,f=d.length,g=null,h=null,i=!1,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(Db.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case Db.ComposeType.Reply:case Db.ComposeType.ReplyAll:i=h.isLinked;break;case Db.ComposeType.Forward:case Db.ComposeType.Draft:case Db.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new z(h.download,h.fileName,h.estimatedSize,h.isInline,h.isLinked,h.cid,h.contentLocation),g.fromMessage=!0,g.cancel=j(h.download),g.waiting(!1).uploading(!0),this.attachments.push(g))}}},K.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},K.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(Fb.getUploadErrorDescByCode(Db.UploadErrorCode.FileNoUploaded))},this)},K.prototype.isEmptyForm=function(a){a=Fb.isUnd(a)?!0:!!a;var b=a?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&b&&(!this.oEditor||""===this.oEditor.getData())},K.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)},K.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},K.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Fb.extendAsViewModel("PopupsContactsViewModel",L),L.prototype.getPropertyPlceholder=function(a){var b="";switch(a){case Db.ContactPropertyType.LastName:b="CONTACTS/PLACEHOLDER_ENTER_LAST_NAME";break;case Db.ContactPropertyType.FirstName:b="CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME";break;case Db.ContactPropertyType.Nick:b="CONTACTS/PLACEHOLDER_ENTER_NICK_NAME"}return b},L.prototype.addNewProperty=function(a,b){this.viewProperties.push(new w(a,b||"","",!0,this.getPropertyPlceholder(a)))},L.prototype.addNewOrFocusProperty=function(a,b){var c=h.find(this.viewProperties(),function(b){return a===b.type()});c?c.focused(!0):this.addNewProperty(a,b)},L.prototype.addNewTag=function(){this.viewTags.visibility(!0),this.viewTags.focusTrigger(!0)},L.prototype.addNewEmail=function(){this.addNewProperty(Db.ContactPropertyType.Email,"Home")},L.prototype.addNewPhone=function(){this.addNewProperty(Db.ContactPropertyType.Phone,"Mobile")},L.prototype.addNewWeb=function(){this.addNewProperty(Db.ContactPropertyType.Web)},L.prototype.addNewNickname=function(){this.addNewOrFocusProperty(Db.ContactPropertyType.Nick)},L.prototype.addNewNotes=function(){this.addNewOrFocusProperty(Db.ContactPropertyType.Note)},L.prototype.addNewBirthday=function(){this.addNewOrFocusProperty(Db.ContactPropertyType.Birthday)},L.prototype.exportVcf=function(){Sb.download(Sb.link().exportContactsVcf())},L.prototype.exportCsv=function(){Sb.download(Sb.link().exportContactsCsv())},L.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Sb.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});b&&b.on("onStart",h.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",h.bind(function(b,c,d){this.contacts.importing(!1),this.reloadContactList(),b&&c&&d&&d.Result||a.alert(Fb.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},L.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contacts().length,e=this.contactsCheckedOrSelected();0 =d&&(this.bDropPageAfterDelete=!0),h.delay(function(){h.each(e,function(a){b.remove(a)})},500))},L.prototype.deleteSelectedContacts=function(){0 0?d:0),Fb.isNonEmptyArray(c.Result.Tags)&&(f=h.map(c.Result.Tags,function(a){var b=new x;return b.parse(a)?b:null}),f=h.compact(f))),b.contactsCount(d),b.contacts(e),b.contactTags(f),b.contacts.loading(!1),b.viewClearSearch(""!==b.search())},c,Cb.Defaults.ContactsPerPage,this.search())},L.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,Db.KeyState.ContactList);var d=this;j("delete",Db.KeyState.ContactList,function(){return d.deleteCommand(),!1}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Fb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},L.prototype.onShow=function(){Lb.routeOff(),this.reloadContactList(!0)},L.prototype.onHide=function(){Lb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},Fb.extendAsViewModel("PopupsAdvancedSearchViewModel",M),M.prototype.buildSearchStringValue=function(a){return-1 li"),e=c&&("tab"===c.shortcut||"right"===c.shortcut),f=d.index(d.filter(".active"));return!e&&f>0?f--:e&&f -1&&g.eq(e).removeClass("focused"),38===f&&e>0?e--:40===f&&e 1?" ("+(100>a?a:"99+")+")":""},ab.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},ab.prototype.moveSelectedMessagesToFolder=function(a,b){return this.canBeMoved()&&Sb.moveMessagesToFolder(Sb.data().currentFolderFullNameRaw(),Sb.data().messageListCheckedOrSelectedUidsWithSubMails(),a,b),!1},ab.prototype.dragAndDronHelper=function(a){a&&a.checked(!0);var b=Fb.draggeblePlace(),c=Sb.data().messageListCheckedOrSelectedUidsWithSubMails();return b.data("rl-folder",Sb.data().currentFolderFullNameRaw()),b.data("rl-uids",c),b.find(".text").text(""+c.length),h.defer(function(){var a=Sb.data().messageListCheckedOrSelectedUidsWithSubMails();b.data("rl-uids",a),b.find(".text").text(""+a.length)}),b},ab.prototype.onMessageResponse=function(a,b,c){var d=Sb.data();d.hideMessageBodies(),d.messageLoading(!1),Db.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):Db.StorageResultType.Unload===a?(d.message(null),d.messageError("")):Db.StorageResultType.Abort!==a&&(d.message(null),d.messageError(Fb.getNotification(b&&b.ErrorCode?b.ErrorCode:Db.Notification.UnknownError)))},ab.prototype.populateMessageBody=function(a){a&&(Sb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Sb.data().messageLoading(!0):Fb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},ab.prototype.setAction=function(a,b,c){var d=[],e=null,f=Sb.cache(),g=0;if(Fb.isUnd(c)&&(c=Sb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0 0?100>a?a:"99+":""},bb.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},bb.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage(this.viewPgpPassword())},bb.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Sb.remote().sendReadReceiptMessage(Fb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),Fb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),Fb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":Sb.data().accountEmail()})),a.isReadReceipt(!0),Sb.cache().storeMessageFlagsToCache(a),Sb.reloadFlagsCurrentMessageListAndMessageFromCache())},Fb.extendAsViewModel("SettingsMenuViewModel",cb),cb.prototype.link=function(a){return Sb.link().settings(a)},cb.prototype.backToMailBoxClick=function(){Lb.setHash(Sb.link().inbox())},Fb.extendAsViewModel("SettingsPaneViewModel",db),db.prototype.onBuild=function(){var a=this;j("esc",Db.KeyState.Settings,function(){a.backToMailBoxClick()})},db.prototype.onShow=function(){Sb.data().message(null)},db.prototype.backToMailBoxClick=function(){Lb.setHash(Sb.link().inbox())},Fb.addSettingsViewModel(eb,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),eb.prototype.toggleLayout=function(){this.layout(Db.Layout.NoPreview===this.layout()?Db.Layout.SidePreview:Db.Layout.NoPreview)},eb.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Sb.data(),d=Fb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(Db.SaveSettingsStep.Animate),b.ajax({url:Sb.link().langLink(c),dataType:"script",cache:!0}).done(function(){Fb.i18nToDoc(),a.languageTrigger(Db.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(Db.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(Db.SaveSettingsStep.Idle)},1e3)}),Sb.remote().saveSettings(Fb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Sb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){Fb.timeOutAction("SaveDesktopNotifications",function(){Sb.remote().saveSettings(Fb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){Fb.timeOutAction("SaveReplySameFolder",function(){Sb.remote().saveSettings(Fb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Sb.remote().saveSettings(Fb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Sb.remote().saveSettings(Fb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},eb.prototype.onShow=function(){Sb.data().desktopNotifications.valueHasMutated()},eb.prototype.selectLanguage=function(){Lb.showScreenPopup(T)},Fb.addSettingsViewModel(fb,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),fb.prototype.onBuild=function(){Sb.data().contactsAutosave.subscribe(function(a){Sb.remote().saveSettings(Fb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},Fb.addSettingsViewModel(gb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),gb.prototype.addNewAccount=function(){Lb.showScreenPopup(N)},gb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Sb.remote().accountDelete(function(b,c){Db.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Lb.routeOff(),Lb.setHash(Sb.link().root(),!0),Lb.routeOff(),h.defer(function(){a.location.reload()})):Sb.accountsAndIdentities()},b.email))}},Fb.addSettingsViewModel(hb,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),hb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Sb.data().signature();this.editor=new l(a.signatureDom(),function(){Sb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},hb.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Sb.data(),c=Fb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=Fb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=Fb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Sb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Sb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Sb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Sb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Fb.addSettingsViewModel(ib,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),ib.prototype.addNewIdentity=function(){Lb.showScreenPopup(S)},ib.prototype.editIdentity=function(a){Lb.showScreenPopup(S,[a])},ib.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Sb.remote().identityDelete(function(){Sb.accountsAndIdentities()},a.id))}},ib.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Sb.data().signature();this.editor=new l(a.signatureDom(),function(){Sb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},ib.prototype.onBuild=function(a){var b=this;a.on("click",".identity-item .e-action",function(){var a=c.dataFor(this);a&&b.editIdentity(a)}),h.delay(function(){var a=Sb.data(),c=Fb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=Fb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=Fb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Sb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Sb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Sb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Sb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Fb.addSettingsViewModel(jb,"SettingsFilters","SETTINGS_LABELS/LABEL_FILTERS_NAME","filters"),jb.prototype.deleteFilter=function(a){this.filters.remove(a)},jb.prototype.addFilter=function(){var a=new F;a.addCondition(),this.filters.push(a)},Fb.addSettingsViewModel(kb,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),kb.prototype.showSecret=function(){this.secreting(!0),Sb.remote().showTwoFactorSecret(this.onSecretResult)},kb.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},kb.prototype.createTwoFactor=function(){this.processing(!0),Sb.remote().createTwoFactor(this.onResult)},kb.prototype.enableTwoFactor=function(){this.processing(!0),Sb.remote().enableTwoFactor(this.onResult,this.viewEnable())},kb.prototype.testTwoFactor=function(){Lb.showScreenPopup(U)},kb.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),Sb.remote().clearTwoFactor(this.onResult)},kb.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},kb.prototype.onResult=function(a,b){if(this.processing(!1),this.clearing(!1),Db.StorageResultType.Success===a&&b&&b.Result?(this.viewUser(Fb.pString(b.Result.User)),this.viewEnable(!!b.Result.Enable),this.twoFactorStatus(!!b.Result.IsSet),this.viewSecret(Fb.pString(b.Result.Secret)),this.viewBackupCodes(Fb.pString(b.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Fb.pString(b.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var c=this;this.viewEnable.subscribe(function(a){this.viewEnable.subs&&Sb.remote().enableTwoFactor(function(a,b){Db.StorageResultType.Success===a&&b&&b.Result||(c.viewEnable.subs=!1,c.viewEnable(!1),c.viewEnable.subs=!0)},a)},this)}},kb.prototype.onSecretResult=function(a,b){this.secreting(!1),Db.StorageResultType.Success===a&&b&&b.Result?(this.viewSecret(Fb.pString(b.Result.Secret)),this.viewUrl(Fb.pString(b.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},kb.prototype.onBuild=function(){this.processing(!0),Sb.remote().getTwoFactor(this.onResult)},Fb.addSettingsViewModel(lb,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Fb.addSettingsViewModel(mb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),mb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},mb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),Db.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(b&&Db.Notification.CurrentPasswordIncorrect===b.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(Fb.getNotification(b&&b.ErrorCode?b.ErrorCode:Db.Notification.CouldNotSaveNewPassword)))},Fb.addSettingsViewModel(nb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),nb.prototype.folderEditOnEnter=function(a){var b=a?Fb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Sb.local().set(Db.ClientSideKeyName.FoldersLashHash,""),Sb.data().foldersRenaming(!0),Sb.remote().folderRename(function(a,b){Sb.data().foldersRenaming(!1),Db.StorageResultType.Success===a&&b&&b.Result||Sb.data().foldersListError(b&&b.ErrorCode?Fb.getNotification(b.ErrorCode):Fb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Sb.folders()},a.fullNameRaw,b),Sb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},nb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},nb.prototype.onShow=function(){Sb.data().foldersListError("")},nb.prototype.createFolder=function(){Lb.showScreenPopup(I)},nb.prototype.systemFolder=function(){Lb.showScreenPopup(J)},nb.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){return a===c?!0:(c.subFolders.remove(b),!1)};a&&(Sb.local().set(Db.ClientSideKeyName.FoldersLashHash,""),Sb.data().folderList.remove(b),Sb.data().foldersDeleting(!0),Sb.remote().folderDelete(function(a,b){Sb.data().foldersDeleting(!1),Db.StorageResultType.Success===a&&b&&b.Result||Sb.data().foldersListError(b&&b.ErrorCode?Fb.getNotification(b.ErrorCode):Fb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Sb.folders()},a.fullNameRaw),Sb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 0&&(c=this.messagesBodiesDom(),c&&(c.find(".rl-cache-class").each(function(){var c=b(this);d>c.data("rl-cache-count")&&(c.addClass("rl-cache-purge"),a++)}),a>0&&h.delay(function(){c.find(".rl-cache-purge").remove()},300)))},rb.prototype.populateDataOnStart=function(){qb.prototype.populateDataOnStart.call(this),this.accountEmail(Sb.settingsGet("Email")),this.accountIncLogin(Sb.settingsGet("IncLogin")),this.accountOutLogin(Sb.settingsGet("OutLogin")),this.projectHash(Sb.settingsGet("ProjectHash")),this.displayName(Sb.settingsGet("DisplayName")),this.replyTo(Sb.settingsGet("ReplyTo")),this.signature(Sb.settingsGet("Signature")),this.signatureToAll(!!Sb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Sb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Sb.local().get(Db.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Sb.settingsGet("RemoteSuggestions"),this.devEmail=Sb.settingsGet("DevEmail"),this.devLogin=Sb.settingsGet("DevLogin"),this.devPassword=Sb.settingsGet("DevPassword")},rb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Fb.isNormal(c)&&""!==c){if(Fb.isArray(d)&&0 3)i(Sb.link().notificationMailIcon(),Sb.data().accountEmail(),Fb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Sb.link().notificationMailIcon(),A.emailsToLine(A.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Sb.cache().setFolderUidNext(b,c)}},rb.prototype.folderResponseParseRec=function(a,b){var c=0,d=0,e=null,f=null,g="",h=[],i=[];for(c=0,d=b.length;d>c;c++)e=b[c],e&&(g=e.FullNameRaw,f=Sb.cache().getFolderFromCacheList(g),f||(f=B.newInstanceFromJson(e),f&&(Sb.cache().setFolderToCacheList(g,f),Sb.cache().setFolderFullNameRaw(f.fullNameHash,g))),f&&(f.collapsed(!Fb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Sb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Fb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Fb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Fb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},rb.prototype.setFolders=function(a){var b=[],c=!1,d=Sb.data(),e=function(a){return""===a||Cb.Values.UnuseOptionValue===a||null!==Sb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Fb.isArray(a.Result["@Collection"])&&(Fb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Sb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Sb.settingsGet("SentFolder")+Sb.settingsGet("DraftFolder")+Sb.settingsGet("SpamFolder")+Sb.settingsGet("TrashFolder")+Sb.settingsGet("ArchiveFolder")+Sb.settingsGet("NullFolder")&&(Sb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Sb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Sb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Sb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Sb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Sb.settingsGet("SentFolder"))),d.draftFolder(e(Sb.settingsGet("DraftFolder"))),d.spamFolder(e(Sb.settingsGet("SpamFolder"))),d.trashFolder(e(Sb.settingsGet("TrashFolder"))),d.archiveFolder(e(Sb.settingsGet("ArchiveFolder"))),c&&Sb.remote().saveSystemFolders(Fb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Sb.local().set(Db.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},rb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},rb.prototype.getNextFolderNames=function(a){a=Fb.isUnd(a)?!1:!!a;var b=[],c=10,d=f().unix(),e=d-300,g=[],i=function(b){h.each(b,function(b){b&&"INBOX"!==b.fullNameRaw&&b.selectable&&b.existen&&e>b.interval&&(!a||b.subScribed())&&g.push([b.interval,b.fullNameRaw]),b&&0 b[0]?1:0}),h.find(g,function(a){var e=Sb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},rb.prototype.removeMessagesFromList=function(a,b,c,d){c=Fb.isNormal(c)?c:"",d=Fb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Fb.pInt(a)});var e=0,f=Sb.data(),g=Sb.cache(),i=f.messageList(),j=Sb.cache().getFolderFromCacheList(a),k=""===c?null:g.getFolderFromCacheList(c||""),l=f.currentFolderFullNameRaw(),m=f.message(),n=l===a?h.filter(i,function(a){return a&&-1 0&&j.messageCountUnread(0<=j.messageCountUnread()-e?j.messageCountUnread()-e:0)),k&&(k.messageCountAll(k.messageCountAll()+b.length),e>0&&k.messageCountUnread(k.messageCountUnread()+e),k.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Ib.iMessageBodyCacheCount),Fb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Fb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Sb.data().capaOpenPGP()&&Fb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Fb.pString(a.Result.PlainRaw),l=/---BEGIN PGP MESSAGE---/.test(n.plainRaw),l||(k=/-----BEGIN PGP SIGNED MESSAGE-----/.test(n.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(n.plainRaw)),Tb.empty(),k&&n.isPgpSigned()?j=Tb.append(b('').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Tb.append(b('').text(n.plainRaw)).html()),Tb.empty(),n.isPgpSigned(k),n.isPgpEncrypted(l)),g.html(j).addClass("b-text-part plain")):d=!1,n.isHtml(!!d),n.hasImages(!!e),n.pgpSignedVerifyStatus(Db.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(n.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),n.storeDataToDom(),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Fb.initBlockquoteSwitcher(g)),Sb.cache().initMessageFlagsFromCache(n),n.unseen()&&Sb.setMessageSeen(n),Fb.windowResize())},rb.prototype.calculateMessageListHash=function(a){return h.map(a,function(a){return""+a.hash+"_"+a.threadsLen()+"_"+a.flagHash()}).join("|")},rb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Fb.isArray(a.Result["@Collection"])){var c=Sb.data(),d=Sb.cache(),e=null,g=0,h=0,i=0,j=0,k=[],l=f().unix(),m=c.staticMessageList,n=null,o=null,p=null,q=0,r=!1;for(i=Fb.pInt(a.Result.MessageResultCount),j=Fb.pInt(a.Result.Offset),Fb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Sb.cache().getFolderFromCacheList(Fb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Sb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Fb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Fb.isNormal(a.Result.MessageUnseenCount)&&(Fb.pInt(p.messageCountUnread())!==Fb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Sb.cache().clearMessageFlagsFromCacheByFolder(p.fullNameRaw),g=0,h=a.Result["@Collection"].length;h>g;g++)n=a.Result["@Collection"][g],n&&"Object/Message"===n["@Object"]&&(o=m[g],o&&o.initByJson(n)||(o=A.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Sb.cache().initMessageFlagsFromCache(o):Sb.cache().storeMessageFlagsToCache(o),o.lastInCollapsedThread(e&&-1 (new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0 0?(this.defaultRequest(a,"Message",{},null,"Message/"+Hb.urlsafe_encode([b,c,Sb.data().projectHash(),Sb.data().threading()&&Sb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},tb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},tb.prototype.folderInformation=function(a,b,c){var d=!0,e=Sb.cache(),f=[];Fb.isArray(c)&&0 l;l++)q.push({id:e[l][0],name:e[l][1],system:!1,seporator:!1,disabled:!1});for(o=!0,l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&(o&&0 l;l++)n=c[l],(n.subScribed()||!n.existen)&&(h?h.call(null,n):!0)&&(Db.FolderType.User===n.type()||!j||0 =5?e:20,e=320>=e?e:320,a.setInterval(function(){Sb.contactsSync()},6e4*e+5e3),h.delay(function(){Sb.contactsSync()},5e3),h.delay(function(){Sb.folderInformationMultiply(!0)},500),h.delay(function(){Sb.emailsPicsHashes(),Sb.remote().servicesPics(function(a,b){Db.StorageResultType.Success===a&&b&&b.Result&&Sb.cache().setServicesData(b.Result)})},2e3),Gb.runHook("rl-start-user-screens"),Sb.pub("rl.bootstart-user-screens"),Sb.settingsGet("AccountSignMe")&&a.navigator.registerProtocolHandler&&h.delay(function(){try{a.navigator.registerProtocolHandler("mailto",a.location.protocol+"//"+a.location.host+a.location.pathname+"?mailto&to=%s",""+(Sb.settingsGet("Title")||"RainLoop"))}catch(b){}Sb.settingsGet("MailToEmail")&&Sb.mailToHelper(Sb.settingsGet("MailToEmail"))},500)):(Lb.startScreens([xb]),Gb.runHook("rl-start-login-screens"),Sb.pub("rl.bootstart-login-screens")),a.SimplePace&&a.SimplePace.set(100),Ib.bMobileDevice||h.defer(function(){Fb.initLayoutResizer("#rl-left","#rl-right",Db.ClientSideKeyName.FolderListSize)})},this))):(c=Fb.pString(Sb.settingsGet("CustomLoginLink")),c?(Lb.routeOff(),Lb.setHash(Sb.link().root(),!0),Lb.routeOff(),h.defer(function(){a.location.href=c})):(Lb.hideLoading(),Lb.startScreens([xb]),Gb.runHook("rl-start-login-screens"),Sb.pub("rl.bootstart-login-screens"),a.SimplePace&&a.SimplePace.set(100))),f&&(a["rl_"+d+"_google_service"]=function(){Sb.data().googleActions(!0),Sb.socialUsers()}),g&&(a["rl_"+d+"_facebook_service"]=function(){Sb.data().facebookActions(!0),Sb.socialUsers()}),i&&(a["rl_"+d+"_twitter_service"]=function(){Sb.data().twitterActions(!0),Sb.socialUsers()}),Sb.sub("interval.1m",function(){Ib.momentTrigger(!Ib.momentTrigger())}),Gb.runHook("rl-start-screens"),Sb.pub("rl.bootstart-end")},Sb=new Bb,Ob.addClass(Ib.bMobileDevice?"mobile":"no-mobile"),Pb.keydown(Fb.killCtrlAandS).keyup(Fb.killCtrlAandS),Pb.unload(function(){Ib.bUnload=!0}),Ob.on("click.dropdown.data-api",function(){Fb.detectDropdownVisibility()}),a.rl=a.rl||{},a.rl.addHook=Gb.addHook,a.rl.settingsGet=Gb.mainSettingsGet,a.rl.remoteRequest=Gb.remoteRequest,a.rl.pluginSettingsGet=Gb.settingsGet,a.rl.addSettingsViewModel=Fb.addSettingsViewModel,a.rl.createCommand=Fb.createCommand,a.rl.EmailModel=u,a.rl.Enums=Db,a.__RLBOOT=function(c){b(function(){a.rainloopTEMPLATES&&a.rainloopTEMPLATES[0]?(b("#rl-templates").html(a.rainloopTEMPLATES[0]),h.delay(function(){a.rainloopAppData={},a.rainloopI18N={},a.rainloopTEMPLATES={},Lb.setBoot(Sb).bootstart(),Ob.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):c(!1),a.__RLBOOT=null})},a.SimplePace&&a.SimplePace.add(10)}(window,jQuery,ko,crossroads,hasher,moment,Jua,_,ifvisible,key); \ No newline at end of file +},1e3),h.delay(function(){Sb.quota()},5e3),h.delay(function(){Sb.remote().appDelayStart(Fb.emptyFunction)},35e3),Ob.toggleClass("rl-no-preview-pane",Db.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Ob.toggleClass("rl-no-preview-pane",Db.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},yb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Fb.pString(b[0]),b[1]=Fb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Fb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2]),!1]},c=function(a,b){return b[0]=Fb.pString(b[0]),b[1]=Fb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:c}],[/^message-preview$/,{normalize_:a}],[/^([^\/]*)$/,{normalize_:b}]]},h.extend(zb.prototype,wb.prototype),zb.prototype.onShow=function(){Sb.setTitle(this.sSettingsTitle),Sb.data().keyScope(Db.KeyState.Settings)},h.extend(Ab.prototype,q.prototype),Ab.prototype.oSettings=null,Ab.prototype.oPlugins=null,Ab.prototype.oLocal=null,Ab.prototype.oLink=null,Ab.prototype.oSubs={},Ab.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):(Ib.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},Ab.prototype.link=function(){return null===this.oLink&&(this.oLink=new k),this.oLink},Ab.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},Ab.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Fb.isNormal(Mb)?Mb:{}),Fb.isUnd(this.oSettings[a])?null:this.oSettings[a]},Ab.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Fb.isNormal(Mb)?Mb:{}),this.oSettings[a]=b},Ab.prototype.setTitle=function(b){b=(Fb.isNormal(b)&&0 l;l++)q.push({id:e[l][0],name:e[l][1],system:!1,seporator:!1,disabled:!1});for(o=!0,l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&(o&&0 l;l++)n=c[l],(n.subScribed()||!n.existen)&&(h?h.call(null,n):!0)&&(Db.FolderType.User===n.type()||!j||0 =5?e:20,e=320>=e?e:320,a.setInterval(function(){Sb.contactsSync()},6e4*e+5e3),h.delay(function(){Sb.contactsSync()},5e3),h.delay(function(){Sb.folderInformationMultiply(!0)},500),h.delay(function(){Sb.emailsPicsHashes(),Sb.remote().servicesPics(function(a,b){Db.StorageResultType.Success===a&&b&&b.Result&&Sb.cache().setServicesData(b.Result)})},2e3),Gb.runHook("rl-start-user-screens"),Sb.pub("rl.bootstart-user-screens"),Sb.settingsGet("AccountSignMe")&&a.navigator.registerProtocolHandler&&h.delay(function(){try{a.navigator.registerProtocolHandler("mailto",a.location.protocol+"//"+a.location.host+a.location.pathname+"?mailto&to=%s",""+(Sb.settingsGet("Title")||"RainLoop"))}catch(b){}Sb.settingsGet("MailToEmail")&&Sb.mailToHelper(Sb.settingsGet("MailToEmail"))},500)):(Lb.startScreens([xb]),Gb.runHook("rl-start-login-screens"),Sb.pub("rl.bootstart-login-screens")),a.SimplePace&&a.SimplePace.set(100),Ib.bMobileDevice||h.defer(function(){Fb.initLayoutResizer("#rl-left","#rl-right",Db.ClientSideKeyName.FolderListSize)})},this))):(c=Fb.pString(Sb.settingsGet("CustomLoginLink")),c?(Lb.routeOff(),Lb.setHash(Sb.link().root(),!0),Lb.routeOff(),h.defer(function(){a.location.href=c})):(Lb.hideLoading(),Lb.startScreens([xb]),Gb.runHook("rl-start-login-screens"),Sb.pub("rl.bootstart-login-screens"),a.SimplePace&&a.SimplePace.set(100))),f&&(a["rl_"+d+"_google_service"]=function(){Sb.data().googleActions(!0),Sb.socialUsers()}),g&&(a["rl_"+d+"_facebook_service"]=function(){Sb.data().facebookActions(!0),Sb.socialUsers()}),i&&(a["rl_"+d+"_twitter_service"]=function(){Sb.data().twitterActions(!0),Sb.socialUsers()}),Sb.sub("interval.1m",function(){Ib.momentTrigger(!Ib.momentTrigger())}),Gb.runHook("rl-start-screens"),Sb.pub("rl.bootstart-end")},Sb=new Bb,Ob.addClass(Ib.bMobileDevice?"mobile":"no-mobile"),Pb.keydown(Fb.killCtrlAandS).keyup(Fb.killCtrlAandS),Pb.unload(function(){Ib.bUnload=!0}),Ob.on("click.dropdown.data-api",function(){Fb.detectDropdownVisibility()}),a.rl=a.rl||{},a.rl.addHook=Gb.addHook,a.rl.settingsGet=Gb.mainSettingsGet,a.rl.remoteRequest=Gb.remoteRequest,a.rl.pluginSettingsGet=Gb.settingsGet,a.rl.addSettingsViewModel=Fb.addSettingsViewModel,a.rl.createCommand=Fb.createCommand,a.rl.EmailModel=u,a.rl.Enums=Db,a.__RLBOOT=function(c){b(function(){a.rainloopTEMPLATES&&a.rainloopTEMPLATES[0]?(b("#rl-templates").html(a.rainloopTEMPLATES[0]),h.delay(function(){a.rainloopAppData={},a.rainloopI18N={},a.rainloopTEMPLATES={},Lb.setBoot(Sb).bootstart(),Ob.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):c(!1),a.__RLBOOT=null})},a.SimplePace&&a.SimplePace.add(10)}(window,jQuery,ko,crossroads,hasher,moment,Jua,_,ifvisible,key); \ No newline at end of file