"use strict";define(["app","Controller","../../../../../components/Overlay/Views/OverlayView","../Views/SignInMessagePopupView","../../Models/AdminSettingsModel","utils"],function(e,f,d,a,g,b){var c=f.extend({callback:null,initialize:function(h){this.adminSettingsModel=new g();f.prototype.initialize.apply(this,arguments);_.extend(this,h);this.overlayView=new d({framework:e.instance().FrontendFramework(),css:{display:"none","background-color":"rgba(27,27,27,0.9)","z-index":"100"}});this.signInMessagePopupView=new a({parent:this.overlayView});this.validationModel=new (Backbone.Model.extend({validation:{languageSelect:{required:true},messageText:{required:true}}}))();},open:function(h,i){this.callback=i;this.view=this.signInMessagePopupView.render(h);Backbone.Validation.bind(this.view,{model:this.validationModel});this.listenTo(this.view,"view:validate",_.bind(this.validate,this));},close:function(){this.overlayView.close();},validate:function(h,i){var k=this.view.$el.find("form").serialize();var l=e.instance().Cache.customMsgAddedLangs?e.instance().Cache.customMsgAddedLangs:[];var j=false;l.forEach(function(n){if(k.languageSelect.length==3){var m=b.getEnglishLanguageName(k.languageSelect);}if(n.languageSelect===((m!=undefined)?m:k.languageSelect)){j=true;}});this.validationModel.set(k);i.validating=this.validationModel.isValid(true);if(this.validationModel.isValid(true)&&(!j||e.instance().Cache.custMsgMode=="edit")){l.push(k);e.instance().Cache.customMsgAddedLangs=l;if(this.callback){this.callback.apply(this,[{LangCd:this.view.$el.find("#languageSelect").val(),excpMessage:k.messageText}]);}}}});return c;});