/*!
-
Parsley.js
-
Version 2.6.5 - built Fri, Feb 24th 2017, 3:50 pm
-
Guillaume Potier - <guillaume@wisembly.com>
-
Marc-Andre Lafortune - <petroselinum@marc-andre.ca>
-
MIT Licensed
*/ function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t
* inputevent - Alleviate browser bugs for input events * https://github.com/marcandre/inputevent * @version v0.0.3 - (built Thu, Apr 14th 2016, 5:58 pm) * @author Marc-Andre Lafortune <github@marc-andre.ca> * @license MIT */
function n(){var t=this,i=window||global;e.extend(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger(“input”)},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on(“change.inputevent”,i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off(“input.inputevent”,i.data.selector,t.behavesOk).off(“change.inputevent”,i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched=“0.0.3”;for(var n=[“select”,‘input','input','input'],r=0;r<n.length;r++){var s=n;e(document).on(“input.inputevent”,s,{selector:s},t.behavesOk).on(“change.inputevent”,s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(“.inputevent”)}})}var r=1,s={},a={attr:function(e,t,i){var n,r,s,a=new RegExp(“^”+t,“i”);if(“undefined”==typeof i)i={};else for(n in i)i.hasOwnProperty(n)&&delete i;if(“undefined”==typeof e||“undefined”==typeof e)return i;for(s=e.attributes,n=s.length;n–;)r=s,r&&r.specified&&a.test(r.name)&&(i=this.deserializeValue(r.value));return i},checkAttr:function(e,t,i){return e.is(“”)},setAttr:function(e,t,i,n){e.setAttribute(this.dasherize(t+i),String(n))},generateID:function(){return“”r+
},deserializeValue:function(t){var i;try{return t?“true”==t||“false”!=t&&(“null”==t?null:isNaN(i=Number(t))?/^[/.test(t)?e.parseJSON(t):t:i):t}catch(n){return t}},camelize:function(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():“”})},dasherize:function(e){return e.replace(/::/g,“/”).replace(/(+)([A-Z])/g,“$1_$2”).replace(/()([A-Z])/g,“$1_$2”).replace(/_/g,“-”).toLowerCase()},warn:function(){var e;window.console&&“function”==typeof window.console.warn&&(e=window.console).warn.apply(e,arguments)},warnOnce:function(e){s||(s=!0,this.warn.apply(this,arguments))},_resetWarnings:function(){s={}},trimString:function(e){return e.replace(/^s+|s+$/g,“”)},namespaceEvents:function(t,i){return t=this.trimString(t||“”).split(/s+/),t?e.map(t,function(e){return e+“.”+i}).join(“ ”):“”},difference:function(t,i){var n=[];return e.each(t,function(e,t){i.indexOf(t)==-1&&n.push(t)}),n},all:function(t){return e.when.apply(e,_toConsumableArray(t).concat())},objectCreate:Object.create||function(){var e=function(){};return function(t){if(arguments.length>1)throw Error(“Second argument not supported”);if(“object”!=typeof t)throw TypeError(“Argument must be an object”);e.prototype=t;var i=new e;return e.prototype=null,i}}(),_SubmitSelector:’input, button:submit'},o=a,l={namespace:“data-parsley-”,inputs:“input, textarea, select”,excluded:“input, input, input, input”,priorityEnabled:!0,multiple:null,group:null,uiEnabled:!0,validationThreshold:3,focus:“first”,trigger:!1,triggerAfterFailure:“input”,errorClass:“parsley-error”,successClass:“parsley-success”,classHandler:function(e){},errorsContainer:function(e){},errorsWrapper:'<ul class=“parsley-errors-list”></ul>',errorTemplate:“<li></li>”},u=function(){this.__id__=o.generateID()};u.prototype={asyncSupport:!0,_pipeAccordingToValidationResult:function(){var t=this,i=function(){var i=e.Deferred();return!0!==t.validationResult&&i.reject(),i.resolve().promise()};return},actualizeOptions:function(){return o.attr(this.$element,this.options.namespace,this.domOptions),this.parent&&this.parent.actualizeOptions&&this.parent.actualizeOptions(),this},_resetOptions:function(e){this.domOptions=o.objectCreate(this.parent.options),this.options=o.objectCreate(this.domOptions);for(var t in e)e.hasOwnProperty(t)&&(this.options=e);this.actualizeOptions()},_listeners:null,on:function(e,t){this._listeners=this._listeners||{};var i=this._listeners=this._listeners||[];return i.push(t),this},subscribe:function(t,i){e.listenTo(this,t.toLowerCase(),i)},off:function(e,t){var i=this._listeners&&this._listeners;if(i)if(t)for(var n=i.length;n–;)i===t&&i.splice(n,1);else delete this._listeners;return this},unsubscribe:function(t,i){e.unsubscribeTo(this,t.toLowerCase())},trigger:function(e,t,i){t=t||this;var n,r=this._listeners&&this._listeners;if®for(var s=r.length;s–;)if(n=r.call(t,t,i),n===!1)return n;return!this.parent||this.parent.trigger(e,t,i)},asyncIsValid:function(e,t){return o.warnOnce(“asyncIsValid is deprecated; please use whenValid instead”),this.whenValid({group:e,force:t})},_findRelated:function(){return this.options.multiple?this.parent.$element.find(“[”this.options.namespace
‘multiple=“’this.options.multiple
‘”]'):this.$element}};var d={string:function(e){return e},integer:function(e){if(isNaN(e))throw'Requirement is not an integer: “'e
'”';return parseInt(e,10)},number:function(e){if(isNaN(e))throw'Requirement is not a number: “'e
'”';return parseFloat(e)},reference:function(t){var i=e(t);if(0===i.length)throw'No such reference: “'t
'”';return i},“boolean”:function(e){return“false”!==e},object:function(e){return o.deserializeValue(e)},regexp:function(e){var t=“”;return/^/.*/(?:*)$/.test(e)?(t=e.replace(/.*/(*)$/,“$1”),e=e.replace(new RegExp(“^/(.*?)/”t
“$”),“$1”)):e=“^”e
“$”,new RegExp(e,t)}},h=function(e,t){var i=e.match(/^s*s*$/);if(!i)throw'Requirement is not an array: “'e
'”';var n=i.split(“,”).map(o.trimString);if(n.length!==t)throw“Requirement has ”n.length
“ values when ”t
“ are needed”;return n},p=function(e,t){var i=d;if(!i)throw'Unknown requirement specification: “'e
'”';return i(t)},c=function(e,t,i){var n=null,r={};for(var s in e)if(s){var a=i(s);“string”==typeof a&&(a=p(e,a)),r=a}else n=p(e,t);return},f=function(t){e.extend(!0,this,t)};f.prototype={validate:function(t,i){if(this.fn)return arguments.length>3&&(i=[].slice.call(arguments,1,-1)),this.fn(t,i);if(e.isArray(t)){if(!this.validateMultiple)throw“Validator `”this.name
“` does not handle multiple values”;return this.validateMultiple.apply(this,arguments)}if(this.validateNumber)return!isNaN(t)&&(arguments=parseFloat(arguments),this.validateNumber.apply(this,arguments));if(this.validateString)return this.validateString.apply(this,arguments);throw“Validator `”this.name
“` only handles multiple values”},parseRequirements:function(t,i){if(“string”!=typeof t)return e.isArray(t)?t:;var n=this.requirementType;if(e.isArray(n)){for(var r=h(t,n.length),s=0;se
'” is already defined.');else if(l.hasOwnProperty(e))return void o.warn('“'e
'” is a restricted keyword and is not a valid validator name.');return this._setValidator.apply(this,arguments)},updateValidator:function(e,t,i){return this.validators?this._setValidator.apply(this,arguments):(o.warn('Validator “'e
'” is not already defined.'),this.addValidator.apply(this,arguments))},removeValidator:function(e){return this.validators||o.warn('Validator “'e
'” is not defined.'),delete this.validators,this},_setValidator:function(e,t,i){“object”!=typeof t&&(t={fn:t,priority:i}),t.validate||(t=new f(t)),this.validators=t;for(var n in t.messages||{})this.addMessage(n,e,t.messages);return this},getErrorMessage:function(e){var t;if(“type”===e.name){var i=this.catalog[e.name]||{};t=i}else t=this.formatMessage(this.catalog[e.name],e.requirements);return t||this.catalog.defaultMessage||this.catalog.en.defaultMessage},formatMessage:function(e,t){if(“object”==typeof t){for(var i in t)e=this.formatMessage(e,t);return e}return“string”==typeof e?e.replace(/%s/i,t):“”},validators:{notblank:{validateString:function(e){return/S/.test(e)},priority:2},required:{validateMultiple:function(e){return e.length>0},validateString:function(e){return/S/.test(e)},priority:512},type:{validateString:function(e,t){var i=arguments.length<=2||void 0===arguments?{}:arguments,n=i.step,r=void 0===n?“any”:n,s=i.base,a=void 0===s?0:s,o=g;if(!o)throw new Error(“validator type `”t
“` is not supported”);if(!o.test(e))return!1;if(“number”===t&&!/^any$/i.test(r||“”)){var l=Number(e),u=Math.max(v®,v(a));if(v(l)>u)return!1;var d=function(e){return Math.round(e*Math.pow(10,u))};if((d(l)-d(a))%d®!=0)return!1}return!0},requirementType:{“”:“string”,step:“string”,base:“number”},priority:256},pattern:{validateString:function(e,t){return t.test(e)},requirementType:“regexp”,priority:64},minlength:{validateString:function(e,t){return e.length>=t},requirementType:“integer”,priority:30},maxlength:{validateString:function(e,t){return e.length<=t},requirementType:“integer”,priority:30},length:{validateString:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:,priority:30},mincheck:{validateMultiple:function(e,t){return e.length>=t},requirementType:“integer”,priority:30},maxcheck:{validateMultiple:function(e,t){return e.length<=t},requirementType:“integer”,priority:30},check:{validateMultiple:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:,priority:30},min:{validateNumber:function(e,t){return e>=t},requirementType:“number”,priority:30},max:{validateNumber:function(e,t){return e<=t},requirementType:“number”,priority:30},range:{validateNumber:function(e,t,i){return e>=t&&e<=i},requirementType:,priority:30},equalto:{validateString:function(t,i){var n=e(i);return n.length?t===n.val():t===i},priority:256}}};var y={},_=function k(e,t,i){for(var n=[],r=,s=0;s<e.length;s++){for(var a=!1,o=0;othis.options.errorsContainer
“` does not exist in DOM”)}else“function”==typeof this.options.errorsContainer&&(t=this.options.errorsContainer.call(this,this));return“undefined”!=typeof t&&t.length?t.append(this._ui.$errorsWrapper):this._inputHolder().after(this._ui.$errorsWrapper)},_actualizeTriggers:function(){var e,t=this,i=this._findRelated();i.off(“.Parsley”),this._failedOnce?i.on(o.namespaceEvents(this.options.triggerAfterFailure,“Parsley”),function(){t._validateIfNeeded()}):(e=o.namespaceEvents(this.options.trigger,“Parsley”))&&i.on(e,function(e){t._validateIfNeeded(e)})},_validateIfNeeded:function(e){var t=this;e&&/key|input/.test(e.type)&&(!this._ui||!this._ui.validationInformationVisible)&&this.getValue().length<=this.options.validationThreshold||(this.options.debounce?(window.clearTimeout(this._debounced),this._debounced=window.setTimeout(function(){return t.validate()},this.options.debounce)):this.validate())},_resetUI:function(){this._failedOnce=!1,this._actualizeTriggers(),“undefined”!=typeof this._ui&&(this._ui.$errorsWrapper.removeClass(“filled”).children().remove(),this._resetClass(),this._ui.lastValidationResult=[],this._ui.validationInformationVisible=!1)},_destroyUI:function(){this._resetUI(),“undefined”!=typeof this._ui&&this._ui.$errorsWrapper.remove(),delete this._ui},_successClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass)},_errorClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass)},_resetClass:function(){this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass)}};var w=function(t,i,n){this.__class__=“ParsleyForm”,this.$element=e(t),this.domOptions=i,this.options=n,this.parent=window.Parsley,this.fields=[],this.validationResult=null},b={pending:null,resolved:!0,rejected:!1};w.prototype={onSubmitValidate:function(e){var t=this;if(!0!==e.parsley){var i=this._$submitSource||this.$element.find(o._SubmitSelector).first();if(this._$submitSource=null,this.$element.find(“.parsley-synthetic-submit-button”).prop(“disabled”,!0),!i.is(“”)){var n=this.whenValidate({event:e});“resolved”===n.state()&&!1!==this._trigger(“submit”)||(e.stopImmediatePropagation(),e.preventDefault(),“pending”===n.state()&&n.done(function(){t._submit(i)}))}}},onSubmitButton:function(t){this._$submitSource=e(t.currentTarget)},_submit:function(t){if(!1!==this._trigger(“submit”)){if(t){var i=this.$element.find(“.parsley-synthetic-submit-button”).prop(“disabled”,!1);0===i.length&&(i=e('<input class=“parsley-synthetic-submit-button” type=“hidden”>').appendTo(this.$element)),i.attr({name:t.attr(“name”),value:t.attr(“value”)})}this.$element.trigger(e.extend(e.Event(“submit”),{parsley:!0}))}},validate:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){o.warnOnce(“Calling validate on a parsley form without passing arguments as an object is deprecated.”);var i=_slice.call(arguments),n=i,r=i,s=i;t={group:n,force:r,event:s}}return b},whenValidate:function(){var t,i=this,n=arguments.length<=0||void 0===arguments?{}:arguments,r=n.group,s=n.force,a=n.event;this.submitEvent=a,a&&(this.submitEvent=e.extend({},a,{preventDefault:function(){o.warnOnce(“Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`”),i.validationResult=!1}})),this.validationResult=!0,this._trigger(“validate”),this._refreshFields();var l=this._withoutReactualizingFormOptions(function(){return e.map(i.fields,function(e){return e.whenValidate({force:s,group:r})})});return(t=o.all(l).done(function(){i._trigger(“success”)}).fail(function(){i.validationResult=!1,i.focus(),i._trigger(“error”)}).always(function(){i._trigger(“validated”)})).pipe.apply(t,_toConsumableArray(this._pipeAccordingToValidationResult()))},isValid:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){o.warnOnce(“Calling isValid on a parsley form without passing arguments as an object is deprecated.”);var i=_slice.call(arguments),n=i,r=i;t={group:n,force:r}}return b},whenValid:function(){var t=this,i=arguments.length<=0||void 0===arguments?{}:arguments,n=i.group,r=i.force;this._refreshFields();var s=this._withoutReactualizingFormOptions(function(){return e.map(t.fields,function(e){return e.whenValid({group:n,force:r})})});return o.all(s)},reset:function(){for(var e=0;et
’”]').each(function(t,i){e(i).is(“input, input”)&&e(i).attr(n.options.namespace+“multiple”,n.options.multiple)});for(var r=this._findRelated(),s=0;s<r.length;s++)if(i=e(r.get(s)).data(“Parsley”),“undefined”!=typeof i){this.$element.data(“ParsleyFieldMultiple”)||i.addElement(this.$element);break}return this.bind(“parsleyField”,!0),i||this.bind(“parsleyFieldMultiple”)},bind:function(t,i){var n;switch(t){case“parsleyForm”:n=e.extend(new w(this.$element,this.domOptions,this.options),new u,window.ParsleyExtend)._bindFields();break;case“parsleyField”:n=e.extend(new E(this.$element,this.domOptions,this.options,this.parent),new u,window.ParsleyExtend);break;case“parsleyFieldMultiple”:n=e.extend(new E(this.$element,this.domOptions,this.options,this.parent),new P,new u,window.ParsleyExtend)._init();break;default:throw new Error(t+“is not a supported Parsley type”)}return this.options.multiple&&o.setAttr(this.$element,this.options.namespace,“multiple”,this.options.multiple),“undefined”!=typeof i?(this.$element.data(“ParsleyFieldMultiple”,n),n):(this.$element.data(“Parsley”,n),n._actualizeTriggers(),n._trigger(“init”),n)}};var M=e.fn.jquery.split(“.”);if(parseInt(M)<=1&&parseInt(M)<8)throw“The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.”;M.forEach||o.warn(“Parsley requires ES5 to run properly. Please include github.com/es-shims/es5-shim”);var O=e.extend(new u,{$element:e(document),actualizeOptions:null,_resetOptions:null,Factory:V,version:“2.6.5”});e.extend(E.prototype,y.Field,u.prototype),e.extend(w.prototype,y.Form,u.prototype),e.extend(V.prototype,u.prototype),e.fn.parsley=e.fn.psly=function(t){if(this.length>1){var i=[];return this.each(function(){i.push(e(this).parsley(t))}),i}return e(this).length?new V(this,t):void o.warn(“You must bind Parsley on an existing element.”)},“undefined”==typeof window.ParsleyExtend&&(window.ParsleyExtend={}),O.options=e.extend(o.objectCreate(l),window.ParsleyConfig),window.ParsleyConfig=O.options,window.Parsley=window.psly=O,window.ParsleyUtils=o;var A=window.Parsley._validatorRegistry=new m(window.ParsleyConfig.validators,window.ParsleyConfig.i18n);window.ParsleyValidator={},e.each(“setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator”.split(“ ”),function(t,i){window.Parsley=e.proxy(A,i),window.ParsleyValidator=function(){var e;return o.warnOnce(“Accessing the method '”i
“' through ParsleyValidator is deprecated. Simply call 'window.Parsley.”i
“(…)‘”),(e=window.Parsley).apply(e,arguments)}}),window.Parsley.UI=y,window.ParsleyUI={removeError:function(e,t,i){var n=!0!==i;return o.warnOnce(“Accessing ParsleyUI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method.”),e.removeError(t,{updateClass:n})},getErrorsMessages:function(e){return o.warnOnce(“Accessing ParsleyUI is deprecated. Call 'getErrorsMessages' on the instance directly.”),e.getErrorsMessages()}},e.each(“addError updateError”.split(“ ”),function(e,t){window.ParsleyUI=function(e,i,n,r,s){var a=!0!==s;return o.warnOnce(“Accessing ParsleyUI is deprecated. Call '”t
“' on the instance directly. Please comment in issue 1073 as to your need to call this method.”),e(i,{message:n,assert:r,updateClass:a})}}),!1!==window.ParsleyConfig.autoBind&&e(function(){e(“”).length&&e(“”).parsley()});var T=e({}),R=function(){o.warnOnce(“Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley”)},I=“parsley:”;e.listen=function(e,n){var r;if(R(),“object”==typeof arguments&&“function”==typeof arguments&&(r=arguments,n=arguments),“function”!=typeof n)throw new Error(“Wrong parameters”);window.Parsley.on(i(e),t(n,r))},e.listenTo=function(e,n,r){if(R(),!(e instanceof E||e instanceof w))throw new Error(“Must give Parsley instance”);if(“string”!=typeof n||“function”!=typeof r)throw new Error(“Wrong parameters”);e.on(i(n),t®)},e.unsubscribe=function(e,t){if(R(),“string”!=typeof e||“function”!=typeof t)throw new Error(“Wrong arguments”);window.Parsley.off(i(e),t.parsleyAdaptedCallback)},e.unsubscribeTo=function(e,t){if(R(),!(e instanceof E||e instanceof w))throw new Error(“Must give Parsley instance”);e.off(i(t))},e.unsubscribeAll=function(t){R(),window.Parsley.off(i(t)),e(“form,input,textarea,select”).each(function(){var n=e(this).data(“Parsley”);n&&n.off(i(t))})},e.emit=function(e,t){var n;R();var r=t instanceof E||t instanceof w,s=Array.prototype.slice.call(arguments,r?2:1);s.unshift(i(e)),r||(t=window.Parsley),(n=t).trigger.apply(n,_toConsumableArray(s))};e.extend(!0,O,{asyncValidators:{“default”:{fn:function(e){return e.status>=200&&e.status<300},url:!1},reverse:{fn:function(e){return e.status<200||e.status>=300},url:!1}},addAsyncValidator:function(e,t,i,n){return O.asyncValidators={fn:t,url:i||!1,options:n||{}},this}}),O.addValidator(“remote”,{requirementType:{“”:“string”,validator:“string”,reverse:“boolean”,options:“object”},validateString:function(t,i,n,r){var s,a,o={},l=n.validator||(!0===n.reverse?“reverse”:“default”);if(“undefined”==typeof O.asyncValidators)throw new Error(“Calling an undefined async validator: `”l
“`”);i=O.asyncValidators.url||i,i.indexOf(“{value}”)>-1?i=i.replace(“{value}”,encodeURIComponent(t)):o=t;var u=e.extend(!0,n.options||{},O.asyncValidators.options);s=e.extend(!0,{},{url:i,data:o,type:“GET”},u),r.trigger(“field:ajaxoptions”,r,s),a=e.param(s),“undefined”==typeof O._remoteCache&&(O._remoteCache={});var d=O._remoteCache=O._remoteCache||e.ajax(s),h=function(){var t=O.asyncValidators.fn.call(r,d,i,n);return t||(t=e.Deferred().reject()),e.when(t)};return d.then(h,h)},priority:-1}),O.on(“form:submit”,function(){O._remoteCache={}}),window.ParsleyExtend.addAsyncValidator=function(){return ParsleyUtils.warnOnce(“Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(…)`”),O.addAsyncValidator.apply(O,arguments)},O.addMessages(“en”,{defaultMessage:“This value seems to be invalid.”,type:{email:“This value should be a valid email.”,url:“This value should be a valid url.”,number:“This value should be a valid number.”,integer:“This value should be a valid integer.”,digits:“This value should be digits.”,alphanum:“This value should be alphanumeric.”},notblank:“This value should not be blank.”,required:“This value is required.”,pattern:“This value seems to be invalid.”,min:“This value should be greater than or equal to %s.”,max:“This value should be lower than or equal to %s.”,range:“This value should be between %s and %s.”,minlength:“This value is too short. It should have %s characters or more.”,maxlength:“This value is too long. It should have %s characters or fewer.”,length:“This value length is invalid. It should be between %s and %s characters long.”,mincheck:“You must select at least %s choices.”,maxcheck:“You must select %s choices or fewer.”,check:“You must select between %s and %s choices.”,equalto:“This value should be the same.”}),O.setLocale(“en”);var D=new n;D.install();var q=O;return q}); //# sourceMappingURL=parsley.min.js.map