!function(e){formintorjs.define(["text!tpl/dashboard.html"],function(t){return Backbone.View.extend({className:"wpmudev-popup--quiz",step:"1",type:"knowledge",events:{"click .select-quiz-template":"selectTemplate","click .sui-dialog-close":"close","change .forminator-new-quiz-type":"clickTemplate","click #forminator-build-your-form":"handleMouseClick",keyup:"handleKeyClick"},popupTpl:Forminator.Utils.template(e(t).find("#forminator-quizzes-popup-tpl").html()),newFormTpl:Forminator.Utils.template(e(t).find("#forminator-new-form-tpl").html()),newFormContent:Forminator.Utils.template(e(t).find("#forminator-new-quiz-content-tpl").html()),render:function(){var e=jQuery("#forminator-popup");"1"===this.step&&(this.$el.html(this.popupTpl()),this.$el.find(".select-quiz-template").prop("disabled",!1),e.removeClass("sui-dialog-sm")),"2"===this.step&&(this.$el.html(this.newFormTpl()),this.$el.find(".sui-box-body").html(this.newFormContent()),e.addClass("sui-dialog-sm"))},close:function(e){e.preventDefault(),Forminator.New_Popup.close()},clickTemplate:function(e){this.$el.find(".select-quiz-template").prop("disabled",!1)},selectTemplate:function(e){e.preventDefault();var t=this.$el.find("input[name=forminator-new-quiz]:checked").val();this.type=t,this.step="2",this.render()},handleMouseClick:function(e){this.createQuiz(e)},handleKeyClick:function(e){e.preventDefault(),13===e.which&&this.createQuiz(e)},createQuiz:function(t){var i=e(t.target).closest(".sui-box").find("#forminator-form-name");if(""===i.val())e(t.target).closest(".sui-box").find(".sui-error-message").show();else{var o=Forminator.Data.modules.quizzes.knowledge_url;"nowrong"===this.type&&(o=Forminator.Data.modules.quizzes.nowrong_url),e(t.target).closest(".sui-box").find(".sui-error-message").hide(),form_url=o+"&name="+i.val(),window.location.href=form_url}}})})}(jQuery);