!function(t){formintorjs.define([],function(){return Backbone.View.extend({events:{},className:"wpmudev-option",initialize:function(t){if(this.options=t,this.model)return this.id=this.options.id,this.name=this.options.name,this.layout=this.options.layout,this.multiple=void 0!==this.options.multiple?this.options.multiple:void 0!==this.multiple&&this.multiple,this.title=void 0!==this.options.title?this.options.title:"",this.label=void 0!==this.options.label?this.options.label:"",this.default_value=void 0!==this.options.default_value?this.options.default_value:this.multiple?[]:"",this.init&&this.init(this.options),this.options.init&&this.options.init(),this.options.change?this.on("changed",this.options.change,this):this.on("changed",this.change,this),this.options.focus&&this.on("focus",this.options.focus,this),this.options.blur&&this.on("blur",this.options.blur,this),this.options.rendered&&this.on("rendered",this.options.rendered,this),this.options.on_click&&(this.on_click=this.options.on_click),this.options.on_change&&this.on("updated",this.options.on_change,this),this.on("changed rendered",this.trigger_show),this.once("rendered",function(){var t=this;this.get_field().on("focus",function(){t.trigger("focus")}).on("blur",function(){t.trigger("blur")})},this),this.render()},get_field_id:function(){return this.id},get_name:function(){return this.name},get_field:function(){return this.$el.find("[name="+this.get_name()+"]")},get_value:function(){var i=this.get_field();return this.multiple&&1!==i.size()?_.map(i,function(i){return t(i).val()}):i.val()},set_value:function(t){this.get_field().val(t)},get_saved_value:function(){var i=this.model.get(this.name);return _.isString(i)&&!_.isEmpty(i)?i=i.replace(/"/g,"&quot;"):_.isArray(i)&&!_.isEmpty(i)&&t.each(i,function(){void 0!==this.label&&(this.label=this.label.replace(/"/g,"&quot;"))}),i||this.default_value},save_value:function(t){this.model.set(this.name,t)},trigger_show:function(){this.options.show&&this.options.show(this.get_saved_value())},change:function(t){this.save_value(t),this.options.on_change&&this.options.on_change(t)},get_title_html:function(){if(!0===this.options.show_title)return'<label class="wpmudev-label--title">'+this.title+"</label>"},get_label_html:function(){if(!0===this.options.hide_label)return"";var t={for:this.get_field_id(),class:"wpmudev-label"};return"<label "+this.get_field_attr_html(t)+">"+this.label+"</label>"},get_field_attr_html:function(t){return _.map(t,function(t,i){return i+'="'+t+'"'}).join(" ")},get_field_html:function(){return""},on_render:function(){return!1},render:function(){this.$el.html(""),this.$el.append(this.get_title_html()),this.$el.append(this.get_label_html()),this.$el.append(this.get_field_html()),this.trigger("rendered",this.get_value()),this.on_render()}})})}(jQuery);