/** * validators 0.3.1 - https://github.com/insin/validators * MIT Licensed */ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.validators=t()}}(function(){var t;return function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return o(r?r:e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;sp;p++)d[p]=d[p].replace(/^0+/,""),""===d[p]&&(d[p]="0"),"0"==d[p]?(c+=1,-1==u&&(u=p),c>a&&(a=c,r=u)):(c=0,u=-1);if(a>1){var m=r+a;m==d.length&&d.push(""),d.splice(r,a,""),0===r&&d.unshift("")}return d.join(":").toLowerCase()}function n(t){if(0!==t.toLowerCase().indexOf("0000:0000:0000:0000:0000:ffff:"))return t;var e=t.split(":");if(-1!=e[e.length-1].indexOf("."))return t;var r=[parseInt(e[6].substring(0,2),16),parseInt(e[6].substring(2,4),16),parseInt(e[7].substring(0,2),16),parseInt(e[7].substring(2,4),16)].join(".");return e.slice(0,6).join(":")+":"+r}function o(t){if(0!==t.toLowerCase().indexOf("0000:0000:0000:0000:0000:ffff:"))return null;var e=t.split(":");return e.pop()}function i(e){var r=t("./validators").validateIPv4Address;if(-1==e.indexOf(":"))return!1;if(c(e,"::")>1)return!1;if(-1!=e.indexOf(":::"))return!1;if(":"==e.charAt(0)&&":"!=e.charAt(1)||":"==e.charAt(e.length-1)&&":"!=e.charAt(e.length-2))return!1;if(c(e,":")>7)return!1;if(-1==e.indexOf("::")&&7!=c(e,":")&&3!=c(e,"."))return!1;e=s(e);for(var n,o=e.split(":"),i=0,a=o.length;a>i;i++)if(n=o[i],3==c(n,".")){if(e.split(":").pop()!=n)return!1;try{r(n)}catch(u){if(!(u instanceof h))throw u;return!1}}else{if(!d.test(n))return!1;var l=parseInt(n,16);if(isNaN(l)||0>l||l>65535)return!1}return!0}function s(t){if(!a(t))return t;var e=[],r=t.split("::"),n=-1!=t.split(":").pop().indexOf(".")?7:8;if(r.length>1){var o=r[0].split(":").length+r[1].split(":").length;e=r[0].split(":");for(var i=0,s=n-o;s>i;i++)e.push("0000");e=e.concat(r[1].split(":"))}else e=t.split(":");var c=[];for(i=0,s=e.length;s>i;i++)c.push(u(e[i],4)+e[i].toLowerCase());return c.join(":")}function a(t){if(1==c(t,"::"))return!0;for(var e=t.split(":"),r=0,n=e.length;n>r;r++)if(e[r].length<4)return!0;return!1}function u(t,e){return t.length>=e?"":new Array(e-t.length+1).join("0")}function c(t,e){return t.split(e).length-1}var l=t("isomorph/object"),f=t("./errors"),h=f.ValidationError,d=/^[0-9a-f]+$/;e.exports={cleanIPv6Address:r,isValidIPv6Address:i}},{"./errors":2,"./validators":4,"isomorph/object":9}],4:[function(t,e){"use strict";function r(t,e,r){var n=t.split(e);return r?[n.slice(0,-r).join(e)].concat(n.slice(-r)):n}function n(t){if(!p(t))throw d("Enter a valid IPv6 address.",{code:"invalid"})}function o(t){try{j(t)}catch(e){if(!(e instanceof d))throw e;try{n(t)}catch(e){if(!(e instanceof d))throw e;throw d("Enter a valid IPv4 or IPv6 address.",{code:"invalid"})}}}function i(t,e){if("both"!=t&&e)throw new Error('You can only use unpackIPv4 if protocol is set to "both"');if(t=t.toLowerCase(),"undefined"==typeof O[t])throw new Error('The protocol "'+t+'" is unknown');return O[t]}var s=t("Concur"),a=t("isomorph/is"),u=t("isomorph/object"),c=t("punycode"),l=t("isomorph/url"),f=t("./errors"),h=t("./ipv6"),d=f.ValidationError,p=h.isValidIPv6Address,v=[null,void 0,""],m=s.extend({constructor:function(t){return this instanceof m?(t=u.extend({regex:null,message:null,code:null,inverseMatch:null},t),t.regex&&(this.regex=t.regex),t.message&&(this.message=t.message),t.code&&(this.code=t.code),t.inverseMatch&&(this.inverseMatch=t.inverseMatch),a.String(this.regex)&&(this.regex=new RegExp(this.regex)),this.__call__.bind(this)):new m(t)},regex:"",message:"Enter a valid value.",code:"invalid",inverseMatch:!1,__call__:function(t){if(this.inverseMatch===this.regex.test(""+t))throw d(this.message,{code:this.code})}}),g=m.extend({regex:new RegExp("^(?:[a-z0-9\\.\\-]*)://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+(?:[A-Z]{2,6}\\.?|[A-Z0-9-]{2,}\\.?)|localhost|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\[?[A-F0-9]*:[A-F0-9:]+\\]?)(?::\\d+)?(?:/?|[/?]\\S+)$","i"),message:"Enter a valid URL.",schemes:["http","https","ftp","ftps"],constructor:function(t){return this instanceof g?(t=u.extend({schemes:null},t),m.call(this,t),null!==t.schemes&&(this.schemes=t.schemes),this.__call__.bind(this)):new g(t)},__call__:function(t){t=""+t;var e=t.split("://")[0].toLowerCase();if(-1===this.schemes.indexOf(e))throw d(this.message,{code:this.code});try{m.prototype.__call__.call(this,t)}catch(r){if(!(r instanceof d))throw r;var n=l.parseUri(t);try{n.host=c.toASCII(n.host)}catch(o){throw r}t=l.makeUri(n),m.prototype.__call__.call(this,t)}}}),_=s.extend({message:"Enter a valid email address.",code:"invalid",userRegex:new RegExp("(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$|^\"([\\001-\\010\\013\\014\\016-\\037!#-\\[\\]-\\177]|\\\\[\\001-\\011\\013\\014\\016-\\177])*\"$)","i"),domainRegex:new RegExp("^(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,})$|^\\[(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\]$","i"),domainWhitelist:["localhost"],constructor:function(t){return this instanceof _?(t=u.extend({message:null,code:null,whitelist:null},t),null!==t.message&&(this.message=t.message),null!==t.code&&(this.code=t.code),null!==t.whitelist&&(this.domainWhitelist=t.whitelist),this.__call__.bind(this)):new _(t)},__call__:function(t){if(t=""+t,!t||-1==t.indexOf("@"))throw d(this.message,{code:this.code});var e=r(t,"@",1),n=e[0],o=e[1];if(!this.userRegex.test(n))throw d(this.message,{code:this.code});if(-1==this.domainWhitelist.indexOf(o)&&!this.domainRegex.test(o)){try{if(o=c.toASCII(o),this.domainRegex.test(o))return}catch(i){}throw d(this.message,{code:this.code})}}}),w=_(),y=/^[-a-zA-Z0-9_]+$/,x=m({regex:y,message:'Enter a valid "slug" consisting of letters, numbers, underscores or hyphens.',code:"invalid"}),b=/^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/,j=m({regex:b,message:"Enter a valid IPv4 address.",code:"invalid"}),O={both:{validators:[o],message:"Enter a valid IPv4 or IPv6 address."},ipv4:{validators:[j],message:"Enter a valid IPv4 address."},ipv6:{validators:[n],message:"Enter a valid IPv6 address."}},E=/^[\d,]+$/,A=m({regex:E,message:"Enter only digits separated by commas.",code:"invalid"}),I=s.extend({constructor:function(t){return this instanceof I?(this.limitValue=t,this.__call__.bind(this)):new I(t)},compare:function(t,e){return t!==e},clean:function(t){return t},message:"Ensure this value is {limitValue} (it is {showValue}).",code:"limitValue",__call__:function(t){var e=this.clean(t),r={limitValue:this.limitValue,showValue:e};if(this.compare(e,this.limitValue))throw d(this.message,{code:this.code,params:r})}}),V=I.extend({constructor:function(t){return this instanceof V?I.call(this,t):new V(t)},compare:function(t,e){return t>e},message:"Ensure this value is less than or equal to {limitValue}.",code:"maxValue"}),C=I.extend({constructor:function(t){return this instanceof C?I.call(this,t):new C(t)},compare:function(t,e){return e>t},message:"Ensure this value is greater than or equal to {limitValue}.",code:"minValue"}),L=I.extend({constructor:function(t){return this instanceof L?I.call(this,t):new L(t)},compare:function(t,e){return e>t},clean:function(t){return t.length},message:"Ensure this value has at least {limitValue} characters (it has {showValue}).",code:"minLength"}),P=I.extend({constructor:function(t){return this instanceof P?I.call(this,t):new P(t)},compare:function(t,e){return t>e},clean:function(t){return t.length},message:"Ensure this value has at most {limitValue} characters (it has {showValue}).",code:"maxLength"});e.exports={EMPTY_VALUES:v,RegexValidator:m,URLValidator:g,EmailValidator:_,validateEmail:w,validateSlug:x,validateIPv4Address:j,validateIPv6Address:n,validateIPv46Address:o,ipAddressValidators:i,validateCommaSeparatedIntegerList:A,BaseValidator:I,MaxValueValidator:V,MinValueValidator:C,MaxLengthValidator:P,MinLengthValidator:L,ValidationError:d,ipv6:h}},{"./errors":2,"./ipv6":3,Concur:5,"isomorph/is":8,"isomorph/object":9,"isomorph/url":10,punycode:6}],5:[function(t,e){"use strict";function r(t){return c.call(t).slice(8,-1).toLowerCase()}function n(t,e){var r=function(){};return r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t}function o(t,e){for(var r in e)u.call(e,r)&&(t[r]=e[r]);return t}function i(t,e){"function"==r(e)?o(t,e.prototype):o(t,e)}function s(t){var e=t.__mixins__;"array"!=r(e)&&(e=[e]);for(var n={},s=0,a=e.length;a>s;s++)i(n,e[s]);return delete t.__mixins__,o(n,t)}function a(t,e,r,i){return null==e&&(e=function(){t.apply(this,arguments)}),r.constructor=e,t!==l&&(n(e,t),e.__super__=t.prototype),o(e.prototype,r),o(e,i),e}var u=Object.prototype.hasOwnProperty,c=Object.prototype.toString,l=e.exports=function(){};l.__mro__=[],l.extend=function(t,e){t=t||{},e=e||{},"undefined"!=typeof this.prototype.__meta__&&this.prototype.__meta__(t,e);var r=u.call(t,"constructor")?t.constructor:null;return u.call(t,"__mixins__")&&(t=s(t)),u.call(e,"__mixins__")&&(e=s(e)),r=a(this,r,t,e),r.extend=this.extend,r.__mro__=[r].concat(this.__mro__),r}},{}],6:[function(e,r,n){(function(e){!function(o){function i(t){throw RangeError(S[t])}function s(t,e){for(var r=t.length;r--;)t[r]=e(t[r]);return t}function a(t,e){return s(t.split(R),e).join(".")}function u(t){for(var e,r,n=[],o=0,i=t.length;i>o;)e=t.charCodeAt(o++),e>=55296&&56319>=e&&i>o?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function c(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=$(t>>>10&1023|55296),t=56320|1023&t),e+=$(t)}).join("")}function l(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:j}function f(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function h(t,e,r){var n=0;for(t=r?Z(t/I):t>>1,t+=Z(t/e);t>k*E>>1;n+=j)t=Z(t/k);return Z(n+(k+1)*t/(t+A))}function d(t){var e,r,n,o,s,a,u,f,d,p,v=[],m=t.length,g=0,_=C,w=V;for(r=t.lastIndexOf(L),0>r&&(r=0),n=0;r>n;++n)t.charCodeAt(n)>=128&&i("not-basic"),v.push(t.charCodeAt(n));for(o=r>0?r+1:0;m>o;){for(s=g,a=1,u=j;o>=m&&i("invalid-input"),f=l(t.charCodeAt(o++)),(f>=j||f>Z((b-g)/a))&&i("overflow"),g+=f*a,d=w>=u?O:u>=w+E?E:u-w,!(d>f);u+=j)p=j-d,a>Z(b/p)&&i("overflow"),a*=p;e=v.length+1,w=h(g-s,e,0==s),Z(g/e)>b-_&&i("overflow"),_+=Z(g/e),g%=e,v.splice(g++,0,_)}return c(v)}function p(t){var e,r,n,o,s,a,c,l,d,p,v,m,g,_,w,y=[];for(t=u(t),m=t.length,e=C,r=0,s=V,a=0;m>a;++a)v=t[a],128>v&&y.push($(v));for(n=o=y.length,o&&y.push(L);m>n;){for(c=b,a=0;m>a;++a)v=t[a],v>=e&&c>v&&(c=v);for(g=n+1,c-e>Z((b-r)/g)&&i("overflow"),r+=(c-e)*g,e=c,a=0;m>a;++a)if(v=t[a],e>v&&++r>b&&i("overflow"),v==e){for(l=r,d=j;p=s>=d?O:d>=s+E?E:d-s,!(p>l);d+=j)w=l-p,_=j-p,y.push($(f(p+w%_,0))),l=Z(w/_);y.push($(f(l,0))),s=h(r,g,n==o),r=0,++n}++r,++e}return y.join("")}function v(t){return a(t,function(t){return P.test(t)?d(t.slice(4).toLowerCase()):t})}function m(t){return a(t,function(t){return M.test(t)?"xn--"+p(t):t})}var g="object"==typeof n&&n,_="object"==typeof r&&r&&r.exports==g&&r,w="object"==typeof e&&e;(w.global===w||w.window===w)&&(o=w);var y,x,b=2147483647,j=36,O=1,E=26,A=38,I=700,V=72,C=128,L="-",P=/^xn--/,M=/[^ -~]/,R=/\x2E|\u3002|\uFF0E|\uFF61/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=j-O,Z=Math.floor,$=String.fromCharCode;if(y={version:"1.2.4",ucs2:{decode:u,encode:c},decode:d,encode:p,toASCII:m,toUnicode:v},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return y});else if(g&&!g.nodeType)if(_)_.exports=y;else for(x in y)y.hasOwnProperty(x)&&(g[x]=y[x]);else o.punycode=y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(t,e){"use strict";function r(t){return n(t,s.call(arguments,1))}function n(t,e){var r=0;return t.replace(a,function(t){return"%%"==t?"%":e[r++]})}function o(t,e){return t.replace(u,function(t,r,n){return 2==r.length?t.slice(1):e[n]})}function i(t,e){e=Math.min(e||768,1024);for(var r=-1,n="bytes",o=t;o>e&&r-1&&(n=c.charAt(r)+"B"),o.toFixed(2).replace(l,"")+" "+n}var s=Array.prototype.slice,a=/%[%s]/g,u=/({{?)(\w+)}/g,c="kMGTPEZY",l=/\.00$|0$/;e.exports={format:r,formatArr:n,formatObj:o,fileSize:i}},{}],8:[function(t,e){"use strict";function r(t){return"[object Array]"==h.call(t)}function n(t){return"[object Boolean]"==h.call(t)}function o(t){return"[object Date]"==h.call(t)}function i(t){return"[object Error]"==h.call(t)}function s(t){return"[object Function]"==h.call(t)}function a(t){return"[object Number]"==h.call(t)}function u(t){return"[object Object]"==h.call(t)}function c(t){return"[object RegExp]"==h.call(t)}function l(t){return"[object String]"==h.call(t)}function f(t){for(var e in t)return!1;return!0}var h=Object.prototype.toString;e.exports={Array:r,Boolean:n,Date:o,Empty:f,Error:i,Function:s,NaN:isNaN,Number:a,Object:u,RegExp:c,String:l}},{}],9:[function(t,e){"use strict";function r(t){for(var e,r=1,n=arguments.length;n>r;r++)if(e=arguments[r])for(var o in e)l(e,o)&&(t[o]=e[o]);return t}function n(t,e){var r=function(){};return r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t}function o(t){var e=[];for(var r in t)l(t,r)&&e.push([r,t[r]]);return e}function i(t){for(var e,r={},n=0,o=t.length;o>n;n++)e=t[n],r[e[0]]=e[1];return r}function s(t){for(var e={},r=0,n=t.length;n>r;r++)e[""+t[r]]=!0;return e}function a(t,e,r){return l(t,e)?t[e]:r}function u(t,e,r){if(null==t)throw new Error("pop was given "+t);if(l(t,e)){var n=t[e];return delete t[e],n}if(2==arguments.length)throw new Error("pop was given an object which didn't have an own '"+e+"' property, without a default value to return");return r}function c(t,e,r){if(null==t)throw new Error("setDefault was given "+t);return r=r||null,l(t,e)?t[e]:(t[e]=r,r)}var l=function(){var t=Object.prototype.hasOwnProperty;return function(e,r){return t.call(e,r)}}(),f=function(){var t=Object.prototype.toString;return function(e){return t.call(e).slice(8,-1).toLowerCase()}}();e.exports={hasOwn:l,type:f,extend:r,inherits:n,items:o,fromItems:i,lookup:s,get:a,pop:u,setDefault:c}},{}],10:[function(t,e){"use strict";function r(t){for(var e=r.options,n=e.parser[e.strictMode?"strict":"loose"].exec(t),o={},i=14;i--;)o[e.key[i]]=n[i]||"";return o[e.q.name]={},o[e.key[12]].replace(e.q.parser,function(t,r,n){r&&(o[e.q.name][r]=n)}),o}function n(t){var e="";t.protocol&&(e+=t.protocol+"://"),t.user&&(e+=t.user),t.password&&(e+=":"+t.password),(t.user||t.password)&&(e+="@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path);var r=t.queryKey,n=[];for(var o in r)if(r.hasOwnProperty(o)){var i=encodeURIComponent(r[o]);o=encodeURIComponent(o),n.push(i?o+"="+i:o)}return n.length>0&&(e+="?"+n.join("&")),t.anchor&&(e+="#"+t.anchor),e}r.options={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.exports={parseUri:r,makeUri:n}},{}]},{},[1])(1)});