Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-livr

Package Overview
Dependencies
Maintainers
45
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-livr - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/cjs/index.js

@@ -1,1 +0,1 @@

"use strict";const isObject=e=>null!==e&&e&&"object"==typeof e&&!Array.isArray(e),patchRule=(e,t)=>{return(...r)=>{const i=t(...r),s=r.splice(0,r.length-1);return(...t)=>{const r=i(...t);if(r){const t={[e]:s};return Array.isArray(r)||isObject(r)?r:{code:r,rule:t}}return""}}},isBuiltInComponent=e=>{if(!e)return!1;const{tag:t}=e.componentOptions;return/^(keep-alive|transition|transition-group)$/.test(t)};var util={isPrimitiveValue:e=>"string"==typeof e||(!("number"!=typeof e||!isFinite(e))||"boolean"==typeof e),looksLikeNumber:e=>!isNaN(+e),isObject:e=>Object(e)===e&&Object.getPrototypeOf(e)===Object.prototype,isEmptyObject(e){for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},escapeRegExp:e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),isNoValue:e=>null==e||""===e},Common={required:()=>e=>{if(util.isNoValue(e))return"REQUIRED"},not_empty:()=>e=>{if(null!=e&&""===e)return"CANNOT_BE_EMPTY"},not_empty_list:()=>e=>void 0===e||""===e?"CANNOT_BE_EMPTY":Array.isArray(e)?e.length<1?"CANNOT_BE_EMPTY":void 0:"FORMAT_ERROR",any_object:()=>e=>{if(!util.isNoValue(e))return util.isObject(e)?void 0:"FORMAT_ERROR"}},_String={string:()=>(e,t,r)=>{if(!util.isNoValue(e))return util.isPrimitiveValue(e)?void r.push(e+""):"FORMAT_ERROR"},eq:e=>(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if(t+""!=e+"")return"NOT_ALLOWED_VALUE";i.push(e)}},one_of(e){return Array.isArray(e)||(e=Array.prototype.slice.call(arguments)).pop(),(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";for(const r of e)if(t+""==r+"")return void i.push(r);return"NOT_ALLOWED_VALUE"}}},max_length:e=>(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if((t+="").length>e)return"TOO_LONG";i.push(t)}},min_length:e=>(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if((t+="").length<e)return"TOO_SHORT";i.push(t)}},length_equal:e=>(t,r,i)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?(t+="").length<e?"TOO_SHORT":t.length>e?"TOO_LONG":void i.push(t):"FORMAT_ERROR"},length_between:(e,t)=>(r,i,s)=>{if(!util.isNoValue(r))return util.isPrimitiveValue(r)?(r+="").length<e?"TOO_SHORT":r.length>t?"TOO_LONG":void s.push(r):"FORMAT_ERROR"},like(e,t){const r=3===arguments.length&&t.match("i"),i=new RegExp(e,r?"i":"");return(e,t,r)=>{if(!util.isNoValue(e)){if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";if(!(e+="").match(i))return"WRONG_FORMAT";r.push(e)}}}},Numeric={integer:()=>(e,t,r)=>{if(!util.isNoValue(e))return util.isPrimitiveValue(e)?util.looksLikeNumber(e)&&Number.isInteger(+e)?void r.push(+e):"NOT_INTEGER":"FORMAT_ERROR"},positive_integer:()=>(e,t,r)=>{if(!util.isNoValue(e))return util.isPrimitiveValue(e)?util.looksLikeNumber(e)?!Number.isInteger(+e)||+e<1?"NOT_POSITIVE_INTEGER":void r.push(+e):"NOT_POSITIVE_INTEGER":"FORMAT_ERROR"},decimal:()=>(e,t,r)=>{if(!util.isNoValue(e)){if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";if(!util.looksLikeNumber(e))return"NOT_DECIMAL";if(!/^(?:\-?(?:(?:[0-9]+\.[0-9]+)|(?:[0-9]+)))$/.test(e+=""))return"NOT_DECIMAL";r.push(+e)}},positive_decimal:()=>(e,t,r)=>{if(!util.isNoValue(e)){if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";if(!util.looksLikeNumber(e))return"NOT_POSITIVE_DECIMAL";if(!/^(?:(?:[0-9]*\.[0-9]+)|(?:[1-9][0-9]*))$/.test(e+=""))return"NOT_POSITIVE_DECIMAL";r.push(+e)}},max_number:e=>(t,r,i)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?util.looksLikeNumber(t)?+t>+e?"TOO_HIGH":void i.push(+t):"NOT_NUMBER":"FORMAT_ERROR"},min_number:e=>(t,r,i)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?util.looksLikeNumber(t)?+t<+e?"TOO_LOW":void i.push(+t):"NOT_NUMBER":"FORMAT_ERROR"},number_between:(e,t)=>(r,i,s)=>{if(!util.isNoValue(r))return util.isPrimitiveValue(r)?util.looksLikeNumber(r)?+r<+e?"TOO_LOW":+r>+t?"TOO_HIGH":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"}},Special={email(){var e=/^(([^<>()\[\]\\.,;:\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,}))$/;return t=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?(t+="",e.test(t)?/\@.*\@/.test(t)?"WRONG_EMAIL":/\@.*_/.test(t)?"WRONG_EMAIL":void 0:"WRONG_EMAIL"):"FORMAT_ERROR"}},equal_to_field:e=>(t,r)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?t!=r[e]?"FIELDS_NOT_EQUAL":void 0:"FORMAT_ERROR"},url(){const e=new RegExp("^(?:(?:http|https)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[0-1]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))\\.?|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");return t=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if(!(t.length<2083&&e.test(t)))return"WRONG_URL"}}},iso_date:()=>e=>{if(util.isNoValue(e))return;if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";const t=e.match(/^(\d{4})-([0-1][0-9])-([0-3][0-9])$/);if(t){const r=Date.parse(e);if(!r&&0!==r)return"WRONG_DATE";const i=new Date(r);if(i.setTime(i.getTime()+60*i.getTimezoneOffset()*1e3),i.getFullYear()==t[1]&&i.getMonth()+1==+t[2]&&i.getDate()==+t[3])return}return"WRONG_DATE"}};const DEFAULT_RULES={};let IS_DEFAULT_AUTO_TRIM=0;class Validator{constructor(e,t){this.isPrepared=!1,this.livrRules=e,this.validators={},this.validatorBuilders={},this.errors=null,this.isAutoTrim=null!=t?t:IS_DEFAULT_AUTO_TRIM,this.registerRules(DEFAULT_RULES)}static getDefaultRules(){return DEFAULT_RULES}static registerAliasedDefaultRule(e){if(!e.name)throw"Alias name required";DEFAULT_RULES[e.name]=this._buildAliasedRule(e.rules,e.error)}static registerDefaultRules(e){for(const t in e)DEFAULT_RULES[t]=e[t]}static defaultAutoTrim(e){IS_DEFAULT_AUTO_TRIM=!!e}static _buildAliasedRule(e,t){if(!e)throw"Alias rules required";const r={value:e};return e=>{const i=new Validator(r).registerRules(e).prepare();return(e,r,s)=>{const a=i.validate({value:e});return a?void s.push(a.value):t||i.getErrors().value}}}prepare(){const e=this.livrRules;for(const t in e){let r=e[t];Array.isArray(r)||(r=[r]);const i=[];for(const e of r){const t=this._parseRule(e);i.push(this._buildValidator(t.name,t.args))}this.validators[t]=i}return this.isPrepared=!0,this}validate(e){if(this.isPrepared||this.prepare(),!util.isObject(e))return void(this.errors="FORMAT_ERROR");this.isAutoTrim&&(e=this._autoTrim(e));const t={},r={};for(const i in this.validators){const s=this.validators[i];if(!s||!s.length)continue;const a=e[i];for(const o of s){const s=[],n=o(r.hasOwnProperty(i)?r[i]:a,e,s);if(n){t[i]=n;break}s.length?r[i]=s[0]:e.hasOwnProperty(i)&&!r.hasOwnProperty(i)&&(r[i]=a)}}return util.isEmptyObject(t)?(this.errors=null,r):(this.errors=t,!1)}getErrors(){return this.errors}registerRules(e){for(const t in e)this.validatorBuilders[t]=e[t];return this}registerAliasedRule(e){if(!e.name)throw"Alias name required";return this.validatorBuilders[e.name]=this.constructor._buildAliasedRule(e.rules,e.error),this}getRules(){return this.validatorBuilders}_parseRule(e){let t,r;return util.isObject(e)?(r=e[t=Object.keys(e)[0]],Array.isArray(r)||(r=[r])):(t=e,r=[]),{name:t,args:r}}_buildValidator(e,t){if(!this.validatorBuilders[e])throw"Rule ["+e+"] not registered";const r=[];return r.push.apply(r,t),r.push(this.getRules()),this.validatorBuilders[e].apply(null,r)}_autoTrim(e){const t=typeof e;if("object"!==t&&e)return e.replace?e.replace(/^\s*/,"").replace(/\s*$/,""):e;if("object"==t&&Array.isArray(e)){const t=[];for(const r of e)t.push(this._autoTrim(r));return t}if("object"==t&&util.isObject(e)){const t={};for(const r in e)e.hasOwnProperty(r)&&(t[r]=this._autoTrim(e[r]));return t}return e}}var Validator_1=Validator,Meta={nested_object(e,t){const r=new Validator_1(e).registerRules(t).prepare();return(e,t,i)=>{if(util.isNoValue(e))return;if(!util.isObject(e))return"FORMAT_ERROR";const s=r.validate(e);return s?void i.push(s):r.getErrors()}},variable_object(e,t,r){const i={};for(const e in t){const s=new Validator_1(t[e]).registerRules(r).prepare();i[e]=s}return(t,r,s)=>{if(util.isNoValue(t))return;if(!util.isObject(t)||!t[e]||!i[t[e]])return"FORMAT_ERROR";const a=i[t[e]],o=a.validate(t);return o?void s.push(o):a.getErrors()}},list_of(e,t){Array.isArray(e)||(t=(e=Array.prototype.slice.call(arguments)).pop());const r=new Validator_1({field:e}).registerRules(t).prepare();return(e,t,i)=>{if(util.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const s=[],a=[];let o=!1;for(const t of e){const e=r.validate({field:t});e?(s.push(e.field),a.push(null)):(o=!0,a.push(r.getErrors().field),s.push(null))}return o?a:void i.push(s)}},list_of_objects(e,t){const r=new Validator_1(e).registerRules(t).prepare();return(e,t,i)=>{if(util.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const s=[],a=[];let o=!1;for(const t of e){const e=r.validate(t);e?(s.push(e),a.push(null)):(o=!0,a.push(r.getErrors()),s.push(null))}return o?a:void i.push(s)}},list_of_different_objects(e,t,r){const i={};for(const e in t){const s=new Validator_1(t[e]).registerRules(r).prepare();i[e]=s}return(t,r,s)=>{if(util.isNoValue(t))return;if(!Array.isArray(t))return"FORMAT_ERROR";const a=[],o=[];let n=!1;for(const r of t){if("object"!=typeof r||!r[e]||!i[r[e]]){o.push("FORMAT_ERROR");continue}const t=i[r[e]],s=t.validate(r);s?(a.push(s),o.push(null)):(n=!0,o.push(t.getErrors()),a.push(null))}return n?o:void s.push(a)}},or(){const e=Array.prototype.slice.call(arguments),t=e.pop(),r=e.map(e=>{return new Validator_1({field:e}).registerRules(t).prepare()});return(e,t,i)=>{if(util.isNoValue(e))return;let s;for(const t of r){const r=t.validate({field:e});if(r)return void i.push(r.field);s=t.getErrors().field}return s||void 0}}},Modifiers={default:e=>(t,r,i)=>{util.isNoValue(t)&&i.push(e)},trim:()=>(e,t,r)=>{util.isNoValue(e)||"object"==typeof e||(e+="",r.push(e.replace(/^\s*/,"").replace(/\s*$/,"")))},to_lc:()=>(e,t,r)=>{util.isNoValue(e)||"object"==typeof e||(e+="",r.push(e.toLowerCase()))},to_uc:()=>(e,t,r)=>{util.isNoValue(e)||"object"==typeof e||(e+="",r.push(e.toUpperCase()))},remove(e){e=util.escapeRegExp(e);const t=new RegExp("["+e+"]","g");return(e,r,i)=>{util.isNoValue(e)||"object"==typeof e||(e+="",i.push(e.replace(t,"")))}},leave_only(e){e=util.escapeRegExp(e);const t=new RegExp("[^"+e+"]","g");return(e,r,i)=>{util.isNoValue(e)||"object"==typeof e||(e+="",i.push(e.replace(t,"")))}}};const LIVR={rules:{}};LIVR.rules.common=Common,LIVR.rules.string=_String,LIVR.rules.numeric=Numeric,LIVR.rules.special=Special,LIVR.rules.meta=Meta,LIVR.rules.modifiers=Modifiers,LIVR.Validator=Validator_1,LIVR.util=util,LIVR.Validator.registerDefaultRules({required:LIVR.rules.common.required,not_empty:LIVR.rules.common.not_empty,not_empty_list:LIVR.rules.common.not_empty_list,any_object:LIVR.rules.common.any_object,string:LIVR.rules.string.string,eq:LIVR.rules.string.eq,one_of:LIVR.rules.string.one_of,max_length:LIVR.rules.string.max_length,min_length:LIVR.rules.string.min_length,length_equal:LIVR.rules.string.length_equal,length_between:LIVR.rules.string.length_between,like:LIVR.rules.string.like,integer:LIVR.rules.numeric.integer,positive_integer:LIVR.rules.numeric.positive_integer,decimal:LIVR.rules.numeric.decimal,positive_decimal:LIVR.rules.numeric.positive_decimal,max_number:LIVR.rules.numeric.max_number,min_number:LIVR.rules.numeric.min_number,number_between:LIVR.rules.numeric.number_between,email:LIVR.rules.special.email,equal_to_field:LIVR.rules.special.equal_to_field,url:LIVR.rules.special.url,iso_date:LIVR.rules.special.iso_date,nested_object:LIVR.rules.meta.nested_object,variable_object:LIVR.rules.meta.variable_object,list_of:LIVR.rules.meta.list_of,list_of_objects:LIVR.rules.meta.list_of_objects,or:LIVR.rules.meta.or,list_of_different_objects:LIVR.rules.meta.list_of_different_objects,default:LIVR.rules.modifiers.default,trim:LIVR.rules.modifiers.trim,to_lc:LIVR.rules.modifiers.to_lc,to_uc:LIVR.rules.modifiers.to_uc,remove:LIVR.rules.modifiers.remove,leave_only:LIVR.rules.modifiers.leave_only});var LIVR_1=LIVR,commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=_freeGlobal||freeSelf||Function("return this")(),_root=root,Symbol=_root.Symbol,_Symbol=Symbol,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty.call(e,symToStringTag),r=e[symToStringTag];try{e[symToStringTag]=void 0;var i=!0}catch(e){}var s=nativeObjectToString.call(e);return i&&(t?e[symToStringTag]=r:delete e[symToStringTag]),s}var _getRawTag=getRawTag,objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var _objectToString=objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?_getRawTag(e):_objectToString(e)}var _baseGetTag=baseGetTag;function isObject$1(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject_1(e))return!1;var t=_baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var isFunction_1=isFunction,coreJsData=_root["__core-js_shared__"],_coreJsData=coreJsData,maskSrcKey=function(){var e=/[^.]+$/.exec(_coreJsData&&_coreJsData.keys&&_coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked,funcProto=Function.prototype,funcToString=funcProto.toString;function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$2=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$1=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject_1(e)||_isMasked(e))&&(isFunction_1(e)?reIsNative:reIsHostCtor).test(_toSource(e))}var _baseIsNative=baseIsNative;function getValue(e,t){return null==e?void 0:e[t]}var _getValue=getValue;function getNative(e,t){var r=_getValue(e,t);return _baseIsNative(r)?r:void 0}var _getNative=getNative,defineProperty=function(){try{var e=_getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_defineProperty=defineProperty;function baseAssignValue(e,t,r){"__proto__"==t&&_defineProperty?_defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var _baseAssignValue=baseAssignValue;function eq(e,t){return e===t||e!=e&&t!=t}var eq_1=eq,objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty;function assignValue(e,t,r){var i=e[t];hasOwnProperty$2.call(e,t)&&eq_1(i,r)&&(void 0!==r||t in e)||_baseAssignValue(e,t,r)}var _assignValue=assignValue,isArray=Array.isArray,isArray_1=isArray;function isObjectLike(e){return null!=e&&"object"==typeof e}var isObjectLike_1=isObjectLike,symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==typeof e||isObjectLike_1(e)&&_baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray_1(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol_1(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey,nativeCreate=_getNative(Object,"create"),_nativeCreate=nativeCreate;function hashClear(){this.__data__=_nativeCreate?_nativeCreate(null):{},this.size=0}var _hashClear=hashClear;function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _hashDelete=hashDelete,HASH_UNDEFINED="__lodash_hash_undefined__",objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function hashGet(e){var t=this.__data__;if(_nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty$3.call(t,e)?t[e]:void 0}var _hashGet=hashGet,objectProto$5=Object.prototype,hasOwnProperty$4=objectProto$5.hasOwnProperty;function hashHas(e){var t=this.__data__;return _nativeCreate?void 0!==t[e]:hasOwnProperty$4.call(t,e)}var _hashHas=hashHas,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=_nativeCreate&&void 0===t?HASH_UNDEFINED$1:t,this}var _hashSet=hashSet;function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Hash.prototype.clear=_hashClear,Hash.prototype.delete=_hashDelete,Hash.prototype.get=_hashGet,Hash.prototype.has=_hashHas,Hash.prototype.set=_hashSet;var _Hash=Hash;function listCacheClear(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear;function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq_1(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=_assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}var _listCacheDelete=listCacheDelete;function listCacheGet(e){var t=this.__data__,r=_assocIndexOf(t,e);return r<0?void 0:t[r][1]}var _listCacheGet=listCacheGet;function listCacheHas(e){return _assocIndexOf(this.__data__,e)>-1}var _listCacheHas=listCacheHas;function listCacheSet(e,t){var r=this.__data__,i=_assocIndexOf(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var _listCacheSet=listCacheSet;function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}ListCache.prototype.clear=_listCacheClear,ListCache.prototype.delete=_listCacheDelete,ListCache.prototype.get=_listCacheGet,ListCache.prototype.has=_listCacheHas,ListCache.prototype.set=_listCacheSet;var _ListCache=ListCache,Map=_getNative(_root,"Map"),_Map=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new _Hash,map:new(_Map||_ListCache),string:new _Hash}}var _mapCacheClear=mapCacheClear;function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable;function getMapData(e,t){var r=e.__data__;return _isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}var _getMapData=getMapData;function mapCacheDelete(e){var t=_getMapData(this,e).delete(e);return this.size-=t?1:0,t}var _mapCacheDelete=mapCacheDelete;function mapCacheGet(e){return _getMapData(this,e).get(e)}var _mapCacheGet=mapCacheGet;function mapCacheHas(e){return _getMapData(this,e).has(e)}var _mapCacheHas=mapCacheHas;function mapCacheSet(e,t){var r=_getMapData(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var _mapCacheSet=mapCacheSet;function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}MapCache.prototype.clear=_mapCacheClear,MapCache.prototype.delete=_mapCacheDelete,MapCache.prototype.get=_mapCacheGet,MapCache.prototype.has=_mapCacheHas,MapCache.prototype.set=_mapCacheSet;var _MapCache=MapCache,FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var i=arguments,s=t?t.apply(this,i):i[0],a=r.cache;if(a.has(s))return a.get(s);var o=e.apply(this,i);return r.cache=a.set(s,o)||a,o};return r.cache=new(memoize.Cache||_MapCache),r}memoize.Cache=_MapCache;var memoize_1=memoize,MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize_1(e,function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e}),r=t.cache;return t}var _memoizeCapped=memoizeCapped,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=_memoizeCapped(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,function(e,r,i,s){t.push(i?s.replace(reEscapeChar,"$1"):r||e)}),t}),_stringToPath=stringToPath;function arrayMap(e,t){for(var r=-1,i=null==e?0:e.length,s=Array(i);++r<i;)s[r]=t(e[r],r,e);return s}var _arrayMap=arrayMap,INFINITY=1/0,symbolProto=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray_1(e))return _arrayMap(e,baseToString)+"";if(isSymbol_1(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}var _baseToString=baseToString;function toString(e){return null==e?"":_baseToString(e)}var toString_1=toString;function castPath(e,t){return isArray_1(e)?e:_isKey(e,t)?[e]:_stringToPath(toString_1(e))}var _castPath=castPath,MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var r=typeof e;return!!(t=null==t?MAX_SAFE_INTEGER:t)&&("number"==r||"symbol"!=r&&reIsUint.test(e))&&e>-1&&e%1==0&&e<t}var _isIndex=isIndex,INFINITY$1=1/0;function toKey(e){if("string"==typeof e||isSymbol_1(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY$1?"-0":t}var _toKey=toKey;function baseSet(e,t,r,i){if(!isObject_1(e))return e;for(var s=-1,a=(t=_castPath(t,e)).length,o=a-1,n=e;null!=n&&++s<a;){var l=_toKey(t[s]),u=r;if(s!=o){var c=n[l];void 0===(u=i?i(c,l,n):void 0)&&(u=isObject_1(c)?c:_isIndex(t[s+1])?[]:{})}_assignValue(n,l,u),n=n[l]}return e}var _baseSet=baseSet;function set(e,t,r){return null==e?e:_baseSet(e,t,r)}var set_1=set;function baseGet(e,t){for(var r=0,i=(t=_castPath(t,e)).length;null!=e&&r<i;)e=e[_toKey(t[r++])];return r&&r==i?e:void 0}var _baseGet=baseGet;function get(e,t,r){var i=null==e?void 0:_baseGet(e,t);return void 0===i?r:i}var get_1=get;const getMessage=(e={},t,r,i)=>{const s=e[r];return s?s(t,i):""},getErrorMessages=(e,t,r=[])=>{const i=Array.isArray(e);return Object.entries(e).reduce((e,[s,a])=>{let o=[].concat(r);if(i||o.push(s),a&&a.code){const[[,e]]=Object.entries(a.rule);Object.assign(a,{msg:getMessage(t,o.join("."),a.code,e)}),o=[]}else a&&getErrorMessages(a,t,o);return Object.assign(e,{[s]:a})},{})};class LivrError{constructor(e,t={}){this.errorHandlers=t.errorHandlers,this.extendedErrors=t.extendedErrors,this.allTouched=!1,e&&e instanceof LivrError?(this.items=e.items,this.touchedFields=e.touchedFields):(this.items={},this.touchedFields={})}setTouched(e){set_1(this.touchedFields,e,!0)}setAllTouched(e=!1){this.allTouched=e}setError(e,t){const r=this.extendedErrors?getErrorMessages(e,this.errorHandlers):e,i=t?this.items:{};if(this.items=Object.assign({},i,r),t){get_1(r,t,!1)||set_1(this.items,t,"")}}clearErrors(e=this.items){e&&Object.entries(e).forEach(([e,t])=>"object"==typeof t?this.clearErrors(t):this.clearError(e))}clearError(e){this.setError({},e)}getError(e){if(!this.hasError(e))return"";const t=this.extendedErrors?".msg":"";return get_1(this.items,`${e}${t}`,"")}hasError(e){const t=this.allTouched||get_1(this.touchedFields,e,!1),r=this.extendedErrors?".msg":"",i=get_1(this.items,`${e}${r}`,"");return t&&""!==i}}const patchRules=()=>{const e=LIVR_1.Validator.getDefaultRules(),t=Object.entries(e).reduce((e,[t,r])=>Object.assign(e,{[t]:patchRule(t,r)}),{});LIVR_1.Validator.registerDefaultRules(t)};class Livr{constructor(e,t){this.extendedErrors=t.extendedErrors,this.aliasedRules=t.aliasedRules,this.aliasedRules.forEach(this.registerAliasedDefaultRule),LIVR_1.Validator.registerDefaultRules(t.extraRules),this.errors=new LivrError(null,t),this.extendedErrors&&patchRules(),this.fields={items:[]},this.$gzLivr=e||{_vm:{$emit:()=>{},$off:()=>{}}}}validate(e,t,r){const i=new LIVR_1.Validator(e),s=i.validate(t),a=s||i.getErrors();return s?(this.errors.clearError(r),a):(this.errors.setError(Object.assign({},a),r),this.errors.setTouched(r),{errors:this.errors.items})}registerAliasedDefaultRule(e){LIVR_1.Validator.registerAliasedDefaultRule(e)}validateAll(e,t){this.validator=new LIVR_1.Validator(e);const r=this.validator.validate(t),i=r||this.validator.getErrors();return r?(this.errors.clearErrors(),i):(this.errors.setError(i),this.errors.setAllTouched(!0),{errors:this.errors.items})}clearErrors(){this.errors.clearErrors()}clearError(e){this.errors.clearError(e)}}let VALIDATOR=null;const getValidator=()=>VALIDATOR,setValidator=e=>(VALIDATOR=e,e),DEFAULT_CONFIG={errorBagName:"errors",fieldsBagName:"fields",inject:!0,extendedErrors:!1,extraRules:{},aliasedRules:[]};let currentConfig=Object.assign({},DEFAULT_CONFIG);const resolveConfig=e=>{const t=get_1(e,"$options.$_livr",{});return Object.assign({},currentConfig,t)},getConfig=()=>currentConfig,setConfig=e=>{currentConfig=Object.assign({},currentConfig,e)},requestsValidator=e=>!(!isObject(e)||!e.$livr);var mixin={provide(){return this.$livr&&!isBuiltInComponent(this.$vnode)?{$livr:this.$livr}:{}},beforeCreate(){if(isBuiltInComponent(this.$vnode)||!1===this.$options.$__livrInject)return;this.$parent||setConfig(this.$options.$_livr||{});const e=resolveConfig(this);(!this.$parent||this.$options.$_livr&&/new/.test(this.$options.$_livr.validator))&&(this.$livr=new Livr(getValidator(),e));const t=requestsValidator(this.$options.inject);if(this.$livr||!e.inject||t||(this.$livr=new Livr(getValidator(),e)),t||this.$livr){if(!t&&this.$livr){this.$options._base.util.defineReactive(this.$livr,"errors",this.$livr.errors)}this.$options.computed||(this.$options.computed={}),this.$options.computed[e.errorBagName||"errors"]=function(){return this.$livr.errors},this.$options.computed[e.fieldsBagName||"fields"]=function(){return this.$livr.fields.items.reduce((e,t)=>t.scope?(e[`$${t.scope}`]||(e[`$${t.scope}`]={}),e[`$${t.scope}`][t.name]=t.flags,e):(e[t.name]=t.flags,e),{})}}}};let Vue,pluginInstance;class LivrPlugin{constructor(e,t){this.configure(e),pluginInstance=this,t&&(Vue=t),this.livrInstance=setValidator(new Livr(null,this.config)),this.initVM(this.config)}static install(e,t={}){Vue&&e===Vue?"production"!==process.env.NODE_ENV&&console.warn("already installed, Vue.use(LivrPlugin) should only be called once."):(Vue=e,pluginInstance=new LivrPlugin(t),Livr.$livr=pluginInstance,Vue.mixin(mixin))}initVM({errorBagName:e,fieldsBagName:t}){this._vm=new Vue({data:()=>({[e]:this.livrInstance.errors,[t]:this.livrInstance.fields})})}configure(e){setConfig(e)}get config(){return getConfig()}static get config(){return getConfig()}static get instance(){return pluginInstance}}module.exports=LivrPlugin;
"use strict";const isObject=e=>null!==e&&e&&"object"==typeof e&&!Array.isArray(e),patchRule=(e,t)=>{return(...r)=>{const i=t(...r),s=r.splice(0,r.length-1);return(...t)=>{const r=i(...t);if(r){const t={[e]:s};return Array.isArray(r)||isObject(r)?r:{code:r,rule:t}}return""}}},isBuiltInComponent=e=>{if(!e)return!1;const{tag:t}=e.componentOptions;return/^(keep-alive|transition|transition-group)$/.test(t)};var util={isPrimitiveValue:e=>"string"==typeof e||(!("number"!=typeof e||!isFinite(e))||"boolean"==typeof e),looksLikeNumber:e=>!isNaN(+e),isObject:e=>Object(e)===e&&Object.getPrototypeOf(e)===Object.prototype,isEmptyObject(e){for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},escapeRegExp:e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),isNoValue:e=>null==e||""===e},Common={required:()=>e=>{if(util.isNoValue(e))return"REQUIRED"},not_empty:()=>e=>{if(null!=e&&""===e)return"CANNOT_BE_EMPTY"},not_empty_list:()=>e=>void 0===e||""===e?"CANNOT_BE_EMPTY":Array.isArray(e)?e.length<1?"CANNOT_BE_EMPTY":void 0:"FORMAT_ERROR",any_object:()=>e=>{if(!util.isNoValue(e))return util.isObject(e)?void 0:"FORMAT_ERROR"}},_String={string:()=>(e,t,r)=>{if(!util.isNoValue(e))return util.isPrimitiveValue(e)?void r.push(e+""):"FORMAT_ERROR"},eq:e=>(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if(t+""!=e+"")return"NOT_ALLOWED_VALUE";i.push(e)}},one_of(e){return Array.isArray(e)||(e=Array.prototype.slice.call(arguments)).pop(),(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";for(const r of e)if(t+""==r+"")return void i.push(r);return"NOT_ALLOWED_VALUE"}}},max_length:e=>(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if((t+="").length>e)return"TOO_LONG";i.push(t)}},min_length:e=>(t,r,i)=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if((t+="").length<e)return"TOO_SHORT";i.push(t)}},length_equal:e=>(t,r,i)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?(t+="").length<e?"TOO_SHORT":t.length>e?"TOO_LONG":void i.push(t):"FORMAT_ERROR"},length_between:(e,t)=>(r,i,s)=>{if(!util.isNoValue(r))return util.isPrimitiveValue(r)?(r+="").length<e?"TOO_SHORT":r.length>t?"TOO_LONG":void s.push(r):"FORMAT_ERROR"},like(e,t){const r=3===arguments.length&&t.match("i"),i=new RegExp(e,r?"i":"");return(e,t,r)=>{if(!util.isNoValue(e)){if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";if(!(e+="").match(i))return"WRONG_FORMAT";r.push(e)}}}},Numeric={integer:()=>(e,t,r)=>{if(!util.isNoValue(e))return util.isPrimitiveValue(e)?util.looksLikeNumber(e)&&Number.isInteger(+e)?void r.push(+e):"NOT_INTEGER":"FORMAT_ERROR"},positive_integer:()=>(e,t,r)=>{if(!util.isNoValue(e))return util.isPrimitiveValue(e)?util.looksLikeNumber(e)?!Number.isInteger(+e)||+e<1?"NOT_POSITIVE_INTEGER":void r.push(+e):"NOT_POSITIVE_INTEGER":"FORMAT_ERROR"},decimal:()=>(e,t,r)=>{if(!util.isNoValue(e)){if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";if(!util.looksLikeNumber(e))return"NOT_DECIMAL";if(!/^(?:\-?(?:(?:[0-9]+\.[0-9]+)|(?:[0-9]+)))$/.test(e+=""))return"NOT_DECIMAL";r.push(+e)}},positive_decimal:()=>(e,t,r)=>{if(!util.isNoValue(e)){if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";if(!util.looksLikeNumber(e))return"NOT_POSITIVE_DECIMAL";if(!/^(?:(?:[0-9]*\.[0-9]+)|(?:[1-9][0-9]*))$/.test(e+=""))return"NOT_POSITIVE_DECIMAL";r.push(+e)}},max_number:e=>(t,r,i)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?util.looksLikeNumber(t)?+t>+e?"TOO_HIGH":void i.push(+t):"NOT_NUMBER":"FORMAT_ERROR"},min_number:e=>(t,r,i)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?util.looksLikeNumber(t)?+t<+e?"TOO_LOW":void i.push(+t):"NOT_NUMBER":"FORMAT_ERROR"},number_between:(e,t)=>(r,i,s)=>{if(!util.isNoValue(r))return util.isPrimitiveValue(r)?util.looksLikeNumber(r)?+r<+e?"TOO_LOW":+r>+t?"TOO_HIGH":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"}},Special={email(){var e=/^(([^<>()\[\]\\.,;:\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,}))$/;return t=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?(t+="",e.test(t)?/\@.*\@/.test(t)?"WRONG_EMAIL":/\@.*_/.test(t)?"WRONG_EMAIL":void 0:"WRONG_EMAIL"):"FORMAT_ERROR"}},equal_to_field:e=>(t,r)=>{if(!util.isNoValue(t))return util.isPrimitiveValue(t)?t!=r[e]?"FIELDS_NOT_EQUAL":void 0:"FORMAT_ERROR"},url(){const e=new RegExp("^(?:(?:http|https)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[0-1]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))\\.?|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");return t=>{if(!util.isNoValue(t)){if(!util.isPrimitiveValue(t))return"FORMAT_ERROR";if(!(t.length<2083&&e.test(t)))return"WRONG_URL"}}},iso_date:()=>e=>{if(util.isNoValue(e))return;if(!util.isPrimitiveValue(e))return"FORMAT_ERROR";const t=e.match(/^(\d{4})-([0-1][0-9])-([0-3][0-9])$/);if(t){const r=Date.parse(e);if(!r&&0!==r)return"WRONG_DATE";const i=new Date(r);if(i.setTime(i.getTime()+60*i.getTimezoneOffset()*1e3),i.getFullYear()==t[1]&&i.getMonth()+1==+t[2]&&i.getDate()==+t[3])return}return"WRONG_DATE"}};const DEFAULT_RULES={};let IS_DEFAULT_AUTO_TRIM=0;class Validator{constructor(e,t){this.isPrepared=!1,this.livrRules=e,this.validators={},this.validatorBuilders={},this.errors=null,this.isAutoTrim=null!=t?t:IS_DEFAULT_AUTO_TRIM,this.registerRules(DEFAULT_RULES)}static getDefaultRules(){return DEFAULT_RULES}static registerAliasedDefaultRule(e){if(!e.name)throw"Alias name required";DEFAULT_RULES[e.name]=this._buildAliasedRule(e.rules,e.error)}static registerDefaultRules(e){for(const t in e)DEFAULT_RULES[t]=e[t]}static defaultAutoTrim(e){IS_DEFAULT_AUTO_TRIM=!!e}static _buildAliasedRule(e,t){if(!e)throw"Alias rules required";const r={value:e};return e=>{const i=new Validator(r).registerRules(e).prepare();return(e,r,s)=>{const a=i.validate({value:e});return a?void s.push(a.value):t||i.getErrors().value}}}prepare(){const e=this.livrRules;for(const t in e){let r=e[t];Array.isArray(r)||(r=[r]);const i=[];for(const e of r){const t=this._parseRule(e);i.push(this._buildValidator(t.name,t.args))}this.validators[t]=i}return this.isPrepared=!0,this}validate(e){if(this.isPrepared||this.prepare(),!util.isObject(e))return void(this.errors="FORMAT_ERROR");this.isAutoTrim&&(e=this._autoTrim(e));const t={},r={};for(const i in this.validators){const s=this.validators[i];if(!s||!s.length)continue;const a=e[i];for(const o of s){const s=[],n=o(r.hasOwnProperty(i)?r[i]:a,e,s);if(n){t[i]=n;break}s.length?r[i]=s[0]:e.hasOwnProperty(i)&&!r.hasOwnProperty(i)&&(r[i]=a)}}return util.isEmptyObject(t)?(this.errors=null,r):(this.errors=t,!1)}getErrors(){return this.errors}registerRules(e){for(const t in e)this.validatorBuilders[t]=e[t];return this}registerAliasedRule(e){if(!e.name)throw"Alias name required";return this.validatorBuilders[e.name]=this.constructor._buildAliasedRule(e.rules,e.error),this}getRules(){return this.validatorBuilders}_parseRule(e){let t,r;return util.isObject(e)?(r=e[t=Object.keys(e)[0]],Array.isArray(r)||(r=[r])):(t=e,r=[]),{name:t,args:r}}_buildValidator(e,t){if(!this.validatorBuilders[e])throw"Rule ["+e+"] not registered";const r=[];return r.push.apply(r,t),r.push(this.getRules()),this.validatorBuilders[e].apply(null,r)}_autoTrim(e){const t=typeof e;if("object"!==t&&e)return e.replace?e.replace(/^\s*/,"").replace(/\s*$/,""):e;if("object"==t&&Array.isArray(e)){const t=[];for(const r of e)t.push(this._autoTrim(r));return t}if("object"==t&&util.isObject(e)){const t={};for(const r in e)e.hasOwnProperty(r)&&(t[r]=this._autoTrim(e[r]));return t}return e}}var Validator_1=Validator,Meta={nested_object(e,t){const r=new Validator_1(e).registerRules(t).prepare();return(e,t,i)=>{if(util.isNoValue(e))return;if(!util.isObject(e))return"FORMAT_ERROR";const s=r.validate(e);return s?void i.push(s):r.getErrors()}},variable_object(e,t,r){const i={};for(const e in t){const s=new Validator_1(t[e]).registerRules(r).prepare();i[e]=s}return(t,r,s)=>{if(util.isNoValue(t))return;if(!util.isObject(t)||!t[e]||!i[t[e]])return"FORMAT_ERROR";const a=i[t[e]],o=a.validate(t);return o?void s.push(o):a.getErrors()}},list_of(e,t){Array.isArray(e)||(t=(e=Array.prototype.slice.call(arguments)).pop());const r=new Validator_1({field:e}).registerRules(t).prepare();return(e,t,i)=>{if(util.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const s=[],a=[];let o=!1;for(const t of e){const e=r.validate({field:t});e?(s.push(e.field),a.push(null)):(o=!0,a.push(r.getErrors().field),s.push(null))}return o?a:void i.push(s)}},list_of_objects(e,t){const r=new Validator_1(e).registerRules(t).prepare();return(e,t,i)=>{if(util.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const s=[],a=[];let o=!1;for(const t of e){const e=r.validate(t);e?(s.push(e),a.push(null)):(o=!0,a.push(r.getErrors()),s.push(null))}return o?a:void i.push(s)}},list_of_different_objects(e,t,r){const i={};for(const e in t){const s=new Validator_1(t[e]).registerRules(r).prepare();i[e]=s}return(t,r,s)=>{if(util.isNoValue(t))return;if(!Array.isArray(t))return"FORMAT_ERROR";const a=[],o=[];let n=!1;for(const r of t){if("object"!=typeof r||!r[e]||!i[r[e]]){o.push("FORMAT_ERROR");continue}const t=i[r[e]],s=t.validate(r);s?(a.push(s),o.push(null)):(n=!0,o.push(t.getErrors()),a.push(null))}return n?o:void s.push(a)}},or(){const e=Array.prototype.slice.call(arguments),t=e.pop(),r=e.map(e=>{return new Validator_1({field:e}).registerRules(t).prepare()});return(e,t,i)=>{if(util.isNoValue(e))return;let s;for(const t of r){const r=t.validate({field:e});if(r)return void i.push(r.field);s=t.getErrors().field}return s||void 0}}},Modifiers={default:e=>(t,r,i)=>{util.isNoValue(t)&&i.push(e)},trim:()=>(e,t,r)=>{util.isNoValue(e)||"object"==typeof e||(e+="",r.push(e.replace(/^\s*/,"").replace(/\s*$/,"")))},to_lc:()=>(e,t,r)=>{util.isNoValue(e)||"object"==typeof e||(e+="",r.push(e.toLowerCase()))},to_uc:()=>(e,t,r)=>{util.isNoValue(e)||"object"==typeof e||(e+="",r.push(e.toUpperCase()))},remove(e){e=util.escapeRegExp(e);const t=new RegExp("["+e+"]","g");return(e,r,i)=>{util.isNoValue(e)||"object"==typeof e||(e+="",i.push(e.replace(t,"")))}},leave_only(e){e=util.escapeRegExp(e);const t=new RegExp("[^"+e+"]","g");return(e,r,i)=>{util.isNoValue(e)||"object"==typeof e||(e+="",i.push(e.replace(t,"")))}}};const LIVR={rules:{}};LIVR.rules.common=Common,LIVR.rules.string=_String,LIVR.rules.numeric=Numeric,LIVR.rules.special=Special,LIVR.rules.meta=Meta,LIVR.rules.modifiers=Modifiers,LIVR.Validator=Validator_1,LIVR.util=util,LIVR.Validator.registerDefaultRules({required:LIVR.rules.common.required,not_empty:LIVR.rules.common.not_empty,not_empty_list:LIVR.rules.common.not_empty_list,any_object:LIVR.rules.common.any_object,string:LIVR.rules.string.string,eq:LIVR.rules.string.eq,one_of:LIVR.rules.string.one_of,max_length:LIVR.rules.string.max_length,min_length:LIVR.rules.string.min_length,length_equal:LIVR.rules.string.length_equal,length_between:LIVR.rules.string.length_between,like:LIVR.rules.string.like,integer:LIVR.rules.numeric.integer,positive_integer:LIVR.rules.numeric.positive_integer,decimal:LIVR.rules.numeric.decimal,positive_decimal:LIVR.rules.numeric.positive_decimal,max_number:LIVR.rules.numeric.max_number,min_number:LIVR.rules.numeric.min_number,number_between:LIVR.rules.numeric.number_between,email:LIVR.rules.special.email,equal_to_field:LIVR.rules.special.equal_to_field,url:LIVR.rules.special.url,iso_date:LIVR.rules.special.iso_date,nested_object:LIVR.rules.meta.nested_object,variable_object:LIVR.rules.meta.variable_object,list_of:LIVR.rules.meta.list_of,list_of_objects:LIVR.rules.meta.list_of_objects,or:LIVR.rules.meta.or,list_of_different_objects:LIVR.rules.meta.list_of_different_objects,default:LIVR.rules.modifiers.default,trim:LIVR.rules.modifiers.trim,to_lc:LIVR.rules.modifiers.to_lc,to_uc:LIVR.rules.modifiers.to_uc,remove:LIVR.rules.modifiers.remove,leave_only:LIVR.rules.modifiers.leave_only});var LIVR_1=LIVR,commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=_freeGlobal||freeSelf||Function("return this")(),_root=root,Symbol=_root.Symbol,_Symbol=Symbol,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty.call(e,symToStringTag),r=e[symToStringTag];try{e[symToStringTag]=void 0;var i=!0}catch(e){}var s=nativeObjectToString.call(e);return i&&(t?e[symToStringTag]=r:delete e[symToStringTag]),s}var _getRawTag=getRawTag,objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var _objectToString=objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?_getRawTag(e):_objectToString(e)}var _baseGetTag=baseGetTag;function isObject$1(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject_1(e))return!1;var t=_baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var isFunction_1=isFunction,coreJsData=_root["__core-js_shared__"],_coreJsData=coreJsData,maskSrcKey=function(){var e=/[^.]+$/.exec(_coreJsData&&_coreJsData.keys&&_coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked,funcProto=Function.prototype,funcToString=funcProto.toString;function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$2=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$1=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject_1(e)||_isMasked(e))&&(isFunction_1(e)?reIsNative:reIsHostCtor).test(_toSource(e))}var _baseIsNative=baseIsNative;function getValue(e,t){return null==e?void 0:e[t]}var _getValue=getValue;function getNative(e,t){var r=_getValue(e,t);return _baseIsNative(r)?r:void 0}var _getNative=getNative,defineProperty=function(){try{var e=_getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_defineProperty=defineProperty;function baseAssignValue(e,t,r){"__proto__"==t&&_defineProperty?_defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var _baseAssignValue=baseAssignValue;function eq(e,t){return e===t||e!=e&&t!=t}var eq_1=eq,objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty;function assignValue(e,t,r){var i=e[t];hasOwnProperty$2.call(e,t)&&eq_1(i,r)&&(void 0!==r||t in e)||_baseAssignValue(e,t,r)}var _assignValue=assignValue,isArray=Array.isArray,isArray_1=isArray;function isObjectLike(e){return null!=e&&"object"==typeof e}var isObjectLike_1=isObjectLike,symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==typeof e||isObjectLike_1(e)&&_baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray_1(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol_1(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey,nativeCreate=_getNative(Object,"create"),_nativeCreate=nativeCreate;function hashClear(){this.__data__=_nativeCreate?_nativeCreate(null):{},this.size=0}var _hashClear=hashClear;function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _hashDelete=hashDelete,HASH_UNDEFINED="__lodash_hash_undefined__",objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function hashGet(e){var t=this.__data__;if(_nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty$3.call(t,e)?t[e]:void 0}var _hashGet=hashGet,objectProto$5=Object.prototype,hasOwnProperty$4=objectProto$5.hasOwnProperty;function hashHas(e){var t=this.__data__;return _nativeCreate?void 0!==t[e]:hasOwnProperty$4.call(t,e)}var _hashHas=hashHas,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=_nativeCreate&&void 0===t?HASH_UNDEFINED$1:t,this}var _hashSet=hashSet;function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Hash.prototype.clear=_hashClear,Hash.prototype.delete=_hashDelete,Hash.prototype.get=_hashGet,Hash.prototype.has=_hashHas,Hash.prototype.set=_hashSet;var _Hash=Hash;function listCacheClear(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear;function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq_1(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=_assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}var _listCacheDelete=listCacheDelete;function listCacheGet(e){var t=this.__data__,r=_assocIndexOf(t,e);return r<0?void 0:t[r][1]}var _listCacheGet=listCacheGet;function listCacheHas(e){return _assocIndexOf(this.__data__,e)>-1}var _listCacheHas=listCacheHas;function listCacheSet(e,t){var r=this.__data__,i=_assocIndexOf(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var _listCacheSet=listCacheSet;function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}ListCache.prototype.clear=_listCacheClear,ListCache.prototype.delete=_listCacheDelete,ListCache.prototype.get=_listCacheGet,ListCache.prototype.has=_listCacheHas,ListCache.prototype.set=_listCacheSet;var _ListCache=ListCache,Map=_getNative(_root,"Map"),_Map=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new _Hash,map:new(_Map||_ListCache),string:new _Hash}}var _mapCacheClear=mapCacheClear;function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable;function getMapData(e,t){var r=e.__data__;return _isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}var _getMapData=getMapData;function mapCacheDelete(e){var t=_getMapData(this,e).delete(e);return this.size-=t?1:0,t}var _mapCacheDelete=mapCacheDelete;function mapCacheGet(e){return _getMapData(this,e).get(e)}var _mapCacheGet=mapCacheGet;function mapCacheHas(e){return _getMapData(this,e).has(e)}var _mapCacheHas=mapCacheHas;function mapCacheSet(e,t){var r=_getMapData(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var _mapCacheSet=mapCacheSet;function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}MapCache.prototype.clear=_mapCacheClear,MapCache.prototype.delete=_mapCacheDelete,MapCache.prototype.get=_mapCacheGet,MapCache.prototype.has=_mapCacheHas,MapCache.prototype.set=_mapCacheSet;var _MapCache=MapCache,FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var i=arguments,s=t?t.apply(this,i):i[0],a=r.cache;if(a.has(s))return a.get(s);var o=e.apply(this,i);return r.cache=a.set(s,o)||a,o};return r.cache=new(memoize.Cache||_MapCache),r}memoize.Cache=_MapCache;var memoize_1=memoize,MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize_1(e,function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e}),r=t.cache;return t}var _memoizeCapped=memoizeCapped,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=_memoizeCapped(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,function(e,r,i,s){t.push(i?s.replace(reEscapeChar,"$1"):r||e)}),t}),_stringToPath=stringToPath;function arrayMap(e,t){for(var r=-1,i=null==e?0:e.length,s=Array(i);++r<i;)s[r]=t(e[r],r,e);return s}var _arrayMap=arrayMap,INFINITY=1/0,symbolProto=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray_1(e))return _arrayMap(e,baseToString)+"";if(isSymbol_1(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}var _baseToString=baseToString;function toString(e){return null==e?"":_baseToString(e)}var toString_1=toString;function castPath(e,t){return isArray_1(e)?e:_isKey(e,t)?[e]:_stringToPath(toString_1(e))}var _castPath=castPath,MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var r=typeof e;return!!(t=null==t?MAX_SAFE_INTEGER:t)&&("number"==r||"symbol"!=r&&reIsUint.test(e))&&e>-1&&e%1==0&&e<t}var _isIndex=isIndex,INFINITY$1=1/0;function toKey(e){if("string"==typeof e||isSymbol_1(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY$1?"-0":t}var _toKey=toKey;function baseSet(e,t,r,i){if(!isObject_1(e))return e;for(var s=-1,a=(t=_castPath(t,e)).length,o=a-1,n=e;null!=n&&++s<a;){var l=_toKey(t[s]),u=r;if(s!=o){var c=n[l];void 0===(u=i?i(c,l,n):void 0)&&(u=isObject_1(c)?c:_isIndex(t[s+1])?[]:{})}_assignValue(n,l,u),n=n[l]}return e}var _baseSet=baseSet;function set(e,t,r){return null==e?e:_baseSet(e,t,r)}var set_1=set;function baseGet(e,t){for(var r=0,i=(t=_castPath(t,e)).length;null!=e&&r<i;)e=e[_toKey(t[r++])];return r&&r==i?e:void 0}var _baseGet=baseGet;function get(e,t,r){var i=null==e?void 0:_baseGet(e,t);return void 0===i?r:i}var get_1=get;const getMessage=(e={},t,r,i)=>{const s=e[r];return s?s(t,i):""},getErrorMessages=(e,t,r=[])=>{const i=Array.isArray(e);return Object.entries(e).reduce((e,[s,a])=>{let o=[].concat(r);if(i||o.push(s),a&&a.code){const[[,e]]=Object.entries(a.rule);Object.assign(a,{msg:getMessage(t,o.join("."),a.code,e)}),o=[]}else a&&getErrorMessages(a,t,o);return Object.assign(e,{[s]:a})},{})};class LivrError{constructor(e,t={}){this.errorHandlers=t.errorHandlers,this.extendedErrors=t.extendedErrors,this.allTouched=!1,e&&e instanceof LivrError?(this.items=e.items,this.touchedFields=e.touchedFields):(this.items={},this.touchedFields={})}setTouched(e){set_1(this.touchedFields,e,!0)}setAllTouched(e=!1){this.allTouched=e}setError(e,t){const r=this.extendedErrors?getErrorMessages(e,this.errorHandlers):e,i=t?this.items:{};if(this.items=Object.assign({},i,r),t){get_1(r,t,!1)||set_1(this.items,t,"")}}clearErrors(e=this.items){e&&Object.entries(e).forEach(([e,t])=>"object"==typeof t?this.clearErrors(t):this.clearError(e))}clearError(e){this.setError({},e)}getError(e){if(!this.hasError(e))return"";const t=this.extendedErrors?".msg":"";return get_1(this.items,`${e}${t}`,"")}hasError(e){const t=this.allTouched||get_1(this.touchedFields,e,!1),r=this.extendedErrors?".msg":"",i=get_1(this.items,`${e}${r}`,"");return t&&""!==i}}const patchRules=()=>{const e=LIVR_1.Validator.getDefaultRules(),t=Object.entries(e).reduce((e,[t,r])=>Object.assign(e,{[t]:patchRule(t,r)}),{});LIVR_1.Validator.registerDefaultRules(t)};class Livr{constructor(e,t){this.extendedErrors=t.extendedErrors,this.aliasedRules=t.aliasedRules,this.aliasedRules.forEach(this.registerAliasedDefaultRule),LIVR_1.Validator.registerDefaultRules(t.extraRules),this.errors=new LivrError(null,t),this.extendedErrors&&patchRules(),this.fields={items:[]},this.$gzLivr=e||{_vm:{$emit:()=>{},$off:()=>{}}}}validate(e,t,r){const i=new LIVR_1.Validator(e),s=i.validate(t),a=s||i.getErrors();return s?(this.errors.clearError(r),a):(this.errors.setError(Object.assign({},a),r),this.errors.setTouched(r),{errors:this.errors.items})}registerAliasedDefaultRule(e){LIVR_1.Validator.registerAliasedDefaultRule(e)}validateAll(e,t){this.validator=new LIVR_1.Validator(e);const r=this.validator.validate(t),i=r||this.validator.getErrors();return r?(this.errors.clearErrors(),i):(this.errors.setError(i),this.errors.setAllTouched(!0),{errors:this.errors.items})}clearErrors(){this.errors.clearErrors()}clearError(e){this.errors.clearError(e)}}let VALIDATOR=null;const getValidator=()=>VALIDATOR,setValidator=e=>(VALIDATOR=e,e),DEFAULT_CONFIG={errorBagName:"errors",fieldsBagName:"fields",inject:!0,extendedErrors:!1,extraRules:{},aliasedRules:[]};let currentConfig=Object.assign({},DEFAULT_CONFIG);const resolveConfig=e=>{const t=get_1(e,"$options.$_livr",{});return Object.assign({},currentConfig,t)},getConfig=()=>currentConfig,setConfig=e=>{currentConfig=Object.assign({},currentConfig,e)},requestsValidator=e=>!(!isObject(e)||!e.$livr);var mixin={provide(){return this.$livr&&!isBuiltInComponent(this.$vnode)?{$livr:this.$livr}:{}},beforeCreate(){const e=t.errorBagName||"errors";if(isBuiltInComponent(this.$vnode)||!1===this.$options.$__livrInject)return;this.$parent||setConfig(this.$options.$_livr||{});const t=resolveConfig(this);(!this.$parent||this.$options.$_livr&&/new/.test(this.$options.$_livr.validator))&&(this.$livr=new Livr(getValidator(),t));const r=requestsValidator(this.$options.inject);if(this.$livr||!t.inject||r||(this.$livr=new Livr(getValidator(),t)),r||this.$livr){if(!r&&this.$livr){this.$options._base.util.defineReactive(this.$livr,e,this.$livr.errors)}this.$options.computed||(this.$options.computed={}),this.$options.computed[e]=function(){return this.$livr.errors},this.$options.computed[t.fieldsBagName||"fields"]=function(){return this.$livr.fields.items.reduce((e,t)=>t.scope?(e[`$${t.scope}`]||(e[`$${t.scope}`]={}),e[`$${t.scope}`][t.name]=t.flags,e):(e[t.name]=t.flags,e),{})}}}};let Vue,pluginInstance;class LivrPlugin{constructor(e,t){this.configure(e),pluginInstance=this,t&&(Vue=t),this.livrInstance=setValidator(new Livr(null,this.config)),this.initVM(this.config)}static install(e,t={}){Vue&&e===Vue?"production"!==process.env.NODE_ENV&&console.warn("already installed, Vue.use(LivrPlugin) should only be called once."):(Vue=e,pluginInstance=new LivrPlugin(t),Livr.$livr=pluginInstance,Vue.mixin(mixin))}initVM({errorBagName:e,fieldsBagName:t}){this._vm=new Vue({data:()=>({[e]:this.livrInstance.errors,[t]:this.livrInstance.fields})})}configure(e){setConfig(e)}get config(){return getConfig()}static get config(){return getConfig()}static get instance(){return pluginInstance}}module.exports=LivrPlugin;

