!function(t){"use strict";t.fn.eac_form=function(e){if("object"==typeof(e=e||{})||!e)return this.each((function(){const o=new t.eac_form(t(this),e);t(this).data("eac_form",o)}));const o=Array.prototype.slice.call(arguments,1);return this.each((function(){const i=t(this).data("eac_form");i&&"function"==typeof i.view[e]&&i.view[e].apply(i.view,o)}))},t.eac_form=function(e,o){e.length&&(this.$el=e,t.extend(this,{events:{}},o||{}),this.$el.data("eac_form",this),this._values=this.getValues(),this.init(),this.$el.trigger("ready"))},t.eac_form.prototype.init=function(){const t=this.events||{};for(const e in t){let o=t[e];if("function"!=typeof o&&(o=this[o]),!o)continue;const i=e.match(/^(\S+)\s*(.*)$/);this.on(i[1],i[2],o.bind(this))}},t.eac_form.prototype.getValues=function(){const e={};return this.$("input, select, textarea").each(((o,i)=>{const n=t(i),s=n.attr("name"),c=n.attr("type");"method"!==s&&void 0!==s&&("radio"===c?e[s]=n.is(":checked")?n.val()||0:e[s]:"checkbox"===c?(e[s]=e[s]||[],n.is(":checked")&&e[s].push(n.val())):e[s]=n.val()||"")})),e},t.eac_form.prototype.getValue=function(t){return this.getValues()[t]||null},t.eac_form.prototype.$=function(t){return this.$el.find(t)},t.eac_form.prototype.on=function(t,e,o){this.$el.on(t,e,o)},t.eac_form.prototype.reset=function(){for(const t in this._values){const e=this.$(`[name="${t}"]`),o=e.attr("type");"radio"===o||"checkbox"===o?(e.prop("checked",!1),e.val()===this._values[t]&&e.prop("checked",!0)):e.val(this._values[t])}return this},t.eac_form.prototype.isDirty=function(){const t=this.getValues();for(const e in this._values)if(this._values[e]!==t[e])return!0;return!1},t.eac_form.prototype.block=function(){return this.$el.find(".blockUI").length>0||("static"===this.$el.css("position")&&this.$el.css("position","relative"),t('<div class="blockUI"></div>').css({position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgb(255, 255, 255)",opacity:.1,cursor:"wait",zIndex:9999}).appendTo(this.$el)),this},t.eac_form.prototype.unblock=function(){return console.log(t(".blockUI",this.$el).length),t(".blockUI",this.$el).remove(),this}}(jQuery);