!function(e){formintorjs.define(["admin/style-editor","text!tpl/appearance.html"],function(a,i){return Backbone.View.extend({mainTpl:Forminator.Utils.template(e(i).find("#appearance-section-behaviour-tpl").html()),className:"wpmudev-box-body",initialize:function(e){return this.render()},render:function(){this.$el.html(this.mainTpl()),this.render_form_lifespan(),this.render_form_submission(),this.render_form_validation(),this.render_form_submit(),this.render_form_security()},render_form_lifespan:function(){var e=this,a=new Forminator.Settings.Radio({model:this.model,id:"behaviours-form-expire",name:"form-expire",show:function(a){setTimeout(function(){var i=e.$el.find("#behaviours-form-expire-date"),n=e.$el.find("#behaviours-form-expire-submits");i.hide(),n.hide(),"date"===a&&i.show(),"submits"===a&&n.show()},10)},default_value:"no_expire",values:[{value:"no_expire",label:Forminator.l10n.appearance.form_doesnt_expire},{value:"date",label:Forminator.l10n.appearance.on_certain_date},{value:"submits",label:Forminator.l10n.appearance.expires_submits}]}),i=new Forminator.Settings.Date({model:this.model,id:"behaviours-form-expire-date",name:"expire_date",placeholder:"Select date",hide_label:!0}),n=new Forminator.Settings.Number({model:this.model,id:"behaviours-form-expire-submits",name:"expire_submits",hide_label:!0});this.$el.find(".appearance-section-form-lifespan").append([a.el,i.el,n.el])},render_form_submission:function(){var e=new Forminator.Settings.Toggle({model:this.model,id:"behaviours-form-enable-ajax",name:"enable-ajax",hide_label:!0,values:[{value:"true",label:Forminator.l10n.appearance.enable_ajax,labelSmall:!0}]});this.$el.find(".appearance-section-form-submission").append(e.el)},render_form_validation:function(){var e=new Forminator.Settings.Radio({model:this.model,id:"behaviours-form-validation",containerSize:"400",name:"validation",default_value:"on_submit",hide_label:!0,values:[{value:"server",label:Forminator.l10n.appearance.server_only},{value:"on_submit",label:Forminator.l10n.appearance.form_submit}]}),a=new Forminator.Settings.Toggle({model:this.model,id:"behaviours-form-validation-inline",name:"validation-inline",hide_label:!0,values:[{value:"true",label:Forminator.l10n.appearance.inline,labelSmall:!0}]});this.$el.find(".appearance-section-form-validation").append(e.el,a.el)},render_form_submit:function(){var e=this,a=new Forminator.Settings.ToggleContainer({model:this.model,id:"behaviour-thankyou",name:"thankyou",hide_label:!0,containerClass:"wpmudev-is_gray",values:[{value:"true",label:Forminator.l10n.appearance.show_thank_you_message,labelSmall:"true"}],on_change:function(a){var i=this.model.get("redirect");!0!==a&&"true"!==a||!0!==i&&"true"!==i||(this.model.set("redirect",!1),e.render())}}),i=new Forminator.Settings.Editor({model:this.model,id:"behaviour-thankyou-message",name:"thankyou-message",hide_label:!0,enableFormData:!0});a.$el.find(".wpmudev-option--switch_content").append(i.$el);var n=new Forminator.Settings.ToggleContainer({model:this.model,id:"behaviour-redirect",name:"redirect",hide_label:!0,containerClass:"wpmudev-is_gray",values:[{value:"true",label:Forminator.l10n.appearance.redirect_to_url,labelSmall:"true"}],on_change:function(a){var i=this.model.get("thankyou");!0!==a&&"true"!==a||!0!==i&&"true"!==i||(this.model.set("thankyou",!1),e.render())}}),r=new Forminator.Settings.Text({model:this.model,id:"behaviour-redirect-url",name:"redirect-url",hide_label:!0,placeholder:"E.g. /thank-you"});n.$el.find(".wpmudev-option--switch_content").append(r.$el),this.$el.find(".appearance-section-form-after-submit").append([a.el,n.el])},render_form_security:function(){var e=new Forminator.Settings.Toggle({model:this.model,id:"behaviours-form-honeypot",name:"honeypot",hide_label:!0,values:[{value:"true",label:Forminator.l10n.appearance.enable_honeypot,labelSmall:"true"}]}),a=new Forminator.Settings.Toggle({model:this.model,id:"behaviours-form-logged-users",name:"logged-users",hide_label:!0,values:[{value:"true",label:Forminator.l10n.appearance.only_logged,labelSmall:"true"}]});this.$el.find(".appearance-section-form-security").append([e.el,a.el])}})})}(jQuery);