]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S]*?)<\/a>/gim,f).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),(a?qb.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,d).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},j.prototype.getHtmlFromText=function(){return qb.convertPlainTextToHtml(this.textarea.val())},j.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()},j.prototype.switchToPlain=function(c){c=qb.isUnd(c)?!0:c;var d=this.getTextFromHtml(),e=h.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),b(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(d),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);c&&0!==qb.trim(d).length?e(a.confirm(this.oOptions.LangSwitcherConferm)):e(!0)},j.prototype.switcherLinkText=function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel},j.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar"),b(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!0)),this.textarea.val(this.getHtmlFromText()),this.updateHtmlArea(),this.textarea.hide(),this.htmlarea.show(),this.fOnSwitch&&this.fOnSwitch(!0)},j.prototype.addButton=function(c,d){var e=this;b("").addClass("editorToolbarButtom").append(b('').addClass(c)).attr("title",d).click(function(d){qb.isUnd(j.htmlFunctions[c])?a.alert(c):j.htmlFunctions[c].apply(e,[b(this),d])}).appendTo(this.toolbar)},j.htmlInitToolbar=function(){this.bOnlyPlain||(this.addButton("bold","Bold"),this.addButton("italic","Italic"),this.addButton("underline","Underline"),this.addButton("strikethrough","Strikethrough"),this.addButton("removeformat","removeformat"),this.addButton("justifyleft","justifyleft"),this.addButton("justifycenter","justifycenter"),this.addButton("justifyright","justifyright"),this.addButton("horizontalrule","horizontalrule"),this.addButton("orderedlist","orderedlist"),this.addButton("unorderedlist","unorderedlist"),this.addButton("indent","indent"),this.addButton("outdent","outdent"),this.addButton("forecolor","forecolor"),function(a,b){a("").addClass("editorSwitcher").text(b.switcherLinkText(!0)).click(function(){b.switchToggle()}).appendTo(b.toolbar)}(b,this))},j.htmlInitEditor=function(){this.editor=this.htmlarea[0],this.editor.innerHTML=this.textarea.val()},j.htmlAttachEditorEvents=function(){var b=this,c=function(a){return a&&a.type&&0===a.type.indexOf("image/")},d=function(d){if(d=(d&&d.originalEvent?d.originalEvent:d)||a.event){d.stopPropagation(),d.preventDefault();var e=null,f=null,g=d.files||(d.dataTransfer?d.dataTransfer.files:null);g&&1===g.length&&c(g[0])&&(f=g[0],e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}b.htmlarea.removeClass("editorDragOver")},e=function(){b.htmlarea.removeClass("editorDragOver")},f=function(a){a.stopPropagation(),a.preventDefault(),b.htmlarea.addClass("editorDragOver")},g=function(d){var e=d&&d.clipboardData?d.clipboardData:d&&d.originalEvent&&d.originalEvent.clipboardData?d.originalEvent.clipboardData:null;e&&e.items&&h.each(e.items,function(d){if(c(d)&&d.getAsFile){var e=null,f=d.getAsFile();f&&(e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}})};this.bOnlyPlain||a.File&&a.FileReader&&a.FileList&&(this.htmlarea.bind("dragover",f),this.htmlarea.bind("dragleave",e),this.htmlarea.bind("drop",d),this.htmlarea.bind("paste",g))},j.htmlColorPickerColors=function(){var a=[],b=[],c=0,d=0,e=0,f=0,g="";for(c=0;256>c;c+=85)g=c.toString(16),a.push(1===g.length?"0"+g:g);for(f=a.length,c=0;f>c;c++)for(d=0;f>d;d++)for(e=0;f>e;e++)b.push("#"+a[c]+a[d]+a[e]);return b}(),j.htmlFontPicker=function(){var c=b(a.document),d=!1,e=b(''),f=e.find(".editorFpFonts"),g=function(){};return b.each(["Arial","Arial Black","Courier New","Tahoma","Times New Roman","Verdana"],function(a,c){f.append(b(''+c+"").click(function(){g(c)})),f.append("
")}),e.hide(),function(f,h,i){d||(e.appendTo(i),d=!0),g=h,c.unbind("click.fpNamespace"),a.setTimeout(function(){c.one("click.fpNamespace",function(){e.hide()})},500);var j=b(f).position();e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.htmlColorPicker=function(){var c=b(a.document),d=!1,e=b(''),f=e.find(".editorCpColors"),g=function(){};return b.each(j.htmlColorPickerColors,function(a,b){f.append('')}),e.hide(),b(".editorCpColor",f).click(function(a){var c=1,d="#000000",e=b(a.target).css("background-color"),f=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==f){for(delete f[0];3>=c;++c)f[c]=qb.pInt(f[c]).toString(16),1===f[c].length&&(f[c]="0"+f[c]);d="#"+f.join("")}else d=e;g(d)}),function(f,h,i){d||(e.appendTo(i),d=!0);var j=b(f).position();g=h,c.unbind("click.cpNamespace"),a.setTimeout(function(){c.one("click.cpNamespace",function(){e.hide()})},100),e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.htmlFunctions={bold:function(){this.ec("bold")},italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikethrough:function(){this.ec("strikethrough")},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")},justifyleft:function(){this.ec("justifyLeft")},justifycenter:function(){this.ec("justifyCenter")},justifyright:function(){this.ec("justifyRight")},horizontalrule:function(){this.ec("insertHorizontalRule",!1,"ht")},removeformat:function(){this.ec("removeFormat")},orderedlist:function(){this.ec("insertorderedlist")},unorderedlist:function(){this.ec("insertunorderedlist")},forecolor:function(a){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){j.htmlFontPicker(a,h.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}},k.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},k.prototype.goDown=function(){this.newSelectPosition(ob.EventKeyCode.Down,!1)},k.prototype.goUp=function(){this.newSelectPosition(ob.EventKeyCode.Up,!1)},k.prototype.init=function(d,e){if(this.oContentVisible=d,this.oContentScrollable=e,this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).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.sLastUid=f.getItemUid(b),b.selected()?(b.checked(!1),f.selectedItem(null)):b.checked(!b.checked())))}),b(a.document).on("keydown",function(a){var b=!0;return a&&f.bUseKeyboard&&!qb.inFocus()&&(-10)if(m){if(m)if(ob.EventKeyCode.Down===b||ob.EventKeyCode.Up===b||ob.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case ob.EventKeyCode.Up:m===a?i=!0:j=a;break;case ob.EventKeyCode.Down:case ob.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(ob.EventKeyCode.Home===b||ob.EventKeyCode.End===b)ob.EventKeyCode.Home===b?j=k[0]:ob.EventKeyCode.End===b&&(j=k[k.length-1]);else if(ob.EventKeyCode.PageDown===b){for(;l>e;e++)if(m===k[e]){e+=f,e=e>l-1?l-1:e,j=k[e];break}}else if(ob.EventKeyCode.PageUp===b)for(e=l;e>=0;e--)if(m===k[e]){e-=f,e=0>e?0:e,j=k[e];break}}else ob.EventKeyCode.Down===b||ob.EventKeyCode.Insert===b||ob.EventKeyCode.Home===b||ob.EventKeyCode.PageUp===b?j=k[0]:(ob.EventKeyCode.Up===b||ob.EventKeyCode.End===b||ob.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(ob.EventKeyCode.Up===b||ob.EventKeyCode.Down===b)&&m.checked(!m.checked()):ob.EventKeyCode.Insert===b&&m.checked(!m.checked())),this.throttleSelection=!0,this.selectedItem(j),this.throttleSelection=!0,0!==this.iSelectTimer?(a.clearTimeout(this.iSelectTimer),this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0,d.actionClick(j)},1e3)):(this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0},200),this.actionClick(j)),this.scrollToSelected()):m&&(!c||ob.EventKeyCode.Up!==b&&ob.EventKeyCode.Down!==b?ob.EventKeyCode.Insert===b&&m.checked(!m.checked()):m.checked(!m.checked()))},k.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemSelectedSelector,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},k.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},k.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked()))),c&&(this.selectedItem(a),this.sLastUid=d)}},k.prototype.on=function(a,b){this.oCallbacks[a]=b},l.supported=function(){return!0},l.prototype.set=function(a,c){var d=b.cookie(nb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(nb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},l.prototype.get=function(a){var c=b.cookie(nb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!qb.isUnd(d[a])?d[a]:null}catch(e){}return d},m.supported=function(){return!!a.localStorage},m.prototype.set=function(b,c){var d=a.localStorage[nb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[nb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},m.prototype.get=function(b){var c=a.localStorage[nb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!qb.isUnd(d[b])?d[b]:null}catch(e){}return d},n.prototype.oDriver=null,n.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},n.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},o.prototype.bootstart=function(){},p.prototype.sPosition="",p.prototype.sTemplate="",p.prototype.viewModelName="",p.prototype.viewModelDom=null,p.prototype.viewModelTemplate=function(){return this.sTemplate},p.prototype.viewModelPosition=function(){return this.sPosition},p.prototype.cancelCommand=p.prototype.closeCommand=function(){},q.prototype.oCross=null,q.prototype.sScreenName="",q.prototype.aViewModels=[],q.prototype.viewModels=function(){return this.aViewModels},q.prototype.screenName=function(){return this.sScreenName},q.prototype.routes=function(){return null},q.prototype.__cross=function(){return this.oCross},q.prototype.__start=function(){var a=this.routes(),b=null,c=null;qb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||qb.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},r.constructorEnd=function(a){qb.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},r.prototype.sDefaultScreenName="",r.prototype.oScreens={},r.prototype.oBoot=null,r.prototype.oCurrentScreen=null,r.prototype.hideLoading=function(){b("#rl-loading").hide()},r.prototype.routeOff=function(){e.changed.active=!1},r.prototype.routeOn=function(){e.changed.active=!0},r.prototype.setBoot=function(a){return qb.isNormal(a)&&(this.oBoot=a),this},r.prototype.screen=function(a){return""===a||qb.isUnd(this.oScreens[a])?null:this.oScreens[a]},r.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=Cb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=qb.createCommand(e,function(){vb.hideScreenPopup(a)})),rb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),qb.delegateRun(e,"onBuild",[h]),rb.runHook("view-model-post-build",[a.__name,e,h])):qb.log("Cannot find view model position: "+f)}return a?a.__vm:null},r.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},r.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),qb.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),rb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},r.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),qb.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),rb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),h.delay(function(){qb.delegateRun(a.__vm,"onFocus")},500)))},r.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===qb.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,qb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),qb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(qb.delegateRun(c.oCurrentScreen,"onHide"),qb.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),qb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(qb.delegateRun(c.oCurrentScreen,"onShow"),rb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),qb.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),qb.delegateRun(a.__vm,"onShow"),rb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},r.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(),rb.runHook("screen-pre-start",[a.screenName(),a]),qb.delegateRun(a,"onStart"),rb.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(){yb.removeClass("rl-started-trigger").addClass("rl-started")},50)},r.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=qb.isUnd(c)?!1:!!c,(qb.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)},r.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},vb=new r,s.newInstanceFromJson=function(a){var b=new s;return b.initByJson(a)?b:null},s.prototype.name="",s.prototype.email="",s.prototype.privateType=null,s.prototype.clear=function(){this.email="",this.name="",this.privateType=null},s.prototype.validate=function(){return""!==this.name||""!==this.email},s.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},s.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},s.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=ob.EmailType.Facebook),null===this.privateType&&(this.privateType=ob.EmailType.Default)),this.privateType},s.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},s.prototype.parse=function(a){this.clear(),a=qb.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)},s.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=qb.trim(a.Name),this.email=qb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},s.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=qb.isUnd(b)?!1:!!b,c=qb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+qb.encodeHtml(this.name)+"":c?qb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=qb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+qb.encodeHtml(d)+""+qb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=qb.encodeHtml(d))):b&&(d=''+qb.encodeHtml(this.email)+""))),d},s.prototype.mailsoParse=function(a){if(a=qb.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").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Cb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),qb.delegateRun(e,"onBuild",[i])):qb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(qb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),qb.delegateRun(d.oCurrentSubScreen,"onShow"),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)),qb.windowResize()})):vb.setHash(Cb.link().settings(),!1,!0)},hb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(qb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},hb.prototype.onBuild=function(){h.each(ub.settings,function(a){a&&a.__rlSettingsData&&!h.find(ub["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(ub["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},hb.prototype.routes=function(){var a=h.find(ub.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=qb.isUnd(c.subname)?b:qb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(ib.prototype,q.prototype),ib.prototype.onShow=function(){Cb.setTitle("")},h.extend(jb.prototype,q.prototype),jb.prototype.oLastRoute={},jb.prototype.setNewTitle=function(){var a=Cb.data().accountEmail(),b=Cb.data().foldersInboxUnreadCount();Cb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+qb.i18n("TITLES/MAILBOX"))},jb.prototype.onShow=function(){this.setNewTitle()},jb.prototype.onRoute=function(a,b,c){var d=Cb.data(),e=Cb.cache().getFolderFullNameRaw(a),f=Cb.cache().getFolderFromCacheList(e);f&&(d.currentFolder(f).messageListPage(b).messageListSearch(c),!d.usePreviewPane()&&d.message()&&d.message(null),Cb.reloadMessageList())},jb.prototype.onStart=function(){var a=Cb.data(),b=function(){qb.windowResize()};(Cb.settingsGet("AllowAdditionalAccounts")||Cb.settingsGet("AllowIdentities"))&&Cb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Cb.folderInformation("INBOX")},1e3),h.delay(function(){Cb.quota()},5e3),h.delay(function(){Cb.remote().appDelayStart(qb.emptyFunction)},35e3),yb.toggleClass("rl-no-preview-pane",!a.usePreviewPane()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.usePreviewPane.subscribe(function(a){yb.toggleClass("rl-no-preview-pane",!a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},jb.prototype.routes=function(){var a=function(a,b){return b[0]=qb.pString(b[0]),b[1]=qb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=qb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2])]},b=function(a,b){return b[0]=qb.pString(b[0]),b[1]=qb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:b}],[/^([^\/]*)$/,{normalize_:a}]]},h.extend(kb.prototype,hb.prototype),kb.prototype.onShow=function(){Cb.setTitle(this.sSettingsTitle)},h.extend(lb.prototype,o.prototype),lb.prototype.oSettings=null,lb.prototype.oPlugins=null,lb.prototype.oLocal=null,lb.prototype.oLink=null,lb.prototype.oSubs={},lb.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):(tb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},lb.prototype.link=function(){return null===this.oLink&&(this.oLink=new i),this.oLink},lb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new n),this.oLocal},lb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=qb.isNormal(wb)?wb:{}),qb.isUnd(this.oSettings[a])?null:this.oSettings[a]},lb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=qb.isNormal(wb)?wb:{}),this.oSettings[a]=b},lb.prototype.setTitle=function(b){b=(qb.isNormal(b)&&00&&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=qb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=qb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=qb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},s.prototype.inputoTagLine=function(){return 0 +$/,""),b=!0),b},v.prototype.isImage=function(){return-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},x.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(qb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=s.newInstanceFromJson(a[b]),d&&e.push(d);return e},x.replyHelper=function(a,b,c){if(a&&0 d;d++)qb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},x.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(ob.MessagePriority.Normal),this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.prefetched=!1,this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!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.priority(ob.MessagePriority.Normal),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)},x.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(qb.pInt(a.Size)),this.from=x.initEmailsFromJson(a.From),this.to=x.initEmailsFromJson(a.To),this.cc=x.initEmailsFromJson(a.Cc),this.bcc=x.initEmailsFromJson(a.Bcc),this.replyTo=x.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(qb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(x.emailsToLine(this.from,!0)),this.toEmailsString(x.emailsToLine(this.to,!0)),this.parentUid(qb.pInt(a.ParentThread)),this.threads(qb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(qb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},x.prototype.computeSenderEmail=function(){var a=Cb.data().sentFolder(),b=Cb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},x.prototype.initUpdateByMessageJson=function(a){var b=!1,c=ob.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=qb.pInt(a.Priority),this.priority(-1 b;b++)d=v.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0 +$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},x.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments(); -return qb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},x.prototype.messageId=function(){return this.sMessageId},x.prototype.inReplyTo=function(){return this.sInReplyTo},x.prototype.references=function(){return this.sReferences},x.prototype.fromAsSingleEmail=function(){return qb.isArray(this.from)&&this.from[0]?this.from[0].email:""},x.prototype.viewLink=function(){return Cb.link().messageViewLink(this.requestHash)},x.prototype.downloadLink=function(){return Cb.link().messageDownloadLink(this.requestHash)},x.prototype.replyEmails=function(a){var b=[],c=qb.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,c,b),0===b.length&&x.replyHelper(this.from,c,b),b},x.prototype.replyAllEmails=function(a){var b=[],c=[],d=qb.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,d,b),0===b.length&&x.replyHelper(this.from,d,b),x.replyHelper(this.to,d,b),x.replyHelper(this.cc,d,c),[b,c]},x.prototype.textBodyToString=function(){return this.body?this.body.html():""},x.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))})},x.prototype.printMessage=function(){this.viewPopupMessage(!0)},x.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},x.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,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.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),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(ob.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},x.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=qb.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=qb.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]}),zb.resize()),qb.windowResize(500))},x.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){a=qb.isUnd(a)?!1:a;var c=this;this.body.data("rl-init-internal-images",!0),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=qb.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]),qb.windowResize(500)}},y.newInstanceFromJson=function(a){var b=new y;return b.initByJson(a)?b.initComputed():null},y.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.canBeEdited=c.computed(function(){return ob.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 ob.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){qb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){qb.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(ob.FolderType.Inbox===c&&Cb.data().foldersInboxUnreadCount(b),a>0){if(ob.FolderType.Draft===c)return""+a;if(b>0&&ob.FolderType.Trash!==c&&ob.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(){qb.timeOutAction("folder-list-folder-visibility-change",function(){zb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){tb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case ob.FolderType.Inbox:b=qb.i18n("FOLDER_LIST/INBOX_NAME");break;case ob.FolderType.SentItems:b=qb.i18n("FOLDER_LIST/SENT_NAME");break;case ob.FolderType.Draft:b=qb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case ob.FolderType.Spam:b=qb.i18n("FOLDER_LIST/SPAM_NAME");break;case ob.FolderType.Trash:b=qb.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){tb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case ob.FolderType.Inbox:a="("+qb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case ob.FolderType.SentItems:a="("+qb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case ob.FolderType.Draft:a="("+qb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case ob.FolderType.Spam:a="("+qb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case ob.FolderType.Trash:a="("+qb.i18n("FOLDER_LIST/TRASH_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},y.prototype.fullName="",y.prototype.fullNameRaw="",y.prototype.fullNameHash="",y.prototype.delimiter="",y.prototype.namespace="",y.prototype.deep=0,y.prototype.interval=0,y.prototype.isNamespaceFolder=!1,y.prototype.isGmailFolder=!1,y.prototype.isUnpaddigFolder=!1,y.prototype.collapsedCss=function(){return this.hasSubScribedSubfolders()?this.collapsed()?"icon-right-mini e-collapsed-sign":"icon-down-mini e-collapsed-sign":"icon-none e-collapsed-sign"},y.prototype.initByJson=function(a){var b=!1;return a&&"Object/Folder"===a["@Object"]&&(this.name(a.Name),this.delimiter=a.Delimiter,this.fullName=a.FullName,this.fullNameRaw=a.FullNameRaw,this.fullNameHash=a.FullNameHash,this.deep=a.FullNameRaw.split(this.delimiter).length-1,this.selectable=!!a.IsSelectable,this.existen=!!a.IsExisten,this.subScribed(!!a.IsSubscribed),this.type("INBOX"===this.fullNameRaw?ob.FolderType.Inbox:ob.FolderType.User),b=!0),b},y.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},z.prototype.email="",z.prototype.changeAccountLink=function(){return Cb.link().change(this.email)},A.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},A.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},A.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+qb.quoteName(a)+'" <'+this.email()+">"},qb.extendAsViewModel("PopupsFolderClearViewModel",B),B.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},B.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},B.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(qb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsFolderCreateViewModel",C),C.prototype.sNoParentText="",C.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(qb.trim(a))},C.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},C.prototype.onShow=function(){this.clearPopup()},C.prototype.onFocus=function(){this.folderName.focused(!0)},C.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(qb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsFolderSystemViewModel",D),D.prototype.sChooseOnText="",D.prototype.sUnuseText="",D.prototype.onShow=function(a){var b="";switch(a=qb.isUnd(a)?ob.SetSystemFoldersNotification.None:a){case ob.SetSystemFoldersNotification.Sent:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case ob.SetSystemFoldersNotification.Draft:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case ob.SetSystemFoldersNotification.Spam:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case ob.SetSystemFoldersNotification.Trash:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},D.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(qb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsComposeViewModel",E),E.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};switch(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Cb.data().accountEmail()]=Cb.data().accountEmail(),a){case ob.ComposeType.Empty:d=Cb.data().accountEmail();break;case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:case ob.ComposeType.Forward:case ob.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case ob.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}return d},E.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},E.prototype.formattedFrom=function(a){var b=Cb.data().displayName(),c=Cb.data().accountEmail();return""===b?c:(qb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+qb.quoteName(b)+'" <'+c+">"},E.prototype.sendMessageResponse=function(b,c){var d=!1;this.sending(!1),ob.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&qb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&ob.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(qb.trim(qb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),a.alert(qb.getNotification(c&&c.ErrorCode?c.ErrorCode:ob.Notification.CantSendMessage))))},E.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),ob.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Cb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Cb.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 b;b++)d.push(a[b].toLine(!1));return d.join(", ")};if(c=c||null,c&&qb.isNormal(c)&&(t=qb.isArray(c)&&1===c.length?c[0]:qb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(u,t))),this.reset(),qb.isNonEmptyArray(d)&&this.to(v(d)),""!==u&&t){switch(j=t.fullFormatDateValue(),k=t.subject(),s=t.aDraftInfo,l=b(t.body).clone(),qb.removeBlockquoteSwitcher(l),m=l.html(),u){case ob.ComposeType.Empty:break;case ob.ComposeType.Reply:this.to(v(t.replyEmails(p))),this.subject(qb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.ReplyAll:o=t.replyAllEmails(p),this.to(v(o[0])),this.cc(v(o[1])),this.subject(qb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.references());break;case ob.ComposeType.Forward:this.subject(qb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.ForwardAsAttachment:this.subject(qb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.Draft:this.to(v(t.to)),this.cc(v(t.cc)),this.bcc(v(t.bcc)),this.bFromDraft=!0,this.draftFolder(t.folderFullNameRaw),this.draftUid(t.uid),this.subject(k),this.prepearMessageAttachments(t,u),this.aDraftInfo=qb.isNonEmptyArray(s)&&3===s.length?s:null,this.sInReplyTo=t.sInReplyTo,this.sReferences=t.sReferences}if(this.oEditor){switch(u){case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:f=t.fromToLine(!1,!0),n=qb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case ob.ComposeType.Forward:f=t.fromToLine(!1,!0),g=t.toToLine(!1,!0),i=t.ccToLine(!1,!0),m="
"+m+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+qb.encodeHtml(j)+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+qb.encodeHtml(k)+"
"+m;break;case ob.ComposeType.ForwardAsAttachment:m=""}this.oEditor.setRawText(m,t.isHtml())}}else this.oEditor&&ob.ComposeType.Empty===u?this.oEditor.setRawText("
"+qb.convertPlainTextToHtml(Cb.data().signature()),ob.EditorDefaultType.Html===Cb.data().editorDefaultType()):qb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload(),qb.isNonEmptyArray(r)&&Cb.remote().messageUploadAttachments(function(a,b){if(ob.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()},r),this.triggerForResize()},E.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},E.prototype.tryToClosePopup=function(){var a=this;vb.showScreenPopup(K,[qb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&qb.delegateRun(a,"closeCommand")}])},E.prototype.onBuild=function(){this.initEditor(),this.initUploader();var a=this,c=null;zb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Cb.data().useKeyboardShortcuts()&&(b.ctrlKey&&ob.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&ob.EventKeyCode.Enter===b.keyCode?(a.sendCommand(),c=!1):ob.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1)),c}),zb.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",Cb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},E.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},E.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new j(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}}),this.oEditor.initLanguage(qb.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),qb.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),qb.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}},E.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=qb.pInt(Cb.settingsGet("AttachmentLimit")),c=new g({action:Cb.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;qb.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=qb.isUnd(d.FileName)?"":d.FileName.toString(),g=qb.isNormal(d.Size)?qb.pInt(d.Size):null,h=new w(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(qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;qb.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=qb.getUploadErrorDescByCode(f):g||(e=qb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Cb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),ob.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(qb.getUploadErrorDescByCode(ob.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},E.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=qb.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(ob.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:i=h.isLinked;break;case ob.ComposeType.Forward:case ob.ComposeType.Draft:i=!0}i=!0,i&&(g=new w(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))}}},E.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},E.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(qb.getUploadErrorDescByCode(ob.UploadErrorCode.FileNoUploaded))},this)},E.prototype.isEmptyForm=function(a){a=qb.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.getTextForRequest()},E.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bReloadFolder=!1,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()},E.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},E.prototype.triggerForResize=function(){this.resizer(!this.resizer())},qb.extendAsViewModel("PopupsContactsViewModel",F),F.prototype.setShareToNone=function(){this.viewScopeType(ob.ContactScopeType.Default)},F.prototype.setShareToAll=function(){this.viewScopeType(ob.ContactScopeType.ShareAll)},F.prototype.addNewProperty=function(a){var b=new u(a,"");b.focused(!0),this.viewProperties.push(b)},F.prototype.addNewEmail=function(){this.addNewProperty(ob.ContactPropertyType.EmailPersonal)},F.prototype.addNewPhone=function(){this.addNewProperty(ob.ContactPropertyType.MobilePersonal)},F.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))},F.prototype.deleteSelectedContacts=function(){0 0?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,nb.Defaults.ContactsPerPage,this.search())},F.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Cb.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(qb.pInt(a.value)),d.reloadContactList())}),zb.on("keydown",function(a){var b=!0;return a&&d.modalVisibility()&&(ob.EventKeyCode.Esc===a.keyCode?(qb.delegateRun(d,"closeCommand"),b=!1):a.ctrlKey&&ob.EventKeyCode.S===a.keyCode&&(d.saveCommand(),b=!1)),b})},F.prototype.onShow=function(){vb.routeOff(),this.reloadContactList(!0)},F.prototype.onHide=function(){vb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},qb.extendAsViewModel("PopupsAdvancedSearchViewModel",G),G.prototype.buildSearchStringValue=function(a){return-1 0&&g.messageCountUnread(0<=g.messageCountUnread()-e?g.messageCountUnread()-e:0)),i&&(i.messageCountAll(i.messageCountAll()+b.length),e>0&&i.messageCountUnread(i.messageCountUnread()+e)),0 0&&(ob.EventKeyCode.Backspace===c||ob.EventKeyCode.Esc===c)&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!qb.inFocus()&&e.message()&&(d.fullScreenMode(!1),e.usePreviewPane()||e.message(null),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Cb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},R.prototype.isDraftFolder=function(){return Cb.data().message()&&Cb.data().draftFolder()===Cb.data().message().folderFullNameRaw},R.prototype.isSentFolder=function(){return Cb.data().message()&&Cb.data().sentFolder()===Cb.data().message().folderFullNameRaw},R.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},R.prototype.composeClick=function(){vb.showScreenPopup(E)},R.prototype.editMessage=function(){Cb.data().message()&&vb.showScreenPopup(E,[ob.ComposeType.Draft,Cb.data().message()])},R.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},R.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},qb.extendAsViewModel("SettingsMenuViewModel",S),S.prototype.link=function(a){return Cb.link().settings(a)},S.prototype.backToMailBoxClick=function(){vb.setHash(Cb.link().inbox())},qb.extendAsViewModel("SettingsPaneViewModel",T),T.prototype.onShow=function(){Cb.data().message(null)},T.prototype.backToMailBoxClick=function(){vb.setHash(Cb.link().inbox())},qb.addSettingsViewModel(U,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),U.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Cb.data(),d=qb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(ob.SaveSettingsStep.Animate),b.ajax({url:Cb.link().langLink(c),dataType:"script",cache:!0}).done(function(){qb.i18nToDoc(),a.languageTrigger(ob.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(ob.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(ob.SaveSettingsStep.Idle)},1e3)}),Cb.remote().saveSettings(qb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Cb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){qb.timeOutAction("SaveDesktopNotifications",function(){Cb.remote().saveSettings(qb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){qb.timeOutAction("SaveReplySameFolder",function(){Cb.remote().saveSettings(qb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Cb.remote().saveSettings(qb.emptyFunction,{UseThreads:a?"1":"0"})}),c.usePreviewPane.subscribe(function(a){c.messageList([]),Cb.remote().saveSettings(qb.emptyFunction,{UsePreviewPane:a?"1":"0"})}),c.useCheckboxesInList.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},U.prototype.onShow=function(){Cb.data().desktopNotifications.valueHasMutated()},U.prototype.selectLanguage=function(){vb.showScreenPopup(J)},qb.addSettingsViewModel(V,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),V.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},V.prototype.onBuild=function(){Cb.data().contactsAutosave.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},V.prototype.onShow=function(){this.showPassword(!1)},qb.addSettingsViewModel(W,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),W.prototype.addNewAccount=function(){vb.showScreenPopup(H)},W.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);var b=function(b){return a===b};a&&(this.accounts.remove(b),Cb.remote().accountDelete(function(){Cb.accountsAndIdentities()},a.email))}},qb.addSettingsViewModel(X,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),X.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Cb.data(),c=qb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=qb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=qb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Cb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Cb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Cb.remote().saveSettings(e,{Signature:a})})},50)},qb.addSettingsViewModel(Y,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),Y.prototype.addNewIdentity=function(){vb.showScreenPopup(I)},Y.prototype.editIdentity=function(a){vb.showScreenPopup(I,[a])},Y.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Cb.remote().identityDelete(function(){Cb.accountsAndIdentities()},a.id))}},Y.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=Cb.data(),c=qb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=qb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=qb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Cb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Cb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Cb.remote().saveSettings(e,{Signature:a})})},50)},qb.addSettingsViewModel(Z,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),qb.addSettingsViewModel($,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),$.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},$.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),ob.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},qb.addSettingsViewModel(_,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),_.prototype.folderEditOnEnter=function(a){var b=a?qb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.data().foldersRenaming(!0),Cb.remote().folderRename(function(a,b){Cb.data().foldersRenaming(!1),ob.StorageResultType.Success===a&&b&&b.Result||Cb.data().foldersListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Cb.folders()},a.fullNameRaw,b),Cb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},_.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},_.prototype.onShow=function(){Cb.data().foldersListError("")},_.prototype.createFolder=function(){vb.showScreenPopup(C)},_.prototype.systemFolder=function(){vb.showScreenPopup(D)},_.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&&(Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.data().folderList.remove(b),Cb.data().foldersDeleting(!0),Cb.remote().folderDelete(function(a,b){Cb.data().foldersDeleting(!1),ob.StorageResultType.Success===a&&b&&b.Result||Cb.data().foldersListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Cb.folders()},a.fullNameRaw),Cb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 1048576?(a.alert(qb.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(){this.customThemeUploaderProgress(!0)},this)).on("onComplete",h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(d&&d.ErrorCode?qb.getUploadErrorDescByCode(d.ErrorCode):qb.getUploadErrorDescByCode(ob.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},bb.prototype.populateDataOnStart=function(){var a=Cb.settingsGet("Languages"),b=Cb.settingsGet("Themes");qb.isArray(a)&&this.languages(a),qb.isArray(b)&&this.themes(b),this.mainLanguage(Cb.settingsGet("Language")),this.mainTheme(Cb.settingsGet("Theme")),this.allowCustomTheme(!!Cb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Cb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Cb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Cb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Cb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Cb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Cb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Cb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Cb.settingsGet("EditorDefaultType")),this.showImages(!!Cb.settingsGet("ShowImages")),this.contactsAutosave(!!Cb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Cb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Cb.settingsGet("MPP")),this.desktopNotifications(!!Cb.settingsGet("DesktopNotifications")),this.useThreads(!!Cb.settingsGet("UseThreads")),this.replySameFolder(!!Cb.settingsGet("ReplySameFolder")),this.usePreviewPane(!!Cb.settingsGet("UsePreviewPane")),this.useCheckboxesInList(!!Cb.settingsGet("UseCheckboxesInList")),this.facebookEnable(!!Cb.settingsGet("AllowFacebookSocial")),this.facebookAppID(Cb.settingsGet("FacebookAppID")),this.facebookAppSecret(Cb.settingsGet("FacebookAppSecret")),this.twitterEnable(!!Cb.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(Cb.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(Cb.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!Cb.settingsGet("AllowGoogleSocial")),this.googleClientID(Cb.settingsGet("GoogleClientID")),this.googleClientSecret(Cb.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!Cb.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(Cb.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!Cb.settingsGet("ContactsIsAllowed"))},h.extend(cb.prototype,bb.prototype),cb.prototype.purgeMessageBodyCache=function(){var a=0,c=null,d=tb.iMessageBodyCacheCount-nb.Values.MessageBodyCacheLimit;d>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)))},cb.prototype.populateDataOnStart=function(){bb.prototype.populateDataOnStart.call(this),this.accountEmail(Cb.settingsGet("Email")),this.accountIncLogin(Cb.settingsGet("IncLogin")),this.accountOutLogin(Cb.settingsGet("OutLogin")),this.projectHash(Cb.settingsGet("ProjectHash")),this.displayName(Cb.settingsGet("DisplayName")),this.replyTo(Cb.settingsGet("ReplyTo")),this.signature(Cb.settingsGet("Signature")),this.lastFoldersHash=Cb.local().get(ob.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Cb.settingsGet("RemoteSuggestions"),this.devEmail=Cb.settingsGet("DevEmail"),this.devLogin=Cb.settingsGet("DevLogin"),this.devPassword=Cb.settingsGet("DevPassword")},cb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&qb.isNormal(c)&&""!==c){if(qb.isArray(d)&&0 3)i(Cb.link().notificationMailIcon(),Cb.data().accountEmail(),qb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Cb.link().notificationMailIcon(),x.emailsToLine(x.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Cb.cache().setFolderUidNext(b,c)}},cb.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=Cb.cache().getFolderFromCacheList(g),f||(f=y.newInstanceFromJson(e),f&&(Cb.cache().setFolderToCacheList(g,f),Cb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=nb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!qb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Cb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),qb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),qb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&qb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},cb.prototype.setFolders=function(a){var b=[],c=!1,d=Cb.data(),e=function(a){return""===a||nb.Values.UnuseOptionValue===a||null!==Cb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&qb.isArray(a.Result["@Collection"])&&(qb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Cb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Cb.settingsGet("SentFolder")+Cb.settingsGet("DraftFolder")+Cb.settingsGet("SpamFolder")+Cb.settingsGet("TrashFolder")+Cb.settingsGet("NullFolder")&&(Cb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Cb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Cb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Cb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),c=!0),d.sentFolder(e(Cb.settingsGet("SentFolder"))),d.draftFolder(e(Cb.settingsGet("DraftFolder"))),d.spamFolder(e(Cb.settingsGet("SpamFolder"))),d.trashFolder(e(Cb.settingsGet("TrashFolder"))),c&&Cb.remote().saveSystemFolders(qb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),NullFolder:"NullFolder"}),Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash)) -},cb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},cb.prototype.getNextFolderNames=function(a){a=qb.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=Cb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},cb.prototype.setMessage=function(a,c){var d=!1,e=!1,f=!1,g=null,h=null,i="",j=this.messagesBodiesDom(),k=this.message();a&&k&&a.Result&&"Object/Message"===a.Result["@Object"]&&k.folderFullNameRaw===a.Result.Folder&&k.uid===a.Result.Uid&&(this.messageError(""),k.initUpdateByMessageJson(a.Result),Cb.cache().addRequestedMessage(k.folderFullNameRaw,k.uid),c||k.initFlagsByJson(a.Result),j=j&&j[0]?j:null,j&&(i="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),h=j.find("#"+i),h&&h[0]?(h.data("rl-cache-count",++tb.iMessageBodyCacheCount),k.isRtl(!!h.data("rl-is-rtl")),k.isHtml(!!h.data("rl-is-html")),k.hasImages(!!h.data("rl-has-images")),k.body=h):(e=!!a.Result.HasExternals,f=!!a.Result.HasInternals,g=b('').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++tb.iMessageBodyCacheCount),qb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):qb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,g.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,a.Result.Rtl&&(g.data("rl-is-rtl",!0),g.addClass("rtl-text-part")),j.append(g),g.data("rl-is-html",d),g.data("rl-has-images",e),k.isRtl(!!g.data("rl-is-rtl")),k.isHtml(!!g.data("rl-is-html")),k.hasImages(!!g.data("rl-has-images")),k.body=g,f&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),g&&qb.initBlockquoteSwitcher(g)),Cb.cache().initMessageFlagsFromCache(k),k.unseen()&&Cb.setMessageSeen(k),qb.windowResize())},cb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&qb.isArray(a.Result["@Collection"])){var c=Cb.data(),d=Cb.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=qb.pInt(a.Result.MessageResultCount),j=qb.pInt(a.Result.Offset),qb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Cb.cache().getFolderFromCacheList(qb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Cb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),qb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),qb.isNormal(a.Result.MessageUnseenCount)&&(qb.pInt(p.messageCountUnread())!==qb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Cb.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=x.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Cb.cache().initMessageFlagsFromCache(o):Cb.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/"+sb.urlsafe_encode([b,c,Cb.data().projectHash(),Cb.data().threading()&&Cb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},eb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},eb.prototype.folderInformation=function(a,b,c){var d=!0,e=Cb.cache(),f=[];qb.isArray(c)&&0 l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1 l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(ob.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0 0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},qb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},qb.friendlySize=function(a){return a=qb.pInt(a),a>=1073741824?qb.roundNumber(a/1073741824,1)+"GB":a>=1048576?qb.roundNumber(a/1048576,1)+"MB":a>=1024?qb.roundNumber(a/1024,0)+"KB":a+"B"},qb.log=function(b){a.console&&a.console.log&&a.console.log(b)},qb.getNotification=function(a){return a=qb.pInt(a),qb.isUnd(pb[a])?"":pb[a]},qb.initNotificationLanguage=function(){pb[ob.Notification.InvalidToken]=qb.i18n("NOTIFICATIONS/INVALID_TOKEN"),pb[ob.Notification.AuthError]=qb.i18n("NOTIFICATIONS/AUTH_ERROR"),pb[ob.Notification.AccessError]=qb.i18n("NOTIFICATIONS/ACCESS_ERROR"),pb[ob.Notification.ConnectionError]=qb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),pb[ob.Notification.CaptchaError]=qb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),pb[ob.Notification.SocialFacebookLoginAccessDisable]=qb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),pb[ob.Notification.SocialTwitterLoginAccessDisable]=qb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),pb[ob.Notification.SocialGoogleLoginAccessDisable]=qb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),pb[ob.Notification.DomainNotAllowed]=qb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),pb[ob.Notification.AccountNotAllowed]=qb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),pb[ob.Notification.CantGetMessageList]=qb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),pb[ob.Notification.CantGetMessage]=qb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),pb[ob.Notification.CantDeleteMessage]=qb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),pb[ob.Notification.CantMoveMessage]=qb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),pb[ob.Notification.CantCopyMessage]=qb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),pb[ob.Notification.CantSaveMessage]=qb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),pb[ob.Notification.CantSendMessage]=qb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),pb[ob.Notification.InvalidRecipients]=qb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),pb[ob.Notification.CantCreateFolder]=qb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),pb[ob.Notification.CantRenameFolder]=qb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),pb[ob.Notification.CantDeleteFolder]=qb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),pb[ob.Notification.CantDeleteNonEmptyFolder]=qb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),pb[ob.Notification.CantSubscribeFolder]=qb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),pb[ob.Notification.CantUnsubscribeFolder]=qb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),pb[ob.Notification.CantSaveSettings]=qb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),pb[ob.Notification.CantSavePluginSettings]=qb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),pb[ob.Notification.DomainAlreadyExists]=qb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),pb[ob.Notification.CantInstallPackage]=qb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),pb[ob.Notification.CantDeletePackage]=qb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),pb[ob.Notification.InvalidPluginPackage]=qb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),pb[ob.Notification.UnsupportedPluginPackage]=qb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),pb[ob.Notification.LicensingServerIsUnavailable]=qb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),pb[ob.Notification.LicensingExpired]=qb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),pb[ob.Notification.LicensingBanned]=qb.i18n("NOTIFICATIONS/LICENSING_BANNED"),pb[ob.Notification.DemoSendMessageError]=qb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),pb[ob.Notification.AccountAlreadyExists]=qb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),pb[ob.Notification.MailServerError]=qb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),pb[ob.Notification.UnknownNotification]=qb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),pb[ob.Notification.UnknownError]=qb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},qb.getUploadErrorDescByCode=function(a){var b="";switch(qb.pInt(a)){case ob.UploadErrorCode.FileIsTooBig:b=qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case ob.UploadErrorCode.FilePartiallyUploaded:b=qb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case ob.UploadErrorCode.FileNoUploaded:b=qb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case ob.UploadErrorCode.MissingTempFolder:b=qb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case ob.UploadErrorCode.FileOnSaveingError:b=qb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case ob.UploadErrorCode.FileType:b=qb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=qb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},qb.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,qb.isArray(c)?c:[])},qb.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===ob.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===ob.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},qb.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=qb.isUnd(d)?!0:d,e.canExecute=qb.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},qb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(ob.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(ob.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),tb.sAnimationType=ob.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.usePreviewPane=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.interfaceAnimation.subscribe(function(a){if(tb.bMobileDevice||a===ob.InterfaceAnimation.None)yb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),tb.sAnimationType=ob.InterfaceAnimation.None;else switch(a){case ob.InterfaceAnimation.Full:yb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),tb.sAnimationType=a;break;case ob.InterfaceAnimation.Normal:yb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),tb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=ob.DesktopNotifications.NotSupported;if(Bb&&Bb.permission)switch(Bb.permission.toLowerCase()){case"granted":c=ob.DesktopNotifications.Allowed;break;case"denied":c=ob.DesktopNotifications.Denied;break;case"default":c=ob.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&ob.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();ob.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):ob.DesktopNotifications.NotAllowed===c?Bb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),ob.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")?qb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?qb.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},qb.isFolderExpanded=function(a){var b=Cb.local().get(ob.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},qb.setExpandedFolder=function(a,b){var c=Cb.local().get(ob.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Cb.local().set(ob.ClientSideKeyName.ExpandedFolders,c)},qb.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Cb.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Cb.local().set(d,b.size.width),f.css({left:""+b.size.width+"px"}))};null!==g&&(e.css({width:""+g+"px"}),f.css({left:""+g+"px"})),e.resizable({helper:"ui-resizable-helper",minWidth:120,maxWidth:400,handles:"e",stop:h})},qb.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"),qb.windowResize()}).after("
").before("
"))})}},qb.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()}))},qb.extendAsViewModel=function(a,b,c){b&&(c||(c=p),b.__name=a,rb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},qb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},ub.settings.push(a)},qb.removeSettingsViewModel=function(a){ub["settings-removed"].push(a)},qb.disableSettingsViewModel=function(a){ub["settings-disabled"].push(a)},qb.convertThemeName=function(a){return qb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},qb.quoteName=function(a){return a.replace(/["]/g,'\\"')},qb.microtime=function(){return(new Date).getTime()},qb.convertLangName=function(a,b){return qb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},qb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=qb.isUnd(a)?32:qb.pInt(a);b.length/g,">").replace(/")},qb.draggeblePlace=function(){return b('').appendTo("#rl-hidden")},qb.defautOptionsAfterRender=function(a,b){b&&!qb.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},qb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+qb.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")),qb.i18nToNode(d),r.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+qb.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)},qb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=qb.isUnd(d)?1e3:qb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?ob.SaveSettingsStep.TrueResult:ob.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,ob.SaveSettingsStep.Idle)},d)}},qb.settingsSaveHelperSimpleFunction=function(a,b){return qb.settingsSaveHelperFunction(null,a,b,1e3)},qb.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},qb.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:qb.isUnd(c)?a.toString():c.toString(),custom:qb.isUnd(c)?!1:!0,title:qb.isUnd(c)?"":a.toString(),value:a.toString()};(qb.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}},sb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return sb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=sb._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 sb._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(!tb.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+qb.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!tb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){qb.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){qb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),qb.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=qb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=qb.pInt(e[2]),g=zb.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(!tb.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),qb.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),qb.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null,!!a.shiftKey)},b(d).draggable(k).on("mousedown",function(){qb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!tb.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){tb.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c();d.inputosaurus({parseOnBlur:!0,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Cb.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=qb.trim(a),c=null;return""!==b?(c=new s,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(){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(qb.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},qb.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=qb.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=qb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),qb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},i.prototype.root=function(){return this.sBase},i.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},i.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},i.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},i.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},i.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},i.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},i.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},i.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},i.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},i.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},i.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},i.prototype.settings=function(a){var b=this.sBase+"settings";return qb.isUnd(a)||""===a||(b+="/"+a),b},i.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},i.prototype.mailBox=function(a,b,c){b=qb.isNormal(b)?qb.pInt(b):1,c=qb.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},i.prototype.phpInfo=function(){return this.sServer+"Info"},i.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},i.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},i.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},i.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},i.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},i.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},i.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},rb.oViewModelsHooks={},rb.oSimpleHooks={},rb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},rb.addHook=function(a,b){qb.isFunc(b)&&(qb.isArray(rb.oSimpleHooks[a])||(rb.oSimpleHooks[a]=[]),rb.oSimpleHooks[a].push(b))},rb.runHook=function(a,b){qb.isArray(rb.oSimpleHooks[a])&&(b=b||[],h.each(rb.oSimpleHooks[a],function(a){a.apply(null,b)}))},rb.mainSettingsGet=function(a){return Cb?Cb.settingsGet(a):null},rb.remoteRequest=function(a,b,c,d,e,f){Cb&&Cb.remote().defaultRequest(a,b,c,d,e,f)},rb.settingsGet=function(a,b){var c=rb.mainSettingsGet("Plugins");return c=c&&qb.isUnd(c[a])?null:c[a],c?qb.isUnd(c[b])?null:c[b]:null},j.prototype.initLanguage=function(a,b,c){this.oOptions.LangSwitcherConferm=a,this.oOptions.LangSwitcherTextLabel=b,this.oOptions.LangSwitcherHtmlLabel=c},j.prototype.execCom=function(b,c,d){a.document&&(a.document.execCommand(b,c||!1,d||null),this.updateTextArea())},j.prototype.getEditorSelection=function(){var b=null;return a.getSelection?b=a.getSelection():a.document.getSelection?b=a.document.getSelection():a.document.selection&&(b=a.document.selection),b},j.prototype.getEditorRange=function(){var a=this.getEditorSelection();return a&&0!==a.rangeCount?a.getRangeAt?a.getRangeAt(0):a.createRange():null},j.prototype.ec=function(a,b,c){this.execCom(a,b,c)},j.prototype.heading=function(a){this.ec("formatblock",!1,this.bIe?"Heading "+a:"h"+a)},j.prototype.insertImage=function(a){this.isHtml()&&!this.bOnlyPlain&&(this.htmlarea.focus(),this.ec("insertImage",!1,a))},j.prototype.focus=function(){this.isHtml()&&!this.bOnlyPlain?this.htmlarea.focus():this.textarea.focus()},j.prototype.setcolor=function(a,b){var c=null,d="";this.bIe&&!document.addEventListener?(c=this.getEditorRange(),c&&c.execCommand("forecolor"===a?"ForeColor":"BackColor",!1,b)):(d=this.bIe?"forecolor"===a?"ForeColor":"BackColor":"forecolor"===a?"foreColor":"backColor",this.ec(d,!1,b))},j.prototype.isHtml=function(){return!0===this.bOnlyPlain?!1:this.textarea.is(":hidden")},j.prototype.toHtmlString=function(){return this.editor.innerHTML},j.prototype.toString=function(){return this.editor.innerText},j.prototype.updateTextArea=function(){this.textarea.val(this.toHtmlString())},j.prototype.updateHtmlArea=function(){this.editor.innerHTML=this.textarea.val()},j.prototype.setRawText=function(a,b){b&&!this.bOnlyPlain?(this.isHtml()||(this.textarea.val(""),this.switchToHtml()),this.textarea.val(a.toString()),this.updateHtmlArea()):(this.textarea.val(a.toString()),this.updateHtmlArea(),this.switchToPlain(!1))},j.prototype.clear=function(){this.textarea.val(""),this.editor.innerHTML="",this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()},j.prototype.getTextForRequest=function(){return this.isHtml()?(this.updateTextArea(),this.textarea.val()):this.textarea.val() +},j.prototype.getTextFromHtml=function(a){var b="",c="> ",d=function(){if(arguments&&1 \n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1 ]*>([\s\S]*)<\/div>/gim,e),a="\n"+qb.trim(a)+"\n"),a}return""},f=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]*)<\/div>/gim,e).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S]*?)<\/a>/gim,f).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),(a?qb.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,d).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},j.prototype.getHtmlFromText=function(){return qb.convertPlainTextToHtml(this.textarea.val())},j.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()},j.prototype.switchToPlain=function(c){c=qb.isUnd(c)?!0:c;var d=this.getTextFromHtml(),e=h.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),b(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(d),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);c&&0!==qb.trim(d).length?e(a.confirm(this.oOptions.LangSwitcherConferm)):e(!0)},j.prototype.switcherLinkText=function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel},j.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar"),b(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!0)),this.textarea.val(this.getHtmlFromText()),this.updateHtmlArea(),this.textarea.hide(),this.htmlarea.show(),this.fOnSwitch&&this.fOnSwitch(!0)},j.prototype.addButton=function(c,d){var e=this;b("").addClass("editorToolbarButtom").append(b('').addClass(c)).attr("title",d).click(function(d){qb.isUnd(j.htmlFunctions[c])?a.alert(c):j.htmlFunctions[c].apply(e,[b(this),d])}).appendTo(this.toolbar)},j.htmlInitToolbar=function(){this.bOnlyPlain||(this.addButton("bold","Bold"),this.addButton("italic","Italic"),this.addButton("underline","Underline"),this.addButton("strikethrough","Strikethrough"),this.addButton("removeformat","removeformat"),this.addButton("justifyleft","justifyleft"),this.addButton("justifycenter","justifycenter"),this.addButton("justifyright","justifyright"),this.addButton("horizontalrule","horizontalrule"),this.addButton("orderedlist","orderedlist"),this.addButton("unorderedlist","unorderedlist"),this.addButton("indent","indent"),this.addButton("outdent","outdent"),this.addButton("forecolor","forecolor"),function(a,b){a("").addClass("editorSwitcher").text(b.switcherLinkText(!0)).click(function(){b.switchToggle()}).appendTo(b.toolbar)}(b,this))},j.htmlInitEditor=function(){this.editor=this.htmlarea[0],this.editor.innerHTML=this.textarea.val()},j.htmlAttachEditorEvents=function(){var b=this,c=function(a){return a&&a.type&&0===a.type.indexOf("image/")},d=function(d){if(d=(d&&d.originalEvent?d.originalEvent:d)||a.event){d.stopPropagation(),d.preventDefault();var e=null,f=null,g=d.files||(d.dataTransfer?d.dataTransfer.files:null);g&&1===g.length&&c(g[0])&&(f=g[0],e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}b.htmlarea.removeClass("editorDragOver")},e=function(){b.htmlarea.removeClass("editorDragOver")},f=function(a){a.stopPropagation(),a.preventDefault(),b.htmlarea.addClass("editorDragOver")},g=function(d){var e=d&&d.clipboardData?d.clipboardData:d&&d.originalEvent&&d.originalEvent.clipboardData?d.originalEvent.clipboardData:null;e&&e.items&&h.each(e.items,function(d){if(c(d)&&d.getAsFile){var e=null,f=d.getAsFile();f&&(e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}})};this.bOnlyPlain||a.File&&a.FileReader&&a.FileList&&(this.htmlarea.bind("dragover",f),this.htmlarea.bind("dragleave",e),this.htmlarea.bind("drop",d),this.htmlarea.bind("paste",g))},j.htmlColorPickerColors=function(){var a=[],b=[],c=0,d=0,e=0,f=0,g="";for(c=0;256>c;c+=85)g=c.toString(16),a.push(1===g.length?"0"+g:g);for(f=a.length,c=0;f>c;c++)for(d=0;f>d;d++)for(e=0;f>e;e++)b.push("#"+a[c]+a[d]+a[e]);return b}(),j.htmlFontPicker=function(){var c=b(a.document),d=!1,e=b(''),f=e.find(".editorFpFonts"),g=function(){};return b.each(["Arial","Arial Black","Courier New","Tahoma","Times New Roman","Verdana"],function(a,c){f.append(b(''+c+"").click(function(){g(c)})),f.append("
")}),e.hide(),function(f,h,i){d||(e.appendTo(i),d=!0),g=h,c.unbind("click.fpNamespace"),a.setTimeout(function(){c.one("click.fpNamespace",function(){e.hide()})},500);var j=b(f).position();e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.htmlColorPicker=function(){var c=b(a.document),d=!1,e=b(''),f=e.find(".editorCpColors"),g=function(){};return b.each(j.htmlColorPickerColors,function(a,b){f.append('')}),e.hide(),b(".editorCpColor",f).click(function(a){var c=1,d="#000000",e=b(a.target).css("background-color"),f=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==f){for(delete f[0];3>=c;++c)f[c]=qb.pInt(f[c]).toString(16),1===f[c].length&&(f[c]="0"+f[c]);d="#"+f.join("")}else d=e;g(d)}),function(f,h,i){d||(e.appendTo(i),d=!0);var j=b(f).position();g=h,c.unbind("click.cpNamespace"),a.setTimeout(function(){c.one("click.cpNamespace",function(){e.hide()})},100),e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.htmlFunctions={bold:function(){this.ec("bold")},italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikethrough:function(){this.ec("strikethrough")},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")},justifyleft:function(){this.ec("justifyLeft")},justifycenter:function(){this.ec("justifyCenter")},justifyright:function(){this.ec("justifyRight")},horizontalrule:function(){this.ec("insertHorizontalRule",!1,"ht")},removeformat:function(){this.ec("removeFormat")},orderedlist:function(){this.ec("insertorderedlist")},unorderedlist:function(){this.ec("insertunorderedlist")},forecolor:function(a){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){j.htmlFontPicker(a,h.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}},k.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},k.prototype.goDown=function(){this.newSelectPosition(ob.EventKeyCode.Down,!1)},k.prototype.goUp=function(){this.newSelectPosition(ob.EventKeyCode.Up,!1)},k.prototype.init=function(d,e){if(this.oContentVisible=d,this.oContentScrollable=e,this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).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.sLastUid=f.getItemUid(b),b.selected()?(b.checked(!1),f.selectedItem(null)):b.checked(!b.checked())))}),b(a.document).on("keydown",function(a){var b=!0;return a&&f.bUseKeyboard&&!qb.inFocus()&&(-10)if(m){if(m)if(ob.EventKeyCode.Down===b||ob.EventKeyCode.Up===b||ob.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case ob.EventKeyCode.Up:m===a?i=!0:j=a;break;case ob.EventKeyCode.Down:case ob.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(ob.EventKeyCode.Home===b||ob.EventKeyCode.End===b)ob.EventKeyCode.Home===b?j=k[0]:ob.EventKeyCode.End===b&&(j=k[k.length-1]);else if(ob.EventKeyCode.PageDown===b){for(;l>e;e++)if(m===k[e]){e+=f,e=e>l-1?l-1:e,j=k[e];break}}else if(ob.EventKeyCode.PageUp===b)for(e=l;e>=0;e--)if(m===k[e]){e-=f,e=0>e?0:e,j=k[e];break}}else ob.EventKeyCode.Down===b||ob.EventKeyCode.Insert===b||ob.EventKeyCode.Home===b||ob.EventKeyCode.PageUp===b?j=k[0]:(ob.EventKeyCode.Up===b||ob.EventKeyCode.End===b||ob.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(ob.EventKeyCode.Up===b||ob.EventKeyCode.Down===b)&&m.checked(!m.checked()):ob.EventKeyCode.Insert===b&&m.checked(!m.checked())),this.throttleSelection=!0,this.selectedItem(j),this.throttleSelection=!0,0!==this.iSelectTimer?(a.clearTimeout(this.iSelectTimer),this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0,d.actionClick(j)},1e3)):(this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0},200),this.actionClick(j)),this.scrollToSelected()):m&&(!c||ob.EventKeyCode.Up!==b&&ob.EventKeyCode.Down!==b?ob.EventKeyCode.Insert===b&&m.checked(!m.checked()):m.checked(!m.checked()))},k.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemSelectedSelector,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},k.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},k.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked()))),c&&(this.selectedItem(a),this.sLastUid=d)}},k.prototype.on=function(a,b){this.oCallbacks[a]=b},l.supported=function(){return!0},l.prototype.set=function(a,c){var d=b.cookie(nb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(nb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},l.prototype.get=function(a){var c=b.cookie(nb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!qb.isUnd(d[a])?d[a]:null}catch(e){}return d},m.supported=function(){return!!a.localStorage},m.prototype.set=function(b,c){var d=a.localStorage[nb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[nb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},m.prototype.get=function(b){var c=a.localStorage[nb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!qb.isUnd(d[b])?d[b]:null}catch(e){}return d},n.prototype.oDriver=null,n.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},n.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},o.prototype.bootstart=function(){},p.prototype.sPosition="",p.prototype.sTemplate="",p.prototype.viewModelName="",p.prototype.viewModelDom=null,p.prototype.viewModelTemplate=function(){return this.sTemplate},p.prototype.viewModelPosition=function(){return this.sPosition},p.prototype.cancelCommand=p.prototype.closeCommand=function(){},q.prototype.oCross=null,q.prototype.sScreenName="",q.prototype.aViewModels=[],q.prototype.viewModels=function(){return this.aViewModels},q.prototype.screenName=function(){return this.sScreenName},q.prototype.routes=function(){return null},q.prototype.__cross=function(){return this.oCross},q.prototype.__start=function(){var a=this.routes(),b=null,c=null;qb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||qb.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},r.constructorEnd=function(a){qb.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},r.prototype.sDefaultScreenName="",r.prototype.oScreens={},r.prototype.oBoot=null,r.prototype.oCurrentScreen=null,r.prototype.hideLoading=function(){b("#rl-loading").hide()},r.prototype.routeOff=function(){e.changed.active=!1},r.prototype.routeOn=function(){e.changed.active=!0},r.prototype.setBoot=function(a){return qb.isNormal(a)&&(this.oBoot=a),this},r.prototype.screen=function(a){return""===a||qb.isUnd(this.oScreens[a])?null:this.oScreens[a]},r.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=Cb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=qb.createCommand(e,function(){vb.hideScreenPopup(a)})),rb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),qb.delegateRun(e,"onBuild",[h]),rb.runHook("view-model-post-build",[a.__name,e,h])):qb.log("Cannot find view model position: "+f)}return a?a.__vm:null},r.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},r.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),qb.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),rb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},r.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),qb.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),rb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),h.delay(function(){qb.delegateRun(a.__vm,"onFocus")},500)))},r.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===qb.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,qb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),qb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(qb.delegateRun(c.oCurrentScreen,"onHide"),qb.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),qb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(qb.delegateRun(c.oCurrentScreen,"onShow"),rb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),qb.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),qb.delegateRun(a.__vm,"onShow"),rb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},r.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(),rb.runHook("screen-pre-start",[a.screenName(),a]),qb.delegateRun(a,"onStart"),rb.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(){yb.removeClass("rl-started-trigger").addClass("rl-started")},50)},r.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=qb.isUnd(c)?!1:!!c,(qb.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)},r.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},vb=new r,s.newInstanceFromJson=function(a){var b=new s;return b.initByJson(a)?b:null},s.prototype.name="",s.prototype.email="",s.prototype.privateType=null,s.prototype.clear=function(){this.email="",this.name="",this.privateType=null},s.prototype.validate=function(){return""!==this.name||""!==this.email},s.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},s.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},s.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=ob.EmailType.Facebook),null===this.privateType&&(this.privateType=ob.EmailType.Default)),this.privateType},s.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},s.prototype.parse=function(a){this.clear(),a=qb.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)},s.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=qb.trim(a.Name),this.email=qb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},s.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=qb.isUnd(b)?!1:!!b,c=qb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+qb.encodeHtml(this.name)+"":c?qb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=qb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+qb.encodeHtml(d)+""+qb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=qb.encodeHtml(d))):b&&(d=''+qb.encodeHtml(this.email)+""))),d},s.prototype.mailsoParse=function(a){if(a=qb.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").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Cb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),qb.delegateRun(e,"onBuild",[i])):qb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(qb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),qb.delegateRun(d.oCurrentSubScreen,"onShow"),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)),qb.windowResize()})):vb.setHash(Cb.link().settings(),!1,!0)},hb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(qb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},hb.prototype.onBuild=function(){h.each(ub.settings,function(a){a&&a.__rlSettingsData&&!h.find(ub["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(ub["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},hb.prototype.routes=function(){var a=h.find(ub.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=qb.isUnd(c.subname)?b:qb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(ib.prototype,q.prototype),ib.prototype.onShow=function(){Cb.setTitle("")},h.extend(jb.prototype,q.prototype),jb.prototype.oLastRoute={},jb.prototype.setNewTitle=function(){var a=Cb.data().accountEmail(),b=Cb.data().foldersInboxUnreadCount();Cb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+qb.i18n("TITLES/MAILBOX"))},jb.prototype.onShow=function(){this.setNewTitle()},jb.prototype.onRoute=function(a,b,c){var d=Cb.data(),e=Cb.cache().getFolderFullNameRaw(a),f=Cb.cache().getFolderFromCacheList(e);f&&(d.currentFolder(f).messageListPage(b).messageListSearch(c),!d.usePreviewPane()&&d.message()&&d.message(null),Cb.reloadMessageList())},jb.prototype.onStart=function(){var a=Cb.data(),b=function(){qb.windowResize()};(Cb.settingsGet("AllowAdditionalAccounts")||Cb.settingsGet("AllowIdentities"))&&Cb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Cb.folderInformation("INBOX")},1e3),h.delay(function(){Cb.quota()},5e3),h.delay(function(){Cb.remote().appDelayStart(qb.emptyFunction)},35e3),yb.toggleClass("rl-no-preview-pane",!a.usePreviewPane()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.usePreviewPane.subscribe(function(a){yb.toggleClass("rl-no-preview-pane",!a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},jb.prototype.routes=function(){var a=function(a,b){return b[0]=qb.pString(b[0]),b[1]=qb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=qb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2])]},b=function(a,b){return b[0]=qb.pString(b[0]),b[1]=qb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:b}],[/^([^\/]*)$/,{normalize_:a}]]},h.extend(kb.prototype,hb.prototype),kb.prototype.onShow=function(){Cb.setTitle(this.sSettingsTitle)},h.extend(lb.prototype,o.prototype),lb.prototype.oSettings=null,lb.prototype.oPlugins=null,lb.prototype.oLocal=null,lb.prototype.oLink=null,lb.prototype.oSubs={},lb.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):(tb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},lb.prototype.link=function(){return null===this.oLink&&(this.oLink=new i),this.oLink},lb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new n),this.oLocal},lb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=qb.isNormal(wb)?wb:{}),qb.isUnd(this.oSettings[a])?null:this.oSettings[a]},lb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=qb.isNormal(wb)?wb:{}),this.oSettings[a]=b},lb.prototype.setTitle=function(b){b=(qb.isNormal(b)&&00&&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=qb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=qb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=qb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},s.prototype.inputoTagLine=function(){return 0 +$/,""),b=!0),b},v.prototype.isImage=function(){return-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},x.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(qb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=s.newInstanceFromJson(a[b]),d&&e.push(d);return e},x.replyHelper=function(a,b,c){if(a&&0 d;d++)qb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},x.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(ob.MessagePriority.Normal),this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.prefetched=!1,this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!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.priority(ob.MessagePriority.Normal),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)},x.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(qb.pInt(a.Size)),this.from=x.initEmailsFromJson(a.From),this.to=x.initEmailsFromJson(a.To),this.cc=x.initEmailsFromJson(a.Cc),this.bcc=x.initEmailsFromJson(a.Bcc),this.replyTo=x.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(qb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(x.emailsToLine(this.from,!0)),this.toEmailsString(x.emailsToLine(this.to,!0)),this.parentUid(qb.pInt(a.ParentThread)),this.threads(qb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(qb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},x.prototype.computeSenderEmail=function(){var a=Cb.data().sentFolder(),b=Cb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},x.prototype.initUpdateByMessageJson=function(a){var b=!1,c=ob.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=qb.pInt(a.Priority),this.priority(-1 b;b++)d=v.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0 +$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},x.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return qb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},x.prototype.messageId=function(){return this.sMessageId},x.prototype.inReplyTo=function(){return this.sInReplyTo},x.prototype.references=function(){return this.sReferences +},x.prototype.fromAsSingleEmail=function(){return qb.isArray(this.from)&&this.from[0]?this.from[0].email:""},x.prototype.viewLink=function(){return Cb.link().messageViewLink(this.requestHash)},x.prototype.downloadLink=function(){return Cb.link().messageDownloadLink(this.requestHash)},x.prototype.replyEmails=function(a){var b=[],c=qb.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,c,b),0===b.length&&x.replyHelper(this.from,c,b),b},x.prototype.replyAllEmails=function(a){var b=[],c=[],d=qb.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,d,b),0===b.length&&x.replyHelper(this.from,d,b),x.replyHelper(this.to,d,b),x.replyHelper(this.cc,d,c),[b,c]},x.prototype.textBodyToString=function(){return this.body?this.body.html():""},x.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))})},x.prototype.printMessage=function(){this.viewPopupMessage(!0)},x.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},x.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,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.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),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(ob.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},x.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=qb.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=qb.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]}),zb.resize()),qb.windowResize(500))},x.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){a=qb.isUnd(a)?!1:a;var c=this;this.body.data("rl-init-internal-images",!0),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=qb.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]),qb.windowResize(500)}},y.newInstanceFromJson=function(a){var b=new y;return b.initByJson(a)?b.initComputed():null},y.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.canBeEdited=c.computed(function(){return ob.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 ob.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){qb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){qb.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(ob.FolderType.Inbox===c&&Cb.data().foldersInboxUnreadCount(b),a>0){if(ob.FolderType.Draft===c)return""+a;if(b>0&&ob.FolderType.Trash!==c&&ob.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(){qb.timeOutAction("folder-list-folder-visibility-change",function(){zb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){tb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case ob.FolderType.Inbox:b=qb.i18n("FOLDER_LIST/INBOX_NAME");break;case ob.FolderType.SentItems:b=qb.i18n("FOLDER_LIST/SENT_NAME");break;case ob.FolderType.Draft:b=qb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case ob.FolderType.Spam:b=qb.i18n("FOLDER_LIST/SPAM_NAME");break;case ob.FolderType.Trash:b=qb.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){tb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case ob.FolderType.Inbox:a="("+qb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case ob.FolderType.SentItems:a="("+qb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case ob.FolderType.Draft:a="("+qb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case ob.FolderType.Spam:a="("+qb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case ob.FolderType.Trash:a="("+qb.i18n("FOLDER_LIST/TRASH_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},y.prototype.fullName="",y.prototype.fullNameRaw="",y.prototype.fullNameHash="",y.prototype.delimiter="",y.prototype.namespace="",y.prototype.deep=0,y.prototype.interval=0,y.prototype.isNamespaceFolder=!1,y.prototype.isGmailFolder=!1,y.prototype.isUnpaddigFolder=!1,y.prototype.collapsedCss=function(){return this.hasSubScribedSubfolders()?this.collapsed()?"icon-right-mini e-collapsed-sign":"icon-down-mini e-collapsed-sign":"icon-none e-collapsed-sign"},y.prototype.initByJson=function(a){var b=!1;return a&&"Object/Folder"===a["@Object"]&&(this.name(a.Name),this.delimiter=a.Delimiter,this.fullName=a.FullName,this.fullNameRaw=a.FullNameRaw,this.fullNameHash=a.FullNameHash,this.deep=a.FullNameRaw.split(this.delimiter).length-1,this.selectable=!!a.IsSelectable,this.existen=!!a.IsExisten,this.subScribed(!!a.IsSubscribed),this.type("INBOX"===this.fullNameRaw?ob.FolderType.Inbox:ob.FolderType.User),b=!0),b},y.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},z.prototype.email="",z.prototype.changeAccountLink=function(){return Cb.link().change(this.email)},A.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},A.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},A.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+qb.quoteName(a)+'" <'+this.email()+">"},qb.extendAsViewModel("PopupsFolderClearViewModel",B),B.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},B.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},B.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(qb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsFolderCreateViewModel",C),C.prototype.sNoParentText="",C.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(qb.trim(a))},C.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},C.prototype.onShow=function(){this.clearPopup()},C.prototype.onFocus=function(){this.folderName.focused(!0)},C.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(qb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsFolderSystemViewModel",D),D.prototype.sChooseOnText="",D.prototype.sUnuseText="",D.prototype.onShow=function(a){var b="";switch(a=qb.isUnd(a)?ob.SetSystemFoldersNotification.None:a){case ob.SetSystemFoldersNotification.Sent:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case ob.SetSystemFoldersNotification.Draft:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case ob.SetSystemFoldersNotification.Spam:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case ob.SetSystemFoldersNotification.Trash:b=qb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},D.prototype.onBuild=function(){var a=this;zb.on("keydown",function(b){var c=!0;return b&&ob.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(qb.delegateRun(a,"cancelCommand"),c=!1),c})},qb.extendAsViewModel("PopupsComposeViewModel",E),E.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};switch(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Cb.data().accountEmail()]=Cb.data().accountEmail(),a){case ob.ComposeType.Empty:d=Cb.data().accountEmail();break;case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:case ob.ComposeType.Forward:case ob.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case ob.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}return d},E.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},E.prototype.formattedFrom=function(a){var b=Cb.data().displayName(),c=Cb.data().accountEmail();return""===b?c:(qb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+qb.quoteName(b)+'" <'+c+">"},E.prototype.sendMessageResponse=function(b,c){var d=!1;this.sending(!1),ob.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&qb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&ob.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(qb.trim(qb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),a.alert(qb.getNotification(c&&c.ErrorCode?c.ErrorCode:ob.Notification.CantSendMessage))))},E.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),ob.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Cb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Cb.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 b;b++)d.push(a[b].toLine(!1));return d.join(", ")};if(c=c||null,c&&qb.isNormal(c)&&(t=qb.isArray(c)&&1===c.length?c[0]:qb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(u,t))),this.reset(),qb.isNonEmptyArray(d)&&this.to(v(d)),""!==u&&t){switch(j=t.fullFormatDateValue(),k=t.subject(),s=t.aDraftInfo,l=b(t.body).clone(),qb.removeBlockquoteSwitcher(l),m=l.html(),u){case ob.ComposeType.Empty:break;case ob.ComposeType.Reply:this.to(v(t.replyEmails(p))),this.subject(qb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.ReplyAll:o=t.replyAllEmails(p),this.to(v(o[0])),this.cc(v(o[1])),this.subject(qb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.references());break;case ob.ComposeType.Forward:this.subject(qb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.ForwardAsAttachment:this.subject(qb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,u),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=qb.trim(this.sInReplyTo+" "+t.sReferences);break;case ob.ComposeType.Draft:this.to(v(t.to)),this.cc(v(t.cc)),this.bcc(v(t.bcc)),this.bFromDraft=!0,this.draftFolder(t.folderFullNameRaw),this.draftUid(t.uid),this.subject(k),this.prepearMessageAttachments(t,u),this.aDraftInfo=qb.isNonEmptyArray(s)&&3===s.length?s:null,this.sInReplyTo=t.sInReplyTo,this.sReferences=t.sReferences}if(this.oEditor){switch(u){case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:f=t.fromToLine(!1,!0),n=qb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case ob.ComposeType.Forward:f=t.fromToLine(!1,!0),g=t.toToLine(!1,!0),i=t.ccToLine(!1,!0),m="
"+m+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+qb.encodeHtml(j)+"
"+qb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+qb.encodeHtml(k)+"
"+m;break;case ob.ComposeType.ForwardAsAttachment:m=""}this.oEditor.setRawText(m,t.isHtml())}}else this.oEditor&&ob.ComposeType.Empty===u?this.oEditor.setRawText("
"+qb.convertPlainTextToHtml(Cb.data().signature()),ob.EditorDefaultType.Html===Cb.data().editorDefaultType()):qb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload(),qb.isNonEmptyArray(r)&&Cb.remote().messageUploadAttachments(function(a,b){if(ob.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()},r),this.triggerForResize()},E.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},E.prototype.tryToClosePopup=function(){var a=this;vb.showScreenPopup(K,[qb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&qb.delegateRun(a,"closeCommand")}])},E.prototype.onBuild=function(){this.initEditor(),this.initUploader();var a=this,c=null;zb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Cb.data().useKeyboardShortcuts()&&(b.ctrlKey&&ob.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&ob.EventKeyCode.Enter===b.keyCode?(a.sendCommand(),c=!1):ob.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1)),c}),zb.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",Cb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},E.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},E.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new j(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}}),this.oEditor.initLanguage(qb.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),qb.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),qb.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}},E.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=qb.pInt(Cb.settingsGet("AttachmentLimit")),c=new g({action:Cb.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;qb.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=qb.isUnd(d.FileName)?"":d.FileName.toString(),g=qb.isNormal(d.Size)?qb.pInt(d.Size):null,h=new w(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(qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;qb.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=qb.getUploadErrorDescByCode(f):g||(e=qb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(qb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Cb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),ob.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(qb.getUploadErrorDescByCode(ob.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},E.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=qb.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(ob.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case ob.ComposeType.Reply:case ob.ComposeType.ReplyAll:i=h.isLinked;break;case ob.ComposeType.Forward:case ob.ComposeType.Draft:i=!0}i=!0,i&&(g=new w(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))}}},E.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},E.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(qb.getUploadErrorDescByCode(ob.UploadErrorCode.FileNoUploaded))},this)},E.prototype.isEmptyForm=function(a){a=qb.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.getTextForRequest()},E.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bReloadFolder=!1,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()},E.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},E.prototype.triggerForResize=function(){this.resizer(!this.resizer())},qb.extendAsViewModel("PopupsContactsViewModel",F),F.prototype.setShareToNone=function(){this.viewScopeType(ob.ContactScopeType.Default)},F.prototype.setShareToAll=function(){this.viewScopeType(ob.ContactScopeType.ShareAll)},F.prototype.addNewProperty=function(a){var b=new u(a,"");b.focused(!0),this.viewProperties.push(b)},F.prototype.addNewEmail=function(){this.addNewProperty(ob.ContactPropertyType.EmailPersonal)},F.prototype.addNewPhone=function(){this.addNewProperty(ob.ContactPropertyType.MobilePersonal)},F.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))},F.prototype.deleteSelectedContacts=function(){0 0?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,nb.Defaults.ContactsPerPage,this.search())},F.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Cb.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(qb.pInt(a.value)),d.reloadContactList())}),zb.on("keydown",function(a){var b=!0;return a&&d.modalVisibility()&&(ob.EventKeyCode.Esc===a.keyCode?(qb.delegateRun(d,"closeCommand"),b=!1):a.ctrlKey&&ob.EventKeyCode.S===a.keyCode&&(d.saveCommand(),b=!1)),b})},F.prototype.onShow=function(){vb.routeOff(),this.reloadContactList(!0)},F.prototype.onHide=function(){vb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},qb.extendAsViewModel("PopupsAdvancedSearchViewModel",G),G.prototype.buildSearchStringValue=function(a){return-1 0&&g.messageCountUnread(0<=g.messageCountUnread()-e?g.messageCountUnread()-e:0)),i&&(i.messageCountAll(i.messageCountAll()+b.length),e>0&&i.messageCountUnread(i.messageCountUnread()+e)),0 0&&(ob.EventKeyCode.Backspace===c||ob.EventKeyCode.Esc===c)&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!qb.inFocus()&&e.message()&&(d.fullScreenMode(!1),e.usePreviewPane()||e.message(null),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Cb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},R.prototype.isDraftFolder=function(){return Cb.data().message()&&Cb.data().draftFolder()===Cb.data().message().folderFullNameRaw},R.prototype.isSentFolder=function(){return Cb.data().message()&&Cb.data().sentFolder()===Cb.data().message().folderFullNameRaw},R.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},R.prototype.composeClick=function(){vb.showScreenPopup(E)},R.prototype.editMessage=function(){Cb.data().message()&&vb.showScreenPopup(E,[ob.ComposeType.Draft,Cb.data().message()])},R.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},R.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},qb.extendAsViewModel("SettingsMenuViewModel",S),S.prototype.link=function(a){return Cb.link().settings(a)},S.prototype.backToMailBoxClick=function(){vb.setHash(Cb.link().inbox())},qb.extendAsViewModel("SettingsPaneViewModel",T),T.prototype.onShow=function(){Cb.data().message(null)},T.prototype.backToMailBoxClick=function(){vb.setHash(Cb.link().inbox())},qb.addSettingsViewModel(U,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),U.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Cb.data(),d=qb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(ob.SaveSettingsStep.Animate),b.ajax({url:Cb.link().langLink(c),dataType:"script",cache:!0}).done(function(){qb.i18nToDoc(),a.languageTrigger(ob.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(ob.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(ob.SaveSettingsStep.Idle)},1e3)}),Cb.remote().saveSettings(qb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Cb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){qb.timeOutAction("SaveDesktopNotifications",function(){Cb.remote().saveSettings(qb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){qb.timeOutAction("SaveReplySameFolder",function(){Cb.remote().saveSettings(qb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Cb.remote().saveSettings(qb.emptyFunction,{UseThreads:a?"1":"0"})}),c.usePreviewPane.subscribe(function(a){c.messageList([]),Cb.remote().saveSettings(qb.emptyFunction,{UsePreviewPane:a?"1":"0"})}),c.useCheckboxesInList.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},U.prototype.onShow=function(){Cb.data().desktopNotifications.valueHasMutated()},U.prototype.selectLanguage=function(){vb.showScreenPopup(J)},qb.addSettingsViewModel(V,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),V.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},V.prototype.onBuild=function(){Cb.data().contactsAutosave.subscribe(function(a){Cb.remote().saveSettings(qb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},V.prototype.onShow=function(){this.showPassword(!1)},qb.addSettingsViewModel(W,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),W.prototype.addNewAccount=function(){vb.showScreenPopup(H)},W.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);var b=function(b){return a===b};a&&(this.accounts.remove(b),Cb.remote().accountDelete(function(){Cb.accountsAndIdentities()},a.email))}},qb.addSettingsViewModel(X,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),X.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Cb.data(),c=qb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=qb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=qb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Cb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Cb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Cb.remote().saveSettings(e,{Signature:a})})},50)},qb.addSettingsViewModel(Y,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),Y.prototype.addNewIdentity=function(){vb.showScreenPopup(I)},Y.prototype.editIdentity=function(a){vb.showScreenPopup(I,[a])},Y.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Cb.remote().identityDelete(function(){Cb.accountsAndIdentities()},a.id))}},Y.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=Cb.data(),c=qb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=qb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=qb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Cb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Cb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Cb.remote().saveSettings(e,{Signature:a})})},50)},qb.addSettingsViewModel(Z,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),qb.addSettingsViewModel($,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),$.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},$.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),ob.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},qb.addSettingsViewModel(_,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),_.prototype.folderEditOnEnter=function(a){var b=a?qb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.data().foldersRenaming(!0),Cb.remote().folderRename(function(a,b){Cb.data().foldersRenaming(!1),ob.StorageResultType.Success===a&&b&&b.Result||Cb.data().foldersListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Cb.folders()},a.fullNameRaw,b),Cb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},_.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},_.prototype.onShow=function(){Cb.data().foldersListError("")},_.prototype.createFolder=function(){vb.showScreenPopup(C)},_.prototype.systemFolder=function(){vb.showScreenPopup(D)},_.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&&(Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,""),Cb.data().folderList.remove(b),Cb.data().foldersDeleting(!0),Cb.remote().folderDelete(function(a,b){Cb.data().foldersDeleting(!1),ob.StorageResultType.Success===a&&b&&b.Result||Cb.data().foldersListError(b&&b.ErrorCode?qb.getNotification(b.ErrorCode):qb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Cb.folders()},a.fullNameRaw),Cb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 1048576?(a.alert(qb.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(){this.customThemeUploaderProgress(!0)},this)).on("onComplete",h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(d&&d.ErrorCode?qb.getUploadErrorDescByCode(d.ErrorCode):qb.getUploadErrorDescByCode(ob.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},bb.prototype.populateDataOnStart=function(){var a=Cb.settingsGet("Languages"),b=Cb.settingsGet("Themes");qb.isArray(a)&&this.languages(a),qb.isArray(b)&&this.themes(b),this.mainLanguage(Cb.settingsGet("Language")),this.mainTheme(Cb.settingsGet("Theme")),this.allowCustomTheme(!!Cb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Cb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Cb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Cb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Cb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Cb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Cb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Cb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Cb.settingsGet("EditorDefaultType")),this.showImages(!!Cb.settingsGet("ShowImages")),this.contactsAutosave(!!Cb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Cb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Cb.settingsGet("MPP")),this.desktopNotifications(!!Cb.settingsGet("DesktopNotifications")),this.useThreads(!!Cb.settingsGet("UseThreads")),this.replySameFolder(!!Cb.settingsGet("ReplySameFolder")),this.usePreviewPane(!!Cb.settingsGet("UsePreviewPane")),this.useCheckboxesInList(!!Cb.settingsGet("UseCheckboxesInList")),this.facebookEnable(!!Cb.settingsGet("AllowFacebookSocial")),this.facebookAppID(Cb.settingsGet("FacebookAppID")),this.facebookAppSecret(Cb.settingsGet("FacebookAppSecret")),this.twitterEnable(!!Cb.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(Cb.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(Cb.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!Cb.settingsGet("AllowGoogleSocial")),this.googleClientID(Cb.settingsGet("GoogleClientID")),this.googleClientSecret(Cb.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!Cb.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(Cb.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!Cb.settingsGet("ContactsIsAllowed"))},h.extend(cb.prototype,bb.prototype),cb.prototype.purgeMessageBodyCache=function(){var a=0,c=null,d=tb.iMessageBodyCacheCount-nb.Values.MessageBodyCacheLimit;d>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)))},cb.prototype.populateDataOnStart=function(){bb.prototype.populateDataOnStart.call(this),this.accountEmail(Cb.settingsGet("Email")),this.accountIncLogin(Cb.settingsGet("IncLogin")),this.accountOutLogin(Cb.settingsGet("OutLogin")),this.projectHash(Cb.settingsGet("ProjectHash")),this.displayName(Cb.settingsGet("DisplayName")),this.replyTo(Cb.settingsGet("ReplyTo")),this.signature(Cb.settingsGet("Signature")),this.lastFoldersHash=Cb.local().get(ob.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Cb.settingsGet("RemoteSuggestions"),this.devEmail=Cb.settingsGet("DevEmail"),this.devLogin=Cb.settingsGet("DevLogin"),this.devPassword=Cb.settingsGet("DevPassword")},cb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&qb.isNormal(c)&&""!==c){if(qb.isArray(d)&&0 3)i(Cb.link().notificationMailIcon(),Cb.data().accountEmail(),qb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Cb.link().notificationMailIcon(),x.emailsToLine(x.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Cb.cache().setFolderUidNext(b,c)}},cb.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=Cb.cache().getFolderFromCacheList(g),f||(f=y.newInstanceFromJson(e),f&&(Cb.cache().setFolderToCacheList(g,f),Cb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=nb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!qb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Cb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),qb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),qb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&qb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},cb.prototype.setFolders=function(a){var b=[],c=!1,d=Cb.data(),e=function(a){return""===a||nb.Values.UnuseOptionValue===a||null!==Cb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&qb.isArray(a.Result["@Collection"])&&(qb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Cb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Cb.settingsGet("SentFolder")+Cb.settingsGet("DraftFolder")+Cb.settingsGet("SpamFolder")+Cb.settingsGet("TrashFolder")+Cb.settingsGet("NullFolder")&&(Cb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Cb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Cb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Cb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),c=!0),d.sentFolder(e(Cb.settingsGet("SentFolder"))),d.draftFolder(e(Cb.settingsGet("DraftFolder"))),d.spamFolder(e(Cb.settingsGet("SpamFolder"))),d.trashFolder(e(Cb.settingsGet("TrashFolder"))),c&&Cb.remote().saveSystemFolders(qb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),NullFolder:"NullFolder"}),Cb.local().set(ob.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},cb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom(); +a&&a.find(".b-text-part").hide()},cb.prototype.getNextFolderNames=function(a){a=qb.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=Cb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},cb.prototype.setMessage=function(a,c){var d=!1,e=!1,f=!1,g=null,h=null,i="",j=this.messagesBodiesDom(),k=this.message();a&&k&&a.Result&&"Object/Message"===a.Result["@Object"]&&k.folderFullNameRaw===a.Result.Folder&&k.uid===a.Result.Uid&&(this.messageError(""),k.initUpdateByMessageJson(a.Result),Cb.cache().addRequestedMessage(k.folderFullNameRaw,k.uid),c||k.initFlagsByJson(a.Result),j=j&&j[0]?j:null,j&&(i="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),h=j.find("#"+i),h&&h[0]?(h.data("rl-cache-count",++tb.iMessageBodyCacheCount),k.isRtl(!!h.data("rl-is-rtl")),k.isHtml(!!h.data("rl-is-html")),k.hasImages(!!h.data("rl-has-images")),k.body=h):(e=!!a.Result.HasExternals,f=!!a.Result.HasInternals,g=b('').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++tb.iMessageBodyCacheCount),qb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):qb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,g.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,a.Result.Rtl&&(g.data("rl-is-rtl",!0),g.addClass("rtl-text-part")),j.append(g),g.data("rl-is-html",d),g.data("rl-has-images",e),k.isRtl(!!g.data("rl-is-rtl")),k.isHtml(!!g.data("rl-is-html")),k.hasImages(!!g.data("rl-has-images")),k.body=g,f&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),g&&qb.initBlockquoteSwitcher(g)),Cb.cache().initMessageFlagsFromCache(k),k.unseen()&&Cb.setMessageSeen(k),qb.windowResize())},cb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&qb.isArray(a.Result["@Collection"])){var c=Cb.data(),d=Cb.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=qb.pInt(a.Result.MessageResultCount),j=qb.pInt(a.Result.Offset),qb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Cb.cache().getFolderFromCacheList(qb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Cb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),qb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),qb.isNormal(a.Result.MessageUnseenCount)&&(qb.pInt(p.messageCountUnread())!==qb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Cb.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=x.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Cb.cache().initMessageFlagsFromCache(o):Cb.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/"+sb.urlsafe_encode([b,c,Cb.data().projectHash(),Cb.data().threading()&&Cb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},eb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},eb.prototype.folderInformation=function(a,b,c){var d=!0,e=Cb.cache(),f=[];qb.isArray(c)&&0 l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1 l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(ob.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0