").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=S.createCommand(e,function(){X.hideScreenPopup(a)})),T.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),this.delegateRun(e,"onBuild",[h]),T.runHook("view-model-post-build",[a.__name,e,h])):S.log("Cannot find view model position: "+f)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),f.defer(function(){a.__dom.find(".ko-select2").select2("close")}))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),T.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===S.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,S.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),this.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onHide"),S.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),c.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onShow"),T.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),S.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),c.delegateRun(a.__vm,"onShow"),T.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),T.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),T.runHook("screen-post-start",[a.screenName(),a]))},this);var b=d.create();b.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(b.parse,b),e.changed.add(b.parse,b),e.init()},n.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=S.isUnd(c)?!1:!!c,(S.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},n.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},X=new n,o.newInstanceFromJson=function(a){var b=new o;return b.initByJson(a)?b:null},o.prototype.name="",o.prototype.email="",o.prototype.privateType=null,o.prototype.validate=function(){return""!==this.name||""!==this.email},o.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},o.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},o.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=Q.EmailType.Facebook),null===this.privateType&&(this.privateType=Q.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){a=S.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},o.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=S.trim(a.Name),this.email=S.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b){var c="";return""!==this.email&&(b=S.isUnd(b)?!1:!!b,a&&""!==this.name?c=b?'
")+'" target="_blank" tabindex="-1">'+S.encodeHtml(this.name)+"":this.name:(c=this.email,""!==this.name?c=b?S.encodeHtml('"'+this.name+'" <')+'
")+'" target="_blank" tabindex="-1">'+S.encodeHtml(c)+""+S.encodeHtml(">"):'"'+this.name+'" <'+c+">":b&&(c='
'+S.encodeHtml(this.email)+""))),c},o.prototype.select2Result=function(){var a="",b=cb.cache().getUserPic(this.email);return a+=""!==b?'
':'
',Q.EmailType.Facebook===this.type()?(a+=""+(0
'):a+=""+(0
('+this.name+")":this.email),a+""},o.prototype.select2Selection=function(a){var c="";if(Q.EmailType.Facebook===this.type()){if(c=0").text(c).appendTo(a),a.append(''),null}else c=0(new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0 ").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(h),e.data=cb.data(),e.viewModelDom=i,e.__rlSettingsData=g.__rlSettingsData,g.__dom=i,g.__builded=!0,g.__vm=e,c.applyBindings(e,i[0]),X.delegateRun(e,"onBuild",[i])):S.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&f.defer(function(){d.oCurrentSubScreen&&(X.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),X.delegateRun(d.oCurrentSubScreen,"onShow"),f.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),S.windowResize()})):X.setHash(cb.link().settings(),!1,!0)},K.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(X.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},K.prototype.onBuild=function(){f.each(W.settings,function(a){a&&a.__rlSettingsData&&!f.find(W["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!f.find(W["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},K.prototype.routes=function(){var a=f.find(W.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=S.isUnd(c.subname)?b:S.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(L.prototype,m.prototype),L.prototype.onShow=function(){cb.setTitle("")},f.extend(M.prototype,K.prototype),M.prototype.onShow=function(){cb.setTitle("")},f.extend(N.prototype,k.prototype),N.prototype.oSettings=null,N.prototype.oLink=null,N.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):(V.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},N.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},N.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},N.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=S.isNormal(Y)?Y:{}),S.isUnd(this.oSettings[a])?null:this.oSettings[a]},N.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=S.isNormal(Y)?Y:{}),this.oSettings[a]=b},N.prototype.setTitle=function(b){b=(0