!function(e){formintorjs.define(["admin/settings/toggle-container","text!tpl/fields.html"],function(t,n){return t.extend({multiple:!1,events:{"click .wpmudev-add-question":"add_question","click .wpmudev-delete-question":"delete_question","change .wpmudev-question-title":"update_title"},className:"wpmudev-multiqs",init:function(){this.questions=this.model.get("questions")},on_render:function(){var t=this;this.questions.length?this.$el.addClass("wpmudev-have_qs"):this.$el.removeClass("wpmudev-have_qs"),setTimeout(function(){t.questions.each(function(n,i){var s=new Forminator.Settings.MultiQuestionAnswer({model:n,question_index:i,results:t.model.get("results")});e("[data-index="+i+"]").find(".wpmudev-multianswer--wrap").append(s.el)})},50)},get_field_html:function(){var t=this.get_values_html();return Forminator.Utils.template(e(n).find("#settings-field-question-multiple-tpl").html())({childs:t})},get_values_html:function(){var e=this;return this.questions.map(function(t,n){return e.get_value_html(t,n)}).join(" ")},get_value_html:function(t,i){this.get_saved_value();return Forminator.Utils.template(e(n).find("#settings-field-question-multiple-question-tpl").html())({row:t.toJSON(),index:i})},add_question:function(e){e.preventDefault(),new_questions=new Forminator.Models.Question({answers:new Forminator.Collections.Answers}),this.questions.add(new_questions,{silent:!0}),this.render()},delete_question:function(t){t.preventDefault();var n=e(t.target),i=this.get_model(n);this.questions.remove(i,{silent:!0}),this.render()},get_index:function(e){return e.closest(".wpmudev-multiqs--item").data("index")},get_model:function(e){var t=this.get_index(e);return this.questions.get_by_index(t)},update_title:function(t){var n=this.get_model(e(t.target));value=e(t.target).val(),n.set("title",value)}})})}(jQuery);