"use strict";define(["app","handlebars","View","text!/v2/webapps/FirstAccess/CommonControls/Localization/Templates/SelectLanguageTemplate.html","../Model/SetCurrentLanguageModel","utils"],function(e,g,f,b,c,a){var d=f.extend({selectLanguageTemplate:g.compile(b),events:{"change #languages":"changeLanguages"},initialize:function(h){f.prototype.initialize.apply(this,arguments);this.options=h||{};},changeLanguages:function(){var h=$("#languages").val();this.onChangeLanguage(h);},onChangeLanguage:function(i){e.instance().Cache.LanguageSettings.CurrentLanguage=i;var h=this.options.parentView;e.instance().resetLanguage(function(){var j=new c();j.fetch({data:{language:i},success:function(){h.refreshView();}});});},render:function(k,h,j){var i={};if(!this.options.ignoreLanguage){if(k&&k.length>1){i=$.map(k,function(l){return{val:l,selected:(h==l?"selected":""),text:j(l)};});this.$el.html(this.selectLanguageTemplate({languages:i}));}else{$("#language").hide();}}else{i=$.map(k,function(l){return{val:l,selected:(h==l?"selected":""),text:j(l)};});this.$el.html(this.selectLanguageTemplate({languages:i}));}return this;}});return d;});