react-hooks-form-validator
Version:
One react hook for all your form validations
1 lines • 55.8 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t,e){return t(e={exports:{}},e.exports),e.exports}function r(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var a=function(t){return t&&t.Math==Math&&t},i=a("object"==typeof globalThis&&globalThis)||a("object"==typeof window&&window)||a("object"==typeof self&&self)||a("object"==typeof e&&e)||function(){return this}()||Function("return this")(),o=function(t){try{return!!t()}catch(t){return!0}},u=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,c={f:l&&!s.call({1:2},1)?function(t){var e=l(this,t);return!!e&&e.enumerable}:s},f=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},p={}.toString,h=function(t){return p.call(t).slice(8,-1)},m="".split,d=o((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==h(t)?m.call(t,""):Object(t)}:Object,v=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},g=function(t){return d(v(t))},y=function(t){return"object"==typeof t?null!==t:"function"==typeof t},b=function(t,e){if(!y(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!y(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!y(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!y(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},x=function(t){return Object(v(t))},w={}.hasOwnProperty,E=Object.hasOwn||function(t,e){return w.call(x(t),e)},O=i.document,$=y(O)&&y(O.createElement),j=function(t){return $?O.createElement(t):{}},S=!u&&!o((function(){return 7!=Object.defineProperty(j("div"),"a",{get:function(){return 7}}).a})),k=Object.getOwnPropertyDescriptor,T={f:u?k:function(t,e){if(t=g(t),e=b(e,!0),S)try{return k(t,e)}catch(t){}if(E(t,e))return f(!c.f.call(t,e),t[e])}},A=function(t){if(!y(t))throw TypeError(String(t)+" is not an object");return t},L=Object.defineProperty,C={f:u?L:function(t,e,n){if(A(t),e=b(e,!0),A(n),S)try{return L(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},V=u?function(t,e,n){return C.f(t,e,f(1,n))}:function(t,e,n){return t[e]=n,t},M=function(t,e){try{V(i,t,e)}catch(n){i[t]=e}return e},N=i["__core-js_shared__"]||M("__core-js_shared__",{}),P=Function.toString;"function"!=typeof N.inspectSource&&(N.inspectSource=function(t){return P.call(t)});var F,I,_,q=N.inspectSource,R=i.WeakMap,D="function"==typeof R&&/native code/.test(q(R)),z=n((function(t){(t.exports=function(t,e){return N[t]||(N[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.15.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),G=0,U=Math.random(),J=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++G+U).toString(36)},B=z("keys"),W=function(t){return B[t]||(B[t]=J(t))},X={},Z=i.WeakMap;if(D||N.state){var H=N.state||(N.state=new Z),Y=H.get,K=H.has,Q=H.set;F=function(t,e){if(K.call(H,t))throw new TypeError("Object already initialized");return e.facade=t,Q.call(H,t,e),e},I=function(t){return Y.call(H,t)||{}},_=function(t){return K.call(H,t)}}else{var tt=W("state");X[tt]=!0,F=function(t,e){if(E(t,tt))throw new TypeError("Object already initialized");return e.facade=t,V(t,tt,e),e},I=function(t){return E(t,tt)?t[tt]:{}},_=function(t){return E(t,tt)}}var et,nt,rt={set:F,get:I,has:_,enforce:function(t){return _(t)?I(t):F(t,{})},getterFor:function(t){return function(e){var n;if(!y(e)||(n=I(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},at=n((function(t){var e=rt.get,n=rt.enforce,r=String(String).split("String");(t.exports=function(t,e,a,o){var u,s=!!o&&!!o.unsafe,l=!!o&&!!o.enumerable,c=!!o&&!!o.noTargetGet;"function"==typeof a&&("string"!=typeof e||E(a,"name")||V(a,"name",e),(u=n(a)).source||(u.source=r.join("string"==typeof e?e:""))),t!==i?(s?!c&&t[e]&&(l=!0):delete t[e],l?t[e]=a:V(t,e,a)):l?t[e]=a:M(e,a)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||q(this)}))})),it=i,ot=function(t){return"function"==typeof t?t:void 0},ut=function(t,e){return arguments.length<2?ot(it[t])||ot(i[t]):it[t]&&it[t][e]||i[t]&&i[t][e]},st=Math.ceil,lt=Math.floor,ct=function(t){return isNaN(t=+t)?0:(t>0?lt:st)(t)},ft=Math.min,pt=function(t){return t>0?ft(ct(t),9007199254740991):0},ht=Math.max,mt=Math.min,dt=function(t){return function(e,n,r){var a,i=g(e),o=pt(i.length),u=function(t,e){var n=ct(t);return n<0?ht(n+e,0):mt(n,e)}(r,o);if(t&&n!=n){for(;o>u;)if((a=i[u++])!=a)return!0}else for(;o>u;u++)if((t||u in i)&&i[u]===n)return t||u||0;return!t&&-1}},vt={includes:dt(!0),indexOf:dt(!1)}.indexOf,gt=function(t,e){var n,r=g(t),a=0,i=[];for(n in r)!E(X,n)&&E(r,n)&&i.push(n);for(;e.length>a;)E(r,n=e[a++])&&(~vt(i,n)||i.push(n));return i},yt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bt=yt.concat("length","prototype"),xt={f:Object.getOwnPropertyNames||function(t){return gt(t,bt)}},wt={f:Object.getOwnPropertySymbols},Et=ut("Reflect","ownKeys")||function(t){var e=xt.f(A(t)),n=wt.f;return n?e.concat(n(t)):e},Ot=function(t,e){for(var n=Et(e),r=C.f,a=T.f,i=0;i<n.length;i++){var o=n[i];E(t,o)||r(t,o,a(e,o))}},$t=/#|\.prototype\./,jt=function(t,e){var n=kt[St(t)];return n==At||n!=Tt&&("function"==typeof e?o(e):!!e)},St=jt.normalize=function(t){return String(t).replace($t,".").toLowerCase()},kt=jt.data={},Tt=jt.NATIVE="N",At=jt.POLYFILL="P",Lt=jt,Ct=T.f,Vt=function(t,e){var n,r,a,o,u,s=t.target,l=t.global,c=t.stat;if(n=l?i:c?i[s]||M(s,{}):(i[s]||{}).prototype)for(r in e){if(o=e[r],a=t.noTargetGet?(u=Ct(n,r))&&u.value:n[r],!Lt(l?r:s+(c?".":"#")+r,t.forced)&&void 0!==a){if(typeof o==typeof a)continue;Ot(o,a)}(t.sham||a&&a.sham)&&V(o,"sham",!0),at(n,r,o,t)}},Mt=Array.isArray||function(t){return"Array"==h(t)},Nt=function(t,e,n){var r=b(e);r in t?C.f(t,r,f(0,n)):t[r]=n},Pt=ut("navigator","userAgent")||"",Ft=i.process,It=Ft&&Ft.versions,_t=It&&It.v8;_t?nt=(et=_t.split("."))[0]<4?1:et[0]+et[1]:Pt&&(!(et=Pt.match(/Edge\/(\d+)/))||et[1]>=74)&&(et=Pt.match(/Chrome\/(\d+)/))&&(nt=et[1]);var qt=nt&&+nt,Rt=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&qt&&qt<41})),Dt=Rt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,zt=z("wks"),Gt=i.Symbol,Ut=Dt?Gt:Gt&&Gt.withoutSetter||J,Jt=function(t){return E(zt,t)&&(Rt||"string"==typeof zt[t])||(Rt&&E(Gt,t)?zt[t]=Gt[t]:zt[t]=Ut("Symbol."+t)),zt[t]},Bt=Jt("species"),Wt=function(t,e){var n;return Mt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Mt(n.prototype)?y(n)&&null===(n=n[Bt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Xt=Jt("species"),Zt=function(t){return qt>=51||!o((function(){var e=[];return(e.constructor={})[Xt]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Ht=Jt("isConcatSpreadable"),Yt=qt>=51||!o((function(){var t=[];return t[Ht]=!1,t.concat()[0]!==t})),Kt=Zt("concat"),Qt=function(t){if(!y(t))return!1;var e=t[Ht];return void 0!==e?!!e:Mt(t)};Vt({target:"Array",proto:!0,forced:!Yt||!Kt},{concat:function(t){var e,n,r,a,i,o=x(this),u=Wt(o,0),s=0;for(e=-1,r=arguments.length;e<r;e++)if(Qt(i=-1===e?o:arguments[e])){if(s+(a=pt(i.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<a;n++,s++)n in i&&Nt(u,s,i[n])}else{if(s>=9007199254740991)throw TypeError("Maximum allowed index exceeded");Nt(u,s++,i)}return u.length=s,u}});var te=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,a){return t.call(e,n,r,a)}}return function(){return t.apply(e,arguments)}},ee=[].push,ne=function(t){var e=1==t,n=2==t,r=3==t,a=4==t,i=6==t,o=7==t,u=5==t||i;return function(s,l,c,f){for(var p,h,m=x(s),v=d(m),g=te(l,c,3),y=pt(v.length),b=0,w=f||Wt,E=e?w(s,y):n||o?w(s,0):void 0;y>b;b++)if((u||b in v)&&(h=g(p=v[b],b,m),t))if(e)E[b]=h;else if(h)switch(t){case 3:return!0;case 5:return p;case 6:return b;case 2:ee.call(E,p)}else switch(t){case 4:return!1;case 7:ee.call(E,p)}return i?-1:r||a?a:E}},re={forEach:ne(0),map:ne(1),filter:ne(2),some:ne(3),every:ne(4),find:ne(5),findIndex:ne(6),filterOut:ne(7)},ae=function(t,e){var n=[][t];return!!n&&o((function(){n.call(null,e||function(){throw 1},1)}))},ie=re.forEach,oe=ae("forEach")?[].forEach:function(t){return ie(this,t,arguments.length>1?arguments[1]:void 0)};Vt({target:"Array",proto:!0,forced:[].forEach!=oe},{forEach:oe});var ue,se=Object.keys||function(t){return gt(t,yt)},le=u?Object.defineProperties:function(t,e){A(t);for(var n,r=se(e),a=r.length,i=0;a>i;)C.f(t,n=r[i++],e[n]);return t},ce=ut("document","documentElement"),fe=W("IE_PROTO"),pe=function(){},he=function(t){return"<script>"+t+"<\/script>"},me=function(){try{ue=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;me=ue?function(t){t.write(he("")),t.close();var e=t.parentWindow.Object;return t=null,e}(ue):((e=j("iframe")).style.display="none",ce.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(he("document.F=Object")),t.close(),t.F);for(var n=yt.length;n--;)delete me.prototype[yt[n]];return me()};X[fe]=!0;var de=Object.create||function(t,e){var n;return null!==t?(pe.prototype=A(t),n=new pe,pe.prototype=null,n[fe]=t):n=me(),void 0===e?n:le(n,e)},ve=Jt("unscopables"),ge=Array.prototype;null==ge[ve]&&C.f(ge,ve,{configurable:!0,value:de(null)});var ye,be,xe,we=function(t){ge[ve][t]=!0},Ee=!o((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Oe=W("IE_PROTO"),$e=Object.prototype,je=Ee?Object.getPrototypeOf:function(t){return t=x(t),E(t,Oe)?t[Oe]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?$e:null},Se=Jt("iterator"),ke=!1;[].keys&&("next"in(xe=[].keys())?(be=je(je(xe)))!==Object.prototype&&(ye=be):ke=!0),(null==ye||o((function(){var t={};return ye[Se].call(t)!==t})))&&(ye={}),E(ye,Se)||V(ye,Se,(function(){return this}));var Te={IteratorPrototype:ye,BUGGY_SAFARI_ITERATORS:ke},Ae=C.f,Le=Jt("toStringTag"),Ce=function(t,e,n){t&&!E(t=n?t:t.prototype,Le)&&Ae(t,Le,{configurable:!0,value:e})},Ve=Te.IteratorPrototype,Me=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return A(n),function(t){if(!y(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(r),e?t.call(n,r):n.__proto__=r,n}}():void 0),Ne=Te.IteratorPrototype,Pe=Te.BUGGY_SAFARI_ITERATORS,Fe=Jt("iterator"),Ie=function(){return this},_e=rt.set,qe=rt.getterFor("Array Iterator"),Re=function(t,e,n,r,a,i,o){!function(t,e,n){var r=e+" Iterator";t.prototype=de(Ve,{next:f(1,n)}),Ce(t,r,!1)}(n,e,r);var u,s,l,c=function(t){if(t===a&&v)return v;if(!Pe&&t in m)return m[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},p=e+" Iterator",h=!1,m=t.prototype,d=m[Fe]||m["@@iterator"]||a&&m[a],v=!Pe&&d||c(a),g="Array"==e&&m.entries||d;if(g&&(u=je(g.call(new t)),Ne!==Object.prototype&&u.next&&(je(u)!==Ne&&(Me?Me(u,Ne):"function"!=typeof u[Fe]&&V(u,Fe,Ie)),Ce(u,p,!0))),"values"==a&&d&&"values"!==d.name&&(h=!0,v=function(){return d.call(this)}),m[Fe]!==v&&V(m,Fe,v),a)if(s={values:c("values"),keys:i?v:c("keys"),entries:c("entries")},o)for(l in s)(Pe||h||!(l in m))&&at(m,l,s[l]);else Vt({target:e,proto:!0,forced:Pe||h},s);return s}(Array,"Array",(function(t,e){_e(this,{type:"Array Iterator",target:g(t),index:0,kind:e})}),(function(){var t=qe(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values");we("keys"),we("values"),we("entries");var De=re.some,ze=ae("some");Vt({target:"Array",proto:!0,forced:!ze},{some:function(t){return De(this,t,arguments.length>1?arguments[1]:void 0)}});var Ge=o((function(){se(1)}));Vt({target:"Object",stat:!0,forced:Ge},{keys:function(t){return se(x(t))}});var Ue={};Ue[Jt("toStringTag")]="z";var Je="[object z]"===String(Ue),Be=Jt("toStringTag"),We="Arguments"==h(function(){return arguments}()),Xe=Je?h:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Be))?n:We?h(e):"Object"==(r=h(e))&&"function"==typeof e.callee?"Arguments":r},Ze=Je?{}.toString:function(){return"[object "+Xe(this)+"]"};Je||at(Object.prototype,"toString",Ze,{unsafe:!0});var He={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0};for(var Ye in He){var Ke=i[Ye],Qe=Ke&&Ke.prototype;if(Qe&&Qe.forEach!==oe)try{V(Qe,"forEach",oe)}catch(t){Qe.forEach=oe}}var tn=Jt("iterator"),en=Jt("toStringTag"),nn=Re.values;for(var rn in He){var an=i[rn],on=an&&an.prototype;if(on){if(on[tn]!==nn)try{V(on,tn,nn)}catch(t){on[tn]=nn}if(on[en]||V(on,en,rn),He[rn])for(var un in Re)if(on[un]!==Re[un])try{V(on,un,Re[un])}catch(t){on[un]=Re[un]}}}n((function(t){!function(e){var n=Object.prototype,r=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag",s=e.regeneratorRuntime;if(s)t.exports=s;else{(s=e.regeneratorRuntime=t.exports).wrap=m;var l={},c={};c[i]=function(){return this};var f=Object.getPrototypeOf,p=f&&f(f(j([])));p&&p!==n&&r.call(p,i)&&(c=p);var h=y.prototype=v.prototype=Object.create(c);g.prototype=h.constructor=y,y.constructor=g,y[u]=g.displayName="GeneratorFunction",s.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},s.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(h),t},s.awrap=function(t){return{__await:t}},b(x.prototype),x.prototype[o]=function(){return this},s.AsyncIterator=x,s.async=function(t,e,n,r){var a=new x(m(t,e,n,r));return s.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(h),h[u]="Generator",h[i]=function(){return this},h.toString=function(){return"[object Generator]"},s.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},s.values=j,$.prototype={constructor:$,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;O(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:j(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}}}function m(t,e,n,r){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),o=new $(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(a,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw i;return S()}for(n.method=a,n.arg=i;;){var o=n.delegate;if(o){var u=w(o,n);if(u){if(u===l)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,o),i}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function v(){}function g(){}function y(){}function b(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function x(t){function n(e,a,i,o){var u=d(t[e],t,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then((function(t){n("next",t,i,o)}),(function(t){n("throw",t,i,o)})):Promise.resolve(l).then((function(t){s.value=t,i(s)}),o)}o(u.arg)}var a;"object"==typeof e.process&&e.process.domain&&(n=e.process.domain.bind(n)),this._invoke=function(t,e){function r(){return new Promise((function(r,a){n(t,e,r,a)}))}return a=a?a.then(r,r):r()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var a=r.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function $(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}}("object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:e)}));function sn(t){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ln(t,e,n,r,a,i,o){try{var u=t[i](o),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(r,a)}function cn(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var i=t.apply(e,n);function o(t){ln(i,r,a,o,u,"next",t)}function u(t){ln(i,r,a,o,u,"throw",t)}o(void 0)}))}}function fn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function hn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?pn(Object(n),!0).forEach((function(e){fn(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pn(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function mn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){a=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(a)throw i}}return n}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return dn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dn(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var vn=re.every,gn=ae("every");Vt({target:"Array",proto:!0,forced:!gn},{every:function(t){return vn(this,t,arguments.length>1?arguments[1]:void 0)}});var yn=re.find,bn=!0;"find"in[]&&Array(1).find((function(){bn=!1})),Vt({target:"Array",proto:!0,forced:bn},{find:function(t){return yn(this,t,arguments.length>1?arguments[1]:void 0)}}),we("find");var xn=re.map,wn=Zt("map");Vt({target:"Array",proto:!0,forced:!wn},{map:function(t){return xn(this,t,arguments.length>1?arguments[1]:void 0)}});var En=c.f,On=function(t){return function(e){for(var n,r=g(e),a=se(r),i=a.length,o=0,s=[];i>o;)n=a[o++],u&&!En.call(r,n)||s.push(t?[n,r[n]]:r[n]);return s}},$n={entries:On(!0),values:On(!1)}.entries;Vt({target:"Object",stat:!0},{entries:function(t){return $n(t)}});var jn="\t\n\v\f\r \u2028\u2029\ufeff",Sn="["+jn+"]",kn=RegExp("^"+Sn+Sn+"*"),Tn=RegExp(Sn+Sn+"*$"),An=function(t){return function(e){var n=String(v(e));return 1&t&&(n=n.replace(kn,"")),2&t&&(n=n.replace(Tn,"")),n}},Ln={start:An(1),end:An(2),trim:An(3)},Cn=Ln.trim;Vt({target:"String",proto:!0,forced:function(t){return o((function(){return!!jn[t]()||"
"!="
"[t]()||jn[t].name!==t}))}("trim")},{trim:function(){return Cn(this)}});var Vn=function t(e,n,r={}){for(let i in n)if("object"==typeof(a=n[i])&&!Array.isArray(a)&&null!=a&&Object.keys(a).length>0)e[i]=e[i]||{},t(e[i],n[i],r);else{if(!0===r.skipIfExist&&void 0!==e[i])continue;e[i]=n[i]}var a;return e},Mn={required:"The '{field}' field is required.",string:"The '{field}' field must be a string.",stringEmpty:"The '{field}' field must not be empty.",stringMin:"The '{field}' field length must be greater than or equal to {expected} characters long.",stringMax:"The '{field}' field length must be less than or equal to {expected} characters long.",stringLength:"The '{field}' field length must be {expected} characters long.",stringPattern:"The '{field}' field fails to match the required pattern.",stringContains:"The '{field}' field must contain the '{expected}' text.",stringEnum:"The '{field}' field does not match any of the allowed values.",stringNumeric:"The '{field}' field must be a numeric string.",stringAlpha:"The '{field}' field must be an alphabetic string.",stringAlphanum:"The '{field}' field must be an alphanumeric string.",stringAlphadash:"The '{field}' field must be an alphadash string.",stringHex:"The '{field}' field must be a hex string.",number:"The '{field}' field must be a number.",numberMin:"The '{field}' field must be greater than or equal to {expected}.",numberMax:"The '{field}' field must be less than or equal to {expected}.",numberEqual:"The '{field}' field must be equal to {expected}.",numberNotEqual:"The '{field}' field can't be equal to {expected}.",numberInteger:"The '{field}' field must be an integer.",numberPositive:"The '{field}' field must be a positive number.",numberNegative:"The '{field}' field must be a negative number.",array:"The '{field}' field must be an array.",arrayEmpty:"The '{field}' field must not be an empty array.",arrayMin:"The '{field}' field must contain at least {expected} items.",arrayMax:"The '{field}' field must contain less than or equal to {expected} items.",arrayLength:"The '{field}' field must contain {expected} items.",arrayContains:"The '{field}' field must contain the '{expected}' item.",arrayUnique:"The '{actual}' value in '{field}' field does not unique the '{expected}' values.",arrayEnum:"The '{actual}' value in '{field}' field does not match any of the '{expected}' values.",boolean:"The '{field}' field must be a boolean.",date:"The '{field}' field must be a Date.",dateMin:"The '{field}' field must be greater than or equal to {expected}.",dateMax:"The '{field}' field must be less than or equal to {expected}.",enumValue:"The '{field}' field value '{expected}' does not match any of the allowed values.",equalValue:"The '{field}' field value must be equal to '{expected}'.",equalField:"The '{field}' field value must be equal to '{expected}' field value.",forbidden:"The '{field}' field is forbidden.",function:"The '{field}' field must be a function.",email:"The '{field}' field must be a valid e-mail.",luhn:"The '{field}' field must be a valid checksum luhn.",mac:"The '{field}' field must be a valid MAC address.",object:"The '{field}' must be an Object.",objectStrict:"The object '{field}' contains forbidden keys: '{actual}'.",url:"The '{field}' field must be a valid URL.",uuid:"The '{field}' field must be a valid UUID.",uuidVersion:"The '{field}' field must be a valid UUID version provided.",classInstanceOf:"The '{field}' field must be an instance of the '{expected}' class."},Nn=function(){return{}},Pn=function({schema:t,messages:e},n,r){const a=[];if(a.push(`\n\t\tif (!Array.isArray(value)) {\n\t\t\t${this.makeError({type:"array",actual:"value",messages:e})}\n\t\t\treturn value;\n\t\t}\n\n\t\tvar len = value.length;\n\t`),!1===t.empty&&a.push(`\n\t\t\tif (len === 0) {\n\t\t\t\t${this.makeError({type:"arrayEmpty",actual:"value",messages:e})}\n\t\t\t}\n\t\t`),null!=t.min&&a.push(`\n\t\t\tif (len < ${t.min}) {\n\t\t\t\t${this.makeError({type:"arrayMin",expected:t.min,actual:"len",messages:e})}\n\t\t\t}\n\t\t`),null!=t.max&&a.push(`\n\t\t\tif (len > ${t.max}) {\n\t\t\t\t${this.makeError({type:"arrayMax",expected:t.max,actual:"len",messages:e})}\n\t\t\t}\n\t\t`),null!=t.length&&a.push(`\n\t\t\tif (len !== ${t.length}) {\n\t\t\t\t${this.makeError({type:"arrayLength",expected:t.length,actual:"len",messages:e})}\n\t\t\t}\n\t\t`),null!=t.contains&&a.push(`\n\t\t\tif (value.indexOf(${JSON.stringify(t.contains)}) === -1) {\n\t\t\t\t${this.makeError({type:"arrayContains",expected:JSON.stringify(t.contains),actual:"value",messages:e})}\n\t\t\t}\n\t\t`),!0===t.unique&&a.push(`\n\t\t\tif(len > (new Set(value)).size) {\n\t\t\t\t${this.makeError({type:"arrayUnique",expected:"Array.from(new Set(value.filter((item, index) => value.indexOf(item) !== index)))",actual:"value",messages:e})}\n\t\t\t}\n\t\t`),null!=t.enum){const n=JSON.stringify(t.enum);a.push(`\n\t\t\tfor (var i = 0; i < value.length; i++) {\n\t\t\t\tif (${n}.indexOf(value[i]) === -1) {\n\t\t\t\t\t${this.makeError({type:"arrayEnum",expected:'"'+t.enum.join(", ")+'"',actual:"value[i]",messages:e})}\n\t\t\t\t}\n\t\t\t}\n\t\t`)}if(null!=t.items){a.push("\n\t\t\tvar arr = value;\n\t\t\tvar parentField = field;\n\t\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t");const i=n+"[]",o=this.getRuleFromSchema(t.items),u=`\n\t\t\tarr[i] = context.fn[%%INDEX%%](arr[i], (parentField ? parentField : "") + "[" + i + "]", parent, errors, context);\n\t\t\t${this.makeCustomValidator({vName:"arr[i]",path:i,schema:o.schema,context:r,messages:e})}\n\t\t`;a.push(this.compileRule(o,r,i,u,"arr[i]")),a.push("\n\t\t\t}\n\t\t")}return a.push("\n\t\treturn value;\n\t"),{source:a.join("\n")}},Fn=function({schema:t,messages:e},n,r){const a=[];let i=!1;return a.push("\n\t\tvar origValue = value;\n\t"),!0===t.convert&&(i=!0,a.push('\n\t\t\tif (typeof value !== "boolean") {\n\t\t\t\tif (\n\t\t\t\tvalue === 1\n\t\t\t\t|| value === "true"\n\t\t\t\t|| value === "1"\n\t\t\t\t|| value === "on"\n\t\t\t\t) {\n\t\t\t\t\tvalue = true;\n\t\t\t\t} else if (\n\t\t\t\tvalue === 0\n\t\t\t\t|| value === "false"\n\t\t\t\t|| value === "0"\n\t\t\t\t|| value === "off"\n\t\t\t\t) {\n\t\t\t\t\tvalue = false;\n\t\t\t\t}\n\t\t\t}\n\t\t')),a.push(`\n\t\tif (typeof value !== "boolean") {\n\t\t\t${this.makeError({type:"boolean",actual:"origValue",messages:e})}\n\t\t}\n\t\t\n\t\treturn value;\n\t`),{sanitized:i,source:a.join("\n")}},In=function({schema:t,messages:e},n,r){const a=[],i=t.instanceOf.name?t.instanceOf.name:"<UnknowClass>";return a.push(`\n\t\tif (!(value instanceof context.customs["${n}"].schema.instanceOf))\n\t\t\t${this.makeError({type:"classInstanceOf",actual:"value",expected:"'"+i+"'",messages:e})}\n\t`),a.push("\n\t\treturn value;\n\t"),{source:a.join("\n")}},_n=function({schema:t,messages:e},n,r){const a=[];return a.push(`\n\t\t${this.makeCustomValidator({fnName:"check",path:n,schema:t,messages:e,context:r})}\n\t\treturn value;\n\t`),{source:a.join("\n")}},qn=function({schema:t,messages:e},n,r){const a=[];let i=!1;return a.push("\n\t\tvar origValue = value;\n\t"),!0===t.convert&&(i=!0,a.push("\n\t\t\tif (!(value instanceof Date)) {\n\t\t\t\tvalue = new Date(value);\n\t\t\t}\n\t\t")),a.push(`\n\t\tif (!(value instanceof Date) || isNaN(value.getTime()))\n\t\t\t${this.makeError({type:"date",actual:"origValue",messages:e})}\n\n\t\treturn value;\n\t`),{sanitized:i,source:a.join("\n")}};const Rn=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Dn=/^\S+@\S+\.\S+$/;var zn=function({schema:t,messages:e},n,r){const a=[],i="precise"==t.mode?Rn:Dn;let o=!1;return a.push(`\n\t\tif (typeof value !== "string") {\n\t\t\t${this.makeError({type:"string",actual:"value",messages:e})}\n\t\t\treturn value;\n\t\t}\n\t`),t.normalize&&(o=!0,a.push("\n\t\t\tvalue = value.trim().toLowerCase();\n\t\t")),a.push(`\n\t\tif (!${i.toString()}.test(value)) {\n\t\t\t${this.makeError({type:"email",actual:"value",messages:e})}\n\t\t}\n\n\t\treturn value;\n\t`),{sanitized:o,source:a.join("\n")}},Gn=function({schema:t,messages:e},n,r){return{source:`\n\t\t\tif (${JSON.stringify(t.values||[])}.indexOf(value) === -1)\n\t\t\t\t${this.makeError({type:"enumValue",expected:'"'+t.values.join(", ")+'"',actual:"value",messages:e})}\n\t\t\t\n\t\t\treturn value;\n\t\t`}},Un=function({schema:t,messages:e},n,r){const a=[];return t.field?(t.strict?a.push(`\n\t\t\t\tif (value !== parent["${t.field}"])\n\t\t\t`):a.push(`\n\t\t\t\tif (value != parent["${t.field}"])\n\t\t\t`),a.push(`\n\t\t\t\t${this.makeError({type:"equalField",actual:"value",expected:JSON.stringify(t.field),messages:e})}\n\t\t`)):(t.strict?a.push(`\n\t\t\t\tif (value !== ${JSON.stringify(t.value)})\n\t\t\t`):a.push(`\n\t\t\t\tif (value != ${JSON.stringify(t.value)})\n\t\t\t`),a.push(`\n\t\t\t\t${this.makeError({type:"equalValue",actual:"value",expected:JSON.stringify(t.value),messages:e})}\n\t\t`)),a.push("\n\t\treturn value;\n\t"),{source:a.join("\n")}},Jn=function({schema:t,messages:e},n,r){const a=[];return a.push("\n\t\tif (value !== null && value !== undefined) {\n\t"),t.remove?a.push("\n\t\t\treturn undefined;\n\t\t"):a.push(`\n\t\t\t${this.makeError({type:"forbidden",actual:"value",messages:e})}\n\t\t`),a.push("\n\t\t}\n\n\t\treturn value;\n\t"),{source:a.join("\n")}},Bn=function({schema:t,messages:e},n,r){return{source:`\n\t\t\tif (typeof value !== "function")\n\t\t\t\t${this.makeError({type:"function",actual:"value",messages:e})}\n\n\t\t\treturn value;\n\t\t`}},Wn=function({schema:t,messages:e},n,r){const a=[];a.push("\n\t\tvar prevErrLen = errors.length;\n\t\tvar errBefore;\n\t\tvar hasValid = false;\n\t\tvar newVal = value;\n\t");for(let e=0;e<t.rules.length;e++){a.push("\n\t\t\tif (!hasValid) {\n\t\t\t\terrBefore = errors.length;\n\t\t");const i=this.getRuleFromSchema(t.rules[e]);a.push(this.compileRule(i,r,n,"var tmpVal = context.fn[%%INDEX%%](value, field, parent, errors, context);","tmpVal")),a.push("\n\t\t\t\tif (errors.length == errBefore) {\n\t\t\t\t\thasValid = true;\n\t\t\t\t\tnewVal = tmpVal;\n\t\t\t\t}\n\t\t\t}\n\t\t")}return a.push("\n\t\tif (hasValid) {\n\t\t\terrors.length = prevErrLen;\n\t\t}\n\t\t\n\t\treturn newVal;\n\t"),{source:a.join("\n")}},Xn=function({schema:t,messages:e},n,r){const a=[];a.push("\n\t\tvar origValue = value;\n\t");let i=!1;return!0===t.convert&&(i=!0,a.push('\n\t\t\tif (typeof value !== "number") {\n\t\t\t\tvalue = Number(value);\n\t\t\t}\n\t\t')),a.push(`\n\t\tif (typeof value !== "number" || isNaN(value) || !isFinite(value)) {\n\t\t\t${this.makeError({type:"number",actual:"origValue",messages:e})}\n\t\t\treturn value;\n\t\t}\n\t`),null!=t.min&&a.push(`\n\t\t\tif (value < ${t.min}) {\n\t\t\t\t${this.makeError({type:"numberMin",expected:t.min,actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),null!=t.max&&a.push(`\n\t\t\tif (value > ${t.max}) {\n\t\t\t\t${this.makeError({type:"numberMax",expected:t.max,actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),null!=t.equal&&a.push(`\n\t\t\tif (value !== ${t.equal}) {\n\t\t\t\t${this.makeError({type:"numberEqual",expected:t.equal,actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),null!=t.notEqual&&a.push(`\n\t\t\tif (value === ${t.notEqual}) {\n\t\t\t\t${this.makeError({type:"numberNotEqual",expected:t.notEqual,actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),!0===t.integer&&a.push(`\n\t\t\tif (value % 1 !== 0) {\n\t\t\t\t${this.makeError({type:"numberInteger",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),!0===t.positive&&a.push(`\n\t\t\tif (value <= 0) {\n\t\t\t\t${this.makeError({type:"numberPositive",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),!0===t.negative&&a.push(`\n\t\t\tif (value >= 0) {\n\t\t\t\t${this.makeError({type:"numberNegative",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),a.push("\n\t\treturn value;\n\t"),{sanitized:i,source:a.join("\n")}};const Zn=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/,Hn=/["'\\\n\r\u2028\u2029]/g;function Yn(t){return t.replace(Hn,(function(t){switch(t){case'"':case"'":case"\\":return"\\"+t;case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029"}}))}var Kn=function({schema:t,messages:e},n,r){const a=[];a.push(`\n\t\tif (typeof value !== "object" || value === null || Array.isArray(value)) {\n\t\t\t${this.makeError({type:"object",actual:"value",messages:e})}\n\t\t\treturn value;\n\t\t}\n\t`);const i=t.properties||t.props;if(i){a.push("var parentObj = value;"),a.push("var parentField = field;");const o=Object.keys(i);for(let t=0;t<o.length;t++){const u=o[t],s=Yn(u),l=Zn.test(s)?"."+s:`['${s}']`,c="parentObj"+l,f=(n?n+".":"")+u;a.push("\n// Field: "+Yn(f)),a.push(`field = parentField ? parentField + "${l}" : "${s}";`),a.push(`value = ${c};`);const p=this.getRuleFromSchema(i[u]),h=`\n\t\t\t\t${c} = context.fn[%%INDEX%%](value, field, parentObj, errors, context);\n\t\t\t\t${this.makeCustomValidator({vName:c,path:f,schema:p.schema,context:r,messages:e})}\n\t\t\t`;a.push(this.compileRule(p,r,f,h,c))}if(t.strict){const n=Object.keys(i);a.push(`\n\t\t\t\tfield = parentField;\n\t\t\t\tvar invalidProps = [];\n\t\t\t\tvar props = Object.keys(parentObj);\n\n\t\t\t\tfor (let i = 0; i < props.length; i++) {\n\t\t\t\t\tif (${JSON.stringify(n)}.indexOf(props[i]) === -1) {\n\t\t\t\t\t\tinvalidProps.push(props[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (invalidProps.length) {\n\t\t\t`),"remove"==t.strict?a.push("\n\t\t\t\t\tinvalidProps.forEach(function(field) {\n\t\t\t\t\t\tdelete parentObj[field];\n\t\t\t\t\t});\n\t\t\t\t"):a.push(`\n\t\t\t\t\t${this.makeError({type:"objectStrict",expected:'"'+n.join(", ")+'"',actual:"invalidProps.join(', ')",messages:e})}\n\t\t\t\t`),a.push("\n\t\t\t\t}\n\t\t\t")}a.push("\n\t\t\treturn parentObj;\n\t\t")}else a.push("\n\t\t\treturn value;\n\t\t");return{source:a.join("\n")}};const Qn=/^-?[0-9]\d*(\.\d+)?$/,tr=/^[a-zA-Z]+$/,er=/^[a-zA-Z0-9]+$/,nr=/^[a-zA-Z0-9_-]+$/,rr=/^[0-9a-fA-F]+$/;var ar=function({schema:t,messages:e},n,r){const a=[];let i=!1;if(!0===t.convert&&(i=!0,a.push('\n\t\t\tif (typeof value !== "string") {\n\t\t\t\tvalue = String(value);\n\t\t\t}\n\t\t')),a.push(`\n\t\tif (typeof value !== "string") {\n\t\t\t${this.makeError({type:"string",actual:"value",messages:e})}\n\t\t\treturn value;\n\t\t}\n\n\t\tvar origValue = value;\n\t`),t.trim&&(i=!0,a.push("\n\t\t\tvalue = value.trim();\n\t\t")),t.trimLeft&&(i=!0,a.push("\n\t\t\tvalue = value.trimLeft();\n\t\t")),t.trimRight&&(i=!0,a.push("\n\t\t\tvalue = value.trimRight();\n\t\t")),t.padStart){i=!0;const e=null!=t.padChar?t.padChar:" ";a.push(`\n\t\t\tvalue = value.padStart(${t.padStart}, ${JSON.stringify(e)});\n\t\t`)}if(t.padEnd){i=!0;const e=null!=t.padChar?t.padChar:" ";a.push(`\n\t\t\tvalue = value.padEnd(${t.padEnd}, ${JSON.stringify(e)});\n\t\t`)}if(t.lowercase&&(i=!0,a.push("\n\t\t\tvalue = value.toLowerCase();\n\t\t")),t.uppercase&&(i=!0,a.push("\n\t\t\tvalue = value.toUpperCase();\n\t\t")),t.localeLowercase&&(i=!0,a.push("\n\t\t\tvalue = value.toLocaleLowerCase();\n\t\t")),t.localeUppercase&&(i=!0,a.push("\n\t\t\tvalue = value.toLocaleUpperCase();\n\t\t")),a.push("\n\t\t\tvar len = value.length;\n\t"),!1===t.empty&&a.push(`\n\t\t\tif (len === 0) {\n\t\t\t\t${this.makeError({type:"stringEmpty",actual:"value",messages:e})}\n\t\t\t}\n\t\t`),null!=t.min&&a.push(`\n\t\t\tif (len < ${t.min}) {\n\t\t\t\t${this.makeError({type:"stringMin",expected:t.min,actual:"len",messages:e})}\n\t\t\t}\n\t\t`),null!=t.max&&a.push(`\n\t\t\tif (len > ${t.max}) {\n\t\t\t\t${this.makeError({type:"stringMax",expected:t.max,actual:"len",messages:e})}\n\t\t\t}\n\t\t`),null!=t.length&&a.push(`\n\t\t\tif (len !== ${t.length}) {\n\t\t\t\t${this.makeError({type:"stringLength",expected:t.length,actual:"len",messages:e})}\n\t\t\t}\n\t\t`),null!=t.pattern){let n=t.pattern;"string"==typeof t.pattern&&(n=new RegExp(t.pattern,t.patternFlags)),a.push(`\n\t\t\tif (!${n.toString()}.test(value))\n\t\t\t\t${this.makeError({type:"stringPattern",expected:'"'+n.toString().replace('"','\\"')+'"',actual:"origValue",messages:e})}\n\t\t`)}if(null!=t.contains&&a.push(`\n\t\t\tif (value.indexOf("${t.contains}") === -1) {\n\t\t\t\t${this.makeError({type:"stringContains",expected:'"'+t.contains+'"',actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),null!=t.enum){const n=JSON.stringify(t.enum);a.push(`\n\t\t\tif (${n}.indexOf(value) === -1) {\n\t\t\t\t${this.makeError({type:"stringEnum",expected:'"'+t.enum.join(", ")+'"',actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`)}return!0===t.numeric&&a.push(`\n\t\t\tif (!${Qn.toString()}.test(value) ) {\n\t\t\t\t${this.makeError({type:"stringNumeric",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),!0===t.alpha&&a.push(`\n\t\t\tif(!${tr.toString()}.test(value)) {\n\t\t\t\t${this.makeError({type:"stringAlpha",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),!0===t.alphanum&&a.push(`\n\t\t\tif(!${er.toString()}.test(value)) {\n\t\t\t\t${this.makeError({type:"stringAlphanum",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),!0===t.alphadash&&a.push(`\n\t\t\tif(!${nr.toString()}.test(value)) {\n\t\t\t\t${this.makeError({type:"stringAlphadash",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),!0===t.hex&&a.push(`\n\t\t\tif(value.length % 2 !== 0 || !${rr.toString()}.test(value)) {\n\t\t\t\t${this.makeError({type:"stringHex",actual:"origValue",messages:e})}\n\t\t\t}\n\t\t`),a.push("\n\t\treturn value;\n\t"),{sanitized:i,source:a.join("\n")}};const ir=/^https?:\/\/\S+/;var or=function({schema:t,messages:e},n,r){const a=[];return a.push(`\n\t\tif (typeof value !== "string") {\n\t\t\t${this.makeError({type:"string",actual:"value",messages:e})}\n\t\t\treturn value;\n\t\t}\n\n\t\tif (!${ir.toString()}.test(value)) {\n\t\t\t${this.makeError({type:"url",actual:"value",messages:e})}\n\t\t}\n\n\t\treturn value;\n\t`),{source:a.join("\n")}};const ur=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var sr=function({schema:t,messages:e},n){const r=[];return r.push(`\n\t\tif (typeof value !== "string") {\n\t\t\t${this.makeError({type:"string",actual:"value",messages:e})}\n\t\t\treturn value;\n\t\t}\n\n\t\tvar val = value.toLowerCase();\n\t\tif (!${ur.toString()}.test(val)) {\n\t\t\t${this.makeError({type:"uuid",actual:"value",messages:e})}\n\t\t\treturn value;\n\t\t}\n\n\t\tconst version = val.charAt(14) | 0;\n\t`),t.version&&r.push(`\n\t\t\tif (${t.version} !== version) {\n\t\t\t\t${this.makeError({type:"uuidVersion",expected:t.version,actual:"version",messages:e})}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t`),r.push(`\n\t\tswitch (version) {\n\t\tcase 1:\n\t\tcase 2:\n\t\t\tbreak;\n\t\tcase 3:\n\t\tcase 4:\n\t\tcase 5:\n\t\t\tif (["8", "9", "a", "b"].indexOf(value.charAt(19)) === -1) {\n\t\t\t\t${this.makeError({type:"uuid",actual:"value",messages:e})}\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t`),{source:r.join("\n")}};const lr=/^((([a-f0-9][a-f0-9]+[-]){5}|([a-f0-9][a-f0-9]+[:]){5})([a-f0-9][a-f0-9])$)|(^([a-f0-9][a-f0-9][a-f0-9][a-f0-9]+[.]){2}([a-f0-9][a-f0-9][a-f0-9][a-f0-9]))$/i;var cr=function({schema:t,messages:e},n,r){return{source:`\n\t\t\tif (typeof value !== "string") {\n\t\t\t\t${this.makeError({type:"string",actual:"value",messages:e})}\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tvar v = value.toLowerCase();\n\t\t\tif (!${lr.toString()}.test(v)) {\n\t\t\t\t${this.makeError({type:"mac",actual:"value",messages:e})}\n\t\t\t}\n\t\t\t\n\t\t\treturn value;\n\t\t`}},fr=function({schema:t,messages:e},n,r){return{source:`\n\t\t\tif (typeof value !== "string") {\n\t\t\t\t${this.makeError({type:"string",actual:"value",messages:e})}\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (typeof value !== "string")\n\t\t\t\tvalue = String(value);\n\n\t\t\tval = value.replace(/\\D+/g, "");\n\n\t\t\tvar array = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];\n\t\t\tvar len = val ? val.length : 0,\n\t\t\t\tbit = 1,\n\t\t\t\tsum = 0;\n\t\t\twhile (len--) {\n\t\t\t\tsum += !(bit ^= 1) ? parseInt(val[len], 10) : array[val[len]];\n\t\t\t}\n\n\t\t\tif (!(sum % 10 === 0 && sum > 0)) {\n\t\t\t\t${this.makeError({type:"luhn",actual:"value",messages:e})}\n\t\t\t}\n\n\t\t\treturn value;\n\t\t`}};let pr,hr,mr,dr;var vr=function(t){pr||(pr=r(),hr={parser:"babel",useTabs:!1,printWidth:120,trailingComma:"none",tabWidth:4,singleQuote:!1,semi:!0,bracketSpacing:!0},mr=r(),dr={language:"js",theme:mr.fromJson({keyword:["white","bold"],built_in:"magenta",literal:"cyan",number:"magenta",regexp:"red",string:["yellow","bold"],symbol:"plain",class:"blue",attr:"plain",function:["white","bold"],title:"plain",params:"green",comment:"grey"})});const e=pr.format(t,hr);return mr.highlight(e,dr)};var gr=new class{constructor(t){this.opts={messages:Vn({},Mn)},this.defaults={},t&&(Vn(this.opts,t),t.defaults&&Vn(this.defaults,t.defaults)),this.messages=this.opts.messages,this.rules={any:Nn,array:Pn,boolean:Fn,class:In,custom:_n,date:qn,email:zn,enum:Gn,equal:Un,forbidden:Jn,function:Bn,multi:Wn,number:Xn,object:Kn,string:ar,url:or,uuid:sr,mac:cr,luhn:fr},this.aliases={},this.cache=new Map}validate(t,e){return this.compile(e)(t)}wrapRequiredCheckSourceCode(t,e,n){const r=[],a=null!=t.schema.default?JSON.stringify(t.schema.default):null;return r.push("\n\t\t\tif (value === undefined || value === null) {\n\t\t"),!0===t.schema.optional||"forbidden"==t.schema.type?null!=a&&n?r.push(`${n} = ${a};`):r.push("// Do nothing, it's an optional field"):null!=a&&n?r.push(`${n} = ${a};`):r.push(this.makeError({type:"required",actual:"value",messages:t.messages})),r.push("} else {"),e&&r.push(e),r.push("\t\t}"),r.join("\n")}compile(t){if(null===t||"object"!=typeof t)throw new Error("Invalid schema.");const e=this,n={index:0,rules:[],fn:[],customs:{}};if(this.cache.clear(),!0!==t.$$root)if(Array.isArray(t)){t=this.getRuleFromSchema(t).schema}else{const e=Object.assign({},t);t={type:"object",strict:e.$$strict,properties:e},delete e.$$strict}const r=["var errors = [];","var field;","var parent = null;"],a=this.getRuleFromSchema(t);r.push(this.compileRule(a,n,null,"context.fn[%%INDEX%%](value, field, null, errors, context);","value")),r.push(`\n\t\t\t\t${this.makeCustomValidator({path:"$$root",schema:a.schema,context:n,messages:a.messages})}\n\t\t`),r.push("if (errors.length) {"),r.push('\n\t\t\treturn errors.map(err => {\n\t\t\t\tif (err.message)\n\t\t\t\t\terr.message = err.message\n\t\t\t\t\t\t.replace(/\\{field\\}/g, err.field || "")\n\t\t\t\t\t\t.replace(/\\{expected\\}/g, err.expected != null ? err.expected : "")\n\t\t\t\t\t\t.replace(/\\{actual\\}/g, err.actual != null ? err.actual : "");\n\n\t\t\t\treturn err;\n\t\t\t});\n\t\t'),r.push("}"),r.push("return true;");const i=r.join("\n"),o=new Function("value","context",i);if(this.opts.debug){let t=function(t){return t};"undefined"==typeof window&&(t=vr),n.fn.forEach((e,n)=>console.log(t(`// Context.fn[${n}]\n`+e.toString()))),console.log(t("// Main check function\n"+o.toString()))}return this.cache.clear(),function(t){return n.data=t,o.call(e,t,n)}}compileRule(t,e,n,r,a){const i=[],o=this.cache.get(t.schema);if(o)(t=o).cycle=!0,t.cycleStack=[],i.push(this.wrapRequiredCheckSourceCode(t,`\n\t\t\t\tvar rule = context.rules[${t.index}];\n\t\t\t\tif (rule.cycleStack.indexOf(value) === -1) {\n\t\t\t\t\trule.cycleStack.push(value);\n\t\t\t\t\t${r.replace("%%INDEX%%",t.index)}\n\t\t\t\t\trule.cycleStack.pop(value);\n\t\t\t\t}\n\t\t\t`,a));else{this.cache.set(t.schema,t),t.index=e.index,e.rules[e.index]=t;const o=null!=n?n:"$$root";e.customs[o]?e.customs[o].schema=t.schema:e.customs[o]={schema:t.schema},e.index++;const u=t.ruleFunction.call(this,t,n,e);if(u.source){const n=new Function("value","field","parent","errors","context",u.source);e.fn[t.index]=n,i.push(this.wrapRequiredCheckSourceCode(t,r.replace("%%INDEX%%",t.index),a))}else i.push(this.wrapRequiredCheckSourceCode(t))}return i.join("\n")}getRuleFromSchema(t){if("string"==typeof t){const e=t.split("|").map(t=>t.trim());t={type:e[0]},e.slice(1).map(e=>{const n=e.indexOf(":");if(-1!==n){const r=e.substr(0,n).trim();let a=e.substr(n+1).trim();"true"===a||"false"===a?a="true"===a:Number.isNaN(Number(a))||(a=Number(a)),t[r]=a}else e.startsWith("no-")?t[e.slice(3)]=!1:t[e]=!0})}else if(Array.isArray(t)){if(0==t.length)throw new Error("Invalid schema.");(t={type:"multi",rules:t}).rules.map(t=>this.getRuleFromSchema(t)).every(t=>1==t.schema.optional)&&(t.optional=!0)}const e=this.aliases[t.type];e&&(delete t.type,t=Vn(t,e,{skipIfExist:!0}));const n=this.rules[t.type];if(!n)throw new Error("Invalid '"+t.type+"' type in validator schema.");return{messages:Object.assign({},this.messages,t.messages),schema:Vn(t,this.defaults[t.type],{skipIfExist:!0}),ruleFunction:n}}makeError({type:t,field:e,expected:n,actual:r,messages:a}){const i={type:`"${t}"`,message:`"${a[t]}"`};i.field=e?`"${e}"`:"field",n&&(i.expected=n),r&&(i.actual=r);return`errors.push({ ${Object.keys(i).map(t=>`${t}: ${i[t]}`).join(", ")} });`}makeCustomValidator({vName:t="value",fnName:e="custom",path:n,schema:r,context:a,messages:i}){if("function"==typeof r[e]){const r=null!=n?n:"$$root";return a.customs[r]?a.customs[r].messages=i:a.customs[r]={messages:i},this.opts.useNewCustomCheckerFunction?`\n\t\t\t\t\tconst rule = context.customs["${r}"];\n\t\t\t\t\tconst fnCustomErrors = [];\n\t\t\t\t\t${t} = rule.schema.${e}.call(this, ${t}, fnCustomErrors, rule.schema, "${n}", parent, context);\n\t\t\t\t\tif (Array.isArray(fnCustomErrors)) {\n\t\t\t\t\tfnCustomErrors.forEach(err => errors.push(Object.assign({ message: rule.messages[err.type], field }, err)));\n\t\t\t\t\t}\n\t\t\t\t`:`\n\t\t\t\tconst rule = context.customs["${r}"];\n\t\t\t\tconst res = rule.schema.${e}.call(this, ${t}, rule.schema, "${n}", parent, context);\n\t\t\t\tif (Array.isArray(res)) {\n\t\t\t\t\tres.forEach(err => errors.push(Object.assign({ message: rule.messages[err.type], field }, err)));\n\t\t\t\t}\n\t\t`}return""}add(t,e){this.rules[t]=e}alias(t,e){if(this.rules[t])throw new Error("Alias name must not be a rule name");this.aliases[t]=e}}({messages:{regex:"The '{field}' field must be an valid regex! Actual: {actual}"}});function yr(t){return gr.compile(t)}gr.add("regex",(function(t){var e=t.messages;return{source:"\n if (!(value instanceof RegExp))\n ".concat(this.makeError({type:"regex",actual:"value",messages:e}),"\n\n return value;\n ")}}));var br={defaultValue:{type:"any",optional: