raw.iife.min.js 7.5 KB

1
  1. var VuelidateValidators=function(r,e){"use strict";function t(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function n(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?t(Object(n),!0).forEach((function(e){a(r,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}function a(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function o(r){return"function"==typeof r}function i(r){return null!==r&&"object"==typeof r&&!Array.isArray(r)}function u(r){return o(r.$validator)?n({},r):{$validator:r}}function s(r){return"object"==typeof r?r.$valid:r}function c(r){return r.$validator||r}const f=r=>{if(r=e.unref(r),Array.isArray(r))return!!r.length;if(null==r)return!1;if(!1===r)return!0;if(r instanceof Date)return!isNaN(r.getTime());if("object"==typeof r){for(let e in r)return!0;return!1}return!!String(r).length},l=r=>(r=e.unref(r),Array.isArray(r)?r.length:"object"==typeof r?Object.keys(r).length:String(r).length);function d(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return r=>(r=e.unref(r),!f(r)||t.every((e=>(e.lastIndex=0,e.test(r)))))}var $=Object.freeze({__proto__:null,forEach:function(r){return{$validator(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return e.unref(t).reduce(((e,t,n)=>{const o=Object.entries(t).reduce(((e,o)=>{let[i,u]=o;const f=r[i]||{},l=Object.entries(f).reduce(((r,e)=>{let[o,f]=e;const l=c(f).call(this,u,t,n,...a),d=s(l);if(r.$data[o]=l,r.$data.$invalid=!d||!!r.$data.$invalid,r.$data.$error=r.$data.$invalid,!d){let e=f.$message||"";const t=f.$params||{};"function"==typeof e&&(e=e({$pending:!1,$invalid:!d,$params:t,$model:u,$response:l})),r.$errors.push({$property:i,$message:e,$params:t,$response:l,$model:u,$pending:!1,$validator:o})}return{$valid:r.$valid&&d,$data:r.$data,$errors:r.$errors}}),{$valid:!0,$data:{},$errors:[]});return e.$data[i]=l.$data,e.$errors[i]=l.$errors,{$valid:e.$valid&&l.$valid,$data:e.$data,$errors:e.$errors}}),{$valid:!0,$data:{},$errors:{}});return{$valid:e.$valid&&o.$valid,$data:e.$data.concat(o.$data),$errors:e.$errors.concat(o.$errors)}}),{$valid:!0,$data:[],$errors:[]})},$message:r=>{let{$response:e}=r;return e?e.$errors.map((r=>Object.values(r).map((r=>r.map((r=>r.$message)))).reduce(((r,e)=>r.concat(e)),[]))):[]}}},len:l,normalizeValidatorObject:u,regex:d,req:f,unwrap:e.unref,unwrapNormalizedValidator:c,unwrapValidatorResponse:s,withAsync:function(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return n(n({},u(r)),{},{$async:!0,$watchTargets:e})},withMessage:function(r,t){if(!o(r)&&"string"!=typeof e.unref(r))throw new Error('[@vuelidate/validators]: First parameter to "withMessage" should be string or a function returning a string, provided '+typeof r);if(!i(t)&&!o(t))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const n=u(t);return n.$message=r,n},withParams:function(r,e){if(!i(r))throw new Error('[@vuelidate/validators]: First parameter to "withParams" should be an object, provided '+typeof r);if(!i(e)&&!o(e))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const t=u(e);return t.$params=n(n({},t.$params||{}),r),t}}),p=d(/^[a-zA-Z]*$/),h=d(/^[a-zA-Z0-9]*$/),g=d(/^\d*(\.\d+)?$/);var v=d(/^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i);const y=r=>{if(r.length>3||0===r.length)return!1;if("0"===r[0]&&"0"!==r)return!1;if(!r.match(/^\d+$/))return!1;const e=0|+r;return e>=0&&e<=255};const m=r=>r.toLowerCase().match(/^[0-9a-f]{2}$/);const w=(r,e)=>!r||f("string"==typeof e?e.trim():e);const b=(r,e)=>!!r||f("string"==typeof e?e.trim():e);var x=d(/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i);var j=d(/(^[0-9]*$)|(^-[0-9]+$)/),O=d(/^[-]?\d*(\.\d+)?$/);return r.alpha=p,r.alphaNum=h,r.and=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];const n=e.some((r=>r.$async)),a=e.reduce(((r,e)=>e.$watchTargets?r.concat(e.$watchTargets):r),[]);let o=()=>!1;return e.length&&(o=n?function(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.reduce((async(r,e)=>{const n=await r;return s(n)?c(e).apply(this,t):n}),Promise.resolve(!0))}}(e):function(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.reduce(((r,e)=>s(r)?c(e).apply(this,t):r),!0)}}(e)),{$async:n,$validator:o,$watchTargets:a}},r.between=function(r,t){return n=>!f(n)||(!/\s/.test(n)||n instanceof Date)&&+e.unref(r)<=+n&&+e.unref(t)>=+n},r.decimal=O,r.email=v,r.helpers=$,r.integer=j,r.ipAddress=function(r){if(!f(r))return!0;if("string"!=typeof r)return!1;const e=r.split(".");return 4===e.length&&e.every(y)},r.macAddress=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":";return t=>{if(r=e.unref(r),!f(t))return!0;if("string"!=typeof t)return!1;const n="string"==typeof r&&""!==r?t.split(r):12===t.length||16===t.length?t.match(/.{2}/g):null;return null!==n&&(6===n.length||8===n.length)&&n.every(m)}},r.maxLength=function(r){return t=>!f(t)||l(t)<=e.unref(r)},r.maxValue=function(r){return t=>!f(t)||(!/\s/.test(t)||t instanceof Date)&&+t<=+e.unref(r)},r.minLength=function(r){return t=>!f(t)||l(t)>=e.unref(r)},r.minValue=function(r){return t=>!f(t)||(!/\s/.test(t)||t instanceof Date)&&+t>=+e.unref(r)},r.not=function(r){return function(e,t){if(!f(e))return!0;const n=c(r).call(this,e,t);return i(a=n)&&o(a.then)?n.then((r=>!s(r))):!s(n);var a}},r.numeric=g,r.or=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];const n=e.some((r=>r.$async)),a=e.reduce(((r,e)=>e.$watchTargets?r.concat(e.$watchTargets):r),[]);let o=()=>!1;return e.length&&(o=n?function(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.reduce((async(r,e)=>{const n=await r;return s(n)?n:c(e).apply(this,t)}),Promise.resolve(!1))}}(e):function(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.reduce(((r,e)=>s(r)?r:c(e).apply(this,t)),!1)}}(e)),{$async:n,$validator:o,$watchTargets:a}},r.required=function(r){return"string"==typeof r&&(r=r.trim()),f(r)},r.requiredIf=function(r){return function(t,n){if("function"!=typeof r)return w(e.unref(r),t);const a=r.call(this,t,n);return w(a,t)}},r.requiredUnless=function(r){return function(t,n){if("function"!=typeof r)return b(e.unref(r),t);const a=r.call(this,t,n);return b(a,t)}},r.sameAs=function(r){return t=>e.unref(t)===e.unref(r)},r.url=x,r}({},VueDemi);