redux-form-validators
Version:
Simple validations with redux-form / react-final-form
1 lines • 20.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ReduxFormValidators=t():e.ReduxFormValidators=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r={absence:{id:"form.errors.absence",defaultMessage:"must be blank"},acceptance:{id:"form.errors.acceptance",defaultMessage:"must be accepted"},confirmation:{id:"form.errors.confirmation",defaultMessage:"doesn't match `{fieldLabel}`"},dateFormat:{id:"form.errors.dateFormat",defaultMessage:"expected format: {format}"},dateInvalid:{id:"form.errors.dateInvalid",defaultMessage:"is not a valid date"},dateRange:{id:"form.errors.dateRange",defaultMessage:"shoud be {op} {date}"},email:{id:"form.errors.email",defaultMessage:"is not a valid email"},emailDomain:{id:"form.errors.emailDomain",defaultMessage:"{domain} is not an accepted domain"},equalTo:{id:"form.errors.equalTo",defaultMessage:"must be equal to {count, number}"},even:{id:"form.errors.even",defaultMessage:"must be even"},exclusion:{id:"form.errors.exclusion",defaultMessage:"is reserved"},file:{id:"form.errors.file",defaultMessage:"is not a file"},fileAccept:{id:"form.errors.fileAccept",defaultMessage:"invalid file {count, plural, one {type} other {types ({count})}}"},fileTooBig:{id:"form.errors.fileTooBig",defaultMessage:"{count, plural, one {is} other {{count} files are}} too big (maximum is {count, plural, one {{size}} other {{size} each}})"},fileTooFew:{id:"form.errors.fileTooFew",defaultMessage:"invalid number of files (minimum is {count})"},fileTooMany:{id:"form.errors.fileTooMany",defaultMessage:"invalid number of files (maximum is {count})"},fileTooSmall:{id:"form.errors.fileTooSmall",defaultMessage:"{count, plural, one {is} other {{count} files are}} too small (minimum is {count, plural, one {{size}} other {{size} each}})"},greaterThan:{id:"form.errors.greaterThan",defaultMessage:"must be greater than {count, number}"},greaterThanOrEqualTo:{id:"form.errors.greaterThanOrEqualTo",defaultMessage:"must be greater than or equal to {count, number}"},inclusion:{id:"form.errors.inclusion",defaultMessage:"is not included in the list"},invalid:{id:"form.errors.invalid",defaultMessage:"is invalid"},lessThan:{id:"form.errors.lessThan",defaultMessage:"must be less than {count, number}"},lessThanOrEqualTo:{id:"form.errors.lessThanOrEqualTo",defaultMessage:"must be less than or equal to {count, number}"},notAnInteger:{id:"form.errors.notAnInteger",defaultMessage:"is not an integer"},notANumber:{id:"form.errors.notANumber",defaultMessage:"is not a number"},odd:{id:"form.errors.odd",defaultMessage:"must be odd"},otherThan:{id:"form.errors.otherThan",defaultMessage:"must be other than {count, number}"},presence:{id:"form.errors.presence",defaultMessage:"is required"},tooLong:{id:"form.errors.tooLong",defaultMessage:"is too long (maximum is {count, number} {count, plural, one {character} other {characters}})"},tooShort:{id:"form.errors.tooShort",defaultMessage:"is too short (minimum is {count, number} {count, plural, one {character} other {characters}})"},url:{id:"form.errors.url",defaultMessage:"is not a valid URL"},wrongLength:{id:"form.errors.wrongLength",defaultMessage:"is the wrong length (should be {count, number} {count, plural, one {character} other {characters}})"}},a={formatMessage:function(e){e.props&&(e=e.props);var t=e.defaultMessage||e.id||"",n=a.pluralRules;return e.values?i(t,function(t){var r=t.split(","),a=e.values[r[0]];if(r.length<=2)return null==a?"":""+a;var o=r.slice(2).join(",").trim(),u={},l=i(o,null,n[+a]||"other",u);return u.found?l:i(o,null,"other",{})}):t},formatSize:function(e,t){return e+" "+t},defaultOptions:{memoize:!0,allowBlank:!1,urlProtocols:["http","https"],dateFormat:"yyyy-mm-dd",dateYmd:"ymd",accept:["1","true"],caseSensitive:!0},messages:r,pluralRules:{0:"zero",1:"one"}},o=a;function i(e,t,n,r){var a=e.indexOf("{");if(a<0)return n?"":e;for(var o=a,u=1,l=e.length;u>0&&o<l;)++o,"{"===e.charAt(o)&&++u,"}"===e.charAt(o)&&--u;return n?n===e.slice(0,a).trim()?(r.found=!0,e.slice(a+1,o).trim()):i(e.slice(o+1),null,n,r):e.slice(0,a)+i(t(e.slice(a+1,o).trim()),t)+i(e.slice(o+1),t)}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l={}.hasOwnProperty,s={}.toString,f=/([.+?^=!:${}()|[\]\/\\])/g,c=/\*/g;function d(e){return new RegExp("^"+e.replace(f,"\\$1").replace(c,".*")+"$","i")}function m(e,t,n,r){return function(a){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(a&&"object"===u(a)||(a=null==a?"":""+a,(null!=n?!n:!o.defaultOptions.allowBlank)||a.trim())){for(var l=arguments.length,s=new Array(l>2?l-2:0),f=2;f<l;f++)s[f-2]=arguments[f];return"function"==typeof e&&!e.apply(void 0,[i,a].concat(s))||"function"==typeof t&&t.apply(void 0,[i,a].concat(s))?void 0:r.apply(void 0,[a,i].concat(s))}}}var g=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)},h=Object.assign||function(e){for(var t=1,n=arguments.length;t<n;++t){var r=arguments[t];if(null!=r)for(var a in r)l.call(r,a)&&(e[a]=r[a])}return e};function p(e,t){return v(e)?+e:arguments.length>1&&v(t)?+t:null}function v(e){return!isNaN(e)&&(0!=e||""!==(""+e).trim())}function M(e){return"object"===u(e)&&"[object Object]"===s.call(e)&&null!==e}function y(e,t){if("function"==typeof e.getIn)return e.getIn(t);for(var n=0,r=t.length;n<r;++n)e=(e||{})[t[n]];return e}function b(e,t){var n=arguments,r=n.length-1,a=n[r];if("string"==typeof a&&(a=void 0,++r),null==e)return x(t,a);l.call(e,"props")&&S(e)&&(e=e.props);for(var o=r-1;o>=1;--o)if(null!=e[n[o]]){e=e[n[o]];break}return M(e)?l.call(e,"id")||l.call(e,"defaultMessage")?h({},e,{values:a}):x(t,a):{id:e,defaultMessage:e,values:a}}function w(e){return null==e?null:M(e)?e:{id:e,defaultMessage:e}}function T(e){return e.cache={},function(t){var n=t?t.memoize:null;if(null==n&&(n=o.defaultOptions.memoize),null!=n&&!n)return e(t);var r="function"==typeof n?n(t,O):O(t);return l.call(e.cache,r)?e.cache[r]:e.cache[r]=e(t)}}function x(e,t){var n=o.messages[e];return"string"==typeof n?{defaultMessage:n,values:t}:h({},n,{values:t})}function O(e){var t,n=[];for(var r in e)l.call(e,r)&&(t=e[r],n.push(r,S(t)?O(t.props):M(t)?O(t):t.toString()));return JSON.stringify(n)}function S(e){return"object"===u(e)&&null!==e&&"$$typeof"in e}var z=T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.message,n=e.msg,r=e.accept,a=e.minSize,i=e.maxSize,u=e.minFiles,l=e.maxFiles,s=e.if,f=e.unless,c=e.allowBlank;n=n||t,u=p(u),(l=p(l))<0&&(l=null),null===u&&(u=1),r="string"==typeof r&&r.trim()?r.trim().toLowerCase().split(",").map(function(e){return"."===(e=e.trim()).charAt(0)||e.indexOf("*")<0?e:d(e)}):null;var g=null!=a?L(a):null,h=null!=i?L(i):null;return m(s,f,!1,function(e){var t=F(e);if(!((null!=c?c:o.defaultOptions.allowBlank)&&("string"==typeof e?""===e.trim():t&&0===e.length))){if(!t)return o.formatMessage(b(n,"file"));if(isNaN(e.length)&&(e=[e]),e.length<u)return o.formatMessage(b(n,"fileTooFew","tooFew","minFiles",{count:u}));if(null!==l&&e.length>l)return o.formatMessage(b(n,"fileTooMany","tooMany","maxFiles",{count:l}));for(var s,f,d,m=[],p=[],v=[],M=function(t,n,a,o,i){var u;a=e[t],r&&(o=a.type||"",u=a.name||"",i=u.slice(1+(u.lastIndexOf(".")-1>>>0)).toLowerCase(),r.some(function(e){return s=a,f=o,d=i,"string"==typeof e?e===("."===e.charAt(0)?i:o):e.test(o)})||m.push(a)),null!=g&&a.size<g&&p.push(a),null!=h&&a.size>h&&v.push(a),s=a,f=o,d=i},y=0,w=e.length;y<w;++y)M(y,0,s,f,d);if(m.length)return o.formatMessage(b(n,"fileAccept","accept",{files:m,count:m.length}));if(p.length){var T=A(a);return o.formatMessage(b(n,"fileTooSmall","tooSmall","minSize",{files:p,count:p.length,size:o.formatSize(T[1],T[2]||"B")}))}if(v.length){var x=A(i);return o.formatMessage(b(n,"fileTooBig","tooBig","maxSize",{files:v,count:v.length,size:o.formatSize(x[1],x[2]||"B")}))}}})});function F(e){if("undefined"!=typeof FileList&&e instanceof FileList||"undefined"!=typeof File&&(e instanceof File||e[0]instanceof File))return!0;var t=s.call(e);return"[object FileList]"===t||"[object File]"===t||"[object File]"===s.call(e[0])}var j=/^([\d\.]+)\s*([KMGTPE]?B)?$/,B={B:1,KB:1024,MB:1048576,GB:1073741824,TB:1099511627776,PB:0x4000000000000,EB:0x1000000000000000};function A(e){return j.exec((""+e).trim())}function L(e){var t=A(e);return t?t[1]*(B[t[2]]||1):("undefined"!=typeof console&&console.error('file validator: size "'.concat(e,'" unknown')),null)}var N=T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.message,n=e.msg,r=e.if,a=e.unless;return n=n||t,m(r,a,!1,function(e){if("string"==typeof e?e.trim():F(e)&&!isNaN(e.length)?e.length:e)return o.formatMessage(b(n,"absence"))})}),R=T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.accept,n=e.message,r=e.msg,a=e.if,i=e.unless;return r=r||n,m(a,i,!1,function(e){if([].concat(t||o.defaultOptions.accept).map(String).indexOf(e)<0)return o.formatMessage(b(r,"acceptance"))})});function E(e){var t=e.validator,n=e.defaultMessage,a=e.defaultMsg;return a=w(a||n)||r.invalid,T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=w(e.msg||e.message)||a;return m(e.if,e.unless,e.allowBlank,function(){for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];var u=t.apply(void 0,[e].concat(a));return"boolean"!=typeof u?u?o.formatMessage(u):null:u?void 0:o.formatMessage(n)})})}var q=T(function(e){var t=e.field,n=e.fieldLabel,r=e.caseSensitive,a=e.message,i=e.msg,u=e.if,l=e.unless;i=i||a;var s=t.split(".");return n=n||s[s.length-1],m(u,l,!1,function(e,t){var a=""+(y(t,s)||"");if((null!=r?r:o.defaultOptions.caseSensitive)?e!==a:e.toLowerCase()!==a.toLowerCase())return o.formatMessage(b(i,"confirmation",{fieldLabel:n}))})}),D={y:function(e){return e.getFullYear()},m:function(e){return e.getMonth()+1},d:function(e){return e.getDate()}},k=/(y+|m+|d+)/g,I={}.toString,_=T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=e.ymd,r=e["="],a=e["!="],i=e[">"],u=e[">="],l=e["<"],s=e["<="],f=e.message,c=e.msg,d=e.if,g=e.unless,h=e.allowBlank;return c=c||f,m(d,g,h,function(e){var f=G(t,n),d=V(e,f,!1);if("wrongFormat"===d)return o.formatMessage(b(c,"dateFormat","format",{format:t}));if("invalid"===d)return o.formatMessage(b(c,"dateInvalid","invalid"));if(d){var m;if(r&&+d!=+(m=C(r)))return o.formatMessage(b(c,"dateRange","range","=",$("=",m,f)));if(a&&+d==+(m=C(a)))return o.formatMessage(b(c,"dateRange","range","!=",$("!=",m,f)));if(i&&d<=(m=C(i)))return o.formatMessage(b(c,"dateRange","range",">",$(">",m,f)));if(u&&d<(m=C(u)))return o.formatMessage(b(c,"dateRange","range",">=",$(">=",m,f)));if(l&&d>=(m=C(l)))return o.formatMessage(b(c,"dateRange","range","<",$("<",m,f)));if(s&&d>(m=C(s)))return o.formatMessage(b(c,"dateRange","range","<=",$("<=",m,f)))}})});_.parseDate=function(e,t,n){return V(e,G(t,n),!0)},_.formatDate=function(e,t,n){if(!(e instanceof Date)&&"[object Date]"!==I.call(e))return null;var r=new Date(e).getTime();return r!=r?null:Y(e,G(t,n))};var P=_;function $(e,t,n){return{op:e,date:Y(t,n),dateObject:t}}function C(e){if("function"==typeof e)return new Date(+e());if(isNaN(e)&&"today"===(""+e).toLowerCase()){var t=new Date;return t.setHours(0,0,0,0),t}return new Date(+e)}function Y(e,t){return t.replace(k,function(t){var n,r,a=t.charAt(0),o=t.length,i=(n=D[a](e),r=o,"0".repeat(Math.max(0,r-(""+n).length))+n);return"y"===a?i.slice(i.length-o,i.length):i})}function G(e,t){if(null==e&&(e=o.defaultOptions.dateFormat),t||(t=o.defaultOptions.dateYmd),!t||"ymd"===t)return e;var n={};return n[t.charAt(0)]="y",n[t.charAt(1)]="m",n[t.charAt(2)]="d",e.replace(new RegExp("[".concat(t,"]"),"g"),function(e){return n[e]})}function V(e,t,n){var r,a=[],o=new RegExp("^"+t.replace(k,function(e){return a.push(e.charAt(0)),"([0-9]{".concat(e.length,"})")})+"$"),i=e.match(o);if(i){var u={};a.forEach(function(e,t){u[e]=+i[t+1]});var l=null!=u.y&&(null!=u.m||null==u.d);(u=h({y:1970,m:1,d:1},u)).y<100&&(u.y=100*(r=u.y>=69?-1:0,g((new Date).getFullYear()/100)+r)+u.y);var s=new Date(u.y,u.m-1,u.d);return function(e,t){var n=[e.getFullYear(),e.getMonth()+1,e.getDate()],r=n[1],a=n[2];return n[0]===t.y&&r===t.m&&a===t.d}(s,u)?l||n?s:null:n?new Date(NaN):"invalid"}return n?new Date(NaN):"wrongFormat"}var K=/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@((?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)$/i,U=T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.domainWhitelist,n=e.domainBlacklist,r=e.message,a=e.msg,i=e.if,u=e.unless,l=e.allowBlank;return a=a||r,t=W(t),n=W(n),m(i,u,l,function(e){var r=e.match(K);if(!r)return o.formatMessage(b(a,"email","invalid"));var i=r[1].toLowerCase();return t&&!J(i,t)||n&&J(i,n)?o.formatMessage(b(a,"emailDomain","domain",{domain:i})):void 0})});U.REG_EMAIL=K;var H=U;function J(e,t){return t.some(function(t){return"string"==typeof t?t===e:t.test(e)})}function W(e){return e?e.map(function(e){return e.indexOf("*")<0?e.toLowerCase():d(e)}):e}var Q=T(function(e){var t=e.with,n=e.without,r=e.message,a=e.msg,i=e.if,u=e.unless,l=e.allowBlank;return a=a||r,m(i,u,l,function(e){if(t&&!e.match(t)||n&&e.match(n))return o.formatMessage(b(a,"invalid"))})}),X=T(function(e){return Z(!0,e)});function Z(e,t){var n=t.in,r=t.within,a=t.caseSensitive,i=t.message,u=t.msg,l=t.if,s=t.unless,f=t.allowBlank;return u=u||i,r=[].concat(r||n).map(function(e){return""+e}),m(l,s,f,function(t){var n=null!=a?a:o.defaultOptions.caseSensitive,i=r;if(n||(t=t.toLowerCase(),i=i.map(function(e){return e.toLowerCase()})),e){if(i.indexOf(t)<0)return o.formatMessage(b(u,"inclusion"))}else if(i.indexOf(t)>=0)return o.formatMessage(b(u,"exclusion"))})}var ee=T(function(e){return Z(!1,e)}),te=T(function(e){var t=e["="],n=e.is,r=e.max,a=e.maximum,i=e.min,u=e.minimum,l=e.in,s=e.within,f=e.message,c=e.msg,d=e.if,g=e.unless,h=e.allowBlank;return c=c||f,t=p(t,n),i=p(i,u),r=p(r,a),(l=l||s)&&v(l[0])&&v(l[1])&&(i=l[0],r=l[1]),m(d,g,h,function(e){return null!==t&&e.length!==t?o.formatMessage(b(c,"wrongLength","is","=",{count:t})):null!==r&&e.length>r?o.formatMessage(b(c,"tooLong","maximum","max",{count:r})):null!==i&&e.length<i?o.formatMessage(b(c,"tooShort","minimum","min",{count:i})):void 0})}),ne=T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.int,n=e.integer,r=e.even,a=e.odd,i=e["="],u=e.equalTo,l=e["!="],s=e.otherThan,f=e[">"],c=e.greaterThan,d=e["<"],h=e.lessThan,M=e[">="],y=e.greaterThanOrEqualTo,w=e["<="],T=e.lessThanOrEqualTo,x=e.message,O=e.msg,S=e.if,z=e.unless,F=e.allowBlank;return O=O||x,t=t||n,i=p(i,u),l=p(l,s),f=p(f,c),M=p(M,y),d=p(d,h),w=p(w,T),m(S,z,F,function(e){return v(e)?t&&+e%1?o.formatMessage(b(O,"notAnInteger","int")):null!==i&&+e!==i?o.formatMessage(b(O,"equalTo","=",{count:i})):null!==l&&+e===l?o.formatMessage(b(O,"otherThan","!=",{count:l})):null!==f&&+e<=f?o.formatMessage(b(O,"greaterThan",">",{count:f})):null!==M&&+e<M?o.formatMessage(b(O,"greaterThanOrEqualTo",">=",{count:M})):null!==d&&+e>=d?o.formatMessage(b(O,"lessThan","<",{count:d})):null!==w&&+e>w?o.formatMessage(b(O,"lessThanOrEqualTo","<=",{count:w})):r&&g(+e)%2?o.formatMessage(b(O,"even")):!a||g(+e)%2?void 0:o.formatMessage(b(O,"odd")):o.formatMessage(b(O,"notANumber","NaN"))})}),re=T(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.message,n=e.msg,r=e.if,a=e.unless;return n=n||t,m(r,a,!1,function(e){if("string"==typeof e?!e.trim():F(e)&&!isNaN(e.length)?!e.length:!e)return o.formatMessage(b(n,"presence"))})}),ae="(?:\\S+(?::\\S*)?@)?",oe="(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0)\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0)",ie="\\[(?:"+["(?:[\\da-f]{1,4}:){7,7}[\\da-f]{1,4}","(?:[\\da-f]{1,4}:){1,4}:"+oe,"::(?:ffff(?::0{1,4}){0,1}:){0,1}"+oe,"[\\da-f]{1,4}:(?:(?::[\\da-f]{1,4}){1,6})","(?:[\\da-f]{1,4}:){1,2}(?::[\\da-f]{1,4}){1,5}","(?:[\\da-f]{1,4}:){1,3}(?::[\\da-f]{1,4}){1,4}","(?:[\\da-f]{1,4}:){1,4}(?::[\\da-f]{1,4}){1,3}","(?:[\\da-f]{1,4}:){1,5}(?::[\\da-f]{1,4}){1,2}","(?:[\\da-f]{1,4}:){1,6}:[\\da-f]{1,4}","(?:[\\da-f]{1,4}:){1,7}:",":(?:(?::[\\da-f]{1,4}){1,7}|:)"].join("|")+")\\]",ue="(?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?)",le="(?::\\d{2,5})?",se="(?:[/][^\\s?#]*)?",fe="(?:[?][^\\s#]*)?",ce="(?:[#]\\S*)?",de={emptyProtocol:!0,protocolIdentifier:!0,basicAuth:!0,local:!0,ipv4:!0,ipv6:!0,host:!0,port:!0,path:!0,search:!0,hash:!0},me=/:?\/\/$/,ge=["protocol","ipv4","host","path","search","hash"];var he,pe,ve=(he=function(e){return we(ye(e),!1)},pe="url",T(function(e){var t=(e=e||{}).msg||e.message;return m(e.if,e.unless,e.allowBlank,function(n){if(!n.match(he(e)))return o.formatMessage(b(t,pe))})}));ve.parseURL=function(e,t){t=ye(t);var n=e.match(we(t,!0));if(!n)return null;var r=1,a={protocol:n[r++].replace(me,"")};if(t.basicAuth){var o=n[r++];if(o){var i=o.slice(0,-1).split(":"),u=i.shift();a.basicAuth={username:u,password:i.length?i.join(":"):void 0}}}if(t.ipv4&&(a.ipv4=n[r++]),t.ipv6){var l=n[r++];l&&(a.ipv6=l.slice(1,-1))}if(t.host&&(a.host=n[r++]),t.local&&(a.host=n[r++]||a.host),t.port){var s=n[r++];s&&(a.port=+s.slice(1))}return t.path&&(a.path=n[r++]),t.search&&(a.search=n[r++]),t.hash&&(a.hash=n[r++]),ge.forEach(function(e){a[e]||delete a[e]}),a};var Me=ve;function ye(e){return(e=h({},de,e)).protocols=[].concat(e.protocol||e.protocols||o.defaultOptions.urlProtocols).join("|"),e}function be(e,t,n){return e?n?"(".concat(t,")"):t:""}function we(e,t){return new RegExp("^"+be(!0,"(?:(?:(?:".concat(e.protocols,"):)").concat(e.emptyProtocol?"?":"","\\/\\/)").concat(e.protocolIdentifier?"":"?"),t)+be(e.basicAuth,ae,t)+"(?:".concat([be(e.ipv4,oe,t),be(e.ipv6,ie,t),be(e.host,ue,t),be(e.local,"localhost",t)].filter(function(e){return e}).join("|"),")")+be(e.port,le,t)+be(e.path,se,t)+be(e.search,fe,t)+be(e.hash,ce,t)+"$","i")}var Te={},xe=0;function Oe(){var e=arguments;if(!o.defaultOptions.memoize)return Se(e);for(var t=[],n=0,r=e.length;n<r;++n)t.push(e[n]._validatorId||(e[n]._validatorId=++xe));var a=t.sort().join("-");return l.call(Te,a)?Te[a]:Te[a]=Se(e)}function Se(e){return function(){for(var t,n=0,r=e.length;n<r;++n)if(t=e[n].apply(null,arguments))return t}}function ze(e){return function(){return function e(t,n,r){var a={};for(var o in t)if(l.call(t,o)&&t[o]){var i=r?r.concat(o):[o];a[o]=M(t[o])?e(t[o],n,i):Se([].concat(t[o])).apply(null,[].concat(y(n[0],i),n))}return a}(e,arguments)}}n.d(t,"required",function(){return Fe}),n.d(t,"absence",function(){return N}),n.d(t,"acceptance",function(){return R}),n.d(t,"addValidator",function(){return E}),n.d(t,"confirmation",function(){return q}),n.d(t,"date",function(){return P}),n.d(t,"email",function(){return H}),n.d(t,"exclusion",function(){return ee}),n.d(t,"file",function(){return z}),n.d(t,"format",function(){return Q}),n.d(t,"inclusion",function(){return X}),n.d(t,"length",function(){return te}),n.d(t,"numericality",function(){return ne}),n.d(t,"presence",function(){return re}),n.d(t,"url",function(){return Me}),n.d(t,"combine",function(){return Oe}),n.d(t,"validateForm",function(){return ze});var Fe=re;t.default=o}])});