/*!
 * jQuery Form Plugin
 * version: 4.2.2
 * Requires jQuery v1.7.2 or later
 * Project repository: https://github.com/jquery-form/form

 * Copyright 2017 Kevin Morris
 * Copyright 2006 M. Alsup

 * Dual licensed under the LGPL-2.1+ or MIT licenses
 * https://github.com/jquery-form/form#license

 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module==="object"&&module.exports){module.exports=function(b,c){if(typeof c==="undefined"){if(typeof window!=="undefined"){c=require("jquery")}else{c=require("jquery")(b)}}a(c);return c}}else{a(jQuery)}}}(function(g){var f=/\r?\n/g;var c={};c.fileapi=g('<input type="file">').get(0).files!==undefined;c.formdata=(typeof window.FormData!=="undefined");var e=!!g.fn.prop;g.fn.attr2=function(){if(!e){return this.attr.apply(this,arguments)}var h=this.prop.apply(this,arguments);if((h&&h.jquery)||typeof h==="string"){return h}return this.attr.apply(this,arguments)};g.fn.ajaxSubmit=function(l,M,E,o){if(!this.length){d("ajaxSubmit: skipping submit process - no element selected");return this}var j,F,n,r=this;if(typeof l==="function"){l={success:l}}else{if(typeof l==="string"||(l===false&&arguments.length>0)){l={url:l,data:M,dataType:E};if(typeof o==="function"){l.success=o}}else{if(typeof l==="undefined"){l={}}}}j=l.method||l.type||this.attr2("method");F=l.url||this.attr2("action");n=(typeof F==="string")?g.trim(F):"";n=n||window.location.href||"";if(n){n=(n.match(/^([^#]+)/)||[])[1]}l=g.extend(true,{url:n,success:g.ajaxSettings.success,type:j||g.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},l);var w={};this.trigger("form-pre-serialize",[this,l,w]);if(w.veto){d("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(l.beforeSerialize&&l.beforeSerialize(this,l)===false){d("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var p=l.traditional;if(typeof p==="undefined"){p=g.ajaxSettings.traditional}var u=[];var I,J=this.formToArray(l.semantic,u,l.filtering);if(l.data){var H=g.isFunction(l.data)?l.data(J):l.data;l.extraData=H;I=g.param(H,p)}if(l.beforeSubmit&&l.beforeSubmit(J,this,l)===false){d("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[J,this,l,w]);if(w.veto){d("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var A=g.param(J,p);if(I){A=(A?(A+"&"+I):I)}if(l.type.toUpperCase()==="GET"){l.url+=(l.url.indexOf("?")>=0?"&":"?")+A;l.data=null}else{l.data=A}var L=[];if(l.resetForm){L.push(function(){r.resetForm()})}if(l.clearForm){L.push(function(){r.clearForm(l.includeHidden)})}if(!l.dataType&&l.target){var m=l.success||function(){};L.push(function(O,P,N){var k=arguments,q=l.replaceTarget?"replaceWith":"html";g(l.target)[q](O).each(function(){m.apply(this,k)})})}else{if(l.success){if(g.isArray(l.success)){g.merge(L,l.success)}else{L.push(l.success)}}}l.success=function(P,q,Q){var O=l.context||this;for(var N=0,k=L.length;N<k;N++){L[N].apply(O,[P,q,Q||r,r])}};if(l.error){var B=l.error;l.error=function(O,k,q){var N=l.context||this;B.apply(N,[O,k,q,r])}}if(l.complete){var i=l.complete;l.complete=function(N,k){var q=l.context||this;i.apply(q,[N,k,r])}}var G=g("input[type=file]:enabled",this).filter(function(){return g(this).val()!==""});var s=G.length>0;var D="multipart/form-data";var z=(r.attr("enctype")===D||r.attr("encoding")===D);var y=c.fileapi&&c.formdata;d("fileAPI :"+y);var t=(s||z)&&!y;var x;if(l.iframe!==false&&(l.iframe||t)){if(l.closeKeepAlive){g.get(l.closeKeepAlive,function(){x=K(J)})}else{x=K(J)}}else{if((s||z)&&y){x=v(J)}else{x=g.ajax(l)}}r.removeData("jqxhr").data("jqxhr",x);for(var C=0;C<u.length;C++){u[C]=null}this.trigger("form-submit-notify",[this,l]);return this;function h(P){var Q=g.param(P,l.traditional).split("&");var q=Q.length;var k=[];var O,N;for(O=0;O<q;O++){Q[O]=Q[O].replace(/\+/g," ");N=Q[O].split("=");k.push([decodeURIComponent(N[0]),decodeURIComponent(N[1])])}return k}function v(q){var k=new FormData();for(var N=0;N<q.length;N++){k.append(q[N].name,q[N].value)}if(l.extraData){var Q=h(l.extraData);for(N=0;N<Q.length;N++){if(Q[N]){k.append(Q[N][0],Q[N][1])}}}l.data=null;var P=g.extend(true,{},g.ajaxSettings,l,{contentType:false,processData:false,cache:false,type:j||"POST"});if(l.uploadProgress){P.xhr=function(){var R=g.ajaxSettings.xhr();if(R.upload){R.upload.addEventListener("progress",function(V){var U=0;var S=V.loaded||V.position;var T=V.total;if(V.lengthComputable){U=Math.ceil(S/T*100)}l.uploadProgress(V,S,T,U)},false)}return R}}P.data=null;var O=P.beforeSend;P.beforeSend=function(S,R){if(l.formData){R.data=l.formData}else{R.data=k}if(O){O.call(this,S,R)}};return g.ajax(P)}function K(al){var Q=r[0],P,ah,aa,aj,ad,S,V,T,U,ae,ai,Z;var ap=g.Deferred();ap.abort=function(aq){T.abort(aq)};if(al){for(ah=0;ah<u.length;ah++){P=g(u[ah]);if(e){P.prop("disabled",false)}else{P.removeAttr("disabled")}}}aa=g.extend(true,{},g.ajaxSettings,l);aa.context=aa.context||aa;ad="jqFormIO"+new Date().getTime();var an=Q.ownerDocument;var ag=r.closest("body");if(aa.iframeTarget){S=g(aa.iframeTarget,an);ae=S.attr2("name");if(!ae){S.attr2("name",ad)}else{ad=ae}}else{S=g('<iframe name="'+ad+'" src="'+aa.iframeSrc+'" />',an);S.css({position:"absolute",top:"-1000px",left:"-1000px"})}V=S[0];T={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(aq){var ar=(aq==="timeout"?"timeout":"aborted");d("aborting upload... "+ar);this.aborted=1;try{if(V.contentWindow.document.execCommand){V.contentWindow.document.execCommand("Stop")}}catch(at){}S.attr("src",aa.iframeSrc);T.error=ar;if(aa.error){aa.error.call(aa.context,T,ar,aq)}if(aj){g.event.trigger("ajaxError",[T,aa,ar])}if(aa.complete){aa.complete.call(aa.context,T,ar)}}};aj=aa.global;if(aj&&g.active++===0){g.event.trigger("ajaxStart")}if(aj){g.event.trigger("ajaxSend",[T,aa])}if(aa.beforeSend&&aa.beforeSend.call(aa.context,T,aa)===false){if(aa.global){g.active--}ap.reject();return ap}if(T.aborted){ap.reject();return ap}U=Q.clk;if(U){ae=U.name;if(ae&&!U.disabled){aa.extraData=aa.extraData||{};aa.extraData[ae]=U.value;if(U.type==="image"){aa.extraData[ae+".x"]=Q.clk_x;aa.extraData[ae+".y"]=Q.clk_y}}}var Y=1;var W=2;function X(at){var ar=null;try{if(at.contentWindow){ar=at.contentWindow.document}}catch(aq){d("cannot get iframe.contentWindow document: "+aq)}if(ar){return ar}try{ar=at.contentDocument?at.contentDocument:at.document}catch(aq){d("cannot get iframe.contentDocument: "+aq);ar=at.document}return ar}var O=g("meta[name=csrf-token]").attr("content");var N=g("meta[name=csrf-param]").attr("content");if(N&&O){aa.extraData=aa.extraData||{};aa.extraData[N]=O}function af(){var az=r.attr2("target"),av=r.attr2("action"),at="multipart/form-data",aw=r.attr("enctype")||r.attr("encoding")||at;Q.setAttribute("target",ad);if(!j||/post/i.test(j)){Q.setAttribute("method","POST")}if(av!==aa.url){Q.setAttribute("action",aa.url)}if(!aa.skipEncodingOverride&&(!j||/post/i.test(j))){r.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(aa.timeout){Z=setTimeout(function(){ai=true;ac(Y)},aa.timeout)}function ax(){try{var aA=X(V).readyState;d("state = "+aA);if(aA&&aA.toLowerCase()==="uninitialized"){setTimeout(ax,50)}}catch(aB){d("Server abort: ",aB," (",aB.name,")");ac(W);if(Z){clearTimeout(Z)}Z=undefined}}var ay=[];try{if(aa.extraData){for(var ar in aa.extraData){if(aa.extraData.hasOwnProperty(ar)){if(g.isPlainObject(aa.extraData[ar])&&aa.extraData[ar].hasOwnProperty("name")&&aa.extraData[ar].hasOwnProperty("value")){ay.push(g('<input type="hidden" name="'+aa.extraData[ar].name+'">',an).val(aa.extraData[ar].value).appendTo(Q)[0])}else{ay.push(g('<input type="hidden" name="'+ar+'">',an).val(aa.extraData[ar]).appendTo(Q)[0])}}}}if(!aa.iframeTarget){S.appendTo(ag)}if(V.attachEvent){V.attachEvent("onload",ac)}else{V.addEventListener("load",ac,false)}setTimeout(ax,15);try{Q.submit()}catch(au){var aq=document.createElement("form").submit;aq.apply(Q)}}finally{Q.setAttribute("action",av);Q.setAttribute("enctype",aw);if(az){Q.setAttribute("target",az)}else{r.removeAttr("target")}g(ay).remove()}}if(aa.forceSync){af()}else{setTimeout(af,10)}var am,ao,ak=50,R;function ac(ax){if(T.aborted||R){return}ao=X(V);if(!ao){d("cannot access response document");ax=W}if(ax===Y&&T){T.abort("timeout");ap.reject(T,"timeout");return}if(ax===W&&T){T.abort("server abort");ap.reject(T,"error","server abort");return}if(!ao||ao.location.href===aa.iframeSrc){if(!ai){return}}if(V.detachEvent){V.detachEvent("onload",ac)}else{V.removeEventListener("load",ac,false)}var av="success",az;try{if(ai){throw"timeout"}var au=aa.dataType==="xml"||ao.XMLDocument||g.isXMLDoc(ao);d("isXml="+au);if(!au&&window.opera&&(ao.body===null||!ao.body.innerHTML)){if(--ak){d("requeing onLoad callback, DOM not available");setTimeout(ac,250);return}}var aA=ao.body?ao.body:ao.documentElement;T.responseText=aA?aA.innerHTML:null;T.responseXML=ao.XMLDocument?ao.XMLDocument:ao;if(au){aa.dataType="xml"}T.getResponseHeader=function(aD){var aC={"content-type":aa.dataType};return aC[aD.toLowerCase()]};if(aA){T.status=Number(aA.getAttribute("status"))||T.status;T.statusText=aA.getAttribute("statusText")||T.statusText}var aq=(aa.dataType||"").toLowerCase();var ay=/(json|script|text)/.test(aq);if(ay||aa.textarea){var aw=ao.getElementsByTagName("textarea")[0];if(aw){T.responseText=aw.value;T.status=Number(aw.getAttribute("status"))||T.status;T.statusText=aw.getAttribute("statusText")||T.statusText}else{if(ay){var ar=ao.getElementsByTagName("pre")[0];var aB=ao.getElementsByTagName("body")[0];if(ar){T.responseText=ar.textContent?ar.textContent:ar.innerText}else{if(aB){T.responseText=aB.textContent?aB.textContent:aB.innerText}}}}}else{if(aq==="xml"&&!T.responseXML&&T.responseText){T.responseXML=ab(T.responseText)}}try{am=k(T,aq,aa)}catch(at){av="parsererror";T.error=az=(at||av)}}catch(at){d("error caught: ",at);av="error";T.error=az=(at||av)}if(T.aborted){d("upload aborted");av=null}if(T.status){av=((T.status>=200&&T.status<300)||T.status===304)?"success":"error"}if(av==="success"){if(aa.success){aa.success.call(aa.context,am,"success",T)}ap.resolve(T.responseText,"success",T);if(aj){g.event.trigger("ajaxSuccess",[T,aa])}}else{if(av){if(typeof az==="undefined"){az=T.statusText}if(aa.error){aa.error.call(aa.context,T,av,az)}ap.reject(T,"error",az);if(aj){g.event.trigger("ajaxError",[T,aa,az])}}}if(aj){g.event.trigger("ajaxComplete",[T,aa])}if(aj&&!--g.active){g.event.trigger("ajaxStop")}if(aa.complete){aa.complete.call(aa.context,T,av)}R=true;if(aa.timeout){clearTimeout(Z)}setTimeout(function(){if(!aa.iframeTarget){S.remove()}else{S.attr("src",aa.iframeSrc)}T.responseXML=null},100)}var ab=g.parseXML||function(aq,ar){if(window.ActiveXObject){ar=new ActiveXObject("Microsoft.XMLDOM");ar.async="false";ar.loadXML(aq)}else{ar=(new DOMParser()).parseFromString(aq,"text/xml")}return(ar&&ar.documentElement&&ar.documentElement.nodeName!=="parsererror")?ar:null};var q=g.parseJSON||function(aq){return window["eval"]("("+aq+")")};var k=function(aw,au,at){var ar=aw.getResponseHeader("content-type")||"",aq=((au==="xml"||!au)&&ar.indexOf("xml")>=0),av=aq?aw.responseXML:aw.responseText;if(aq&&av.documentElement.nodeName==="parsererror"){if(g.error){g.error("parsererror")}}if(at&&at.dataFilter){av=at.dataFilter(av,au)}if(typeof av==="string"){if((au==="json"||!au)&&ar.indexOf("json")>=0){av=q(av)}else{if((au==="script"||!au)&&ar.indexOf("javascript")>=0){g.globalEval(av)}}}return av};return ap}};g.fn.ajaxForm=function(i,j,h,l){if(typeof i==="string"||(i===false&&arguments.length>0)){i={url:i,data:j,dataType:h};if(typeof l==="function"){i.success=l}}i=i||{};i.delegation=i.delegation&&g.isFunction(g.fn.on);if(!i.delegation&&this.length===0){var k={s:this.selector,c:this.context};if(!g.isReady&&k.s){d("DOM not ready, queuing ajaxForm");g(function(){g(k.s,k.c).ajaxForm(i)});return this}d("terminating; zero elements found by selector"+(g.isReady?"":" (DOM not ready)"));return this}if(i.delegation){g(document).off("submit.form-plugin",this.selector,b).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,i,b).on("click.form-plugin",this.selector,i,a);return this}return this.ajaxFormUnbind().on("submit.form-plugin",i,b).on("click.form-plugin",i,a)};function b(i){var h=i.data;if(!i.isDefaultPrevented()){i.preventDefault();g(i.target).closest("form").ajaxSubmit(h)}}function a(l){var k=l.target;var i=g(k);if(!i.is("[type=submit],[type=image]")){var h=i.closest("[type=submit]");if(h.length===0){return}k=h[0]}var j=k.form;j.clk=k;if(k.type==="image"){if(typeof l.offsetX!=="undefined"){j.clk_x=l.offsetX;j.clk_y=l.offsetY}else{if(typeof g.fn.offset==="function"){var m=i.offset();j.clk_x=l.pageX-m.left;j.clk_y=l.pageY-m.top}else{j.clk_x=l.pageX-k.offsetLeft;j.clk_y=l.pageY-k.offsetTop}}}setTimeout(function(){j.clk=j.clk_x=j.clk_y=null},100)}g.fn.ajaxFormUnbind=function(){return this.off("submit.form-plugin click.form-plugin")};g.fn.formToArray=function(p,s,A){var B=[];if(this.length===0){return B}var l=this[0];var C=this.attr("id");var m=(p||typeof l.elements==="undefined")?l.getElementsByTagName("*"):l.elements;var z;if(m){m=g.makeArray(m)}if(C&&(p||/(Edge|Trident)\//.test(navigator.userAgent))){z=g(':input[form="'+C+'"]').get();if(z.length){m=(m||[]).concat(z)}}if(!m||!m.length){return B}if(g.isFunction(A)){m=g.map(m,A)}var y,w,u,r,k,x,t;for(y=0,x=m.length;y<x;y++){k=m[y];u=k.name;if(!u||k.disabled){continue}if(p&&l.clk&&k.type==="image"){if(l.clk===k){B.push({name:u,value:g(k).val(),type:k.type});B.push({name:u+".x",value:l.clk_x},{name:u+".y",value:l.clk_y})}continue}r=g.fieldValue(k,true);if(r&&r.constructor===Array){if(s){s.push(k)}for(w=0,t=r.length;w<t;w++){B.push({name:u,value:r[w]})}}else{if(c.fileapi&&k.type==="file"){if(s){s.push(k)}var o=k.files;if(o.length){for(w=0;w<o.length;w++){B.push({name:u,value:o[w],type:k.type})}}else{B.push({name:u,value:"",type:k.type})}}else{if(r!==null&&typeof r!=="undefined"){if(s){s.push(k)}B.push({name:u,value:r,type:k.type,required:k.required})}}}}if(!p&&l.clk){var h=g(l.clk),q=h[0];u=q.name;if(u&&!q.disabled&&q.type==="image"){B.push({name:u,value:h.val()});B.push({name:u+".x",value:l.clk_x},{name:u+".y",value:l.clk_y})}}return B};g.fn.formSerialize=function(h){return g.param(this.formToArray(h))};g.fn.fieldSerialize=function(i){var h=[];this.each(function(){var m=this.name;if(!m){return}var k=g.fieldValue(this,i);if(k&&k.constructor===Array){for(var l=0,j=k.length;l<j;l++){h.push({name:m,value:k[l]})}}else{if(k!==null&&typeof k!=="undefined"){h.push({name:this.name,value:k})}}});return g.param(h)};g.fn.fieldValue=function(n){for(var m=[],k=0,h=this.length;k<h;k++){var l=this[k];var j=g.fieldValue(l,n);if(j===null||typeof j==="undefined"||(j.constructor===Array&&!j.length)){continue}if(j.constructor===Array){g.merge(m,j)}else{m.push(j)}}return m};g.fieldValue=function(h,p){var k=h.name,w=h.type,x=h.tagName.toLowerCase();if(typeof p==="undefined"){p=true}if(p&&(!k||h.disabled||w==="reset"||w==="button"||(w==="checkbox"||w==="radio")&&!h.checked||(w==="submit"||w==="image")&&h.form&&h.form.clk!==h||x==="select"&&h.selectedIndex===-1)){return null}if(x==="select"){var q=h.selectedIndex;if(q<0){return null}var s=[],j=h.options;var m=(w==="select-one");var r=(m?q+1:j.length);for(var l=(m?q:0);l<r;l++){var o=j[l];if(o.selected&&!o.disabled){var u=o.value;if(!u){u=(o.attributes&&o.attributes.value&&!(o.attributes.value.specified))?o.text:o.value}if(m){return u}s.push(u)}}return s}return g(h).val().replace(f,"\r\n")};g.fn.clearForm=function(h){return this.each(function(){g("input,select,textarea",this).clearFields(h)})};g.fn.clearFields=g.fn.clearInputs=function(h){var i=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var k=this.type,j=this.tagName.toLowerCase();if(i.test(k)||j==="textarea"){this.value=""}else{if(k==="checkbox"||k==="radio"){this.checked=false}else{if(j==="select"){this.selectedIndex=-1}else{if(k==="file"){if(/MSIE/.test(navigator.userAgent)){g(this).replaceWith(g(this).clone(true))}else{g(this).val("")}}else{if(h){if((h===true&&/hidden/.test(k))||(typeof h==="string"&&g(this).is(h))){this.value=""}}}}}}})};g.fn.resetForm=function(){return this.each(function(){var j=g(this);var i=this.tagName.toLowerCase();switch(i){case"input":this.checked=this.defaultChecked;case"textarea":this.value=this.defaultValue;return true;case"option":case"optgroup":var h=j.parents("select");if(h.length&&h[0].multiple){if(i==="option"){this.selected=this.defaultSelected}else{j.find("option").resetForm()}}else{h.resetForm()}return true;case"select":j.find("option").each(function(m){this.selected=this.defaultSelected;if(this.defaultSelected&&!j[0].multiple){j[0].selectedIndex=m;return false}});return true;case"label":var k=g(j.attr("for"));var l=j.find("input,select,textarea");if(k[0]){l.unshift(k[0])}l.resetForm();return true;case"form":if(typeof this.reset==="function"||(typeof this.reset==="object"&&!this.reset.nodeType)){this.reset()}return true;default:j.find("form,input,label,select,textarea").resetForm();return true}})};g.fn.enable=function(h){if(typeof h==="undefined"){h=true}return this.each(function(){this.disabled=!h})};g.fn.selected=function(h){if(typeof h==="undefined"){h=true}return this.each(function(){var i=this.type;if(i==="checkbox"||i==="radio"){this.checked=h}else{if(this.tagName.toLowerCase()==="option"){var j=g(this).parent("select");if(h&&j[0]&&j[0].type==="select-one"){j.find("option").selected(false)}this.selected=h}}})};g.fn.ajaxSubmit.debug=false;function d(){if(!g.fn.ajaxSubmit.debug){return}var h="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(h)}else{if(window.opera&&window.opera.postError){window.opera.postError(h)}}}}));