@@ -1,1 +0,1 @@

const e=e=>null!==e&&e&&"object"==typeof e&&!Array.isArray(e),r=(r,t)=>{return(...i)=>{const s=t(...i),n=i.splice(0,i.length-1);return(...t)=>{const i=s(...t);if(i){const t={[r]:n};return Array.isArray(i)||e(i)?i:{code:i,rule:t}}return""}}},t=e=>{if(!e)return!1;const{tag:r}=e.componentOptions;return/^(keep-alive|transition|transition-group)$/.test(r)};var i={isPrimitiveValue:e=>"string"==typeof e||(!("number"!=typeof e||!isFinite(e))||"boolean"==typeof e),looksLikeNumber:e=>!isNaN(+e),isObject:e=>Object(e)===e&&Object.getPrototypeOf(e)===Object.prototype,isEmptyObject(e){for(const r in e)if(e.hasOwnProperty(r))return!1;return!0},escapeRegExp:e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),isNoValue:e=>null==e||""===e},s={required:()=>e=>{if(i.isNoValue(e))return"REQUIRED"},not_empty:()=>e=>{if(null!=e&&""===e)return"CANNOT_BE_EMPTY"},not_empty_list:()=>e=>void 0===e||""===e?"CANNOT_BE_EMPTY":Array.isArray(e)?e.length<1?"CANNOT_BE_EMPTY":void 0:"FORMAT_ERROR",any_object:()=>e=>{if(!i.isNoValue(e))return i.isObject(e)?void 0:"FORMAT_ERROR"}},n={string:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?void t.push(e+""):"FORMAT_ERROR"},eq:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(r+""!=e+"")return"NOT_ALLOWED_VALUE";s.push(e)}},one_of(e){return Array.isArray(e)||(e=Array.prototype.slice.call(arguments)).pop(),(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";for(const t of e)if(r+""==t+"")return void s.push(t);return"NOT_ALLOWED_VALUE"}}},max_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length>e)return"TOO_LONG";s.push(r)}},min_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length<e)return"TOO_SHORT";s.push(r)}},length_equal:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="").length<e?"TOO_SHORT":r.length>e?"TOO_LONG":void s.push(r):"FORMAT_ERROR"},length_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?(t+="").length<e?"TOO_SHORT":t.length>r?"TOO_LONG":void n.push(t):"FORMAT_ERROR"},like(e,r){const t=3===arguments.length&&r.match("i"),s=new RegExp(e,t?"i":"");return(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!(e+="").match(s))return"WRONG_FORMAT";t.push(e)}}}},o={integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)&&Number.isInteger(+e)?void t.push(+e):"NOT_INTEGER":"FORMAT_ERROR"},positive_integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)?!Number.isInteger(+e)||+e<1?"NOT_POSITIVE_INTEGER":void t.push(+e):"NOT_POSITIVE_INTEGER":"FORMAT_ERROR"},decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_DECIMAL";if(!/^(?:\-?(?:(?:[0-9]+\.[0-9]+)|(?:[0-9]+)))$/.test(e+=""))return"NOT_DECIMAL";t.push(+e)}},positive_decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_POSITIVE_DECIMAL";if(!/^(?:(?:[0-9]*\.[0-9]+)|(?:[1-9][0-9]*))$/.test(e+=""))return"NOT_POSITIVE_DECIMAL";t.push(+e)}},max_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r>+e?"TOO_HIGH":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},min_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r<+e?"TOO_LOW":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},number_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?i.looksLikeNumber(t)?+t<+e?"TOO_LOW":+t>+r?"TOO_HIGH":void n.push(+t):"NOT_NUMBER":"FORMAT_ERROR"}},u={email(){var e=/^(([^<>()\[\]\\.,;:\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,}))$/;return r=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="",e.test(r)?/\@.*\@/.test(r)?"WRONG_EMAIL":/\@.*_/.test(r)?"WRONG_EMAIL":void 0:"WRONG_EMAIL"):"FORMAT_ERROR"}},equal_to_field:e=>(r,t)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?r!=t[e]?"FIELDS_NOT_EQUAL":void 0:"FORMAT_ERROR"},url(){const e=new RegExp("^(?:(?:http|https)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[0-1]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))\\.?|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");return r=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(!(r.length<2083&&e.test(r)))return"WRONG_URL"}}},iso_date:()=>e=>{if(i.isNoValue(e))return;if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";const r=e.match(/^(\d{4})-([0-1][0-9])-([0-3][0-9])$/);if(r){const t=Date.parse(e);if(!t&&0!==t)return"WRONG_DATE";const i=new Date(t);if(i.setTime(i.getTime()+60*i.getTimezoneOffset()*1e3),i.getFullYear()==r[1]&&i.getMonth()+1==+r[2]&&i.getDate()==+r[3])return}return"WRONG_DATE"}};const a={};let l=0;class c{constructor(e,r){this.isPrepared=!1,this.livrRules=e,this.validators={},this.validatorBuilders={},this.errors=null,this.isAutoTrim=null!=r?r:l,this.registerRules(a)}static getDefaultRules(){return a}static registerAliasedDefaultRule(e){if(!e.name)throw"Alias name required";a[e.name]=this._buildAliasedRule(e.rules,e.error)}static registerDefaultRules(e){for(const r in e)a[r]=e[r]}static defaultAutoTrim(e){l=!!e}static _buildAliasedRule(e,r){if(!e)throw"Alias rules required";const t={value:e};return e=>{const i=new c(t).registerRules(e).prepare();return(e,t,s)=>{const n=i.validate({value:e});return n?void s.push(n.value):r||i.getErrors().value}}}prepare(){const e=this.livrRules;for(const r in e){let t=e[r];Array.isArray(t)||(t=[t]);const i=[];for(const e of t){const r=this._parseRule(e);i.push(this._buildValidator(r.name,r.args))}this.validators[r]=i}return this.isPrepared=!0,this}validate(e){if(this.isPrepared||this.prepare(),!i.isObject(e))return void(this.errors="FORMAT_ERROR");this.isAutoTrim&&(e=this._autoTrim(e));const r={},t={};for(const i in this.validators){const s=this.validators[i];if(!s||!s.length)continue;const n=e[i];for(const o of s){const s=[],u=o(t.hasOwnProperty(i)?t[i]:n,e,s);if(u){r[i]=u;break}s.length?t[i]=s[0]:e.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=n)}}return i.isEmptyObject(r)?(this.errors=null,t):(this.errors=r,!1)}getErrors(){return this.errors}registerRules(e){for(const r in e)this.validatorBuilders[r]=e[r];return this}registerAliasedRule(e){if(!e.name)throw"Alias name required";return this.validatorBuilders[e.name]=this.constructor._buildAliasedRule(e.rules,e.error),this}getRules(){return this.validatorBuilders}_parseRule(e){let r,t;return i.isObject(e)?(t=e[r=Object.keys(e)[0]],Array.isArray(t)||(t=[t])):(r=e,t=[]),{name:r,args:t}}_buildValidator(e,r){if(!this.validatorBuilders[e])throw"Rule ["+e+"] not registered";const t=[];return t.push.apply(t,r),t.push(this.getRules()),this.validatorBuilders[e].apply(null,t)}_autoTrim(e){const r=typeof e;if("object"!==r&&e)return e.replace?e.replace(/^\s*/,"").replace(/\s*$/,""):e;if("object"==r&&Array.isArray(e)){const r=[];for(const t of e)r.push(this._autoTrim(t));return r}if("object"==r&&i.isObject(e)){const r={};for(const t in e)e.hasOwnProperty(t)&&(r[t]=this._autoTrim(e[t]));return r}return e}}var f=c,h={nested_object(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!i.isObject(e))return"FORMAT_ERROR";const n=t.validate(e);return n?void s.push(n):t.getErrors()}},variable_object(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!i.isObject(r)||!r[e]||!s[r[e]])return"FORMAT_ERROR";const o=s[r[e]],u=o.validate(r);return u?void n.push(u):o.getErrors()}},list_of(e,r){Array.isArray(e)||(r=(e=Array.prototype.slice.call(arguments)).pop());const t=new f({field:e}).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate({field:r});e?(n.push(e.field),o.push(null)):(u=!0,o.push(t.getErrors().field),n.push(null))}return u?o:void s.push(n)}},list_of_objects(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate(r);e?(n.push(e),o.push(null)):(u=!0,o.push(t.getErrors()),n.push(null))}return u?o:void s.push(n)}},list_of_different_objects(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!Array.isArray(r))return"FORMAT_ERROR";const o=[],u=[];let a=!1;for(const t of r){if("object"!=typeof t||!t[e]||!s[t[e]]){u.push("FORMAT_ERROR");continue}const r=s[t[e]],i=r.validate(t);i?(o.push(i),u.push(null)):(a=!0,u.push(r.getErrors()),o.push(null))}return a?u:void n.push(o)}},or(){const e=Array.prototype.slice.call(arguments),r=e.pop(),t=e.map(e=>{return new f({field:e}).registerRules(r).prepare()});return(e,r,s)=>{if(i.isNoValue(e))return;let n;for(const r of t){const t=r.validate({field:e});if(t)return void s.push(t.field);n=r.getErrors().field}return n||void 0}}},p={default:e=>(r,t,s)=>{i.isNoValue(r)&&s.push(e)},trim:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.replace(/^\s*/,"").replace(/\s*$/,"")))},to_lc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toLowerCase()))},to_uc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toUpperCase()))},remove(e){e=i.escapeRegExp(e);const r=new RegExp("["+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}},leave_only(e){e=i.escapeRegExp(e);const r=new RegExp("[^"+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}}};const d={rules:{}};d.rules.common=s,d.rules.string=n,d.rules.numeric=o,d.rules.special=u,d.rules.meta=h,d.rules.modifiers=p,d.Validator=f,d.util=i,d.Validator.registerDefaultRules({required:d.rules.common.required,not_empty:d.rules.common.not_empty,not_empty_list:d.rules.common.not_empty_list,any_object:d.rules.common.any_object,string:d.rules.string.string,eq:d.rules.string.eq,one_of:d.rules.string.one_of,max_length:d.rules.string.max_length,min_length:d.rules.string.min_length,length_equal:d.rules.string.length_equal,length_between:d.rules.string.length_between,like:d.rules.string.like,integer:d.rules.numeric.integer,positive_integer:d.rules.numeric.positive_integer,decimal:d.rules.numeric.decimal,positive_decimal:d.rules.numeric.positive_decimal,max_number:d.rules.numeric.max_number,min_number:d.rules.numeric.min_number,number_between:d.rules.numeric.number_between,email:d.rules.special.email,equal_to_field:d.rules.special.equal_to_field,url:d.rules.special.url,iso_date:d.rules.special.iso_date,nested_object:d.rules.meta.nested_object,variable_object:d.rules.meta.variable_object,list_of:d.rules.meta.list_of,list_of_objects:d.rules.meta.list_of_objects,or:d.rules.meta.or,list_of_different_objects:d.rules.meta.list_of_different_objects,default:d.rules.modifiers.default,trim:d.rules.modifiers.trim,to_lc:d.rules.modifiers.to_lc,to_uc:d.rules.modifiers.to_uc,remove:d.rules.modifiers.remove,leave_only:d.rules.modifiers.leave_only});var _=d,v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},R="object"==typeof v&&v&&v.Object===Object&&v,m="object"==typeof self&&self&&self.Object===Object&&self,O=R||m||Function("return this")(),g=O.Symbol,y=Object.prototype,b=y.hasOwnProperty,E=y.toString,A=g?g.toStringTag:void 0;var T=function(e){var r=b.call(e,A),t=e[A];try{e[A]=void 0;var i=!0}catch(e){}var s=E.call(e);return i&&(r?e[A]=t:delete e[A]),s},N=Object.prototype.toString;var j=function(e){return N.call(e)},V="[object Null]",$="[object Undefined]",w=g?g.toStringTag:void 0;var M=function(e){return null==e?void 0===e?$:V:w&&w in Object(e)?T(e):j(e)};var P=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)},F="[object AsyncFunction]",L="[object Function]",x="[object GeneratorFunction]",I="[object Proxy]";var k,D=function(e){if(!P(e))return!1;var r=M(e);return r==L||r==x||r==F||r==I},z=O["__core-js_shared__"],S=(k=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var B=function(e){return!!S&&S in e},G=Function.prototype.toString;var q=function(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""},C=/^\[object .+?Constructor\]$/,W=Function.prototype,H=Object.prototype,U=W.toString,Y=H.hasOwnProperty,Q=RegExp("^"+U.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Z=function(e){return!(!P(e)||B(e))&&(D(e)?Q:C).test(q(e))};var J=function(e,r){return null==e?void 0:e[r]};var K=function(e,r){var t=J(e,r);return Z(t)?t:void 0},X=function(){try{var e=K(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var ee=function(e,r,t){"__proto__"==r&&X?X(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t};var re=function(e,r){return e===r||e!=e&&r!=r},te=Object.prototype.hasOwnProperty;var ie=function(e,r,t){var i=e[r];te.call(e,r)&&re(i,t)&&(void 0!==t||r in e)||ee(e,r,t)},se=Array.isArray;var ne=function(e){return null!=e&&"object"==typeof e},oe="[object Symbol]";var ue=function(e){return"symbol"==typeof e||ne(e)&&M(e)==oe},ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,le=/^\w*$/;var ce=function(e,r){if(se(e))return!1;var t=typeof e;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!ue(e))||le.test(e)||!ae.test(e)||null!=r&&e in Object(r)},fe=K(Object,"create");var he=function(){this.__data__=fe?fe(null):{},this.size=0};var pe=function(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r},de="__lodash_hash_undefined__",_e=Object.prototype.hasOwnProperty;var ve=function(e){var r=this.__data__;if(fe){var t=r[e];return t===de?void 0:t}return _e.call(r,e)?r[e]:void 0},Re=Object.prototype.hasOwnProperty;var me=function(e){var r=this.__data__;return fe?void 0!==r[e]:Re.call(r,e)},Oe="__lodash_hash_undefined__";var ge=function(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=fe&&void 0===r?Oe:r,this};function ye(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}ye.prototype.clear=he,ye.prototype.delete=pe,ye.prototype.get=ve,ye.prototype.has=me,ye.prototype.set=ge;var be=ye;var Ee=function(){this.__data__=[],this.size=0};var Ae=function(e,r){for(var t=e.length;t--;)if(re(e[t][0],r))return t;return-1},Te=Array.prototype.splice;var Ne=function(e){var r=this.__data__,t=Ae(r,e);return!(t<0||(t==r.length-1?r.pop():Te.call(r,t,1),--this.size,0))};var je=function(e){var r=this.__data__,t=Ae(r,e);return t<0?void 0:r[t][1]};var Ve=function(e){return Ae(this.__data__,e)>-1};var $e=function(e,r){var t=this.__data__,i=Ae(t,e);return i<0?(++this.size,t.push([e,r])):t[i][1]=r,this};function we(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}we.prototype.clear=Ee,we.prototype.delete=Ne,we.prototype.get=je,we.prototype.has=Ve,we.prototype.set=$e;var Me=we,Pe=K(O,"Map");var Fe=function(){this.size=0,this.__data__={hash:new be,map:new(Pe||Me),string:new be}};var Le=function(e){var r=typeof e;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e};var xe=function(e,r){var t=e.__data__;return Le(r)?t["string"==typeof r?"string":"hash"]:t.map};var Ie=function(e){var r=xe(this,e).delete(e);return this.size-=r?1:0,r};var ke=function(e){return xe(this,e).get(e)};var De=function(e){return xe(this,e).has(e)};var ze=function(e,r){var t=xe(this,e),i=t.size;return t.set(e,r),this.size+=t.size==i?0:1,this};function Se(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}Se.prototype.clear=Fe,Se.prototype.delete=Ie,Se.prototype.get=ke,Se.prototype.has=De,Se.prototype.set=ze;var Be=Se,Ge="Expected a function";function qe(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(Ge);var t=function(){var i=arguments,s=r?r.apply(this,i):i[0],n=t.cache;if(n.has(s))return n.get(s);var o=e.apply(this,i);return t.cache=n.set(s,o)||n,o};return t.cache=new(qe.Cache||Be),t}qe.Cache=Be;var Ce=qe,We=500;var He=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ue=/\\(\\)?/g,Ye=function(e){var r=Ce(e,function(e){return t.size===We&&t.clear(),e}),t=r.cache;return r}(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(He,function(e,t,i,s){r.push(i?s.replace(Ue,"$1"):t||e)}),r});var Qe=function(e,r){for(var t=-1,i=null==e?0:e.length,s=Array(i);++t<i;)s[t]=r(e[t],t,e);return s},Ze=1/0,Je=g?g.prototype:void 0,Ke=Je?Je.toString:void 0;var Xe=function e(r){if("string"==typeof r)return r;if(se(r))return Qe(r,e)+"";if(ue(r))return Ke?Ke.call(r):"";var t=r+"";return"0"==t&&1/r==-Ze?"-0":t};var er=function(e){return null==e?"":Xe(e)};var rr=function(e,r){return se(e)?e:ce(e,r)?[e]:Ye(er(e))},tr=9007199254740991,ir=/^(?:0|[1-9]\d*)$/;var sr=function(e,r){var t=typeof e;return!!(r=null==r?tr:r)&&("number"==t||"symbol"!=t&&ir.test(e))&&e>-1&&e%1==0&&e<r},nr=1/0;var or=function(e){if("string"==typeof e||ue(e))return e;var r=e+"";return"0"==r&&1/e==-nr?"-0":r};var ur=function(e,r,t,i){if(!P(e))return e;for(var s=-1,n=(r=rr(r,e)).length,o=n-1,u=e;null!=u&&++s<n;){var a=or(r[s]),l=t;if(s!=o){var c=u[a];void 0===(l=i?i(c,a,u):void 0)&&(l=P(c)?c:sr(r[s+1])?[]:{})}ie(u,a,l),u=u[a]}return e};var ar=function(e,r,t){return null==e?e:ur(e,r,t)};var lr=function(e,r){for(var t=0,i=(r=rr(r,e)).length;null!=e&&t<i;)e=e[or(r[t++])];return t&&t==i?e:void 0};var cr=function(e,r,t){var i=null==e?void 0:lr(e,r);return void 0===i?t:i};const fr=(e={},r,t,i)=>{const s=e[t];return s?s(r,i):""},hr=(e,r,t=[])=>{const i=Array.isArray(e);return Object.entries(e).reduce((e,[s,n])=>{let o=[].concat(t);if(i||o.push(s),n&&n.code){const[[,e]]=Object.entries(n.rule);Object.assign(n,{msg:fr(r,o.join("."),n.code,e)}),o=[]}else n&&hr(n,r,o);return Object.assign(e,{[s]:n})},{})};class pr{constructor(e,r={}){this.errorHandlers=r.errorHandlers,this.extendedErrors=r.extendedErrors,this.allTouched=!1,e&&e instanceof pr?(this.items=e.items,this.touchedFields=e.touchedFields):(this.items={},this.touchedFields={})}setTouched(e){ar(this.touchedFields,e,!0)}setAllTouched(e=!1){this.allTouched=e}setError(e,r){const t=this.extendedErrors?hr(e,this.errorHandlers):e,i=r?this.items:{};if(this.items=Object.assign({},i,t),r){cr(t,r,!1)||ar(this.items,r,"")}}clearErrors(e=this.items){e&&Object.entries(e).forEach(([e,r])=>"object"==typeof r?this.clearErrors(r):this.clearError(e))}clearError(e){this.setError({},e)}getError(e){if(!this.hasError(e))return"";const r=this.extendedErrors?".msg":"";return cr(this.items,`${e}${r}`,"")}hasError(e){const r=this.allTouched||cr(this.touchedFields,e,!1),t=this.extendedErrors?".msg":"",i=cr(this.items,`${e}${t}`,"");return r&&""!==i}}const dr=()=>{const e=_.Validator.getDefaultRules(),t=Object.entries(e).reduce((e,[t,i])=>Object.assign(e,{[t]:r(t,i)}),{});_.Validator.registerDefaultRules(t)};class _r{constructor(e,r){this.extendedErrors=r.extendedErrors,this.aliasedRules=r.aliasedRules,this.aliasedRules.forEach(this.registerAliasedDefaultRule),_.Validator.registerDefaultRules(r.extraRules),this.errors=new pr(null,r),this.extendedErrors&&dr(),this.fields={items:[]},this.$gzLivr=e||{_vm:{$emit:()=>{},$off:()=>{}}}}validate(e,r,t){const i=new _.Validator(e),s=i.validate(r),n=s||i.getErrors();return s?(this.errors.clearError(t),n):(this.errors.setError(Object.assign({},n),t),this.errors.setTouched(t),{errors:this.errors.items})}registerAliasedDefaultRule(e){_.Validator.registerAliasedDefaultRule(e)}validateAll(e,r){this.validator=new _.Validator(e);const t=this.validator.validate(r),i=t||this.validator.getErrors();return t?(this.errors.clearErrors(),i):(this.errors.setError(i),this.errors.setAllTouched(!0),{errors:this.errors.items})}clearErrors(){this.errors.clearErrors()}clearError(e){this.errors.clearError(e)}}let vr=null;const Rr=()=>vr,mr=e=>(vr=e,e);let Or=Object.assign({},{errorBagName:"errors",fieldsBagName:"fields",inject:!0,extendedErrors:!1,extraRules:{},aliasedRules:[]});const gr=()=>Or,yr=e=>{Or=Object.assign({},Or,e)};var br={provide(){return this.$livr&&!t(this.$vnode)?{$livr:this.$livr}:{}},beforeCreate(){if(t(this.$vnode)||!1===this.$options.$__livrInject)return;this.$parent||yr(this.$options.$_livr||{});const r=(e=>{const r=cr(e,"$options.$_livr",{});return Object.assign({},Or,r)})(this);(!this.$parent||this.$options.$_livr&&/new/.test(this.$options.$_livr.validator))&&(this.$livr=new _r(Rr(),r));const i=(r=>!(!e(r)||!r.$livr))(this.$options.inject);if(this.$livr||!r.inject||i||(this.$livr=new _r(Rr(),r)),i||this.$livr){if(!i&&this.$livr){this.$options._base.util.defineReactive(this.$livr,"errors",this.$livr.errors)}this.$options.computed||(this.$options.computed={}),this.$options.computed[r.errorBagName||"errors"]=function(){return this.$livr.errors},this.$options.computed[r.fieldsBagName||"fields"]=function(){return this.$livr.fields.items.reduce((e,r)=>r.scope?(e[`$${r.scope}`]||(e[`$${r.scope}`]={}),e[`$${r.scope}`][r.name]=r.flags,e):(e[r.name]=r.flags,e),{})}}}};let Er,Ar;class Tr{constructor(e,r){this.configure(e),Ar=this,r&&(Er=r),this.livrInstance=mr(new _r(null,this.config)),this.initVM(this.config)}static install(e,r={}){Er&&e===Er?"production"!==process.env.NODE_ENV&&console.warn("already installed, Vue.use(LivrPlugin) should only be called once."):(Er=e,Ar=new Tr(r),_r.$livr=Ar,Er.mixin(br))}initVM({errorBagName:e,fieldsBagName:r}){this._vm=new Er({data:()=>({[e]:this.livrInstance.errors,[r]:this.livrInstance.fields})})}configure(e){yr(e)}get config(){return gr()}static get config(){return gr()}static get instance(){return Ar}}export default Tr;
const e=e=>null!==e&&e&&"object"==typeof e&&!Array.isArray(e),r=(r,t)=>{return(...i)=>{const s=t(...i),n=i.splice(0,i.length-1);return(...t)=>{const i=s(...t);if(i){const t={[r]:n};return Array.isArray(i)||e(i)?i:{code:i,rule:t}}return""}}},t=e=>{if(!e)return!1;const{tag:r}=e.componentOptions;return/^(keep-alive|transition|transition-group)$/.test(r)};var i={isPrimitiveValue:e=>"string"==typeof e||(!("number"!=typeof e||!isFinite(e))||"boolean"==typeof e),looksLikeNumber:e=>!isNaN(+e),isObject:e=>Object(e)===e&&Object.getPrototypeOf(e)===Object.prototype,isEmptyObject(e){for(const r in e)if(e.hasOwnProperty(r))return!1;return!0},escapeRegExp:e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),isNoValue:e=>null==e||""===e},s={required:()=>e=>{if(i.isNoValue(e))return"REQUIRED"},not_empty:()=>e=>{if(null!=e&&""===e)return"CANNOT_BE_EMPTY"},not_empty_list:()=>e=>void 0===e||""===e?"CANNOT_BE_EMPTY":Array.isArray(e)?e.length<1?"CANNOT_BE_EMPTY":void 0:"FORMAT_ERROR",any_object:()=>e=>{if(!i.isNoValue(e))return i.isObject(e)?void 0:"FORMAT_ERROR"}},n={string:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?void t.push(e+""):"FORMAT_ERROR"},eq:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(r+""!=e+"")return"NOT_ALLOWED_VALUE";s.push(e)}},one_of(e){return Array.isArray(e)||(e=Array.prototype.slice.call(arguments)).pop(),(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";for(const t of e)if(r+""==t+"")return void s.push(t);return"NOT_ALLOWED_VALUE"}}},max_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length>e)return"TOO_LONG";s.push(r)}},min_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length<e)return"TOO_SHORT";s.push(r)}},length_equal:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="").length<e?"TOO_SHORT":r.length>e?"TOO_LONG":void s.push(r):"FORMAT_ERROR"},length_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?(t+="").length<e?"TOO_SHORT":t.length>r?"TOO_LONG":void n.push(t):"FORMAT_ERROR"},like(e,r){const t=3===arguments.length&&r.match("i"),s=new RegExp(e,t?"i":"");return(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!(e+="").match(s))return"WRONG_FORMAT";t.push(e)}}}},o={integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)&&Number.isInteger(+e)?void t.push(+e):"NOT_INTEGER":"FORMAT_ERROR"},positive_integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)?!Number.isInteger(+e)||+e<1?"NOT_POSITIVE_INTEGER":void t.push(+e):"NOT_POSITIVE_INTEGER":"FORMAT_ERROR"},decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_DECIMAL";if(!/^(?:\-?(?:(?:[0-9]+\.[0-9]+)|(?:[0-9]+)))$/.test(e+=""))return"NOT_DECIMAL";t.push(+e)}},positive_decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_POSITIVE_DECIMAL";if(!/^(?:(?:[0-9]*\.[0-9]+)|(?:[1-9][0-9]*))$/.test(e+=""))return"NOT_POSITIVE_DECIMAL";t.push(+e)}},max_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r>+e?"TOO_HIGH":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},min_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r<+e?"TOO_LOW":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},number_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?i.looksLikeNumber(t)?+t<+e?"TOO_LOW":+t>+r?"TOO_HIGH":void n.push(+t):"NOT_NUMBER":"FORMAT_ERROR"}},u={email(){var e=/^(([^<>()\[\]\\.,;:\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,}))$/;return r=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="",e.test(r)?/\@.*\@/.test(r)?"WRONG_EMAIL":/\@.*_/.test(r)?"WRONG_EMAIL":void 0:"WRONG_EMAIL"):"FORMAT_ERROR"}},equal_to_field:e=>(r,t)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?r!=t[e]?"FIELDS_NOT_EQUAL":void 0:"FORMAT_ERROR"},url(){const e=new RegExp("^(?:(?:http|https)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[0-1]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))\\.?|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");return r=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(!(r.length<2083&&e.test(r)))return"WRONG_URL"}}},iso_date:()=>e=>{if(i.isNoValue(e))return;if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";const r=e.match(/^(\d{4})-([0-1][0-9])-([0-3][0-9])$/);if(r){const t=Date.parse(e);if(!t&&0!==t)return"WRONG_DATE";const i=new Date(t);if(i.setTime(i.getTime()+60*i.getTimezoneOffset()*1e3),i.getFullYear()==r[1]&&i.getMonth()+1==+r[2]&&i.getDate()==+r[3])return}return"WRONG_DATE"}};const a={};let l=0;class c{constructor(e,r){this.isPrepared=!1,this.livrRules=e,this.validators={},this.validatorBuilders={},this.errors=null,this.isAutoTrim=null!=r?r:l,this.registerRules(a)}static getDefaultRules(){return a}static registerAliasedDefaultRule(e){if(!e.name)throw"Alias name required";a[e.name]=this._buildAliasedRule(e.rules,e.error)}static registerDefaultRules(e){for(const r in e)a[r]=e[r]}static defaultAutoTrim(e){l=!!e}static _buildAliasedRule(e,r){if(!e)throw"Alias rules required";const t={value:e};return e=>{const i=new c(t).registerRules(e).prepare();return(e,t,s)=>{const n=i.validate({value:e});return n?void s.push(n.value):r||i.getErrors().value}}}prepare(){const e=this.livrRules;for(const r in e){let t=e[r];Array.isArray(t)||(t=[t]);const i=[];for(const e of t){const r=this._parseRule(e);i.push(this._buildValidator(r.name,r.args))}this.validators[r]=i}return this.isPrepared=!0,this}validate(e){if(this.isPrepared||this.prepare(),!i.isObject(e))return void(this.errors="FORMAT_ERROR");this.isAutoTrim&&(e=this._autoTrim(e));const r={},t={};for(const i in this.validators){const s=this.validators[i];if(!s||!s.length)continue;const n=e[i];for(const o of s){const s=[],u=o(t.hasOwnProperty(i)?t[i]:n,e,s);if(u){r[i]=u;break}s.length?t[i]=s[0]:e.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=n)}}return i.isEmptyObject(r)?(this.errors=null,t):(this.errors=r,!1)}getErrors(){return this.errors}registerRules(e){for(const r in e)this.validatorBuilders[r]=e[r];return this}registerAliasedRule(e){if(!e.name)throw"Alias name required";return this.validatorBuilders[e.name]=this.constructor._buildAliasedRule(e.rules,e.error),this}getRules(){return this.validatorBuilders}_parseRule(e){let r,t;return i.isObject(e)?(t=e[r=Object.keys(e)[0]],Array.isArray(t)||(t=[t])):(r=e,t=[]),{name:r,args:t}}_buildValidator(e,r){if(!this.validatorBuilders[e])throw"Rule ["+e+"] not registered";const t=[];return t.push.apply(t,r),t.push(this.getRules()),this.validatorBuilders[e].apply(null,t)}_autoTrim(e){const r=typeof e;if("object"!==r&&e)return e.replace?e.replace(/^\s*/,"").replace(/\s*$/,""):e;if("object"==r&&Array.isArray(e)){const r=[];for(const t of e)r.push(this._autoTrim(t));return r}if("object"==r&&i.isObject(e)){const r={};for(const t in e)e.hasOwnProperty(t)&&(r[t]=this._autoTrim(e[t]));return r}return e}}var f=c,h={nested_object(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!i.isObject(e))return"FORMAT_ERROR";const n=t.validate(e);return n?void s.push(n):t.getErrors()}},variable_object(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!i.isObject(r)||!r[e]||!s[r[e]])return"FORMAT_ERROR";const o=s[r[e]],u=o.validate(r);return u?void n.push(u):o.getErrors()}},list_of(e,r){Array.isArray(e)||(r=(e=Array.prototype.slice.call(arguments)).pop());const t=new f({field:e}).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate({field:r});e?(n.push(e.field),o.push(null)):(u=!0,o.push(t.getErrors().field),n.push(null))}return u?o:void s.push(n)}},list_of_objects(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate(r);e?(n.push(e),o.push(null)):(u=!0,o.push(t.getErrors()),n.push(null))}return u?o:void s.push(n)}},list_of_different_objects(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!Array.isArray(r))return"FORMAT_ERROR";const o=[],u=[];let a=!1;for(const t of r){if("object"!=typeof t||!t[e]||!s[t[e]]){u.push("FORMAT_ERROR");continue}const r=s[t[e]],i=r.validate(t);i?(o.push(i),u.push(null)):(a=!0,u.push(r.getErrors()),o.push(null))}return a?u:void n.push(o)}},or(){const e=Array.prototype.slice.call(arguments),r=e.pop(),t=e.map(e=>{return new f({field:e}).registerRules(r).prepare()});return(e,r,s)=>{if(i.isNoValue(e))return;let n;for(const r of t){const t=r.validate({field:e});if(t)return void s.push(t.field);n=r.getErrors().field}return n||void 0}}},p={default:e=>(r,t,s)=>{i.isNoValue(r)&&s.push(e)},trim:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.replace(/^\s*/,"").replace(/\s*$/,"")))},to_lc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toLowerCase()))},to_uc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toUpperCase()))},remove(e){e=i.escapeRegExp(e);const r=new RegExp("["+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}},leave_only(e){e=i.escapeRegExp(e);const r=new RegExp("[^"+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}}};const d={rules:{}};d.rules.common=s,d.rules.string=n,d.rules.numeric=o,d.rules.special=u,d.rules.meta=h,d.rules.modifiers=p,d.Validator=f,d.util=i,d.Validator.registerDefaultRules({required:d.rules.common.required,not_empty:d.rules.common.not_empty,not_empty_list:d.rules.common.not_empty_list,any_object:d.rules.common.any_object,string:d.rules.string.string,eq:d.rules.string.eq,one_of:d.rules.string.one_of,max_length:d.rules.string.max_length,min_length:d.rules.string.min_length,length_equal:d.rules.string.length_equal,length_between:d.rules.string.length_between,like:d.rules.string.like,integer:d.rules.numeric.integer,positive_integer:d.rules.numeric.positive_integer,decimal:d.rules.numeric.decimal,positive_decimal:d.rules.numeric.positive_decimal,max_number:d.rules.numeric.max_number,min_number:d.rules.numeric.min_number,number_between:d.rules.numeric.number_between,email:d.rules.special.email,equal_to_field:d.rules.special.equal_to_field,url:d.rules.special.url,iso_date:d.rules.special.iso_date,nested_object:d.rules.meta.nested_object,variable_object:d.rules.meta.variable_object,list_of:d.rules.meta.list_of,list_of_objects:d.rules.meta.list_of_objects,or:d.rules.meta.or,list_of_different_objects:d.rules.meta.list_of_different_objects,default:d.rules.modifiers.default,trim:d.rules.modifiers.trim,to_lc:d.rules.modifiers.to_lc,to_uc:d.rules.modifiers.to_uc,remove:d.rules.modifiers.remove,leave_only:d.rules.modifiers.leave_only});var _=d,v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},R="object"==typeof v&&v&&v.Object===Object&&v,m="object"==typeof self&&self&&self.Object===Object&&self,O=R||m||Function("return this")(),g=O.Symbol,y=Object.prototype,b=y.hasOwnProperty,E=y.toString,A=g?g.toStringTag:void 0;var T=function(e){var r=b.call(e,A),t=e[A];try{e[A]=void 0;var i=!0}catch(e){}var s=E.call(e);return i&&(r?e[A]=t:delete e[A]),s},N=Object.prototype.toString;var j=function(e){return N.call(e)},V="[object Null]",$="[object Undefined]",w=g?g.toStringTag:void 0;var M=function(e){return null==e?void 0===e?$:V:w&&w in Object(e)?T(e):j(e)};var P=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)},F="[object AsyncFunction]",L="[object Function]",x="[object GeneratorFunction]",I="[object Proxy]";var k,D=function(e){if(!P(e))return!1;var r=M(e);return r==L||r==x||r==F||r==I},z=O["__core-js_shared__"],S=(k=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var B=function(e){return!!S&&S in e},G=Function.prototype.toString;var q=function(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""},C=/^\[object .+?Constructor\]$/,W=Function.prototype,H=Object.prototype,U=W.toString,Y=H.hasOwnProperty,Q=RegExp("^"+U.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Z=function(e){return!(!P(e)||B(e))&&(D(e)?Q:C).test(q(e))};var J=function(e,r){return null==e?void 0:e[r]};var K=function(e,r){var t=J(e,r);return Z(t)?t:void 0},X=function(){try{var e=K(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var ee=function(e,r,t){"__proto__"==r&&X?X(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t};var re=function(e,r){return e===r||e!=e&&r!=r},te=Object.prototype.hasOwnProperty;var ie=function(e,r,t){var i=e[r];te.call(e,r)&&re(i,t)&&(void 0!==t||r in e)||ee(e,r,t)},se=Array.isArray;var ne=function(e){return null!=e&&"object"==typeof e},oe="[object Symbol]";var ue=function(e){return"symbol"==typeof e||ne(e)&&M(e)==oe},ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,le=/^\w*$/;var ce=function(e,r){if(se(e))return!1;var t=typeof e;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!ue(e))||le.test(e)||!ae.test(e)||null!=r&&e in Object(r)},fe=K(Object,"create");var he=function(){this.__data__=fe?fe(null):{},this.size=0};var pe=function(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r},de="__lodash_hash_undefined__",_e=Object.prototype.hasOwnProperty;var ve=function(e){var r=this.__data__;if(fe){var t=r[e];return t===de?void 0:t}return _e.call(r,e)?r[e]:void 0},Re=Object.prototype.hasOwnProperty;var me=function(e){var r=this.__data__;return fe?void 0!==r[e]:Re.call(r,e)},Oe="__lodash_hash_undefined__";var ge=function(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=fe&&void 0===r?Oe:r,this};function ye(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}ye.prototype.clear=he,ye.prototype.delete=pe,ye.prototype.get=ve,ye.prototype.has=me,ye.prototype.set=ge;var be=ye;var Ee=function(){this.__data__=[],this.size=0};var Ae=function(e,r){for(var t=e.length;t--;)if(re(e[t][0],r))return t;return-1},Te=Array.prototype.splice;var Ne=function(e){var r=this.__data__,t=Ae(r,e);return!(t<0||(t==r.length-1?r.pop():Te.call(r,t,1),--this.size,0))};var je=function(e){var r=this.__data__,t=Ae(r,e);return t<0?void 0:r[t][1]};var Ve=function(e){return Ae(this.__data__,e)>-1};var $e=function(e,r){var t=this.__data__,i=Ae(t,e);return i<0?(++this.size,t.push([e,r])):t[i][1]=r,this};function we(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}we.prototype.clear=Ee,we.prototype.delete=Ne,we.prototype.get=je,we.prototype.has=Ve,we.prototype.set=$e;var Me=we,Pe=K(O,"Map");var Fe=function(){this.size=0,this.__data__={hash:new be,map:new(Pe||Me),string:new be}};var Le=function(e){var r=typeof e;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e};var xe=function(e,r){var t=e.__data__;return Le(r)?t["string"==typeof r?"string":"hash"]:t.map};var Ie=function(e){var r=xe(this,e).delete(e);return this.size-=r?1:0,r};var ke=function(e){return xe(this,e).get(e)};var De=function(e){return xe(this,e).has(e)};var ze=function(e,r){var t=xe(this,e),i=t.size;return t.set(e,r),this.size+=t.size==i?0:1,this};function Se(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}Se.prototype.clear=Fe,Se.prototype.delete=Ie,Se.prototype.get=ke,Se.prototype.has=De,Se.prototype.set=ze;var Be=Se,Ge="Expected a function";function qe(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(Ge);var t=function(){var i=arguments,s=r?r.apply(this,i):i[0],n=t.cache;if(n.has(s))return n.get(s);var o=e.apply(this,i);return t.cache=n.set(s,o)||n,o};return t.cache=new(qe.Cache||Be),t}qe.Cache=Be;var Ce=qe,We=500;var He=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ue=/\\(\\)?/g,Ye=function(e){var r=Ce(e,function(e){return t.size===We&&t.clear(),e}),t=r.cache;return r}(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(He,function(e,t,i,s){r.push(i?s.replace(Ue,"$1"):t||e)}),r});var Qe=function(e,r){for(var t=-1,i=null==e?0:e.length,s=Array(i);++t<i;)s[t]=r(e[t],t,e);return s},Ze=1/0,Je=g?g.prototype:void 0,Ke=Je?Je.toString:void 0;var Xe=function e(r){if("string"==typeof r)return r;if(se(r))return Qe(r,e)+"";if(ue(r))return Ke?Ke.call(r):"";var t=r+"";return"0"==t&&1/r==-Ze?"-0":t};var er=function(e){return null==e?"":Xe(e)};var rr=function(e,r){return se(e)?e:ce(e,r)?[e]:Ye(er(e))},tr=9007199254740991,ir=/^(?:0|[1-9]\d*)$/;var sr=function(e,r){var t=typeof e;return!!(r=null==r?tr:r)&&("number"==t||"symbol"!=t&&ir.test(e))&&e>-1&&e%1==0&&e<r},nr=1/0;var or=function(e){if("string"==typeof e||ue(e))return e;var r=e+"";return"0"==r&&1/e==-nr?"-0":r};var ur=function(e,r,t,i){if(!P(e))return e;for(var s=-1,n=(r=rr(r,e)).length,o=n-1,u=e;null!=u&&++s<n;){var a=or(r[s]),l=t;if(s!=o){var c=u[a];void 0===(l=i?i(c,a,u):void 0)&&(l=P(c)?c:sr(r[s+1])?[]:{})}ie(u,a,l),u=u[a]}return e};var ar=function(e,r,t){return null==e?e:ur(e,r,t)};var lr=function(e,r){for(var t=0,i=(r=rr(r,e)).length;null!=e&&t<i;)e=e[or(r[t++])];return t&&t==i?e:void 0};var cr=function(e,r,t){var i=null==e?void 0:lr(e,r);return void 0===i?t:i};const fr=(e={},r,t,i)=>{const s=e[t];return s?s(r,i):""},hr=(e,r,t=[])=>{const i=Array.isArray(e);return Object.entries(e).reduce((e,[s,n])=>{let o=[].concat(t);if(i||o.push(s),n&&n.code){const[[,e]]=Object.entries(n.rule);Object.assign(n,{msg:fr(r,o.join("."),n.code,e)}),o=[]}else n&&hr(n,r,o);return Object.assign(e,{[s]:n})},{})};class pr{constructor(e,r={}){this.errorHandlers=r.errorHandlers,this.extendedErrors=r.extendedErrors,this.allTouched=!1,e&&e instanceof pr?(this.items=e.items,this.touchedFields=e.touchedFields):(this.items={},this.touchedFields={})}setTouched(e){ar(this.touchedFields,e,!0)}setAllTouched(e=!1){this.allTouched=e}setError(e,r){const t=this.extendedErrors?hr(e,this.errorHandlers):e,i=r?this.items:{};if(this.items=Object.assign({},i,t),r){cr(t,r,!1)||ar(this.items,r,"")}}clearErrors(e=this.items){e&&Object.entries(e).forEach(([e,r])=>"object"==typeof r?this.clearErrors(r):this.clearError(e))}clearError(e){this.setError({},e)}getError(e){if(!this.hasError(e))return"";const r=this.extendedErrors?".msg":"";return cr(this.items,`${e}${r}`,"")}hasError(e){const r=this.allTouched||cr(this.touchedFields,e,!1),t=this.extendedErrors?".msg":"",i=cr(this.items,`${e}${t}`,"");return r&&""!==i}}const dr=()=>{const e=_.Validator.getDefaultRules(),t=Object.entries(e).reduce((e,[t,i])=>Object.assign(e,{[t]:r(t,i)}),{});_.Validator.registerDefaultRules(t)};class _r{constructor(e,r){this.extendedErrors=r.extendedErrors,this.aliasedRules=r.aliasedRules,this.aliasedRules.forEach(this.registerAliasedDefaultRule),_.Validator.registerDefaultRules(r.extraRules),this.errors=new pr(null,r),this.extendedErrors&&dr(),this.fields={items:[]},this.$gzLivr=e||{_vm:{$emit:()=>{},$off:()=>{}}}}validate(e,r,t){const i=new _.Validator(e),s=i.validate(r),n=s||i.getErrors();return s?(this.errors.clearError(t),n):(this.errors.setError(Object.assign({},n),t),this.errors.setTouched(t),{errors:this.errors.items})}registerAliasedDefaultRule(e){_.Validator.registerAliasedDefaultRule(e)}validateAll(e,r){this.validator=new _.Validator(e);const t=this.validator.validate(r),i=t||this.validator.getErrors();return t?(this.errors.clearErrors(),i):(this.errors.setError(i),this.errors.setAllTouched(!0),{errors:this.errors.items})}clearErrors(){this.errors.clearErrors()}clearError(e){this.errors.clearError(e)}}let vr=null;const Rr=()=>vr,mr=e=>(vr=e,e);let Or=Object.assign({},{errorBagName:"errors",fieldsBagName:"fields",inject:!0,extendedErrors:!1,extraRules:{},aliasedRules:[]});const gr=()=>Or,yr=e=>{Or=Object.assign({},Or,e)};var br={provide(){return this.$livr&&!t(this.$vnode)?{$livr:this.$livr}:{}},beforeCreate(){const r=i.errorBagName||"errors";if(t(this.$vnode)||!1===this.$options.$__livrInject)return;this.$parent||yr(this.$options.$_livr||{});const i=(e=>{const r=cr(e,"$options.$_livr",{});return Object.assign({},Or,r)})(this);(!this.$parent||this.$options.$_livr&&/new/.test(this.$options.$_livr.validator))&&(this.$livr=new _r(Rr(),i));const s=(r=>!(!e(r)||!r.$livr))(this.$options.inject);if(this.$livr||!i.inject||s||(this.$livr=new _r(Rr(),i)),s||this.$livr){if(!s&&this.$livr){this.$options._base.util.defineReactive(this.$livr,r,this.$livr.errors)}this.$options.computed||(this.$options.computed={}),this.$options.computed[r]=function(){return this.$livr.errors},this.$options.computed[i.fieldsBagName||"fields"]=function(){return this.$livr.fields.items.reduce((e,r)=>r.scope?(e[`$${r.scope}`]||(e[`$${r.scope}`]={}),e[`$${r.scope}`][r.name]=r.flags,e):(e[r.name]=r.flags,e),{})}}}};let Er,Ar;class Tr{constructor(e,r){this.configure(e),Ar=this,r&&(Er=r),this.livrInstance=mr(new _r(null,this.config)),this.initVM(this.config)}static install(e,r={}){Er&&e===Er?"production"!==process.env.NODE_ENV&&console.warn("already installed, Vue.use(LivrPlugin) should only be called once."):(Er=e,Ar=new Tr(r),_r.$livr=Ar,Er.mixin(br))}initVM({errorBagName:e,fieldsBagName:r}){this._vm=new Er({data:()=>({[e]:this.livrInstance.errors,[r]:this.livrInstance.fields})})}configure(e){yr(e)}get config(){return gr()}static get config(){return gr()}static get instance(){return Ar}}export default Tr;

@@ -1,1 +0,1 @@

var VueLivr=function(){"use strict";const e=e=>null!==e&&e&&"object"==typeof e&&!Array.isArray(e),r=(r,t)=>{return(...i)=>{const s=t(...i),n=i.splice(0,i.length-1);return(...t)=>{const i=s(...t);if(i){const t={[r]:n};return Array.isArray(i)||e(i)?i:{code:i,rule:t}}return""}}},t=e=>{if(!e)return!1;const{tag:r}=e.componentOptions;return/^(keep-alive|transition|transition-group)$/.test(r)};var i={isPrimitiveValue:e=>"string"==typeof e||(!("number"!=typeof e||!isFinite(e))||"boolean"==typeof e),looksLikeNumber:e=>!isNaN(+e),isObject:e=>Object(e)===e&&Object.getPrototypeOf(e)===Object.prototype,isEmptyObject(e){for(const r in e)if(e.hasOwnProperty(r))return!1;return!0},escapeRegExp:e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),isNoValue:e=>null==e||""===e},s={required:()=>e=>{if(i.isNoValue(e))return"REQUIRED"},not_empty:()=>e=>{if(null!=e&&""===e)return"CANNOT_BE_EMPTY"},not_empty_list:()=>e=>void 0===e||""===e?"CANNOT_BE_EMPTY":Array.isArray(e)?e.length<1?"CANNOT_BE_EMPTY":void 0:"FORMAT_ERROR",any_object:()=>e=>{if(!i.isNoValue(e))return i.isObject(e)?void 0:"FORMAT_ERROR"}},n={string:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?void t.push(e+""):"FORMAT_ERROR"},eq:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(r+""!=e+"")return"NOT_ALLOWED_VALUE";s.push(e)}},one_of(e){return Array.isArray(e)||(e=Array.prototype.slice.call(arguments)).pop(),(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";for(const t of e)if(r+""==t+"")return void s.push(t);return"NOT_ALLOWED_VALUE"}}},max_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length>e)return"TOO_LONG";s.push(r)}},min_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length<e)return"TOO_SHORT";s.push(r)}},length_equal:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="").length<e?"TOO_SHORT":r.length>e?"TOO_LONG":void s.push(r):"FORMAT_ERROR"},length_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?(t+="").length<e?"TOO_SHORT":t.length>r?"TOO_LONG":void n.push(t):"FORMAT_ERROR"},like(e,r){const t=3===arguments.length&&r.match("i"),s=new RegExp(e,t?"i":"");return(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!(e+="").match(s))return"WRONG_FORMAT";t.push(e)}}}},o={integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)&&Number.isInteger(+e)?void t.push(+e):"NOT_INTEGER":"FORMAT_ERROR"},positive_integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)?!Number.isInteger(+e)||+e<1?"NOT_POSITIVE_INTEGER":void t.push(+e):"NOT_POSITIVE_INTEGER":"FORMAT_ERROR"},decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_DECIMAL";if(!/^(?:\-?(?:(?:[0-9]+\.[0-9]+)|(?:[0-9]+)))$/.test(e+=""))return"NOT_DECIMAL";t.push(+e)}},positive_decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_POSITIVE_DECIMAL";if(!/^(?:(?:[0-9]*\.[0-9]+)|(?:[1-9][0-9]*))$/.test(e+=""))return"NOT_POSITIVE_DECIMAL";t.push(+e)}},max_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r>+e?"TOO_HIGH":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},min_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r<+e?"TOO_LOW":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},number_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?i.looksLikeNumber(t)?+t<+e?"TOO_LOW":+t>+r?"TOO_HIGH":void n.push(+t):"NOT_NUMBER":"FORMAT_ERROR"}},u={email(){var e=/^(([^<>()\[\]\\.,;:\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,}))$/;return r=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="",e.test(r)?/\@.*\@/.test(r)?"WRONG_EMAIL":/\@.*_/.test(r)?"WRONG_EMAIL":void 0:"WRONG_EMAIL"):"FORMAT_ERROR"}},equal_to_field:e=>(r,t)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?r!=t[e]?"FIELDS_NOT_EQUAL":void 0:"FORMAT_ERROR"},url(){const e=new RegExp("^(?:(?:http|https)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[0-1]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))\\.?|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");return r=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(!(r.length<2083&&e.test(r)))return"WRONG_URL"}}},iso_date:()=>e=>{if(i.isNoValue(e))return;if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";const r=e.match(/^(\d{4})-([0-1][0-9])-([0-3][0-9])$/);if(r){const t=Date.parse(e);if(!t&&0!==t)return"WRONG_DATE";const i=new Date(t);if(i.setTime(i.getTime()+60*i.getTimezoneOffset()*1e3),i.getFullYear()==r[1]&&i.getMonth()+1==+r[2]&&i.getDate()==+r[3])return}return"WRONG_DATE"}};const a={};let l=0;class c{constructor(e,r){this.isPrepared=!1,this.livrRules=e,this.validators={},this.validatorBuilders={},this.errors=null,this.isAutoTrim=null!=r?r:l,this.registerRules(a)}static getDefaultRules(){return a}static registerAliasedDefaultRule(e){if(!e.name)throw"Alias name required";a[e.name]=this._buildAliasedRule(e.rules,e.error)}static registerDefaultRules(e){for(const r in e)a[r]=e[r]}static defaultAutoTrim(e){l=!!e}static _buildAliasedRule(e,r){if(!e)throw"Alias rules required";const t={value:e};return e=>{const i=new c(t).registerRules(e).prepare();return(e,t,s)=>{const n=i.validate({value:e});return n?void s.push(n.value):r||i.getErrors().value}}}prepare(){const e=this.livrRules;for(const r in e){let t=e[r];Array.isArray(t)||(t=[t]);const i=[];for(const e of t){const r=this._parseRule(e);i.push(this._buildValidator(r.name,r.args))}this.validators[r]=i}return this.isPrepared=!0,this}validate(e){if(this.isPrepared||this.prepare(),!i.isObject(e))return void(this.errors="FORMAT_ERROR");this.isAutoTrim&&(e=this._autoTrim(e));const r={},t={};for(const i in this.validators){const s=this.validators[i];if(!s||!s.length)continue;const n=e[i];for(const o of s){const s=[],u=o(t.hasOwnProperty(i)?t[i]:n,e,s);if(u){r[i]=u;break}s.length?t[i]=s[0]:e.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=n)}}return i.isEmptyObject(r)?(this.errors=null,t):(this.errors=r,!1)}getErrors(){return this.errors}registerRules(e){for(const r in e)this.validatorBuilders[r]=e[r];return this}registerAliasedRule(e){if(!e.name)throw"Alias name required";return this.validatorBuilders[e.name]=this.constructor._buildAliasedRule(e.rules,e.error),this}getRules(){return this.validatorBuilders}_parseRule(e){let r,t;return i.isObject(e)?(t=e[r=Object.keys(e)[0]],Array.isArray(t)||(t=[t])):(r=e,t=[]),{name:r,args:t}}_buildValidator(e,r){if(!this.validatorBuilders[e])throw"Rule ["+e+"] not registered";const t=[];return t.push.apply(t,r),t.push(this.getRules()),this.validatorBuilders[e].apply(null,t)}_autoTrim(e){const r=typeof e;if("object"!==r&&e)return e.replace?e.replace(/^\s*/,"").replace(/\s*$/,""):e;if("object"==r&&Array.isArray(e)){const r=[];for(const t of e)r.push(this._autoTrim(t));return r}if("object"==r&&i.isObject(e)){const r={};for(const t in e)e.hasOwnProperty(t)&&(r[t]=this._autoTrim(e[t]));return r}return e}}var f=c,h={nested_object(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!i.isObject(e))return"FORMAT_ERROR";const n=t.validate(e);return n?void s.push(n):t.getErrors()}},variable_object(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!i.isObject(r)||!r[e]||!s[r[e]])return"FORMAT_ERROR";const o=s[r[e]],u=o.validate(r);return u?void n.push(u):o.getErrors()}},list_of(e,r){Array.isArray(e)||(r=(e=Array.prototype.slice.call(arguments)).pop());const t=new f({field:e}).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate({field:r});e?(n.push(e.field),o.push(null)):(u=!0,o.push(t.getErrors().field),n.push(null))}return u?o:void s.push(n)}},list_of_objects(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate(r);e?(n.push(e),o.push(null)):(u=!0,o.push(t.getErrors()),n.push(null))}return u?o:void s.push(n)}},list_of_different_objects(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!Array.isArray(r))return"FORMAT_ERROR";const o=[],u=[];let a=!1;for(const t of r){if("object"!=typeof t||!t[e]||!s[t[e]]){u.push("FORMAT_ERROR");continue}const r=s[t[e]],i=r.validate(t);i?(o.push(i),u.push(null)):(a=!0,u.push(r.getErrors()),o.push(null))}return a?u:void n.push(o)}},or(){const e=Array.prototype.slice.call(arguments),r=e.pop(),t=e.map(e=>{return new f({field:e}).registerRules(r).prepare()});return(e,r,s)=>{if(i.isNoValue(e))return;let n;for(const r of t){const t=r.validate({field:e});if(t)return void s.push(t.field);n=r.getErrors().field}return n||void 0}}},p={default:e=>(r,t,s)=>{i.isNoValue(r)&&s.push(e)},trim:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.replace(/^\s*/,"").replace(/\s*$/,"")))},to_lc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toLowerCase()))},to_uc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toUpperCase()))},remove(e){e=i.escapeRegExp(e);const r=new RegExp("["+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}},leave_only(e){e=i.escapeRegExp(e);const r=new RegExp("[^"+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}}};const d={rules:{}};d.rules.common=s,d.rules.string=n,d.rules.numeric=o,d.rules.special=u,d.rules.meta=h,d.rules.modifiers=p,d.Validator=f,d.util=i,d.Validator.registerDefaultRules({required:d.rules.common.required,not_empty:d.rules.common.not_empty,not_empty_list:d.rules.common.not_empty_list,any_object:d.rules.common.any_object,string:d.rules.string.string,eq:d.rules.string.eq,one_of:d.rules.string.one_of,max_length:d.rules.string.max_length,min_length:d.rules.string.min_length,length_equal:d.rules.string.length_equal,length_between:d.rules.string.length_between,like:d.rules.string.like,integer:d.rules.numeric.integer,positive_integer:d.rules.numeric.positive_integer,decimal:d.rules.numeric.decimal,positive_decimal:d.rules.numeric.positive_decimal,max_number:d.rules.numeric.max_number,min_number:d.rules.numeric.min_number,number_between:d.rules.numeric.number_between,email:d.rules.special.email,equal_to_field:d.rules.special.equal_to_field,url:d.rules.special.url,iso_date:d.rules.special.iso_date,nested_object:d.rules.meta.nested_object,variable_object:d.rules.meta.variable_object,list_of:d.rules.meta.list_of,list_of_objects:d.rules.meta.list_of_objects,or:d.rules.meta.or,list_of_different_objects:d.rules.meta.list_of_different_objects,default:d.rules.modifiers.default,trim:d.rules.modifiers.trim,to_lc:d.rules.modifiers.to_lc,to_uc:d.rules.modifiers.to_uc,remove:d.rules.modifiers.remove,leave_only:d.rules.modifiers.leave_only});var _=d,v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},R="object"==typeof v&&v&&v.Object===Object&&v,m="object"==typeof self&&self&&self.Object===Object&&self,O=R||m||Function("return this")(),g=O.Symbol,y=Object.prototype,b=y.hasOwnProperty,E=y.toString,A=g?g.toStringTag:void 0;var T=function(e){var r=b.call(e,A),t=e[A];try{e[A]=void 0;var i=!0}catch(e){}var s=E.call(e);return i&&(r?e[A]=t:delete e[A]),s},N=Object.prototype.toString;var j=function(e){return N.call(e)},V="[object Null]",$="[object Undefined]",w=g?g.toStringTag:void 0;var M=function(e){return null==e?void 0===e?$:V:w&&w in Object(e)?T(e):j(e)};var P=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)},F="[object AsyncFunction]",L="[object Function]",x="[object GeneratorFunction]",I="[object Proxy]";var k,D=function(e){if(!P(e))return!1;var r=M(e);return r==L||r==x||r==F||r==I},z=O["__core-js_shared__"],S=(k=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var B=function(e){return!!S&&S in e},G=Function.prototype.toString;var q=function(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""},C=/^\[object .+?Constructor\]$/,W=Function.prototype,H=Object.prototype,U=W.toString,Y=H.hasOwnProperty,Q=RegExp("^"+U.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Z=function(e){return!(!P(e)||B(e))&&(D(e)?Q:C).test(q(e))};var J=function(e,r){return null==e?void 0:e[r]};var K=function(e,r){var t=J(e,r);return Z(t)?t:void 0},X=function(){try{var e=K(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var ee=function(e,r,t){"__proto__"==r&&X?X(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t};var re=function(e,r){return e===r||e!=e&&r!=r},te=Object.prototype.hasOwnProperty;var ie=function(e,r,t){var i=e[r];te.call(e,r)&&re(i,t)&&(void 0!==t||r in e)||ee(e,r,t)},se=Array.isArray;var ne=function(e){return null!=e&&"object"==typeof e},oe="[object Symbol]";var ue=function(e){return"symbol"==typeof e||ne(e)&&M(e)==oe},ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,le=/^\w*$/;var ce=function(e,r){if(se(e))return!1;var t=typeof e;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!ue(e))||le.test(e)||!ae.test(e)||null!=r&&e in Object(r)},fe=K(Object,"create");var he=function(){this.__data__=fe?fe(null):{},this.size=0};var pe=function(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r},de="__lodash_hash_undefined__",_e=Object.prototype.hasOwnProperty;var ve=function(e){var r=this.__data__;if(fe){var t=r[e];return t===de?void 0:t}return _e.call(r,e)?r[e]:void 0},Re=Object.prototype.hasOwnProperty;var me=function(e){var r=this.__data__;return fe?void 0!==r[e]:Re.call(r,e)},Oe="__lodash_hash_undefined__";var ge=function(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=fe&&void 0===r?Oe:r,this};function ye(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}ye.prototype.clear=he,ye.prototype.delete=pe,ye.prototype.get=ve,ye.prototype.has=me,ye.prototype.set=ge;var be=ye;var Ee=function(){this.__data__=[],this.size=0};var Ae=function(e,r){for(var t=e.length;t--;)if(re(e[t][0],r))return t;return-1},Te=Array.prototype.splice;var Ne=function(e){var r=this.__data__,t=Ae(r,e);return!(t<0||(t==r.length-1?r.pop():Te.call(r,t,1),--this.size,0))};var je=function(e){var r=this.__data__,t=Ae(r,e);return t<0?void 0:r[t][1]};var Ve=function(e){return Ae(this.__data__,e)>-1};var $e=function(e,r){var t=this.__data__,i=Ae(t,e);return i<0?(++this.size,t.push([e,r])):t[i][1]=r,this};function we(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}we.prototype.clear=Ee,we.prototype.delete=Ne,we.prototype.get=je,we.prototype.has=Ve,we.prototype.set=$e;var Me=we,Pe=K(O,"Map");var Fe=function(){this.size=0,this.__data__={hash:new be,map:new(Pe||Me),string:new be}};var Le=function(e){var r=typeof e;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e};var xe=function(e,r){var t=e.__data__;return Le(r)?t["string"==typeof r?"string":"hash"]:t.map};var Ie=function(e){var r=xe(this,e).delete(e);return this.size-=r?1:0,r};var ke=function(e){return xe(this,e).get(e)};var De=function(e){return xe(this,e).has(e)};var ze=function(e,r){var t=xe(this,e),i=t.size;return t.set(e,r),this.size+=t.size==i?0:1,this};function Se(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}Se.prototype.clear=Fe,Se.prototype.delete=Ie,Se.prototype.get=ke,Se.prototype.has=De,Se.prototype.set=ze;var Be=Se,Ge="Expected a function";function qe(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(Ge);var t=function(){var i=arguments,s=r?r.apply(this,i):i[0],n=t.cache;if(n.has(s))return n.get(s);var o=e.apply(this,i);return t.cache=n.set(s,o)||n,o};return t.cache=new(qe.Cache||Be),t}qe.Cache=Be;var Ce=qe,We=500;var He=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ue=/\\(\\)?/g,Ye=function(e){var r=Ce(e,function(e){return t.size===We&&t.clear(),e}),t=r.cache;return r}(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(He,function(e,t,i,s){r.push(i?s.replace(Ue,"$1"):t||e)}),r});var Qe=function(e,r){for(var t=-1,i=null==e?0:e.length,s=Array(i);++t<i;)s[t]=r(e[t],t,e);return s},Ze=1/0,Je=g?g.prototype:void 0,Ke=Je?Je.toString:void 0;var Xe=function e(r){if("string"==typeof r)return r;if(se(r))return Qe(r,e)+"";if(ue(r))return Ke?Ke.call(r):"";var t=r+"";return"0"==t&&1/r==-Ze?"-0":t};var er=function(e){return null==e?"":Xe(e)};var rr=function(e,r){return se(e)?e:ce(e,r)?[e]:Ye(er(e))},tr=9007199254740991,ir=/^(?:0|[1-9]\d*)$/;var sr=function(e,r){var t=typeof e;return!!(r=null==r?tr:r)&&("number"==t||"symbol"!=t&&ir.test(e))&&e>-1&&e%1==0&&e<r},nr=1/0;var or=function(e){if("string"==typeof e||ue(e))return e;var r=e+"";return"0"==r&&1/e==-nr?"-0":r};var ur=function(e,r,t,i){if(!P(e))return e;for(var s=-1,n=(r=rr(r,e)).length,o=n-1,u=e;null!=u&&++s<n;){var a=or(r[s]),l=t;if(s!=o){var c=u[a];void 0===(l=i?i(c,a,u):void 0)&&(l=P(c)?c:sr(r[s+1])?[]:{})}ie(u,a,l),u=u[a]}return e};var ar=function(e,r,t){return null==e?e:ur(e,r,t)};var lr=function(e,r){for(var t=0,i=(r=rr(r,e)).length;null!=e&&t<i;)e=e[or(r[t++])];return t&&t==i?e:void 0};var cr=function(e,r,t){var i=null==e?void 0:lr(e,r);return void 0===i?t:i};const fr=(e={},r,t,i)=>{const s=e[t];return s?s(r,i):""},hr=(e,r,t=[])=>{const i=Array.isArray(e);return Object.entries(e).reduce((e,[s,n])=>{let o=[].concat(t);if(i||o.push(s),n&&n.code){const[[,e]]=Object.entries(n.rule);Object.assign(n,{msg:fr(r,o.join("."),n.code,e)}),o=[]}else n&&hr(n,r,o);return Object.assign(e,{[s]:n})},{})};class pr{constructor(e,r={}){this.errorHandlers=r.errorHandlers,this.extendedErrors=r.extendedErrors,this.allTouched=!1,e&&e instanceof pr?(this.items=e.items,this.touchedFields=e.touchedFields):(this.items={},this.touchedFields={})}setTouched(e){ar(this.touchedFields,e,!0)}setAllTouched(e=!1){this.allTouched=e}setError(e,r){const t=this.extendedErrors?hr(e,this.errorHandlers):e,i=r?this.items:{};if(this.items=Object.assign({},i,t),r){cr(t,r,!1)||ar(this.items,r,"")}}clearErrors(e=this.items){e&&Object.entries(e).forEach(([e,r])=>"object"==typeof r?this.clearErrors(r):this.clearError(e))}clearError(e){this.setError({},e)}getError(e){if(!this.hasError(e))return"";const r=this.extendedErrors?".msg":"";return cr(this.items,`${e}${r}`,"")}hasError(e){const r=this.allTouched||cr(this.touchedFields,e,!1),t=this.extendedErrors?".msg":"",i=cr(this.items,`${e}${t}`,"");return r&&""!==i}}const dr=()=>{const e=_.Validator.getDefaultRules(),t=Object.entries(e).reduce((e,[t,i])=>Object.assign(e,{[t]:r(t,i)}),{});_.Validator.registerDefaultRules(t)};class _r{constructor(e,r){this.extendedErrors=r.extendedErrors,this.aliasedRules=r.aliasedRules,this.aliasedRules.forEach(this.registerAliasedDefaultRule),_.Validator.registerDefaultRules(r.extraRules),this.errors=new pr(null,r),this.extendedErrors&&dr(),this.fields={items:[]},this.$gzLivr=e||{_vm:{$emit:()=>{},$off:()=>{}}}}validate(e,r,t){const i=new _.Validator(e),s=i.validate(r),n=s||i.getErrors();return s?(this.errors.clearError(t),n):(this.errors.setError(Object.assign({},n),t),this.errors.setTouched(t),{errors:this.errors.items})}registerAliasedDefaultRule(e){_.Validator.registerAliasedDefaultRule(e)}validateAll(e,r){this.validator=new _.Validator(e);const t=this.validator.validate(r),i=t||this.validator.getErrors();return t?(this.errors.clearErrors(),i):(this.errors.setError(i),this.errors.setAllTouched(!0),{errors:this.errors.items})}clearErrors(){this.errors.clearErrors()}clearError(e){this.errors.clearError(e)}}let vr=null;const Rr=()=>vr,mr=e=>(vr=e,e);let Or=Object.assign({},{errorBagName:"errors",fieldsBagName:"fields",inject:!0,extendedErrors:!1,extraRules:{},aliasedRules:[]});const gr=()=>Or,yr=e=>{Or=Object.assign({},Or,e)};var br={provide(){return this.$livr&&!t(this.$vnode)?{$livr:this.$livr}:{}},beforeCreate(){if(t(this.$vnode)||!1===this.$options.$__livrInject)return;this.$parent||yr(this.$options.$_livr||{});const r=(e=>{const r=cr(e,"$options.$_livr",{});return Object.assign({},Or,r)})(this);(!this.$parent||this.$options.$_livr&&/new/.test(this.$options.$_livr.validator))&&(this.$livr=new _r(Rr(),r));const i=(r=>!(!e(r)||!r.$livr))(this.$options.inject);if(this.$livr||!r.inject||i||(this.$livr=new _r(Rr(),r)),i||this.$livr){if(!i&&this.$livr){this.$options._base.util.defineReactive(this.$livr,"errors",this.$livr.errors)}this.$options.computed||(this.$options.computed={}),this.$options.computed[r.errorBagName||"errors"]=function(){return this.$livr.errors},this.$options.computed[r.fieldsBagName||"fields"]=function(){return this.$livr.fields.items.reduce((e,r)=>r.scope?(e[`$${r.scope}`]||(e[`$${r.scope}`]={}),e[`$${r.scope}`][r.name]=r.flags,e):(e[r.name]=r.flags,e),{})}}}};let Er,Ar;class Tr{constructor(e,r){this.configure(e),Ar=this,r&&(Er=r),this.livrInstance=mr(new _r(null,this.config)),this.initVM(this.config)}static install(e,r={}){Er&&e===Er?"production"!==process.env.NODE_ENV&&console.warn("already installed, Vue.use(LivrPlugin) should only be called once."):(Er=e,Ar=new Tr(r),_r.$livr=Ar,Er.mixin(br))}initVM({errorBagName:e,fieldsBagName:r}){this._vm=new Er({data:()=>({[e]:this.livrInstance.errors,[r]:this.livrInstance.fields})})}configure(e){yr(e)}get config(){return gr()}static get config(){return gr()}static get instance(){return Ar}}return Tr}();
var VueLivr=function(){"use strict";const e=e=>null!==e&&e&&"object"==typeof e&&!Array.isArray(e),r=(r,t)=>{return(...i)=>{const s=t(...i),n=i.splice(0,i.length-1);return(...t)=>{const i=s(...t);if(i){const t={[r]:n};return Array.isArray(i)||e(i)?i:{code:i,rule:t}}return""}}},t=e=>{if(!e)return!1;const{tag:r}=e.componentOptions;return/^(keep-alive|transition|transition-group)$/.test(r)};var i={isPrimitiveValue:e=>"string"==typeof e||(!("number"!=typeof e||!isFinite(e))||"boolean"==typeof e),looksLikeNumber:e=>!isNaN(+e),isObject:e=>Object(e)===e&&Object.getPrototypeOf(e)===Object.prototype,isEmptyObject(e){for(const r in e)if(e.hasOwnProperty(r))return!1;return!0},escapeRegExp:e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),isNoValue:e=>null==e||""===e},s={required:()=>e=>{if(i.isNoValue(e))return"REQUIRED"},not_empty:()=>e=>{if(null!=e&&""===e)return"CANNOT_BE_EMPTY"},not_empty_list:()=>e=>void 0===e||""===e?"CANNOT_BE_EMPTY":Array.isArray(e)?e.length<1?"CANNOT_BE_EMPTY":void 0:"FORMAT_ERROR",any_object:()=>e=>{if(!i.isNoValue(e))return i.isObject(e)?void 0:"FORMAT_ERROR"}},n={string:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?void t.push(e+""):"FORMAT_ERROR"},eq:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(r+""!=e+"")return"NOT_ALLOWED_VALUE";s.push(e)}},one_of(e){return Array.isArray(e)||(e=Array.prototype.slice.call(arguments)).pop(),(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";for(const t of e)if(r+""==t+"")return void s.push(t);return"NOT_ALLOWED_VALUE"}}},max_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length>e)return"TOO_LONG";s.push(r)}},min_length:e=>(r,t,s)=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if((r+="").length<e)return"TOO_SHORT";s.push(r)}},length_equal:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="").length<e?"TOO_SHORT":r.length>e?"TOO_LONG":void s.push(r):"FORMAT_ERROR"},length_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?(t+="").length<e?"TOO_SHORT":t.length>r?"TOO_LONG":void n.push(t):"FORMAT_ERROR"},like(e,r){const t=3===arguments.length&&r.match("i"),s=new RegExp(e,t?"i":"");return(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!(e+="").match(s))return"WRONG_FORMAT";t.push(e)}}}},o={integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)&&Number.isInteger(+e)?void t.push(+e):"NOT_INTEGER":"FORMAT_ERROR"},positive_integer:()=>(e,r,t)=>{if(!i.isNoValue(e))return i.isPrimitiveValue(e)?i.looksLikeNumber(e)?!Number.isInteger(+e)||+e<1?"NOT_POSITIVE_INTEGER":void t.push(+e):"NOT_POSITIVE_INTEGER":"FORMAT_ERROR"},decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_DECIMAL";if(!/^(?:\-?(?:(?:[0-9]+\.[0-9]+)|(?:[0-9]+)))$/.test(e+=""))return"NOT_DECIMAL";t.push(+e)}},positive_decimal:()=>(e,r,t)=>{if(!i.isNoValue(e)){if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";if(!i.looksLikeNumber(e))return"NOT_POSITIVE_DECIMAL";if(!/^(?:(?:[0-9]*\.[0-9]+)|(?:[1-9][0-9]*))$/.test(e+=""))return"NOT_POSITIVE_DECIMAL";t.push(+e)}},max_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r>+e?"TOO_HIGH":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},min_number:e=>(r,t,s)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?i.looksLikeNumber(r)?+r<+e?"TOO_LOW":void s.push(+r):"NOT_NUMBER":"FORMAT_ERROR"},number_between:(e,r)=>(t,s,n)=>{if(!i.isNoValue(t))return i.isPrimitiveValue(t)?i.looksLikeNumber(t)?+t<+e?"TOO_LOW":+t>+r?"TOO_HIGH":void n.push(+t):"NOT_NUMBER":"FORMAT_ERROR"}},u={email(){var e=/^(([^<>()\[\]\\.,;:\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,}))$/;return r=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?(r+="",e.test(r)?/\@.*\@/.test(r)?"WRONG_EMAIL":/\@.*_/.test(r)?"WRONG_EMAIL":void 0:"WRONG_EMAIL"):"FORMAT_ERROR"}},equal_to_field:e=>(r,t)=>{if(!i.isNoValue(r))return i.isPrimitiveValue(r)?r!=t[e]?"FIELDS_NOT_EQUAL":void 0:"FORMAT_ERROR"},url(){const e=new RegExp("^(?:(?:http|https)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[0-1]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))\\.?|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");return r=>{if(!i.isNoValue(r)){if(!i.isPrimitiveValue(r))return"FORMAT_ERROR";if(!(r.length<2083&&e.test(r)))return"WRONG_URL"}}},iso_date:()=>e=>{if(i.isNoValue(e))return;if(!i.isPrimitiveValue(e))return"FORMAT_ERROR";const r=e.match(/^(\d{4})-([0-1][0-9])-([0-3][0-9])$/);if(r){const t=Date.parse(e);if(!t&&0!==t)return"WRONG_DATE";const i=new Date(t);if(i.setTime(i.getTime()+60*i.getTimezoneOffset()*1e3),i.getFullYear()==r[1]&&i.getMonth()+1==+r[2]&&i.getDate()==+r[3])return}return"WRONG_DATE"}};const a={};let l=0;class c{constructor(e,r){this.isPrepared=!1,this.livrRules=e,this.validators={},this.validatorBuilders={},this.errors=null,this.isAutoTrim=null!=r?r:l,this.registerRules(a)}static getDefaultRules(){return a}static registerAliasedDefaultRule(e){if(!e.name)throw"Alias name required";a[e.name]=this._buildAliasedRule(e.rules,e.error)}static registerDefaultRules(e){for(const r in e)a[r]=e[r]}static defaultAutoTrim(e){l=!!e}static _buildAliasedRule(e,r){if(!e)throw"Alias rules required";const t={value:e};return e=>{const i=new c(t).registerRules(e).prepare();return(e,t,s)=>{const n=i.validate({value:e});return n?void s.push(n.value):r||i.getErrors().value}}}prepare(){const e=this.livrRules;for(const r in e){let t=e[r];Array.isArray(t)||(t=[t]);const i=[];for(const e of t){const r=this._parseRule(e);i.push(this._buildValidator(r.name,r.args))}this.validators[r]=i}return this.isPrepared=!0,this}validate(e){if(this.isPrepared||this.prepare(),!i.isObject(e))return void(this.errors="FORMAT_ERROR");this.isAutoTrim&&(e=this._autoTrim(e));const r={},t={};for(const i in this.validators){const s=this.validators[i];if(!s||!s.length)continue;const n=e[i];for(const o of s){const s=[],u=o(t.hasOwnProperty(i)?t[i]:n,e,s);if(u){r[i]=u;break}s.length?t[i]=s[0]:e.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=n)}}return i.isEmptyObject(r)?(this.errors=null,t):(this.errors=r,!1)}getErrors(){return this.errors}registerRules(e){for(const r in e)this.validatorBuilders[r]=e[r];return this}registerAliasedRule(e){if(!e.name)throw"Alias name required";return this.validatorBuilders[e.name]=this.constructor._buildAliasedRule(e.rules,e.error),this}getRules(){return this.validatorBuilders}_parseRule(e){let r,t;return i.isObject(e)?(t=e[r=Object.keys(e)[0]],Array.isArray(t)||(t=[t])):(r=e,t=[]),{name:r,args:t}}_buildValidator(e,r){if(!this.validatorBuilders[e])throw"Rule ["+e+"] not registered";const t=[];return t.push.apply(t,r),t.push(this.getRules()),this.validatorBuilders[e].apply(null,t)}_autoTrim(e){const r=typeof e;if("object"!==r&&e)return e.replace?e.replace(/^\s*/,"").replace(/\s*$/,""):e;if("object"==r&&Array.isArray(e)){const r=[];for(const t of e)r.push(this._autoTrim(t));return r}if("object"==r&&i.isObject(e)){const r={};for(const t in e)e.hasOwnProperty(t)&&(r[t]=this._autoTrim(e[t]));return r}return e}}var f=c,h={nested_object(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!i.isObject(e))return"FORMAT_ERROR";const n=t.validate(e);return n?void s.push(n):t.getErrors()}},variable_object(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!i.isObject(r)||!r[e]||!s[r[e]])return"FORMAT_ERROR";const o=s[r[e]],u=o.validate(r);return u?void n.push(u):o.getErrors()}},list_of(e,r){Array.isArray(e)||(r=(e=Array.prototype.slice.call(arguments)).pop());const t=new f({field:e}).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate({field:r});e?(n.push(e.field),o.push(null)):(u=!0,o.push(t.getErrors().field),n.push(null))}return u?o:void s.push(n)}},list_of_objects(e,r){const t=new f(e).registerRules(r).prepare();return(e,r,s)=>{if(i.isNoValue(e))return;if(!Array.isArray(e))return"FORMAT_ERROR";const n=[],o=[];let u=!1;for(const r of e){const e=t.validate(r);e?(n.push(e),o.push(null)):(u=!0,o.push(t.getErrors()),n.push(null))}return u?o:void s.push(n)}},list_of_different_objects(e,r,t){const s={};for(const e in r){const i=new f(r[e]).registerRules(t).prepare();s[e]=i}return(r,t,n)=>{if(i.isNoValue(r))return;if(!Array.isArray(r))return"FORMAT_ERROR";const o=[],u=[];let a=!1;for(const t of r){if("object"!=typeof t||!t[e]||!s[t[e]]){u.push("FORMAT_ERROR");continue}const r=s[t[e]],i=r.validate(t);i?(o.push(i),u.push(null)):(a=!0,u.push(r.getErrors()),o.push(null))}return a?u:void n.push(o)}},or(){const e=Array.prototype.slice.call(arguments),r=e.pop(),t=e.map(e=>{return new f({field:e}).registerRules(r).prepare()});return(e,r,s)=>{if(i.isNoValue(e))return;let n;for(const r of t){const t=r.validate({field:e});if(t)return void s.push(t.field);n=r.getErrors().field}return n||void 0}}},p={default:e=>(r,t,s)=>{i.isNoValue(r)&&s.push(e)},trim:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.replace(/^\s*/,"").replace(/\s*$/,"")))},to_lc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toLowerCase()))},to_uc:()=>(e,r,t)=>{i.isNoValue(e)||"object"==typeof e||(e+="",t.push(e.toUpperCase()))},remove(e){e=i.escapeRegExp(e);const r=new RegExp("["+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}},leave_only(e){e=i.escapeRegExp(e);const r=new RegExp("[^"+e+"]","g");return(e,t,s)=>{i.isNoValue(e)||"object"==typeof e||(e+="",s.push(e.replace(r,"")))}}};const d={rules:{}};d.rules.common=s,d.rules.string=n,d.rules.numeric=o,d.rules.special=u,d.rules.meta=h,d.rules.modifiers=p,d.Validator=f,d.util=i,d.Validator.registerDefaultRules({required:d.rules.common.required,not_empty:d.rules.common.not_empty,not_empty_list:d.rules.common.not_empty_list,any_object:d.rules.common.any_object,string:d.rules.string.string,eq:d.rules.string.eq,one_of:d.rules.string.one_of,max_length:d.rules.string.max_length,min_length:d.rules.string.min_length,length_equal:d.rules.string.length_equal,length_between:d.rules.string.length_between,like:d.rules.string.like,integer:d.rules.numeric.integer,positive_integer:d.rules.numeric.positive_integer,decimal:d.rules.numeric.decimal,positive_decimal:d.rules.numeric.positive_decimal,max_number:d.rules.numeric.max_number,min_number:d.rules.numeric.min_number,number_between:d.rules.numeric.number_between,email:d.rules.special.email,equal_to_field:d.rules.special.equal_to_field,url:d.rules.special.url,iso_date:d.rules.special.iso_date,nested_object:d.rules.meta.nested_object,variable_object:d.rules.meta.variable_object,list_of:d.rules.meta.list_of,list_of_objects:d.rules.meta.list_of_objects,or:d.rules.meta.or,list_of_different_objects:d.rules.meta.list_of_different_objects,default:d.rules.modifiers.default,trim:d.rules.modifiers.trim,to_lc:d.rules.modifiers.to_lc,to_uc:d.rules.modifiers.to_uc,remove:d.rules.modifiers.remove,leave_only:d.rules.modifiers.leave_only});var _=d,v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},R="object"==typeof v&&v&&v.Object===Object&&v,m="object"==typeof self&&self&&self.Object===Object&&self,O=R||m||Function("return this")(),g=O.Symbol,y=Object.prototype,b=y.hasOwnProperty,E=y.toString,A=g?g.toStringTag:void 0;var T=function(e){var r=b.call(e,A),t=e[A];try{e[A]=void 0;var i=!0}catch(e){}var s=E.call(e);return i&&(r?e[A]=t:delete e[A]),s},N=Object.prototype.toString;var j=function(e){return N.call(e)},V="[object Null]",$="[object Undefined]",w=g?g.toStringTag:void 0;var M=function(e){return null==e?void 0===e?$:V:w&&w in Object(e)?T(e):j(e)};var P=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)},F="[object AsyncFunction]",L="[object Function]",x="[object GeneratorFunction]",I="[object Proxy]";var k,D=function(e){if(!P(e))return!1;var r=M(e);return r==L||r==x||r==F||r==I},z=O["__core-js_shared__"],S=(k=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var B=function(e){return!!S&&S in e},G=Function.prototype.toString;var q=function(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""},C=/^\[object .+?Constructor\]$/,W=Function.prototype,H=Object.prototype,U=W.toString,Y=H.hasOwnProperty,Q=RegExp("^"+U.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Z=function(e){return!(!P(e)||B(e))&&(D(e)?Q:C).test(q(e))};var J=function(e,r){return null==e?void 0:e[r]};var K=function(e,r){var t=J(e,r);return Z(t)?t:void 0},X=function(){try{var e=K(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var ee=function(e,r,t){"__proto__"==r&&X?X(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t};var re=function(e,r){return e===r||e!=e&&r!=r},te=Object.prototype.hasOwnProperty;var ie=function(e,r,t){var i=e[r];te.call(e,r)&&re(i,t)&&(void 0!==t||r in e)||ee(e,r,t)},se=Array.isArray;var ne=function(e){return null!=e&&"object"==typeof e},oe="[object Symbol]";var ue=function(e){return"symbol"==typeof e||ne(e)&&M(e)==oe},ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,le=/^\w*$/;var ce=function(e,r){if(se(e))return!1;var t=typeof e;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!ue(e))||le.test(e)||!ae.test(e)||null!=r&&e in Object(r)},fe=K(Object,"create");var he=function(){this.__data__=fe?fe(null):{},this.size=0};var pe=function(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r},de="__lodash_hash_undefined__",_e=Object.prototype.hasOwnProperty;var ve=function(e){var r=this.__data__;if(fe){var t=r[e];return t===de?void 0:t}return _e.call(r,e)?r[e]:void 0},Re=Object.prototype.hasOwnProperty;var me=function(e){var r=this.__data__;return fe?void 0!==r[e]:Re.call(r,e)},Oe="__lodash_hash_undefined__";var ge=function(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=fe&&void 0===r?Oe:r,this};function ye(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}ye.prototype.clear=he,ye.prototype.delete=pe,ye.prototype.get=ve,ye.prototype.has=me,ye.prototype.set=ge;var be=ye;var Ee=function(){this.__data__=[],this.size=0};var Ae=function(e,r){for(var t=e.length;t--;)if(re(e[t][0],r))return t;return-1},Te=Array.prototype.splice;var Ne=function(e){var r=this.__data__,t=Ae(r,e);return!(t<0||(t==r.length-1?r.pop():Te.call(r,t,1),--this.size,0))};var je=function(e){var r=this.__data__,t=Ae(r,e);return t<0?void 0:r[t][1]};var Ve=function(e){return Ae(this.__data__,e)>-1};var $e=function(e,r){var t=this.__data__,i=Ae(t,e);return i<0?(++this.size,t.push([e,r])):t[i][1]=r,this};function we(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}we.prototype.clear=Ee,we.prototype.delete=Ne,we.prototype.get=je,we.prototype.has=Ve,we.prototype.set=$e;var Me=we,Pe=K(O,"Map");var Fe=function(){this.size=0,this.__data__={hash:new be,map:new(Pe||Me),string:new be}};var Le=function(e){var r=typeof e;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e};var xe=function(e,r){var t=e.__data__;return Le(r)?t["string"==typeof r?"string":"hash"]:t.map};var Ie=function(e){var r=xe(this,e).delete(e);return this.size-=r?1:0,r};var ke=function(e){return xe(this,e).get(e)};var De=function(e){return xe(this,e).has(e)};var ze=function(e,r){var t=xe(this,e),i=t.size;return t.set(e,r),this.size+=t.size==i?0:1,this};function Se(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}Se.prototype.clear=Fe,Se.prototype.delete=Ie,Se.prototype.get=ke,Se.prototype.has=De,Se.prototype.set=ze;var Be=Se,Ge="Expected a function";function qe(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(Ge);var t=function(){var i=arguments,s=r?r.apply(this,i):i[0],n=t.cache;if(n.has(s))return n.get(s);var o=e.apply(this,i);return t.cache=n.set(s,o)||n,o};return t.cache=new(qe.Cache||Be),t}qe.Cache=Be;var Ce=qe,We=500;var He=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ue=/\\(\\)?/g,Ye=function(e){var r=Ce(e,function(e){return t.size===We&&t.clear(),e}),t=r.cache;return r}(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(He,function(e,t,i,s){r.push(i?s.replace(Ue,"$1"):t||e)}),r});var Qe=function(e,r){for(var t=-1,i=null==e?0:e.length,s=Array(i);++t<i;)s[t]=r(e[t],t,e);return s},Ze=1/0,Je=g?g.prototype:void 0,Ke=Je?Je.toString:void 0;var Xe=function e(r){if("string"==typeof r)return r;if(se(r))return Qe(r,e)+"";if(ue(r))return Ke?Ke.call(r):"";var t=r+"";return"0"==t&&1/r==-Ze?"-0":t};var er=function(e){return null==e?"":Xe(e)};var rr=function(e,r){return se(e)?e:ce(e,r)?[e]:Ye(er(e))},tr=9007199254740991,ir=/^(?:0|[1-9]\d*)$/;var sr=function(e,r){var t=typeof e;return!!(r=null==r?tr:r)&&("number"==t||"symbol"!=t&&ir.test(e))&&e>-1&&e%1==0&&e<r},nr=1/0;var or=function(e){if("string"==typeof e||ue(e))return e;var r=e+"";return"0"==r&&1/e==-nr?"-0":r};var ur=function(e,r,t,i){if(!P(e))return e;for(var s=-1,n=(r=rr(r,e)).length,o=n-1,u=e;null!=u&&++s<n;){var a=or(r[s]),l=t;if(s!=o){var c=u[a];void 0===(l=i?i(c,a,u):void 0)&&(l=P(c)?c:sr(r[s+1])?[]:{})}ie(u,a,l),u=u[a]}return e};var ar=function(e,r,t){return null==e?e:ur(e,r,t)};var lr=function(e,r){for(var t=0,i=(r=rr(r,e)).length;null!=e&&t<i;)e=e[or(r[t++])];return t&&t==i?e:void 0};var cr=function(e,r,t){var i=null==e?void 0:lr(e,r);return void 0===i?t:i};const fr=(e={},r,t,i)=>{const s=e[t];return s?s(r,i):""},hr=(e,r,t=[])=>{const i=Array.isArray(e);return Object.entries(e).reduce((e,[s,n])=>{let o=[].concat(t);if(i||o.push(s),n&&n.code){const[[,e]]=Object.entries(n.rule);Object.assign(n,{msg:fr(r,o.join("."),n.code,e)}),o=[]}else n&&hr(n,r,o);return Object.assign(e,{[s]:n})},{})};class pr{constructor(e,r={}){this.errorHandlers=r.errorHandlers,this.extendedErrors=r.extendedErrors,this.allTouched=!1,e&&e instanceof pr?(this.items=e.items,this.touchedFields=e.touchedFields):(this.items={},this.touchedFields={})}setTouched(e){ar(this.touchedFields,e,!0)}setAllTouched(e=!1){this.allTouched=e}setError(e,r){const t=this.extendedErrors?hr(e,this.errorHandlers):e,i=r?this.items:{};if(this.items=Object.assign({},i,t),r){cr(t,r,!1)||ar(this.items,r,"")}}clearErrors(e=this.items){e&&Object.entries(e).forEach(([e,r])=>"object"==typeof r?this.clearErrors(r):this.clearError(e))}clearError(e){this.setError({},e)}getError(e){if(!this.hasError(e))return"";const r=this.extendedErrors?".msg":"";return cr(this.items,`${e}${r}`,"")}hasError(e){const r=this.allTouched||cr(this.touchedFields,e,!1),t=this.extendedErrors?".msg":"",i=cr(this.items,`${e}${t}`,"");return r&&""!==i}}const dr=()=>{const e=_.Validator.getDefaultRules(),t=Object.entries(e).reduce((e,[t,i])=>Object.assign(e,{[t]:r(t,i)}),{});_.Validator.registerDefaultRules(t)};class _r{constructor(e,r){this.extendedErrors=r.extendedErrors,this.aliasedRules=r.aliasedRules,this.aliasedRules.forEach(this.registerAliasedDefaultRule),_.Validator.registerDefaultRules(r.extraRules),this.errors=new pr(null,r),this.extendedErrors&&dr(),this.fields={items:[]},this.$gzLivr=e||{_vm:{$emit:()=>{},$off:()=>{}}}}validate(e,r,t){const i=new _.Validator(e),s=i.validate(r),n=s||i.getErrors();return s?(this.errors.clearError(t),n):(this.errors.setError(Object.assign({},n),t),this.errors.setTouched(t),{errors:this.errors.items})}registerAliasedDefaultRule(e){_.Validator.registerAliasedDefaultRule(e)}validateAll(e,r){this.validator=new _.Validator(e);const t=this.validator.validate(r),i=t||this.validator.getErrors();return t?(this.errors.clearErrors(),i):(this.errors.setError(i),this.errors.setAllTouched(!0),{errors:this.errors.items})}clearErrors(){this.errors.clearErrors()}clearError(e){this.errors.clearError(e)}}let vr=null;const Rr=()=>vr,mr=e=>(vr=e,e);let Or=Object.assign({},{errorBagName:"errors",fieldsBagName:"fields",inject:!0,extendedErrors:!1,extraRules:{},aliasedRules:[]});const gr=()=>Or,yr=e=>{Or=Object.assign({},Or,e)};var br={provide(){return this.$livr&&!t(this.$vnode)?{$livr:this.$livr}:{}},beforeCreate(){const r=i.errorBagName||"errors";if(t(this.$vnode)||!1===this.$options.$__livrInject)return;this.$parent||yr(this.$options.$_livr||{});const i=(e=>{const r=cr(e,"$options.$_livr",{});return Object.assign({},Or,r)})(this);(!this.$parent||this.$options.$_livr&&/new/.test(this.$options.$_livr.validator))&&(this.$livr=new _r(Rr(),i));const s=(r=>!(!e(r)||!r.$livr))(this.$options.inject);if(this.$livr||!i.inject||s||(this.$livr=new _r(Rr(),i)),s||this.$livr){if(!s&&this.$livr){this.$options._base.util.defineReactive(this.$livr,r,this.$livr.errors)}this.$options.computed||(this.$options.computed={}),this.$options.computed[r]=function(){return this.$livr.errors},this.$options.computed[i.fieldsBagName||"fields"]=function(){return this.$livr.fields.items.reduce((e,r)=>r.scope?(e[`$${r.scope}`]||(e[`$${r.scope}`]={}),e[`$${r.scope}`][r.name]=r.flags,e):(e[r.name]=r.flags,e),{})}}}};let Er,Ar;class Tr{constructor(e,r){this.configure(e),Ar=this,r&&(Er=r),this.livrInstance=mr(new _r(null,this.config)),this.initVM(this.config)}static install(e,r={}){Er&&e===Er?"production"!==process.env.NODE_ENV&&console.warn("already installed, Vue.use(LivrPlugin) should only be called once."):(Er=e,Ar=new Tr(r),_r.$livr=Ar,Er.mixin(br))}initVM({errorBagName:e,fieldsBagName:r}){this._vm=new Er({data:()=>({[e]:this.livrInstance.errors,[r]:this.livrInstance.fields})})}configure(e){yr(e)}get config(){return gr()}static get config(){return gr()}static get instance(){return Ar}}return Tr}();
{
"name": "vue-livr",
"version": "0.1.0",
"version": "0.1.1",
"description": "Vue LIVR plugin",

@@ -5,0 +5,0 @@ "author": "Jonatas Gusmão <js.gusmao@hotmail.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc