react-hooks-form-validator
Version:
One react hook for all your form validations
1 lines • 55.6 kB
JavaScript
import{useRef as t,useState as e,useCallback as n,useEffect as r,useMemo as a}from"react";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e){return t(e={exports:{}},e.exports),e.exports}function u(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var s=function(t){return t&&t.Math==Math&&t},l=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s("object"==typeof i&&i)||function(){return this}()||Function("return this")(),c=function(t){try{return!!t()}catch(t){return!0}},f=!c((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,m={f:h&&!p.call({1:2},1)?function(t){var e=h(this,t);return!!e&&e.enumerable}:p},d=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v={}.toString,g=function(t){return v.call(t).slice(8,-1)},y="".split,b=c((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==g(t)?y.call(t,""):Object(t)}:Object,x=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},w=function(t){return b(x(t))},E=function(t){return"object"==typeof t?null!==t:"function"==typeof t},O=function(t,e){if(!E(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!E(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!E(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!E(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},$=function(t){return Object(x(t))},j={}.hasOwnProperty,S=Object.hasOwn||function(t,e){return j.call($(t),e)},k=l.document,T=E(k)&&E(k.createElement),A=function(t){return T?k.createElement(t):{}},L=!f&&!c((function(){return 7!=Object.defineProperty(A("div"),"a",{get:function(){return 7}}).a})),V=Object.getOwnPropertyDescriptor,C={f:f?V:function(t,e){if(t=w(t),e=O(e,!0),L)try{return V(t,e)}catch(t){}if(S(t,e))return d(!m.f.call(t,e),t[e])}},N=function(t){if(!E(t))throw TypeError(String(t)+" is not an object");return t},P=Object.defineProperty,M={f:f?P:function(t,e,n){if(N(t),e=O(e,!0),N(n),L)try{return P(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}},F=f?function(t,e,n){return M.f(t,e,d(1,n))}:function(t,e,n){return t[e]=n,t},I=function(t,e){try{F(l,t,e)}catch(n){l[t]=e}return e},_=l["__core-js_shared__"]||I("__core-js_shared__",{}),q=Function.toString;"function"!=typeof _.inspectSource&&(_.inspectSource=function(t){return q.call(t)});var R,D,z,G=_.inspectSource,U=l.WeakMap,J="function"==typeof U&&/native code/.test(G(U)),B=o((function(t){(t.exports=function(t,e){return _[t]||(_[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.15.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),W=0,X=Math.random(),Z=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++W+X).toString(36)},H=B("keys"),Y=function(t){return H[t]||(H[t]=Z(t))},K={},Q=l.WeakMap;if(J||_.state){var tt=_.state||(_.state=new Q),et=tt.get,nt=tt.has,rt=tt.set;R=function(t,e){if(nt.call(tt,t))throw new TypeError("Object already initialized");return e.facade=t,rt.call(tt,t,e),e},D=function(t){return et.call(tt,t)||{}},z=function(t){return nt.call(tt,t)}}else{var at=Y("state");K[at]=!0,R=function(t,e){if(S(t,at))throw new TypeError("Object already initialized");return e.facade=t,F(t,at,e),e},D=function(t){return S(t,at)?t[at]:{}},z=function(t){return S(t,at)}}var it,ot,ut={set:R,get:D,has:z,enforce:function(t){return z(t)?D(t):R(t,{})},getterFor:function(t){return function(e){var n;if(!E(e)||(n=D(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},st=o((function(t){var e=ut.get,n=ut.enforce,r=String(String).split("String");(t.exports=function(t,e,a,i){var o,u=!!i&&!!i.unsafe,s=!!i&&!!i.enumerable,c=!!i&&!!i.noTargetGet;"function"==typeof a&&("string"!=typeof e||S(a,"name")||F(a,"name",e),(o=n(a)).source||(o.source=r.join("string"==typeof e?e:""))),t!==l?(u?!c&&t[e]&&(s=!0):delete t[e],s?t[e]=a:F(t,e,a)):s?t[e]=a:I(e,a)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||G(this)}))})),lt=l,ct=function(t){return"function"==typeof t?t:void 0},ft=function(t,e){return arguments.length<2?ct(lt[t])||ct(l[t]):lt[t]&<[t][e]||l[t]&&l[t][e]},pt=Math.ceil,ht=Math.floor,mt=function(t){return isNaN(t=+t)?0:(t>0?ht:pt)(t)},dt=Math.min,vt=function(t){return t>0?dt(mt(t),9007199254740991):0},gt=Math.max,yt=Math.min,bt=function(t){return function(e,n,r){var a,i=w(e),o=vt(i.length),u=function(t,e){var n=mt(t);return n<0?gt(n+e,0):yt(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}},xt={includes:bt(!0),indexOf:bt(!1)}.indexOf,wt=function(t,e){var n,r=w(t),a=0,i=[];for(n in r)!S(K,n)&&S(r,n)&&i.push(n);for(;e.length>a;)S(r,n=e[a++])&&(~xt(i,n)||i.push(n));return i},Et=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ot=Et.concat("length","prototype"),$t={f:Object.getOwnPropertyNames||function(t){return wt(t,Ot)}},jt={f:Object.getOwnPropertySymbols},St=ft("Reflect","ownKeys")||function(t){var e=$t.f(N(t)),n=jt.f;return n?e.concat(n(t)):e},kt=function(t,e){for(var n=St(e),r=M.f,a=C.f,i=0;i<n.length;i++){var o=n[i];S(t,o)||r(t,o,a(e,o))}},Tt=/#|\.prototype\./,At=function(t,e){var n=Vt[Lt(t)];return n==Nt||n!=Ct&&("function"==typeof e?c(e):!!e)},Lt=At.normalize=function(t){return String(t).replace(Tt,".").toLowerCase()},Vt=At.data={},Ct=At.NATIVE="N",Nt=At.POLYFILL="P",Pt=At,Mt=C.f,Ft=function(t,e){var n,r,a,i,o,u=t.target,s=t.global,c=t.stat;if(n=s?l:c?l[u]||I(u,{}):(l[u]||{}).prototype)for(r in e){if(i=e[r],a=t.noTargetGet?(o=Mt(n,r))&&o.value:n[r],!Pt(s?r:u+(c?".":"#")+r,t.forced)&&void 0!==a){if(typeof i==typeof a)continue;kt(i,a)}(t.sham||a&&a.sham)&&F(i,"sham",!0),st(n,r,i,t)}},It=Array.isArray||function(t){return"Array"==g(t)},_t=function(t,e,n){var r=O(e);r in t?M.f(t,r,d(0,n)):t[r]=n},qt=ft("navigator","userAgent")||"",Rt=l.process,Dt=Rt&&Rt.versions,zt=Dt&&Dt.v8;zt?ot=(it=zt.split("."))[0]<4?1:it[0]+it[1]:qt&&(!(it=qt.match(/Edge\/(\d+)/))||it[1]>=74)&&(it=qt.match(/Chrome\/(\d+)/))&&(ot=it[1]);var Gt=ot&&+ot,Ut=!!Object.getOwnPropertySymbols&&!c((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Gt&&Gt<41})),Jt=Ut&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Bt=B("wks"),Wt=l.Symbol,Xt=Jt?Wt:Wt&&Wt.withoutSetter||Z,Zt=function(t){return S(Bt,t)&&(Ut||"string"==typeof Bt[t])||(Ut&&S(Wt,t)?Bt[t]=Wt[t]:Bt[t]=Xt("Symbol."+t)),Bt[t]},Ht=Zt("species"),Yt=function(t,e){var n;return It(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!It(n.prototype)?E(n)&&null===(n=n[Ht])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Kt=Zt("species"),Qt=function(t){return Gt>=51||!c((function(){var e=[];return(e.constructor={})[Kt]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},te=Zt("isConcatSpreadable"),ee=Gt>=51||!c((function(){var t=[];return t[te]=!1,t.concat()[0]!==t})),ne=Qt("concat"),re=function(t){if(!E(t))return!1;var e=t[te];return void 0!==e?!!e:It(t)};Ft({target:"Array",proto:!0,forced:!ee||!ne},{concat:function(t){var e,n,r,a,i,o=$(this),u=Yt(o,0),s=0;for(e=-1,r=arguments.length;e<r;e++)if(re(i=-1===e?o:arguments[e])){if(s+(a=vt(i.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<a;n++,s++)n in i&&_t(u,s,i[n])}else{if(s>=9007199254740991)throw TypeError("Maximum allowed index exceeded");_t(u,s++,i)}return u.length=s,u}});var ae=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)}},ie=[].push,oe=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=$(s),d=b(m),v=ae(l,c,3),g=vt(d.length),y=0,x=f||Yt,w=e?x(s,g):n||o?x(s,0):void 0;g>y;y++)if((u||y in d)&&(h=v(p=d[y],y,m),t))if(e)w[y]=h;else if(h)switch(t){case 3:return!0;case 5:return p;case 6:return y;case 2:ie.call(w,p)}else switch(t){case 4:return!1;case 7:ie.call(w,p)}return i?-1:r||a?a:w}},ue={forEach:oe(0),map:oe(1),filter:oe(2),some:oe(3),every:oe(4),find:oe(5),findIndex:oe(6),filterOut:oe(7)},se=function(t,e){var n=[][t];return!!n&&c((function(){n.call(null,e||function(){throw 1},1)}))},le=ue.forEach,ce=se("forEach")?[].forEach:function(t){return le(this,t,arguments.length>1?arguments[1]:void 0)};Ft({target:"Array",proto:!0,forced:[].forEach!=ce},{forEach:ce});var fe,pe=Object.keys||function(t){return wt(t,Et)},he=f?Object.defineProperties:function(t,e){N(t);for(var n,r=pe(e),a=r.length,i=0;a>i;)M.f(t,n=r[i++],e[n]);return t},me=ft("document","documentElement"),de=Y("IE_PROTO"),ve=function(){},ge=function(t){return"<script>"+t+"<\/script>"},ye=function(){try{fe=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;ye=fe?function(t){t.write(ge("")),t.close();var e=t.parentWindow.Object;return t=null,e}(fe):((e=A("iframe")).style.display="none",me.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(ge("document.F=Object")),t.close(),t.F);for(var n=Et.length;n--;)delete ye.prototype[Et[n]];return ye()};K[de]=!0;var be=Object.create||function(t,e){var n;return null!==t?(ve.prototype=N(t),n=new ve,ve.prototype=null,n[de]=t):n=ye(),void 0===e?n:he(n,e)},xe=Zt("unscopables"),we=Array.prototype;null==we[xe]&&M.f(we,xe,{configurable:!0,value:be(null)});var Ee,Oe,$e,je=function(t){we[xe][t]=!0},Se=!c((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),ke=Y("IE_PROTO"),Te=Object.prototype,Ae=Se?Object.getPrototypeOf:function(t){return t=$(t),S(t,ke)?t[ke]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Te:null},Le=Zt("iterator"),Ve=!1;[].keys&&("next"in($e=[].keys())?(Oe=Ae(Ae($e)))!==Object.prototype&&(Ee=Oe):Ve=!0),(null==Ee||c((function(){var t={};return Ee[Le].call(t)!==t})))&&(Ee={}),S(Ee,Le)||F(Ee,Le,(function(){return this}));var Ce={IteratorPrototype:Ee,BUGGY_SAFARI_ITERATORS:Ve},Ne=M.f,Pe=Zt("toStringTag"),Me=function(t,e,n){t&&!S(t=n?t:t.prototype,Pe)&&Ne(t,Pe,{configurable:!0,value:e})},Fe=Ce.IteratorPrototype,Ie=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 N(n),function(t){if(!E(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),_e=Ce.IteratorPrototype,qe=Ce.BUGGY_SAFARI_ITERATORS,Re=Zt("iterator"),De=function(){return this},ze=ut.set,Ge=ut.getterFor("Array Iterator"),Ue=function(t,e,n,r,a,i,o){!function(t,e,n){var r=e+" Iterator";t.prototype=be(Fe,{next:d(1,n)}),Me(t,r,!1)}(n,e,r);var u,s,l,c=function(t){if(t===a&&v)return v;if(!qe&&t in h)return h[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},f=e+" Iterator",p=!1,h=t.prototype,m=h[Re]||h["@@iterator"]||a&&h[a],v=!qe&&m||c(a),g="Array"==e&&h.entries||m;if(g&&(u=Ae(g.call(new t)),_e!==Object.prototype&&u.next&&(Ae(u)!==_e&&(Ie?Ie(u,_e):"function"!=typeof u[Re]&&F(u,Re,De)),Me(u,f,!0))),"values"==a&&m&&"values"!==m.name&&(p=!0,v=function(){return m.call(this)}),h[Re]!==v&&F(h,Re,v),a)if(s={values:c("values"),keys:i?v:c("keys"),entries:c("entries")},o)for(l in s)(qe||p||!(l in h))&&st(h,l,s[l]);else Ft({target:e,proto:!0,forced:qe||p},s);return s}(Array,"Array",(function(t,e){ze(this,{type:"Array Iterator",target:w(t),index:0,kind:e})}),(function(){var t=Ge(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");je("keys"),je("values"),je("entries");var Je=ue.some,Be=se("some");Ft({target:"Array",proto:!0,forced:!Be},{some:function(t){return Je(this,t,arguments.length>1?arguments[1]:void 0)}});var We=c((function(){pe(1)}));Ft({target:"Object",stat:!0,forced:We},{keys:function(t){return pe($(t))}});var Xe={};Xe[Zt("toStringTag")]="z";var Ze="[object z]"===String(Xe),He=Zt("toStringTag"),Ye="Arguments"==g(function(){return arguments}()),Ke=Ze?g: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),He))?n:Ye?g(e):"Object"==(r=g(e))&&"function"==typeof e.callee?"Arguments":r},Qe=Ze?{}.toString:function(){return"[object "+Ke(this)+"]"};Ze||st(Object.prototype,"toString",Qe,{unsafe:!0});var tn={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 en in tn){var nn=l[en],rn=nn&&nn.prototype;if(rn&&rn.forEach!==ce)try{F(rn,"forEach",ce)}catch(t){rn.forEach=ce}}var an=Zt("iterator"),on=Zt("toStringTag"),un=Ue.values;for(var sn in tn){var ln=l[sn],cn=ln&&ln.prototype;if(cn){if(cn[an]!==un)try{F(cn,an,un)}catch(t){cn[an]=un}if(cn[on]||F(cn,on,sn),tn[sn])for(var fn in Ue)if(cn[fn]!==Ue[fn])try{F(cn,fn,Ue[fn])}catch(t){cn[fn]=Ue[fn]}}}o((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 i?i:"object"==typeof window?window:"object"==typeof self?self:i)}));function pn(t){return(pn="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 hn(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 mn(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var i=t.apply(e,n);function o(t){hn(i,r,a,o,u,"next",t)}function u(t){hn(i,r,a,o,u,"throw",t)}o(void 0)}))}}function dn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vn(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 gn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vn(Object(n),!0).forEach((function(e){dn(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vn(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function yn(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 bn(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 bn(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 bn(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 xn=ue.every,wn=se("every");Ft({target:"Array",proto:!0,forced:!wn},{every:function(t){return xn(this,t,arguments.length>1?arguments[1]:void 0)}});var En=ue.find,On=!0;"find"in[]&&Array(1).find((function(){On=!1})),Ft({target:"Array",proto:!0,forced:On},{find:function(t){return En(this,t,arguments.length>1?arguments[1]:void 0)}}),je("find");var $n=ue.map,jn=Qt("map");Ft({target:"Array",proto:!0,forced:!jn},{map:function(t){return $n(this,t,arguments.length>1?arguments[1]:void 0)}});var Sn=m.f,kn=function(t){return function(e){for(var n,r=w(e),a=pe(r),i=a.length,o=0,u=[];i>o;)n=a[o++],f&&!Sn.call(r,n)||u.push(t?[n,r[n]]:r[n]);return u}},Tn={entries:kn(!0),values:kn(!1)}.entries;Ft({target:"Object",stat:!0},{entries:function(t){return Tn(t)}});var An="\t\n\v\f\r \u2028\u2029\ufeff",Ln="["+An+"]",Vn=RegExp("^"+Ln+Ln+"*"),Cn=RegExp(Ln+Ln+"*$"),Nn=function(t){return function(e){var n=String(x(e));return 1&t&&(n=n.replace(Vn,"")),2&t&&(n=n.replace(Cn,"")),n}},Pn={start:Nn(1),end:Nn(2),trim:Nn(3)},Mn=Pn.trim;Ft({target:"String",proto:!0,forced:function(t){return c((function(){return!!An[t]()||"
"!="
"[t]()||An[t].name!==t}))}("trim")},{trim:function(){return Mn(this)}});var Fn=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},In={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."},_n=function(){return{}},qn=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")}},Rn=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")}},Dn=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")}},zn=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")}},Gn=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 Un=/^(([^<>()[\]\\.,;:\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,}))$/,Jn=/^\S+@\S+\.\S+$/;var Bn=function({schema:t,messages:e},n,r){const a=[],i="precise"==t.mode?Un:Jn;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")}},Wn=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`}},Xn=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")}},Zn=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")}},Hn=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`}},Yn=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")}},Kn=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 Qn=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/,tr=/["'\\\n\r\u2028\u2029]/g;function er(t){return t.replace(tr,(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 nr=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=er(u),l=Qn.test(s)?"."+s:`['${s}']`,c="parentObj"+l,f=(n?n+".":"")+u;a.push("\n// Field: "+er(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 rr=/^-?[0-9]\d*(\.\d+)?$/,ar=/^[a-zA-Z]+$/,ir=/^[a-zA-Z0-9]+$/,or=/^[a-zA-Z0-9_-]+$/,ur=/^[0-9a-fA-F]+$/;var sr=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 (!${rr.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(!${ar.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(!${ir.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(!${or.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 || !${ur.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 lr=/^https?:\/\/\S+/;var cr=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 (!${lr.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 fr=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var pr=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 (!${fr.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 hr=/^((([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 mr=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 (!${hr.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`}},dr=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 vr,gr,yr,br;var xr=function(t){vr||(vr=u(),gr={parser:"babel",useTabs:!1,printWidth:120,trailingComma:"none",tabWidth:4,singleQuote:!1,semi:!0,bracketSpacing:!0},yr=u(),br={language:"js",theme:yr.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=vr.format(t,gr);return yr.highlight(e,br)};var wr=new class{constructor(t){this.opts={messages:Fn({},In)},this.defaults={},t&&(Fn(this.opts,t),t.defaults&&Fn(this.defaults,t.defaults)),this.messages=this.opts.messages,this.rules={any:_n,array:qn,boolean:Rn,class:Dn,custom:zn,date:Gn,email:Bn,enum:Wn,equal:Xn,forbidden:Zn,function:Hn,multi:Yn,number:Kn,object:nr,string:sr,url:cr,uuid:pr,mac:mr,luhn:dr},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=xr),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=Fn(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:Fn(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 Er(t){return wr.compile(t)}wr.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 Or={defaultValue:{ty