@thecb/components 5.7.0-beta.4 → 5.7.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1410 -380
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1409 -379
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -33970,10 +33970,1008 @@ const TypeaheadInput = ({
|
|
|
33970
33970
|
}));
|
|
33971
33971
|
};
|
|
33972
33972
|
|
|
33973
|
-
|
|
33974
|
-
|
|
33975
|
-
|
|
33976
|
-
|
|
33973
|
+
// makes subclassing work correct for wrapped built-ins
|
|
33974
|
+
var inheritIfRequired = function ($this, dummy, Wrapper) {
|
|
33975
|
+
var NewTarget, NewTargetPrototype;
|
|
33976
|
+
if (
|
|
33977
|
+
// it can work only with native `setPrototypeOf`
|
|
33978
|
+
objectSetPrototypeOf &&
|
|
33979
|
+
// we haven't completely correct pre-ES6 way for getting `new.target`, so use this
|
|
33980
|
+
isCallable(NewTarget = dummy.constructor) &&
|
|
33981
|
+
NewTarget !== Wrapper &&
|
|
33982
|
+
isObject(NewTargetPrototype = NewTarget.prototype) &&
|
|
33983
|
+
NewTargetPrototype !== Wrapper.prototype
|
|
33984
|
+
) objectSetPrototypeOf($this, NewTargetPrototype);
|
|
33985
|
+
return $this;
|
|
33986
|
+
};
|
|
33987
|
+
|
|
33988
|
+
var valueOf = 1.0.valueOf;
|
|
33989
|
+
|
|
33990
|
+
// `thisNumberValue` abstract operation
|
|
33991
|
+
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
33992
|
+
var thisNumberValue = function (value) {
|
|
33993
|
+
return valueOf.call(value);
|
|
33994
|
+
};
|
|
33995
|
+
|
|
33996
|
+
// a string of all valid unicode whitespaces
|
|
33997
|
+
var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
33998
|
+
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
33999
|
+
|
|
34000
|
+
var whitespace = '[' + whitespaces + ']';
|
|
34001
|
+
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
34002
|
+
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
34003
|
+
|
|
34004
|
+
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
34005
|
+
var createMethod$2 = function (TYPE) {
|
|
34006
|
+
return function ($this) {
|
|
34007
|
+
var string = toString_1(requireObjectCoercible($this));
|
|
34008
|
+
if (TYPE & 1) string = string.replace(ltrim, '');
|
|
34009
|
+
if (TYPE & 2) string = string.replace(rtrim, '');
|
|
34010
|
+
return string;
|
|
34011
|
+
};
|
|
34012
|
+
};
|
|
34013
|
+
|
|
34014
|
+
var stringTrim = {
|
|
34015
|
+
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
34016
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
34017
|
+
start: createMethod$2(1),
|
|
34018
|
+
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
34019
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
34020
|
+
end: createMethod$2(2),
|
|
34021
|
+
// `String.prototype.trim` method
|
|
34022
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
34023
|
+
trim: createMethod$2(3)
|
|
34024
|
+
};
|
|
34025
|
+
|
|
34026
|
+
var getOwnPropertyNames = objectGetOwnPropertyNames.f;
|
|
34027
|
+
var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
|
|
34028
|
+
var defineProperty$1 = objectDefineProperty.f;
|
|
34029
|
+
|
|
34030
|
+
var trim = stringTrim.trim;
|
|
34031
|
+
|
|
34032
|
+
var NUMBER = 'Number';
|
|
34033
|
+
var NativeNumber = global_1[NUMBER];
|
|
34034
|
+
var NumberPrototype = NativeNumber.prototype;
|
|
34035
|
+
|
|
34036
|
+
// `ToNumeric` abstract operation
|
|
34037
|
+
// https://tc39.es/ecma262/#sec-tonumeric
|
|
34038
|
+
var toNumeric = function (value) {
|
|
34039
|
+
var primValue = toPrimitive(value, 'number');
|
|
34040
|
+
return typeof primValue === 'bigint' ? primValue : toNumber(primValue);
|
|
34041
|
+
};
|
|
34042
|
+
|
|
34043
|
+
// `ToNumber` abstract operation
|
|
34044
|
+
// https://tc39.es/ecma262/#sec-tonumber
|
|
34045
|
+
var toNumber = function (argument) {
|
|
34046
|
+
var it = toPrimitive(argument, 'number');
|
|
34047
|
+
var first, third, radix, maxCode, digits, length, index, code;
|
|
34048
|
+
if (isSymbol(it)) throw TypeError('Cannot convert a Symbol value to a number');
|
|
34049
|
+
if (typeof it == 'string' && it.length > 2) {
|
|
34050
|
+
it = trim(it);
|
|
34051
|
+
first = it.charCodeAt(0);
|
|
34052
|
+
if (first === 43 || first === 45) {
|
|
34053
|
+
third = it.charCodeAt(2);
|
|
34054
|
+
if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
|
|
34055
|
+
} else if (first === 48) {
|
|
34056
|
+
switch (it.charCodeAt(1)) {
|
|
34057
|
+
case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
|
|
34058
|
+
case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
|
|
34059
|
+
default: return +it;
|
|
34060
|
+
}
|
|
34061
|
+
digits = it.slice(2);
|
|
34062
|
+
length = digits.length;
|
|
34063
|
+
for (index = 0; index < length; index++) {
|
|
34064
|
+
code = digits.charCodeAt(index);
|
|
34065
|
+
// parseInt parses a string to a first unavailable symbol
|
|
34066
|
+
// but ToNumber should return NaN if a string contains unavailable symbols
|
|
34067
|
+
if (code < 48 || code > maxCode) return NaN;
|
|
34068
|
+
} return parseInt(digits, radix);
|
|
34069
|
+
}
|
|
34070
|
+
} return +it;
|
|
34071
|
+
};
|
|
34072
|
+
|
|
34073
|
+
// `Number` constructor
|
|
34074
|
+
// https://tc39.es/ecma262/#sec-number-constructor
|
|
34075
|
+
if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
|
|
34076
|
+
var NumberWrapper = function Number(value) {
|
|
34077
|
+
var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
|
|
34078
|
+
var dummy = this;
|
|
34079
|
+
// check on 1..constructor(foo) case
|
|
34080
|
+
return dummy instanceof NumberWrapper && fails(function () { thisNumberValue(dummy); })
|
|
34081
|
+
? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
|
|
34082
|
+
};
|
|
34083
|
+
for (var keys$2 = descriptors ? getOwnPropertyNames(NativeNumber) : (
|
|
34084
|
+
// ES3:
|
|
34085
|
+
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
|
|
34086
|
+
// ES2015 (in case, if modules with ES2015 Number statics required before):
|
|
34087
|
+
'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
|
|
34088
|
+
// ESNext
|
|
34089
|
+
'fromString,range'
|
|
34090
|
+
).split(','), j = 0, key; keys$2.length > j; j++) {
|
|
34091
|
+
if (hasOwnProperty_1(NativeNumber, key = keys$2[j]) && !hasOwnProperty_1(NumberWrapper, key)) {
|
|
34092
|
+
defineProperty$1(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
|
|
34093
|
+
}
|
|
34094
|
+
}
|
|
34095
|
+
NumberWrapper.prototype = NumberPrototype;
|
|
34096
|
+
NumberPrototype.constructor = NumberWrapper;
|
|
34097
|
+
redefine(global_1, NUMBER, NumberWrapper);
|
|
34098
|
+
}
|
|
34099
|
+
|
|
34100
|
+
// `Array.prototype.{ reduce, reduceRight }` methods implementation
|
|
34101
|
+
var createMethod$3 = function (IS_RIGHT) {
|
|
34102
|
+
return function (that, callbackfn, argumentsLength, memo) {
|
|
34103
|
+
aCallable(callbackfn);
|
|
34104
|
+
var O = toObject(that);
|
|
34105
|
+
var self = indexedObject(O);
|
|
34106
|
+
var length = lengthOfArrayLike(O);
|
|
34107
|
+
var index = IS_RIGHT ? length - 1 : 0;
|
|
34108
|
+
var i = IS_RIGHT ? -1 : 1;
|
|
34109
|
+
if (argumentsLength < 2) while (true) {
|
|
34110
|
+
if (index in self) {
|
|
34111
|
+
memo = self[index];
|
|
34112
|
+
index += i;
|
|
34113
|
+
break;
|
|
34114
|
+
}
|
|
34115
|
+
index += i;
|
|
34116
|
+
if (IS_RIGHT ? index < 0 : length <= index) {
|
|
34117
|
+
throw TypeError('Reduce of empty array with no initial value');
|
|
34118
|
+
}
|
|
34119
|
+
}
|
|
34120
|
+
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
|
|
34121
|
+
memo = callbackfn(memo, self[index], index, O);
|
|
34122
|
+
}
|
|
34123
|
+
return memo;
|
|
34124
|
+
};
|
|
34125
|
+
};
|
|
34126
|
+
|
|
34127
|
+
var arrayReduce = {
|
|
34128
|
+
// `Array.prototype.reduce` method
|
|
34129
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduce
|
|
34130
|
+
left: createMethod$3(false),
|
|
34131
|
+
// `Array.prototype.reduceRight` method
|
|
34132
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduceright
|
|
34133
|
+
right: createMethod$3(true)
|
|
34134
|
+
};
|
|
34135
|
+
|
|
34136
|
+
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
34137
|
+
var method = [][METHOD_NAME];
|
|
34138
|
+
return !!method && fails(function () {
|
|
34139
|
+
// eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
|
|
34140
|
+
method.call(null, argument || function () { throw 1; }, 1);
|
|
34141
|
+
});
|
|
34142
|
+
};
|
|
34143
|
+
|
|
34144
|
+
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
34145
|
+
|
|
34146
|
+
var $reduce = arrayReduce.left;
|
|
34147
|
+
|
|
34148
|
+
|
|
34149
|
+
|
|
34150
|
+
|
|
34151
|
+
var STRICT_METHOD = arrayMethodIsStrict('reduce');
|
|
34152
|
+
// Chrome 80-82 has a critical bug
|
|
34153
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
|
|
34154
|
+
var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83;
|
|
34155
|
+
|
|
34156
|
+
// `Array.prototype.reduce` method
|
|
34157
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduce
|
|
34158
|
+
_export({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
|
|
34159
|
+
reduce: function reduce(callbackfn /* , initialValue */) {
|
|
34160
|
+
return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
|
|
34161
|
+
}
|
|
34162
|
+
});
|
|
34163
|
+
|
|
34164
|
+
// `Object.prototype.toString` method implementation
|
|
34165
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
34166
|
+
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
34167
|
+
return '[object ' + classof(this) + ']';
|
|
34168
|
+
};
|
|
34169
|
+
|
|
34170
|
+
// `Object.prototype.toString` method
|
|
34171
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
34172
|
+
if (!toStringTagSupport) {
|
|
34173
|
+
redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
34174
|
+
}
|
|
34175
|
+
|
|
34176
|
+
var trim$1 = stringTrim.trim;
|
|
34177
|
+
|
|
34178
|
+
|
|
34179
|
+
var $parseInt = global_1.parseInt;
|
|
34180
|
+
var Symbol$2 = global_1.Symbol;
|
|
34181
|
+
var ITERATOR$3 = Symbol$2 && Symbol$2.iterator;
|
|
34182
|
+
var hex$1 = /^[+-]?0x/i;
|
|
34183
|
+
var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
|
|
34184
|
+
// MS Edge 18- broken with boxed symbols
|
|
34185
|
+
|| (ITERATOR$3 && !fails(function () { $parseInt(Object(ITERATOR$3)); }));
|
|
34186
|
+
|
|
34187
|
+
// `parseInt` method
|
|
34188
|
+
// https://tc39.es/ecma262/#sec-parseint-string-radix
|
|
34189
|
+
var numberParseInt = FORCED ? function parseInt(string, radix) {
|
|
34190
|
+
var S = trim$1(toString_1(string));
|
|
34191
|
+
return $parseInt(S, (radix >>> 0) || (hex$1.test(S) ? 16 : 10));
|
|
34192
|
+
} : $parseInt;
|
|
34193
|
+
|
|
34194
|
+
// `parseInt` method
|
|
34195
|
+
// https://tc39.es/ecma262/#sec-parseint-string-radix
|
|
34196
|
+
_export({ global: true, forced: parseInt != numberParseInt }, {
|
|
34197
|
+
parseInt: numberParseInt
|
|
34198
|
+
});
|
|
34199
|
+
|
|
34200
|
+
// `IsArray` abstract operation
|
|
34201
|
+
// https://tc39.es/ecma262/#sec-isarray
|
|
34202
|
+
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
34203
|
+
var isArray = Array.isArray || function isArray(argument) {
|
|
34204
|
+
return classofRaw(argument) == 'Array';
|
|
34205
|
+
};
|
|
34206
|
+
|
|
34207
|
+
var empty = [];
|
|
34208
|
+
var construct = getBuiltIn('Reflect', 'construct');
|
|
34209
|
+
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
34210
|
+
var exec = constructorRegExp.exec;
|
|
34211
|
+
var INCORRECT_TO_STRING = !constructorRegExp.exec(function () { /* empty */ });
|
|
34212
|
+
|
|
34213
|
+
var isConstructorModern = function (argument) {
|
|
34214
|
+
if (!isCallable(argument)) return false;
|
|
34215
|
+
try {
|
|
34216
|
+
construct(Object, empty, argument);
|
|
34217
|
+
return true;
|
|
34218
|
+
} catch (error) {
|
|
34219
|
+
return false;
|
|
34220
|
+
}
|
|
34221
|
+
};
|
|
34222
|
+
|
|
34223
|
+
var isConstructorLegacy = function (argument) {
|
|
34224
|
+
if (!isCallable(argument)) return false;
|
|
34225
|
+
switch (classof(argument)) {
|
|
34226
|
+
case 'AsyncFunction':
|
|
34227
|
+
case 'GeneratorFunction':
|
|
34228
|
+
case 'AsyncGeneratorFunction': return false;
|
|
34229
|
+
// we can't check .prototype since constructors produced by .bind haven't it
|
|
34230
|
+
} return INCORRECT_TO_STRING || !!exec.call(constructorRegExp, inspectSource(argument));
|
|
34231
|
+
};
|
|
34232
|
+
|
|
34233
|
+
// `IsConstructor` abstract operation
|
|
34234
|
+
// https://tc39.es/ecma262/#sec-isconstructor
|
|
34235
|
+
var isConstructor = !construct || fails(function () {
|
|
34236
|
+
var called;
|
|
34237
|
+
return isConstructorModern(isConstructorModern.call)
|
|
34238
|
+
|| !isConstructorModern(Object)
|
|
34239
|
+
|| !isConstructorModern(function () { called = true; })
|
|
34240
|
+
|| called;
|
|
34241
|
+
}) ? isConstructorLegacy : isConstructorModern;
|
|
34242
|
+
|
|
34243
|
+
var createProperty = function (object, key, value) {
|
|
34244
|
+
var propertyKey = toPropertyKey(key);
|
|
34245
|
+
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
34246
|
+
else object[propertyKey] = value;
|
|
34247
|
+
};
|
|
34248
|
+
|
|
34249
|
+
var SPECIES$1 = wellKnownSymbol('species');
|
|
34250
|
+
|
|
34251
|
+
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
34252
|
+
// We can't use this feature detection in V8 since it causes
|
|
34253
|
+
// deoptimization and serious performance degradation
|
|
34254
|
+
// https://github.com/zloirock/core-js/issues/677
|
|
34255
|
+
return engineV8Version >= 51 || !fails(function () {
|
|
34256
|
+
var array = [];
|
|
34257
|
+
var constructor = array.constructor = {};
|
|
34258
|
+
constructor[SPECIES$1] = function () {
|
|
34259
|
+
return { foo: 1 };
|
|
34260
|
+
};
|
|
34261
|
+
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
34262
|
+
});
|
|
34263
|
+
};
|
|
34264
|
+
|
|
34265
|
+
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
|
|
34266
|
+
|
|
34267
|
+
var SPECIES$2 = wellKnownSymbol('species');
|
|
34268
|
+
var nativeSlice = [].slice;
|
|
34269
|
+
var max$2 = Math.max;
|
|
34270
|
+
|
|
34271
|
+
// `Array.prototype.slice` method
|
|
34272
|
+
// https://tc39.es/ecma262/#sec-array.prototype.slice
|
|
34273
|
+
// fallback for not array-like ES3 strings and DOM objects
|
|
34274
|
+
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
|
|
34275
|
+
slice: function slice(start, end) {
|
|
34276
|
+
var O = toIndexedObject(this);
|
|
34277
|
+
var length = lengthOfArrayLike(O);
|
|
34278
|
+
var k = toAbsoluteIndex(start, length);
|
|
34279
|
+
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
34280
|
+
// inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
|
|
34281
|
+
var Constructor, result, n;
|
|
34282
|
+
if (isArray(O)) {
|
|
34283
|
+
Constructor = O.constructor;
|
|
34284
|
+
// cross-realm fallback
|
|
34285
|
+
if (isConstructor(Constructor) && (Constructor === Array || isArray(Constructor.prototype))) {
|
|
34286
|
+
Constructor = undefined;
|
|
34287
|
+
} else if (isObject(Constructor)) {
|
|
34288
|
+
Constructor = Constructor[SPECIES$2];
|
|
34289
|
+
if (Constructor === null) Constructor = undefined;
|
|
34290
|
+
}
|
|
34291
|
+
if (Constructor === Array || Constructor === undefined) {
|
|
34292
|
+
return nativeSlice.call(O, k, fin);
|
|
34293
|
+
}
|
|
34294
|
+
}
|
|
34295
|
+
result = new (Constructor === undefined ? Array : Constructor)(max$2(fin - k, 0));
|
|
34296
|
+
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
|
|
34297
|
+
result.length = n;
|
|
34298
|
+
return result;
|
|
34299
|
+
}
|
|
34300
|
+
});
|
|
34301
|
+
|
|
34302
|
+
var MATCH = wellKnownSymbol('match');
|
|
34303
|
+
|
|
34304
|
+
// `IsRegExp` abstract operation
|
|
34305
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
34306
|
+
var isRegexp = function (it) {
|
|
34307
|
+
var isRegExp;
|
|
34308
|
+
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
34309
|
+
};
|
|
34310
|
+
|
|
34311
|
+
var SPECIES$3 = wellKnownSymbol('species');
|
|
34312
|
+
|
|
34313
|
+
var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
34314
|
+
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
|
34315
|
+
var defineProperty = objectDefineProperty.f;
|
|
34316
|
+
|
|
34317
|
+
if (descriptors && Constructor && !Constructor[SPECIES$3]) {
|
|
34318
|
+
defineProperty(Constructor, SPECIES$3, {
|
|
34319
|
+
configurable: true,
|
|
34320
|
+
get: function () { return this; }
|
|
34321
|
+
});
|
|
34322
|
+
}
|
|
34323
|
+
};
|
|
34324
|
+
|
|
34325
|
+
var defineProperty$2 = objectDefineProperty.f;
|
|
34326
|
+
var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
|
|
34327
|
+
|
|
34328
|
+
|
|
34329
|
+
|
|
34330
|
+
|
|
34331
|
+
|
|
34332
|
+
|
|
34333
|
+
|
|
34334
|
+
var enforceInternalState = internalState.enforce;
|
|
34335
|
+
|
|
34336
|
+
|
|
34337
|
+
|
|
34338
|
+
|
|
34339
|
+
|
|
34340
|
+
var MATCH$1 = wellKnownSymbol('match');
|
|
34341
|
+
var NativeRegExp = global_1.RegExp;
|
|
34342
|
+
var RegExpPrototype$1 = NativeRegExp.prototype;
|
|
34343
|
+
// TODO: Use only propper RegExpIdentifierName
|
|
34344
|
+
var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
|
|
34345
|
+
var re1 = /a/g;
|
|
34346
|
+
var re2 = /a/g;
|
|
34347
|
+
|
|
34348
|
+
// "new" should create a new object, old webkit bug
|
|
34349
|
+
var CORRECT_NEW = new NativeRegExp(re1) !== re1;
|
|
34350
|
+
|
|
34351
|
+
var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y;
|
|
34352
|
+
|
|
34353
|
+
var BASE_FORCED = descriptors &&
|
|
34354
|
+
(!CORRECT_NEW || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () {
|
|
34355
|
+
re2[MATCH$1] = false;
|
|
34356
|
+
// RegExp constructor can alter flags and IsRegExp works correct with @@match
|
|
34357
|
+
return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
|
|
34358
|
+
}));
|
|
34359
|
+
|
|
34360
|
+
var handleDotAll = function (string) {
|
|
34361
|
+
var length = string.length;
|
|
34362
|
+
var index = 0;
|
|
34363
|
+
var result = '';
|
|
34364
|
+
var brackets = false;
|
|
34365
|
+
var chr;
|
|
34366
|
+
for (; index <= length; index++) {
|
|
34367
|
+
chr = string.charAt(index);
|
|
34368
|
+
if (chr === '\\') {
|
|
34369
|
+
result += chr + string.charAt(++index);
|
|
34370
|
+
continue;
|
|
34371
|
+
}
|
|
34372
|
+
if (!brackets && chr === '.') {
|
|
34373
|
+
result += '[\\s\\S]';
|
|
34374
|
+
} else {
|
|
34375
|
+
if (chr === '[') {
|
|
34376
|
+
brackets = true;
|
|
34377
|
+
} else if (chr === ']') {
|
|
34378
|
+
brackets = false;
|
|
34379
|
+
} result += chr;
|
|
34380
|
+
}
|
|
34381
|
+
} return result;
|
|
34382
|
+
};
|
|
34383
|
+
|
|
34384
|
+
var handleNCG = function (string) {
|
|
34385
|
+
var length = string.length;
|
|
34386
|
+
var index = 0;
|
|
34387
|
+
var result = '';
|
|
34388
|
+
var named = [];
|
|
34389
|
+
var names = {};
|
|
34390
|
+
var brackets = false;
|
|
34391
|
+
var ncg = false;
|
|
34392
|
+
var groupid = 0;
|
|
34393
|
+
var groupname = '';
|
|
34394
|
+
var chr;
|
|
34395
|
+
for (; index <= length; index++) {
|
|
34396
|
+
chr = string.charAt(index);
|
|
34397
|
+
if (chr === '\\') {
|
|
34398
|
+
chr = chr + string.charAt(++index);
|
|
34399
|
+
} else if (chr === ']') {
|
|
34400
|
+
brackets = false;
|
|
34401
|
+
} else if (!brackets) switch (true) {
|
|
34402
|
+
case chr === '[':
|
|
34403
|
+
brackets = true;
|
|
34404
|
+
break;
|
|
34405
|
+
case chr === '(':
|
|
34406
|
+
if (IS_NCG.test(string.slice(index + 1))) {
|
|
34407
|
+
index += 2;
|
|
34408
|
+
ncg = true;
|
|
34409
|
+
}
|
|
34410
|
+
result += chr;
|
|
34411
|
+
groupid++;
|
|
34412
|
+
continue;
|
|
34413
|
+
case chr === '>' && ncg:
|
|
34414
|
+
if (groupname === '' || hasOwnProperty_1(names, groupname)) {
|
|
34415
|
+
throw new SyntaxError('Invalid capture group name');
|
|
34416
|
+
}
|
|
34417
|
+
names[groupname] = true;
|
|
34418
|
+
named.push([groupname, groupid]);
|
|
34419
|
+
ncg = false;
|
|
34420
|
+
groupname = '';
|
|
34421
|
+
continue;
|
|
34422
|
+
}
|
|
34423
|
+
if (ncg) groupname += chr;
|
|
34424
|
+
else result += chr;
|
|
34425
|
+
} return [result, named];
|
|
34426
|
+
};
|
|
34427
|
+
|
|
34428
|
+
// `RegExp` constructor
|
|
34429
|
+
// https://tc39.es/ecma262/#sec-regexp-constructor
|
|
34430
|
+
if (isForced_1('RegExp', BASE_FORCED)) {
|
|
34431
|
+
var RegExpWrapper = function RegExp(pattern, flags) {
|
|
34432
|
+
var thisIsRegExp = this instanceof RegExpWrapper;
|
|
34433
|
+
var patternIsRegExp = isRegexp(pattern);
|
|
34434
|
+
var flagsAreUndefined = flags === undefined;
|
|
34435
|
+
var groups = [];
|
|
34436
|
+
var rawPattern = pattern;
|
|
34437
|
+
var rawFlags, dotAll, sticky, handled, result, state;
|
|
34438
|
+
|
|
34439
|
+
if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
|
|
34440
|
+
return pattern;
|
|
34441
|
+
}
|
|
34442
|
+
|
|
34443
|
+
if (patternIsRegExp || pattern instanceof RegExpWrapper) {
|
|
34444
|
+
pattern = pattern.source;
|
|
34445
|
+
if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : regexpFlags.call(rawPattern);
|
|
34446
|
+
}
|
|
34447
|
+
|
|
34448
|
+
pattern = pattern === undefined ? '' : toString_1(pattern);
|
|
34449
|
+
flags = flags === undefined ? '' : toString_1(flags);
|
|
34450
|
+
rawPattern = pattern;
|
|
34451
|
+
|
|
34452
|
+
if (regexpUnsupportedDotAll && 'dotAll' in re1) {
|
|
34453
|
+
dotAll = !!flags && flags.indexOf('s') > -1;
|
|
34454
|
+
if (dotAll) flags = flags.replace(/s/g, '');
|
|
34455
|
+
}
|
|
34456
|
+
|
|
34457
|
+
rawFlags = flags;
|
|
34458
|
+
|
|
34459
|
+
if (UNSUPPORTED_Y$2 && 'sticky' in re1) {
|
|
34460
|
+
sticky = !!flags && flags.indexOf('y') > -1;
|
|
34461
|
+
if (sticky) flags = flags.replace(/y/g, '');
|
|
34462
|
+
}
|
|
34463
|
+
|
|
34464
|
+
if (regexpUnsupportedNcg) {
|
|
34465
|
+
handled = handleNCG(pattern);
|
|
34466
|
+
pattern = handled[0];
|
|
34467
|
+
groups = handled[1];
|
|
34468
|
+
}
|
|
34469
|
+
|
|
34470
|
+
result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$1, RegExpWrapper);
|
|
34471
|
+
|
|
34472
|
+
if (dotAll || sticky || groups.length) {
|
|
34473
|
+
state = enforceInternalState(result);
|
|
34474
|
+
if (dotAll) {
|
|
34475
|
+
state.dotAll = true;
|
|
34476
|
+
state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
|
|
34477
|
+
}
|
|
34478
|
+
if (sticky) state.sticky = true;
|
|
34479
|
+
if (groups.length) state.groups = groups;
|
|
34480
|
+
}
|
|
34481
|
+
|
|
34482
|
+
if (pattern !== rawPattern) try {
|
|
34483
|
+
// fails in old engines, but we have no alternatives for unsupported regex syntax
|
|
34484
|
+
createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
|
|
34485
|
+
} catch (error) { /* empty */ }
|
|
34486
|
+
|
|
34487
|
+
return result;
|
|
34488
|
+
};
|
|
34489
|
+
|
|
34490
|
+
var proxy = function (key) {
|
|
34491
|
+
key in RegExpWrapper || defineProperty$2(RegExpWrapper, key, {
|
|
34492
|
+
configurable: true,
|
|
34493
|
+
get: function () { return NativeRegExp[key]; },
|
|
34494
|
+
set: function (it) { NativeRegExp[key] = it; }
|
|
34495
|
+
});
|
|
34496
|
+
};
|
|
34497
|
+
|
|
34498
|
+
for (var keys$3 = getOwnPropertyNames$1(NativeRegExp), index$4 = 0; keys$3.length > index$4;) {
|
|
34499
|
+
proxy(keys$3[index$4++]);
|
|
34500
|
+
}
|
|
34501
|
+
|
|
34502
|
+
RegExpPrototype$1.constructor = RegExpWrapper;
|
|
34503
|
+
RegExpWrapper.prototype = RegExpPrototype$1;
|
|
34504
|
+
redefine(global_1, 'RegExp', RegExpWrapper);
|
|
34505
|
+
}
|
|
34506
|
+
|
|
34507
|
+
// https://tc39.es/ecma262/#sec-get-regexp-@@species
|
|
34508
|
+
setSpecies('RegExp');
|
|
34509
|
+
|
|
34510
|
+
var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
|
|
34511
|
+
|
|
34512
|
+
|
|
34513
|
+
|
|
34514
|
+
|
|
34515
|
+
|
|
34516
|
+
|
|
34517
|
+
var TO_STRING = 'toString';
|
|
34518
|
+
var RegExpPrototype$2 = RegExp.prototype;
|
|
34519
|
+
var nativeToString = RegExpPrototype$2[TO_STRING];
|
|
34520
|
+
|
|
34521
|
+
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
|
|
34522
|
+
// FF44- RegExp#toString has a wrong name
|
|
34523
|
+
var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name != TO_STRING;
|
|
34524
|
+
|
|
34525
|
+
// `RegExp.prototype.toString` method
|
|
34526
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
34527
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
34528
|
+
redefine(RegExp.prototype, TO_STRING, function toString() {
|
|
34529
|
+
var R = anObject(this);
|
|
34530
|
+
var p = toString_1(R.source);
|
|
34531
|
+
var rf = R.flags;
|
|
34532
|
+
var f = toString_1(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$2) ? regexpFlags.call(R) : rf);
|
|
34533
|
+
return '/' + p + '/' + f;
|
|
34534
|
+
}, { unsafe: true });
|
|
34535
|
+
}
|
|
34536
|
+
|
|
34537
|
+
// optional / simple context binding
|
|
34538
|
+
var functionBindContext = function (fn, that, length) {
|
|
34539
|
+
aCallable(fn);
|
|
34540
|
+
if (that === undefined) return fn;
|
|
34541
|
+
switch (length) {
|
|
34542
|
+
case 0: return function () {
|
|
34543
|
+
return fn.call(that);
|
|
34544
|
+
};
|
|
34545
|
+
case 1: return function (a) {
|
|
34546
|
+
return fn.call(that, a);
|
|
34547
|
+
};
|
|
34548
|
+
case 2: return function (a, b) {
|
|
34549
|
+
return fn.call(that, a, b);
|
|
34550
|
+
};
|
|
34551
|
+
case 3: return function (a, b, c) {
|
|
34552
|
+
return fn.call(that, a, b, c);
|
|
34553
|
+
};
|
|
34554
|
+
}
|
|
34555
|
+
return function (/* ...args */) {
|
|
34556
|
+
return fn.apply(that, arguments);
|
|
34557
|
+
};
|
|
34558
|
+
};
|
|
34559
|
+
|
|
34560
|
+
var SPECIES$4 = wellKnownSymbol('species');
|
|
34561
|
+
|
|
34562
|
+
// a part of `ArraySpeciesCreate` abstract operation
|
|
34563
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
34564
|
+
var arraySpeciesConstructor = function (originalArray) {
|
|
34565
|
+
var C;
|
|
34566
|
+
if (isArray(originalArray)) {
|
|
34567
|
+
C = originalArray.constructor;
|
|
34568
|
+
// cross-realm fallback
|
|
34569
|
+
if (isConstructor(C) && (C === Array || isArray(C.prototype))) C = undefined;
|
|
34570
|
+
else if (isObject(C)) {
|
|
34571
|
+
C = C[SPECIES$4];
|
|
34572
|
+
if (C === null) C = undefined;
|
|
34573
|
+
}
|
|
34574
|
+
} return C === undefined ? Array : C;
|
|
34575
|
+
};
|
|
34576
|
+
|
|
34577
|
+
// `ArraySpeciesCreate` abstract operation
|
|
34578
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
34579
|
+
var arraySpeciesCreate = function (originalArray, length) {
|
|
34580
|
+
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
34581
|
+
};
|
|
34582
|
+
|
|
34583
|
+
var push = [].push;
|
|
34584
|
+
|
|
34585
|
+
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
|
|
34586
|
+
var createMethod$4 = function (TYPE) {
|
|
34587
|
+
var IS_MAP = TYPE == 1;
|
|
34588
|
+
var IS_FILTER = TYPE == 2;
|
|
34589
|
+
var IS_SOME = TYPE == 3;
|
|
34590
|
+
var IS_EVERY = TYPE == 4;
|
|
34591
|
+
var IS_FIND_INDEX = TYPE == 6;
|
|
34592
|
+
var IS_FILTER_REJECT = TYPE == 7;
|
|
34593
|
+
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
|
34594
|
+
return function ($this, callbackfn, that, specificCreate) {
|
|
34595
|
+
var O = toObject($this);
|
|
34596
|
+
var self = indexedObject(O);
|
|
34597
|
+
var boundFunction = functionBindContext(callbackfn, that, 3);
|
|
34598
|
+
var length = lengthOfArrayLike(self);
|
|
34599
|
+
var index = 0;
|
|
34600
|
+
var create = specificCreate || arraySpeciesCreate;
|
|
34601
|
+
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
|
|
34602
|
+
var value, result;
|
|
34603
|
+
for (;length > index; index++) if (NO_HOLES || index in self) {
|
|
34604
|
+
value = self[index];
|
|
34605
|
+
result = boundFunction(value, index, O);
|
|
34606
|
+
if (TYPE) {
|
|
34607
|
+
if (IS_MAP) target[index] = result; // map
|
|
34608
|
+
else if (result) switch (TYPE) {
|
|
34609
|
+
case 3: return true; // some
|
|
34610
|
+
case 5: return value; // find
|
|
34611
|
+
case 6: return index; // findIndex
|
|
34612
|
+
case 2: push.call(target, value); // filter
|
|
34613
|
+
} else switch (TYPE) {
|
|
34614
|
+
case 4: return false; // every
|
|
34615
|
+
case 7: push.call(target, value); // filterReject
|
|
34616
|
+
}
|
|
34617
|
+
}
|
|
34618
|
+
}
|
|
34619
|
+
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
|
34620
|
+
};
|
|
34621
|
+
};
|
|
34622
|
+
|
|
34623
|
+
var arrayIteration = {
|
|
34624
|
+
// `Array.prototype.forEach` method
|
|
34625
|
+
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
34626
|
+
forEach: createMethod$4(0),
|
|
34627
|
+
// `Array.prototype.map` method
|
|
34628
|
+
// https://tc39.es/ecma262/#sec-array.prototype.map
|
|
34629
|
+
map: createMethod$4(1),
|
|
34630
|
+
// `Array.prototype.filter` method
|
|
34631
|
+
// https://tc39.es/ecma262/#sec-array.prototype.filter
|
|
34632
|
+
filter: createMethod$4(2),
|
|
34633
|
+
// `Array.prototype.some` method
|
|
34634
|
+
// https://tc39.es/ecma262/#sec-array.prototype.some
|
|
34635
|
+
some: createMethod$4(3),
|
|
34636
|
+
// `Array.prototype.every` method
|
|
34637
|
+
// https://tc39.es/ecma262/#sec-array.prototype.every
|
|
34638
|
+
every: createMethod$4(4),
|
|
34639
|
+
// `Array.prototype.find` method
|
|
34640
|
+
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
34641
|
+
find: createMethod$4(5),
|
|
34642
|
+
// `Array.prototype.findIndex` method
|
|
34643
|
+
// https://tc39.es/ecma262/#sec-array.prototype.findIndex
|
|
34644
|
+
findIndex: createMethod$4(6),
|
|
34645
|
+
// `Array.prototype.filterReject` method
|
|
34646
|
+
// https://github.com/tc39/proposal-array-filtering
|
|
34647
|
+
filterReject: createMethod$4(7)
|
|
34648
|
+
};
|
|
34649
|
+
|
|
34650
|
+
var $map = arrayIteration.map;
|
|
34651
|
+
|
|
34652
|
+
|
|
34653
|
+
var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map');
|
|
34654
|
+
|
|
34655
|
+
// `Array.prototype.map` method
|
|
34656
|
+
// https://tc39.es/ecma262/#sec-array.prototype.map
|
|
34657
|
+
// with adding support of @@species
|
|
34658
|
+
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
|
|
34659
|
+
map: function map(callbackfn /* , thisArg */) {
|
|
34660
|
+
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
34661
|
+
}
|
|
34662
|
+
});
|
|
34663
|
+
|
|
34664
|
+
// `Assert: IsConstructor(argument) is true`
|
|
34665
|
+
var aConstructor = function (argument) {
|
|
34666
|
+
if (isConstructor(argument)) return argument;
|
|
34667
|
+
throw TypeError(tryToString(argument) + ' is not a constructor');
|
|
34668
|
+
};
|
|
34669
|
+
|
|
34670
|
+
var SPECIES$5 = wellKnownSymbol('species');
|
|
34671
|
+
|
|
34672
|
+
// `SpeciesConstructor` abstract operation
|
|
34673
|
+
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
34674
|
+
var speciesConstructor = function (O, defaultConstructor) {
|
|
34675
|
+
var C = anObject(O).constructor;
|
|
34676
|
+
var S;
|
|
34677
|
+
return C === undefined || (S = anObject(C)[SPECIES$5]) == undefined ? defaultConstructor : aConstructor(S);
|
|
34678
|
+
};
|
|
34679
|
+
|
|
34680
|
+
var UNSUPPORTED_Y$3 = regexpStickyHelpers.UNSUPPORTED_Y;
|
|
34681
|
+
var arrayPush = [].push;
|
|
34682
|
+
var min$3 = Math.min;
|
|
34683
|
+
var MAX_UINT32 = 0xFFFFFFFF;
|
|
34684
|
+
|
|
34685
|
+
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
|
|
34686
|
+
// Weex JS has frozen built-in prototypes, so use try / catch wrapper
|
|
34687
|
+
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
|
34688
|
+
// eslint-disable-next-line regexp/no-empty-group -- required for testing
|
|
34689
|
+
var re = /(?:)/;
|
|
34690
|
+
var originalExec = re.exec;
|
|
34691
|
+
re.exec = function () { return originalExec.apply(this, arguments); };
|
|
34692
|
+
var result = 'ab'.split(re);
|
|
34693
|
+
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
|
34694
|
+
});
|
|
34695
|
+
|
|
34696
|
+
// @@split logic
|
|
34697
|
+
fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
|
|
34698
|
+
var internalSplit;
|
|
34699
|
+
if (
|
|
34700
|
+
'abbc'.split(/(b)*/)[1] == 'c' ||
|
|
34701
|
+
// eslint-disable-next-line regexp/no-empty-group -- required for testing
|
|
34702
|
+
'test'.split(/(?:)/, -1).length != 4 ||
|
|
34703
|
+
'ab'.split(/(?:ab)*/).length != 2 ||
|
|
34704
|
+
'.'.split(/(.?)(.?)/).length != 4 ||
|
|
34705
|
+
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
|
|
34706
|
+
'.'.split(/()()/).length > 1 ||
|
|
34707
|
+
''.split(/.?/).length
|
|
34708
|
+
) {
|
|
34709
|
+
// based on es5-shim implementation, need to rework it
|
|
34710
|
+
internalSplit = function (separator, limit) {
|
|
34711
|
+
var string = toString_1(requireObjectCoercible(this));
|
|
34712
|
+
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
|
34713
|
+
if (lim === 0) return [];
|
|
34714
|
+
if (separator === undefined) return [string];
|
|
34715
|
+
// If `separator` is not a regex, use native split
|
|
34716
|
+
if (!isRegexp(separator)) {
|
|
34717
|
+
return nativeSplit.call(string, separator, lim);
|
|
34718
|
+
}
|
|
34719
|
+
var output = [];
|
|
34720
|
+
var flags = (separator.ignoreCase ? 'i' : '') +
|
|
34721
|
+
(separator.multiline ? 'm' : '') +
|
|
34722
|
+
(separator.unicode ? 'u' : '') +
|
|
34723
|
+
(separator.sticky ? 'y' : '');
|
|
34724
|
+
var lastLastIndex = 0;
|
|
34725
|
+
// Make `global` and avoid `lastIndex` issues by working with a copy
|
|
34726
|
+
var separatorCopy = new RegExp(separator.source, flags + 'g');
|
|
34727
|
+
var match, lastIndex, lastLength;
|
|
34728
|
+
while (match = regexpExec.call(separatorCopy, string)) {
|
|
34729
|
+
lastIndex = separatorCopy.lastIndex;
|
|
34730
|
+
if (lastIndex > lastLastIndex) {
|
|
34731
|
+
output.push(string.slice(lastLastIndex, match.index));
|
|
34732
|
+
if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
|
|
34733
|
+
lastLength = match[0].length;
|
|
34734
|
+
lastLastIndex = lastIndex;
|
|
34735
|
+
if (output.length >= lim) break;
|
|
34736
|
+
}
|
|
34737
|
+
if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
|
|
34738
|
+
}
|
|
34739
|
+
if (lastLastIndex === string.length) {
|
|
34740
|
+
if (lastLength || !separatorCopy.test('')) output.push('');
|
|
34741
|
+
} else output.push(string.slice(lastLastIndex));
|
|
34742
|
+
return output.length > lim ? output.slice(0, lim) : output;
|
|
34743
|
+
};
|
|
34744
|
+
// Chakra, V8
|
|
34745
|
+
} else if ('0'.split(undefined, 0).length) {
|
|
34746
|
+
internalSplit = function (separator, limit) {
|
|
34747
|
+
return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
|
|
34748
|
+
};
|
|
34749
|
+
} else internalSplit = nativeSplit;
|
|
34750
|
+
|
|
34751
|
+
return [
|
|
34752
|
+
// `String.prototype.split` method
|
|
34753
|
+
// https://tc39.es/ecma262/#sec-string.prototype.split
|
|
34754
|
+
function split(separator, limit) {
|
|
34755
|
+
var O = requireObjectCoercible(this);
|
|
34756
|
+
var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
|
|
34757
|
+
return splitter
|
|
34758
|
+
? splitter.call(separator, O, limit)
|
|
34759
|
+
: internalSplit.call(toString_1(O), separator, limit);
|
|
34760
|
+
},
|
|
34761
|
+
// `RegExp.prototype[@@split]` method
|
|
34762
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@split
|
|
34763
|
+
//
|
|
34764
|
+
// NOTE: This cannot be properly polyfilled in engines that don't support
|
|
34765
|
+
// the 'y' flag.
|
|
34766
|
+
function (string, limit) {
|
|
34767
|
+
var rx = anObject(this);
|
|
34768
|
+
var S = toString_1(string);
|
|
34769
|
+
var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
|
|
34770
|
+
|
|
34771
|
+
if (res.done) return res.value;
|
|
34772
|
+
|
|
34773
|
+
var C = speciesConstructor(rx, RegExp);
|
|
34774
|
+
|
|
34775
|
+
var unicodeMatching = rx.unicode;
|
|
34776
|
+
var flags = (rx.ignoreCase ? 'i' : '') +
|
|
34777
|
+
(rx.multiline ? 'm' : '') +
|
|
34778
|
+
(rx.unicode ? 'u' : '') +
|
|
34779
|
+
(UNSUPPORTED_Y$3 ? 'g' : 'y');
|
|
34780
|
+
|
|
34781
|
+
// ^(? + rx + ) is needed, in combination with some S slicing, to
|
|
34782
|
+
// simulate the 'y' flag.
|
|
34783
|
+
var splitter = new C(UNSUPPORTED_Y$3 ? '^(?:' + rx.source + ')' : rx, flags);
|
|
34784
|
+
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
|
34785
|
+
if (lim === 0) return [];
|
|
34786
|
+
if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
|
|
34787
|
+
var p = 0;
|
|
34788
|
+
var q = 0;
|
|
34789
|
+
var A = [];
|
|
34790
|
+
while (q < S.length) {
|
|
34791
|
+
splitter.lastIndex = UNSUPPORTED_Y$3 ? 0 : q;
|
|
34792
|
+
var z = regexpExecAbstract(splitter, UNSUPPORTED_Y$3 ? S.slice(q) : S);
|
|
34793
|
+
var e;
|
|
34794
|
+
if (
|
|
34795
|
+
z === null ||
|
|
34796
|
+
(e = min$3(toLength(splitter.lastIndex + (UNSUPPORTED_Y$3 ? q : 0)), S.length)) === p
|
|
34797
|
+
) {
|
|
34798
|
+
q = advanceStringIndex(S, q, unicodeMatching);
|
|
34799
|
+
} else {
|
|
34800
|
+
A.push(S.slice(p, q));
|
|
34801
|
+
if (A.length === lim) return A;
|
|
34802
|
+
for (var i = 1; i <= z.length - 1; i++) {
|
|
34803
|
+
A.push(z[i]);
|
|
34804
|
+
if (A.length === lim) return A;
|
|
34805
|
+
}
|
|
34806
|
+
q = p = e;
|
|
34807
|
+
}
|
|
34808
|
+
}
|
|
34809
|
+
A.push(S.slice(p));
|
|
34810
|
+
return A;
|
|
34811
|
+
}
|
|
34812
|
+
];
|
|
34813
|
+
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y$3);
|
|
34814
|
+
|
|
34815
|
+
var $filter = arrayIteration.filter;
|
|
34816
|
+
|
|
34817
|
+
|
|
34818
|
+
var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('filter');
|
|
34819
|
+
|
|
34820
|
+
// `Array.prototype.filter` method
|
|
34821
|
+
// https://tc39.es/ecma262/#sec-array.prototype.filter
|
|
34822
|
+
// with adding support of @@species
|
|
34823
|
+
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
|
|
34824
|
+
filter: function filter(callbackfn /* , thisArg */) {
|
|
34825
|
+
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
34826
|
+
}
|
|
34827
|
+
});
|
|
34828
|
+
|
|
34829
|
+
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
34830
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
34831
|
+
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
34832
|
+
|
|
34833
|
+
// We can't use this feature detection in V8 since it causes
|
|
34834
|
+
// deoptimization and serious performance degradation
|
|
34835
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
34836
|
+
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
34837
|
+
var array = [];
|
|
34838
|
+
array[IS_CONCAT_SPREADABLE] = false;
|
|
34839
|
+
return array.concat()[0] !== array;
|
|
34840
|
+
});
|
|
34841
|
+
|
|
34842
|
+
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
34843
|
+
|
|
34844
|
+
var isConcatSpreadable = function (O) {
|
|
34845
|
+
if (!isObject(O)) return false;
|
|
34846
|
+
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
34847
|
+
return spreadable !== undefined ? !!spreadable : isArray(O);
|
|
34848
|
+
};
|
|
34849
|
+
|
|
34850
|
+
var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
34851
|
+
|
|
34852
|
+
// `Array.prototype.concat` method
|
|
34853
|
+
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
34854
|
+
// with adding support of @@isConcatSpreadable and @@species
|
|
34855
|
+
_export({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
34856
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
34857
|
+
concat: function concat(arg) {
|
|
34858
|
+
var O = toObject(this);
|
|
34859
|
+
var A = arraySpeciesCreate(O, 0);
|
|
34860
|
+
var n = 0;
|
|
34861
|
+
var i, k, length, len, E;
|
|
34862
|
+
for (i = -1, length = arguments.length; i < length; i++) {
|
|
34863
|
+
E = i === -1 ? O : arguments[i];
|
|
34864
|
+
if (isConcatSpreadable(E)) {
|
|
34865
|
+
len = lengthOfArrayLike(E);
|
|
34866
|
+
if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
34867
|
+
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
34868
|
+
} else {
|
|
34869
|
+
if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
34870
|
+
createProperty(A, n++, E);
|
|
34871
|
+
}
|
|
34872
|
+
}
|
|
34873
|
+
A.length = n;
|
|
34874
|
+
return A;
|
|
34875
|
+
}
|
|
34876
|
+
});
|
|
34877
|
+
|
|
34878
|
+
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
34879
|
+
|
|
34880
|
+
// `Object.keys` method
|
|
34881
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
34882
|
+
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
34883
|
+
keys: function keys(it) {
|
|
34884
|
+
return objectKeys(toObject(it));
|
|
34885
|
+
}
|
|
34886
|
+
});
|
|
34887
|
+
|
|
34888
|
+
var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
|
34889
|
+
|
|
34890
|
+
// `Object.{ entries, values }` methods implementation
|
|
34891
|
+
var createMethod$5 = function (TO_ENTRIES) {
|
|
34892
|
+
return function (it) {
|
|
34893
|
+
var O = toIndexedObject(it);
|
|
34894
|
+
var keys = objectKeys(O);
|
|
34895
|
+
var length = keys.length;
|
|
34896
|
+
var i = 0;
|
|
34897
|
+
var result = [];
|
|
34898
|
+
var key;
|
|
34899
|
+
while (length > i) {
|
|
34900
|
+
key = keys[i++];
|
|
34901
|
+
if (!descriptors || propertyIsEnumerable.call(O, key)) {
|
|
34902
|
+
result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
|
|
34903
|
+
}
|
|
34904
|
+
}
|
|
34905
|
+
return result;
|
|
34906
|
+
};
|
|
34907
|
+
};
|
|
34908
|
+
|
|
34909
|
+
var objectToArray = {
|
|
34910
|
+
// `Object.entries` method
|
|
34911
|
+
// https://tc39.es/ecma262/#sec-object.entries
|
|
34912
|
+
entries: createMethod$5(true),
|
|
34913
|
+
// `Object.values` method
|
|
34914
|
+
// https://tc39.es/ecma262/#sec-object.values
|
|
34915
|
+
values: createMethod$5(false)
|
|
34916
|
+
};
|
|
34917
|
+
|
|
34918
|
+
var $entries = objectToArray.entries;
|
|
34919
|
+
|
|
34920
|
+
// `Object.entries` method
|
|
34921
|
+
// https://tc39.es/ecma262/#sec-object.entries
|
|
34922
|
+
_export({ target: 'Object', stat: true }, {
|
|
34923
|
+
entries: function entries(O) {
|
|
34924
|
+
return $entries(O);
|
|
34925
|
+
}
|
|
34926
|
+
});
|
|
34927
|
+
|
|
34928
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
34929
|
+
if (!o) return;
|
|
34930
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
34931
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
34932
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
34933
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
34934
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
34935
|
+
}
|
|
34936
|
+
|
|
34937
|
+
function _arrayLikeToArray(arr, len) {
|
|
34938
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
34939
|
+
|
|
34940
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
34941
|
+
|
|
34942
|
+
return arr2;
|
|
34943
|
+
}
|
|
34944
|
+
|
|
34945
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
34946
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
34947
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
34948
|
+
|
|
34949
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
34950
|
+
if (it) o = it;
|
|
34951
|
+
var i = 0;
|
|
34952
|
+
return function () {
|
|
34953
|
+
if (i >= o.length) return {
|
|
34954
|
+
done: true
|
|
34955
|
+
};
|
|
34956
|
+
return {
|
|
34957
|
+
done: false,
|
|
34958
|
+
value: o[i++]
|
|
34959
|
+
};
|
|
34960
|
+
};
|
|
34961
|
+
}
|
|
34962
|
+
|
|
34963
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
34964
|
+
}
|
|
34965
|
+
|
|
34966
|
+
var validatorToPredicate = function validatorToPredicate(validatorFn, emptyCase) {
|
|
34967
|
+
return function (value) {
|
|
34968
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
34969
|
+
rest[_key - 1] = arguments[_key];
|
|
34970
|
+
}
|
|
34971
|
+
|
|
34972
|
+
return value === "" ? emptyCase : validatorFn.apply(void 0, [value].concat(rest));
|
|
34973
|
+
};
|
|
34974
|
+
};
|
|
33977
34975
|
|
|
33978
34976
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
33979
34977
|
|
|
@@ -34009,10 +35007,19 @@ var isSameOrAfter$1 = {exports: {}};
|
|
|
34009
35007
|
|
|
34010
35008
|
var isSameOrAfter = isSameOrAfter$1.exports;
|
|
34011
35009
|
|
|
34012
|
-
|
|
35010
|
+
var createValidator = function createValidator(type, error) {
|
|
35011
|
+
var validator = function validator() {
|
|
35012
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35013
|
+
args[_key] = arguments[_key];
|
|
35014
|
+
}
|
|
35015
|
+
|
|
35016
|
+
return {
|
|
35017
|
+
type: type,
|
|
35018
|
+
args: args,
|
|
35019
|
+
error: error
|
|
35020
|
+
};
|
|
35021
|
+
};
|
|
34013
35022
|
|
|
34014
|
-
const createValidator = (type, error) => {
|
|
34015
|
-
let validator = (...args) => ({ type, args, error });
|
|
34016
35023
|
validator.error = error;
|
|
34017
35024
|
return validator;
|
|
34018
35025
|
};
|
|
@@ -34020,428 +35027,408 @@ const createValidator = (type, error) => {
|
|
|
34020
35027
|
dayjs.extend(customParseFormat);
|
|
34021
35028
|
dayjs.extend(isSameOrBefore);
|
|
34022
35029
|
dayjs.extend(isSameOrAfter);
|
|
35030
|
+
var validatorFns = {};
|
|
35031
|
+
var REQUIRED = "validator/REQUIRED";
|
|
35032
|
+
var REQUIRED_ERROR = "error/REQUIRED";
|
|
35033
|
+
var required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
35034
|
+
|
|
35035
|
+
validatorFns[REQUIRED] = function (value, args, form) {
|
|
35036
|
+
return value !== "";
|
|
35037
|
+
};
|
|
34023
35038
|
|
|
34024
|
-
|
|
35039
|
+
var ONLY_INTEGERS = "validator/ONLY_INTEGERS";
|
|
35040
|
+
var ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
|
|
35041
|
+
var onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
34025
35042
|
|
|
34026
|
-
|
|
34027
|
-
|
|
34028
|
-
|
|
34029
|
-
|
|
35043
|
+
validatorFns[ONLY_INTEGERS] = function (value, args, form) {
|
|
35044
|
+
return /^(-?\d+)?$/.test(value);
|
|
35045
|
+
};
|
|
35046
|
+
|
|
35047
|
+
var ONLY_NATURALS = "validator/ONLY_NATURALS";
|
|
35048
|
+
var ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
35049
|
+
var onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
34030
35050
|
|
|
34031
|
-
|
|
34032
|
-
|
|
34033
|
-
|
|
34034
|
-
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
35051
|
+
validatorFns[ONLY_NATURALS] = function (value, args, form) {
|
|
35052
|
+
return /^(\d+)?$/.test(value);
|
|
35053
|
+
};
|
|
34035
35054
|
|
|
34036
|
-
|
|
34037
|
-
|
|
34038
|
-
|
|
34039
|
-
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
35055
|
+
var NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
35056
|
+
var NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
35057
|
+
var numberLessThan = createValidator(NUMBER_LESS_THAN, NUMBER_LESS_THAN_ERROR);
|
|
34040
35058
|
|
|
34041
|
-
|
|
34042
|
-
const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
34043
|
-
const numberLessThan = createValidator(
|
|
34044
|
-
NUMBER_LESS_THAN,
|
|
34045
|
-
NUMBER_LESS_THAN_ERROR
|
|
34046
|
-
);
|
|
34047
|
-
validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
|
|
35059
|
+
validatorFns[NUMBER_LESS_THAN] = function (value, args, form) {
|
|
34048
35060
|
if (value === "") {
|
|
34049
35061
|
return true;
|
|
34050
35062
|
}
|
|
35063
|
+
|
|
34051
35064
|
return Number(value) < args[0];
|
|
34052
35065
|
};
|
|
34053
35066
|
|
|
34054
|
-
|
|
34055
|
-
|
|
34056
|
-
|
|
34057
|
-
|
|
34058
|
-
|
|
34059
|
-
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
34060
|
-
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
34061
|
-
);
|
|
34062
|
-
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
35067
|
+
var NUMBER_LESS_THAN_OR_EQUAL_TO = "validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
35068
|
+
var NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR = "error/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
35069
|
+
var numberLessThanOrEqualTo = createValidator(NUMBER_LESS_THAN_OR_EQUAL_TO, NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR);
|
|
35070
|
+
|
|
35071
|
+
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = function (value, args, form) {
|
|
34063
35072
|
if (value === "") {
|
|
34064
35073
|
return true;
|
|
34065
35074
|
}
|
|
35075
|
+
|
|
34066
35076
|
return Number(value) <= args[0];
|
|
34067
35077
|
};
|
|
34068
35078
|
|
|
34069
|
-
|
|
34070
|
-
|
|
34071
|
-
|
|
34072
|
-
|
|
34073
|
-
|
|
34074
|
-
);
|
|
34075
|
-
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
35079
|
+
var NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
|
|
35080
|
+
var NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
|
|
35081
|
+
var numberGreaterThan = createValidator(NUMBER_GREATER_THAN, NUMBER_GREATER_THAN_ERROR);
|
|
35082
|
+
|
|
35083
|
+
validatorFns[NUMBER_GREATER_THAN] = function (value, args, form) {
|
|
34076
35084
|
if (value === "") {
|
|
34077
35085
|
return true;
|
|
34078
35086
|
}
|
|
35087
|
+
|
|
34079
35088
|
return Number(value) > args[0];
|
|
34080
35089
|
};
|
|
34081
35090
|
|
|
34082
|
-
|
|
34083
|
-
|
|
34084
|
-
|
|
34085
|
-
|
|
34086
|
-
|
|
34087
|
-
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
34088
|
-
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
34089
|
-
);
|
|
34090
|
-
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
35091
|
+
var NUMBER_GREATER_THAN_OR_EQUAL_TO = "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
35092
|
+
var NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR = "error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
35093
|
+
var numberGreaterThanOrEqualTo = createValidator(NUMBER_GREATER_THAN_OR_EQUAL_TO, NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR);
|
|
35094
|
+
|
|
35095
|
+
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = function (value, args, form) {
|
|
34091
35096
|
if (value === "") {
|
|
34092
35097
|
return true;
|
|
34093
35098
|
}
|
|
35099
|
+
|
|
34094
35100
|
return Number(value) >= args[0];
|
|
34095
35101
|
};
|
|
34096
35102
|
|
|
34097
|
-
|
|
34098
|
-
|
|
34099
|
-
|
|
34100
|
-
|
|
34101
|
-
|
|
34102
|
-
|
|
35103
|
+
var MATCHES_FIELD = "validator/MATCHES_FIELD";
|
|
35104
|
+
var MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
|
|
35105
|
+
var matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
35106
|
+
|
|
35107
|
+
validatorFns[MATCHES_FIELD] = function (value, args, form) {
|
|
35108
|
+
var _dependentField$rawVa;
|
|
35109
|
+
|
|
35110
|
+
var dependentField = form[args[0]];
|
|
35111
|
+
var dependentFieldValue = (_dependentField$rawVa = dependentField == null ? void 0 : dependentField.rawValue) != null ? _dependentField$rawVa : "";
|
|
35112
|
+
|
|
34103
35113
|
if (dependentField === undefined) {
|
|
34104
|
-
throw new Error(
|
|
34105
|
-
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
34106
|
-
);
|
|
35114
|
+
throw new Error(args[0] + " was passed to matchesField, but that field does not exist in the form");
|
|
34107
35115
|
}
|
|
35116
|
+
|
|
34108
35117
|
return value === dependentFieldValue;
|
|
34109
35118
|
};
|
|
34110
35119
|
|
|
34111
|
-
|
|
34112
|
-
|
|
34113
|
-
|
|
34114
|
-
|
|
34115
|
-
|
|
34116
|
-
|
|
34117
|
-
|
|
34118
|
-
|
|
34119
|
-
|
|
34120
|
-
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34125
|
-
) => ({
|
|
34126
|
-
type: VALIDATE_WHEN,
|
|
34127
|
-
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
34128
|
-
error: dependentValidator.error
|
|
34129
|
-
});
|
|
35120
|
+
var validateWhenErrorMessage = function validateWhenErrorMessage(type) {
|
|
35121
|
+
return type + " was passed to validateWhen, but that validator type does not exist.\n Please check that you are only calling validator creator functions exported from\n redux-freeform in your form config and that you didn't forget to\n invoke the validator creator (you cannot pass the functions themselves to\n createFormState). Also make sure you aren't passing validateWhen() to validateWhen\n as the primary validator.";
|
|
35122
|
+
};
|
|
35123
|
+
var VALIDATE_WHEN = "validator/VALIDATE_WHEN";
|
|
35124
|
+
var VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
|
|
35125
|
+
|
|
35126
|
+
var validateWhen = function validateWhen(dependentValidator, primaryValidator, optionalFieldName) {
|
|
35127
|
+
return {
|
|
35128
|
+
type: VALIDATE_WHEN,
|
|
35129
|
+
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
35130
|
+
error: dependentValidator.error
|
|
35131
|
+
};
|
|
35132
|
+
};
|
|
35133
|
+
|
|
34130
35134
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
34131
|
-
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
34132
|
-
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
34133
|
-
const dependsOnOtherField = typeof optionalFieldName === "string";
|
|
34134
35135
|
|
|
34135
|
-
|
|
34136
|
-
|
|
34137
|
-
|
|
34138
|
-
|
|
35136
|
+
validatorFns[VALIDATE_WHEN] = function (value, args, form) {
|
|
35137
|
+
var dependentValidator = args[0],
|
|
35138
|
+
primaryValidator = args[1],
|
|
35139
|
+
optionalFieldName = args[2];
|
|
35140
|
+
var dependsOnOtherField = typeof optionalFieldName === "string";
|
|
35141
|
+
|
|
35142
|
+
if (primaryValidator.type === undefined || typeof validatorFns[primaryValidator.type] !== "function") {
|
|
34139
35143
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
34140
35144
|
}
|
|
35145
|
+
|
|
34141
35146
|
if (dependsOnOtherField && form[optionalFieldName] === undefined) {
|
|
34142
|
-
throw new Error(
|
|
34143
|
-
`${args[2]} was passed to matchesField, but that field does not exist in the form`
|
|
34144
|
-
);
|
|
35147
|
+
throw new Error(args[2] + " was passed to matchesField, but that field does not exist in the form");
|
|
34145
35148
|
}
|
|
34146
35149
|
|
|
34147
|
-
|
|
34148
|
-
|
|
34149
|
-
|
|
34150
|
-
);
|
|
34151
|
-
|
|
34152
|
-
|
|
34153
|
-
|
|
34154
|
-
|
|
34155
|
-
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
35150
|
+
var primaryPredicate = validatorToPredicate(validatorFns[primaryValidator.type], false);
|
|
35151
|
+
var primaryValue = dependsOnOtherField ? form[optionalFieldName].rawValue : value;
|
|
35152
|
+
var primaryPredicatePassed = primaryPredicate(primaryValue, primaryValidator.args, form);
|
|
35153
|
+
return primaryPredicatePassed ? validatorFns[dependentValidator.type](value, dependentValidator.args, form) : true;
|
|
35154
|
+
};
|
|
35155
|
+
|
|
35156
|
+
var validateSumErrorMessage = function validateSumErrorMessage(type) {
|
|
35157
|
+
return type + " was passed to validateSum, but that validator type does not exist.\n Please check that you are only calling validator creator functions exported from\n redux-freeform in your form config and that you didn't forget to\n invoke the validator creator (you cannot pass the functions themselves to\n createFormState).";
|
|
35158
|
+
};
|
|
35159
|
+
var VALIDATE_SUM = "validator/VALIDATE_SUM";
|
|
35160
|
+
var VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
|
|
35161
|
+
|
|
35162
|
+
var validateSum = function validateSum(validator, fieldNamesArray) {
|
|
35163
|
+
return {
|
|
35164
|
+
type: VALIDATE_SUM,
|
|
35165
|
+
args: [validator, fieldNamesArray],
|
|
35166
|
+
error: validator.error
|
|
35167
|
+
};
|
|
35168
|
+
};
|
|
34159
35169
|
|
|
34160
|
-
return primaryPredicatePassed
|
|
34161
|
-
? validatorFns[dependentValidator.type](
|
|
34162
|
-
value,
|
|
34163
|
-
dependentValidator.args,
|
|
34164
|
-
form
|
|
34165
|
-
)
|
|
34166
|
-
: true;
|
|
34167
|
-
};
|
|
34168
|
-
|
|
34169
|
-
const validateSumErrorMessage = type =>
|
|
34170
|
-
`${type} was passed to validateSum, but that validator type does not exist.
|
|
34171
|
-
Please check that you are only calling validator creator functions exported from
|
|
34172
|
-
redux-freeform in your form config and that you didn't forget to
|
|
34173
|
-
invoke the validator creator (you cannot pass the functions themselves to
|
|
34174
|
-
createFormState).`;
|
|
34175
|
-
const VALIDATE_SUM = "validator/VALIDATE_SUM";
|
|
34176
|
-
const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
|
|
34177
|
-
const validateSum = (validator, fieldNamesArray) => ({
|
|
34178
|
-
type: VALIDATE_SUM,
|
|
34179
|
-
args: [validator, fieldNamesArray],
|
|
34180
|
-
error: validator.error
|
|
34181
|
-
});
|
|
34182
35170
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
34183
|
-
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
34184
|
-
const [validator, fieldNamesArray] = args;
|
|
34185
35171
|
|
|
34186
|
-
|
|
34187
|
-
|
|
34188
|
-
|
|
34189
|
-
|
|
35172
|
+
validatorFns[VALIDATE_SUM] = function (value, args, form) {
|
|
35173
|
+
var validator = args[0],
|
|
35174
|
+
fieldNamesArray = args[1];
|
|
35175
|
+
|
|
35176
|
+
if (validator.type === undefined || typeof validatorFns[validator.type] !== "function") {
|
|
34190
35177
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
34191
35178
|
}
|
|
34192
35179
|
|
|
34193
|
-
for (
|
|
35180
|
+
for (var _iterator = _createForOfIteratorHelperLoose(fieldNamesArray), _step; !(_step = _iterator()).done;) {
|
|
35181
|
+
var fieldName = _step.value;
|
|
35182
|
+
|
|
34194
35183
|
if (form[fieldName] === undefined) {
|
|
34195
|
-
throw new Error(
|
|
34196
|
-
`${fieldName} was passed to matchesField, but that field does not exist in the form`
|
|
34197
|
-
);
|
|
35184
|
+
throw new Error(fieldName + " was passed to matchesField, but that field does not exist in the form");
|
|
34198
35185
|
}
|
|
34199
35186
|
}
|
|
34200
35187
|
|
|
34201
|
-
|
|
34202
|
-
|
|
34203
|
-
|
|
34204
|
-
);
|
|
34205
|
-
|
|
35188
|
+
var sum = fieldNamesArray.reduce(function (acc, curr) {
|
|
35189
|
+
return acc + Number(form[curr].rawValue);
|
|
35190
|
+
}, Number(value));
|
|
34206
35191
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
34207
35192
|
};
|
|
34208
35193
|
|
|
34209
|
-
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
35194
|
+
var HAS_LENGTH = "validator/HAS_LENGTH";
|
|
35195
|
+
var HAS_LENGTH_ERROR = "error/HAS_LENGTH";
|
|
35196
|
+
var hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
35197
|
+
|
|
35198
|
+
validatorFns[HAS_LENGTH] = function (value, args, form) {
|
|
34213
35199
|
if (value === "") {
|
|
34214
35200
|
return true;
|
|
34215
35201
|
}
|
|
34216
|
-
|
|
34217
|
-
|
|
35202
|
+
|
|
35203
|
+
var min = args[0];
|
|
35204
|
+
var max = args[1];
|
|
35205
|
+
|
|
34218
35206
|
if (max == undefined || min == undefined) {
|
|
34219
|
-
throw new Error(
|
|
34220
|
-
"Max and min need to be defined for hasLength, both or one of them is undefined"
|
|
34221
|
-
);
|
|
35207
|
+
throw new Error("Max and min need to be defined for hasLength, both or one of them is undefined");
|
|
34222
35208
|
}
|
|
35209
|
+
|
|
34223
35210
|
if (max < min) {
|
|
34224
|
-
throw new Error(
|
|
34225
|
-
"hasLength validator was passed a min greater than the max"
|
|
34226
|
-
);
|
|
35211
|
+
throw new Error("hasLength validator was passed a min greater than the max");
|
|
34227
35212
|
}
|
|
34228
|
-
|
|
35213
|
+
|
|
35214
|
+
var valueLength = value.length;
|
|
34229
35215
|
return max >= valueLength && valueLength >= min;
|
|
34230
35216
|
};
|
|
34231
35217
|
|
|
34232
|
-
|
|
34233
|
-
|
|
34234
|
-
|
|
34235
|
-
|
|
34236
|
-
|
|
34237
|
-
);
|
|
34238
|
-
validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
35218
|
+
var DATE_BEFORE_TODAY = "validator/DATE_BEFORE_TODAY";
|
|
35219
|
+
var DATE_BEFORE_TODAY_ERROR = "error/DATE_BEFORE_TODAY";
|
|
35220
|
+
var dateBeforeToday = createValidator(DATE_BEFORE_TODAY, DATE_BEFORE_TODAY_ERROR);
|
|
35221
|
+
|
|
35222
|
+
validatorFns[DATE_BEFORE_TODAY] = function (value, args, form) {
|
|
34239
35223
|
if (value === "") {
|
|
34240
35224
|
return true;
|
|
34241
35225
|
}
|
|
34242
|
-
|
|
34243
|
-
|
|
34244
|
-
|
|
35226
|
+
|
|
35227
|
+
var dateFormat = args[0];
|
|
35228
|
+
var unit = args[1];
|
|
35229
|
+
var inclusive = args[2] || false;
|
|
34245
35230
|
|
|
34246
35231
|
if (dateFormat == undefined || unit == undefined) {
|
|
34247
|
-
throw new Error(
|
|
34248
|
-
"Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
|
|
34249
|
-
);
|
|
35232
|
+
throw new Error("Date format and unit need to be defined for dateBeforeToday, one or both are undefined");
|
|
34250
35233
|
}
|
|
34251
|
-
|
|
34252
|
-
|
|
35234
|
+
|
|
35235
|
+
var now = dayjs();
|
|
35236
|
+
var dateValue = dayjs(value, dateFormat);
|
|
34253
35237
|
|
|
34254
35238
|
if (inclusive === true) {
|
|
34255
35239
|
return dateValue.isSameOrBefore(now, unit);
|
|
34256
35240
|
}
|
|
35241
|
+
|
|
34257
35242
|
return dateValue.isBefore(now, unit);
|
|
34258
35243
|
};
|
|
34259
35244
|
|
|
34260
|
-
|
|
34261
|
-
|
|
34262
|
-
|
|
34263
|
-
|
|
34264
|
-
|
|
34265
|
-
);
|
|
34266
|
-
validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
35245
|
+
var DATE_AFTER_TODAY = "validator/DATE_AFTER_TODAY";
|
|
35246
|
+
var DATE_AFTER_TODAY_ERROR = "error/DATE_AFTER_TODAY";
|
|
35247
|
+
var dateAfterToday = createValidator(DATE_AFTER_TODAY, DATE_AFTER_TODAY_ERROR);
|
|
35248
|
+
|
|
35249
|
+
validatorFns[DATE_AFTER_TODAY] = function (value, args, form) {
|
|
34267
35250
|
if (value === "") {
|
|
34268
35251
|
return true;
|
|
34269
35252
|
}
|
|
34270
|
-
|
|
34271
|
-
|
|
34272
|
-
|
|
35253
|
+
|
|
35254
|
+
var dateFormat = args[0];
|
|
35255
|
+
var unit = args[1];
|
|
35256
|
+
var inclusive = args[2] || false;
|
|
34273
35257
|
|
|
34274
35258
|
if (dateFormat == undefined || unit == undefined) {
|
|
34275
|
-
throw new Error(
|
|
34276
|
-
"Date format and unit need to be defined for dateAfterToday, one or both are undefined"
|
|
34277
|
-
);
|
|
35259
|
+
throw new Error("Date format and unit need to be defined for dateAfterToday, one or both are undefined");
|
|
34278
35260
|
}
|
|
34279
|
-
|
|
34280
|
-
|
|
35261
|
+
|
|
35262
|
+
var now = dayjs();
|
|
35263
|
+
var dateValue = dayjs(value, dateFormat);
|
|
34281
35264
|
|
|
34282
35265
|
if (inclusive === true) {
|
|
34283
35266
|
return dateValue.isSameOrAfter(now, unit);
|
|
34284
35267
|
}
|
|
35268
|
+
|
|
34285
35269
|
return dateValue.isAfter(now, unit);
|
|
34286
35270
|
};
|
|
34287
35271
|
|
|
34288
|
-
|
|
34289
|
-
|
|
34290
|
-
|
|
34291
|
-
|
|
34292
|
-
|
|
34293
|
-
);
|
|
34294
|
-
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
35272
|
+
var IS_VALID_MONTH = "validator/IS_VALID_MONTH";
|
|
35273
|
+
var IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
|
|
35274
|
+
var isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
|
|
35275
|
+
|
|
35276
|
+
validatorFns[IS_VALID_MONTH] = function (value, args, form) {
|
|
34295
35277
|
if (value === "") {
|
|
34296
35278
|
return true;
|
|
34297
|
-
}
|
|
34298
|
-
// Function takes one argument representing the character position
|
|
35279
|
+
} // Function takes one argument representing the character position
|
|
34299
35280
|
// In a date string to identify where the month is
|
|
34300
35281
|
// Eg "10/21/2021" - start position is 0
|
|
34301
35282
|
// Or "18/03/1990" - start position is 3
|
|
34302
35283
|
// Only works with two digit months (01, 02, 03, etc)
|
|
34303
|
-
|
|
34304
|
-
|
|
35284
|
+
|
|
35285
|
+
|
|
35286
|
+
var monthStartPosition = parseInt(args[0]);
|
|
35287
|
+
var monthEndPosition = monthStartPosition + 2;
|
|
35288
|
+
|
|
34305
35289
|
if (monthStartPosition === NaN) {
|
|
34306
35290
|
throw new Error("Month start position has to be a valid integer string");
|
|
34307
35291
|
}
|
|
34308
|
-
|
|
35292
|
+
|
|
35293
|
+
var month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
35294
|
+
|
|
34309
35295
|
if (month === NaN) {
|
|
34310
35296
|
return false;
|
|
34311
35297
|
}
|
|
35298
|
+
|
|
34312
35299
|
return month >= 1 && month <= 12;
|
|
34313
35300
|
};
|
|
34314
35301
|
|
|
34315
|
-
|
|
34316
|
-
|
|
34317
|
-
|
|
34318
|
-
|
|
35302
|
+
var MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
35303
|
+
var MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
35304
|
+
var matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
35305
|
+
|
|
35306
|
+
validatorFns[MATCHES_REGEX] = function (value, args, form) {
|
|
34319
35307
|
if (value === "") {
|
|
34320
35308
|
return true;
|
|
34321
35309
|
}
|
|
35310
|
+
|
|
34322
35311
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
34323
|
-
};
|
|
35312
|
+
}; // based on http://www.brainjar.com/js/validation/
|
|
34324
35313
|
|
|
34325
|
-
|
|
34326
|
-
|
|
34327
|
-
|
|
34328
|
-
|
|
34329
|
-
|
|
34330
|
-
|
|
34331
|
-
);
|
|
34332
|
-
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
35314
|
+
|
|
35315
|
+
var IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
|
|
35316
|
+
var IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
|
|
35317
|
+
var isRoutingNumber = createValidator(IS_ROUTING_NUMBER, IS_ROUTING_NUMBER_ERROR);
|
|
35318
|
+
|
|
35319
|
+
validatorFns[IS_ROUTING_NUMBER] = function (value, args, form) {
|
|
34333
35320
|
if (value === "") {
|
|
34334
35321
|
return true;
|
|
34335
35322
|
}
|
|
35323
|
+
|
|
34336
35324
|
if (value.length != 9) {
|
|
34337
35325
|
return false;
|
|
34338
35326
|
}
|
|
34339
|
-
|
|
34340
|
-
|
|
34341
|
-
|
|
34342
|
-
|
|
34343
|
-
|
|
34344
|
-
|
|
34345
|
-
|
|
34346
|
-
|
|
34347
|
-
|
|
34348
|
-
|
|
34349
|
-
|
|
34350
|
-
|
|
34351
|
-
|
|
35327
|
+
|
|
35328
|
+
var sum = value.split("").map(function (ch) {
|
|
35329
|
+
return parseInt(ch);
|
|
35330
|
+
}).reduce(function (acc, cur, idx) {
|
|
35331
|
+
switch (idx % 3) {
|
|
35332
|
+
case 0:
|
|
35333
|
+
return acc + 3 * cur;
|
|
35334
|
+
|
|
35335
|
+
case 1:
|
|
35336
|
+
return acc + 7 * cur;
|
|
35337
|
+
|
|
35338
|
+
case 2:
|
|
35339
|
+
return acc + 1 * cur;
|
|
35340
|
+
}
|
|
35341
|
+
}, 0);
|
|
34352
35342
|
return sum != 0 && sum % 10 == 0;
|
|
34353
35343
|
};
|
|
34354
35344
|
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
35345
|
+
var HAS_NUMBER = "validator/HAS_NUMBER";
|
|
35346
|
+
var HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
|
|
35347
|
+
var hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
35348
|
+
|
|
35349
|
+
validatorFns[HAS_NUMBER] = function (value, args, form) {
|
|
34359
35350
|
if (value === "") {
|
|
34360
35351
|
return true;
|
|
34361
35352
|
}
|
|
35353
|
+
|
|
34362
35354
|
return new RegExp(/[0-9]/).test(value);
|
|
34363
35355
|
};
|
|
34364
35356
|
|
|
34365
|
-
|
|
34366
|
-
|
|
34367
|
-
|
|
34368
|
-
|
|
34369
|
-
|
|
34370
|
-
);
|
|
34371
|
-
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
35357
|
+
var HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
|
|
35358
|
+
var HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
|
|
35359
|
+
var hasLowercaseLetter = createValidator(HAS_LOWERCASE_LETTER, HAS_LOWERCASE_LETTER_ERROR$1);
|
|
35360
|
+
|
|
35361
|
+
validatorFns[HAS_LOWERCASE_LETTER] = function (value, args, form) {
|
|
34372
35362
|
if (value === "") {
|
|
34373
35363
|
return true;
|
|
34374
35364
|
}
|
|
35365
|
+
|
|
34375
35366
|
return new RegExp(/[a-z]/).test(value);
|
|
34376
35367
|
};
|
|
34377
35368
|
|
|
34378
|
-
|
|
34379
|
-
|
|
34380
|
-
|
|
34381
|
-
|
|
34382
|
-
|
|
34383
|
-
);
|
|
34384
|
-
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
35369
|
+
var HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
|
|
35370
|
+
var HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
|
|
35371
|
+
var hasUppercaseLetter = createValidator(HAS_UPPERCASE_LETTER, HAS_UPPERCASE_LETTER_ERROR$1);
|
|
35372
|
+
|
|
35373
|
+
validatorFns[HAS_UPPERCASE_LETTER] = function (value, args, form) {
|
|
34385
35374
|
if (value === "") {
|
|
34386
35375
|
return true;
|
|
34387
35376
|
}
|
|
35377
|
+
|
|
34388
35378
|
return new RegExp(/[A-Z]/).test(value);
|
|
34389
35379
|
};
|
|
34390
35380
|
|
|
34391
|
-
|
|
34392
|
-
|
|
34393
|
-
|
|
34394
|
-
|
|
34395
|
-
|
|
34396
|
-
);
|
|
34397
|
-
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
35381
|
+
var HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
|
|
35382
|
+
var HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
|
|
35383
|
+
var hasSpecialCharacter = createValidator(HAS_SPECIAL_CHARACTER, HAS_SPECIAL_CHARACTER_ERROR$1);
|
|
35384
|
+
|
|
35385
|
+
validatorFns[HAS_SPECIAL_CHARACTER] = function (value, args, form) {
|
|
34398
35386
|
if (value === "") {
|
|
34399
35387
|
return true;
|
|
34400
35388
|
}
|
|
35389
|
+
|
|
34401
35390
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
34402
35391
|
};
|
|
34403
35392
|
|
|
34404
|
-
|
|
34405
|
-
|
|
34406
|
-
|
|
34407
|
-
|
|
34408
|
-
|
|
34409
|
-
);
|
|
34410
|
-
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
35393
|
+
var IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
|
|
35394
|
+
var IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
|
|
35395
|
+
var isProbablyEmail = createValidator(IS_PROBABLY_EMAIL, IS_PROBABLY_EMAIL_ERROR);
|
|
35396
|
+
|
|
35397
|
+
validatorFns[IS_PROBABLY_EMAIL] = function (value, args, form) {
|
|
34411
35398
|
if (value === "") {
|
|
34412
35399
|
return true;
|
|
34413
35400
|
}
|
|
35401
|
+
|
|
34414
35402
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
34415
35403
|
};
|
|
34416
35404
|
|
|
34417
|
-
|
|
34418
|
-
|
|
34419
|
-
|
|
34420
|
-
|
|
34421
|
-
|
|
34422
|
-
createFormState)`;
|
|
35405
|
+
var runValidatorErrorMessage = function runValidatorErrorMessage(type) {
|
|
35406
|
+
return type + " was passed to runValidator, but that validator type does not exist. \n Please check that you are only calling validator creator functions exported from \n redux-freeform in your form config and that you didn't forget to \n invoke the validator creator (you cannot pass the functions themselves to \n createFormState)";
|
|
35407
|
+
};
|
|
35408
|
+
var runValidator = function runValidator(validator, value, form) {
|
|
35409
|
+
var validatorFn = validatorFns[validator.type];
|
|
34423
35410
|
|
|
34424
|
-
const runValidator = (validator, value, form) => {
|
|
34425
|
-
const validatorFn = validatorFns[validator.type];
|
|
34426
35411
|
if (validatorFn === undefined) {
|
|
34427
35412
|
throw new Error(runValidatorErrorMessage(validator.type));
|
|
34428
35413
|
}
|
|
35414
|
+
|
|
34429
35415
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
34430
35416
|
};
|
|
34431
35417
|
|
|
34432
|
-
|
|
34433
|
-
return validators
|
|
34434
|
-
|
|
34435
|
-
|
|
35418
|
+
var _computeErrors = function _computeErrors(fieldName, form, validators) {
|
|
35419
|
+
return validators.map(function (v) {
|
|
35420
|
+
return runValidator(v, form[fieldName].rawValue, form);
|
|
35421
|
+
}).filter(function (x) {
|
|
35422
|
+
return x !== null;
|
|
35423
|
+
});
|
|
34436
35424
|
};
|
|
34437
35425
|
|
|
34438
|
-
|
|
34439
|
-
|
|
35426
|
+
var computeConstraints = function computeConstraints(fieldName, form) {
|
|
35427
|
+
var constraints = form[fieldName].constraints;
|
|
34440
35428
|
return _computeErrors(fieldName, form, constraints);
|
|
34441
35429
|
};
|
|
34442
|
-
|
|
34443
|
-
|
|
34444
|
-
const validators = form[fieldName].validators;
|
|
35430
|
+
var computeErrors = function computeErrors(fieldName, form) {
|
|
35431
|
+
var validators = form[fieldName].validators;
|
|
34445
35432
|
return _computeErrors(fieldName, form, validators);
|
|
34446
35433
|
};
|
|
34447
35434
|
|
|
@@ -34896,7 +35883,7 @@ var objectTraps = {
|
|
|
34896
35883
|
|
|
34897
35884
|
set: set$1$1,
|
|
34898
35885
|
deleteProperty: deleteProperty,
|
|
34899
|
-
getOwnPropertyDescriptor: getOwnPropertyDescriptor$
|
|
35886
|
+
getOwnPropertyDescriptor: getOwnPropertyDescriptor$3,
|
|
34900
35887
|
|
|
34901
35888
|
defineProperty: function defineProperty() {
|
|
34902
35889
|
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
@@ -35004,7 +35991,7 @@ function deleteProperty(state, prop) {
|
|
|
35004
35991
|
// the same guarantee in ES5 mode.
|
|
35005
35992
|
|
|
35006
35993
|
|
|
35007
|
-
function getOwnPropertyDescriptor$
|
|
35994
|
+
function getOwnPropertyDescriptor$3(state, prop) {
|
|
35008
35995
|
var owner = source$1(state);
|
|
35009
35996
|
var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
35010
35997
|
|
|
@@ -35579,127 +36566,179 @@ immer.createDraft.bind(immer);
|
|
|
35579
36566
|
|
|
35580
36567
|
immer.finishDraft.bind(immer);
|
|
35581
36568
|
|
|
35582
|
-
|
|
35583
|
-
|
|
35584
|
-
|
|
35585
|
-
|
|
36569
|
+
var createInitialState = function createInitialState(formConfig) {
|
|
36570
|
+
var initialForm = {};
|
|
36571
|
+
var formConfigKeys = Object.keys(formConfig);
|
|
36572
|
+
|
|
36573
|
+
for (var _i = 0, _formConfigKeys = formConfigKeys; _i < _formConfigKeys.length; _i++) {
|
|
36574
|
+
var formKey = _formConfigKeys[_i];
|
|
35586
36575
|
initialForm[formKey] = {
|
|
35587
36576
|
dirty: false,
|
|
35588
36577
|
rawValue: formConfig[formKey].defaultValue || "",
|
|
35589
36578
|
validators: formConfig[formKey].validators || [],
|
|
35590
36579
|
constraints: formConfig[formKey].constraints || []
|
|
35591
36580
|
};
|
|
35592
|
-
}
|
|
35593
|
-
// Because validators require the entire form we have to do a
|
|
36581
|
+
} // Because validators require the entire form we have to do a
|
|
35594
36582
|
// second pass to add errors once the initial form has been
|
|
35595
36583
|
// constructed
|
|
35596
|
-
|
|
35597
|
-
|
|
35598
|
-
|
|
35599
|
-
|
|
36584
|
+
|
|
36585
|
+
|
|
36586
|
+
for (var _i2 = 0, _formConfigKeys2 = formConfigKeys; _i2 < _formConfigKeys2.length; _i2++) {
|
|
36587
|
+
var _formKey = _formConfigKeys2[_i2];
|
|
36588
|
+
var errors = computeErrors(_formKey, initialForm);
|
|
36589
|
+
initialForm[_formKey].errors = errors;
|
|
36590
|
+
initialForm[_formKey].hasErrors = errors.length > 0;
|
|
35600
36591
|
}
|
|
36592
|
+
|
|
35601
36593
|
return initialForm;
|
|
35602
36594
|
};
|
|
36595
|
+
var SET = "field/SET";
|
|
35603
36596
|
|
|
35604
|
-
|
|
35605
|
-
|
|
35606
|
-
|
|
35607
|
-
|
|
35608
|
-
|
|
36597
|
+
var _set = function set(fieldName) {
|
|
36598
|
+
return function (value) {
|
|
36599
|
+
return {
|
|
36600
|
+
type: SET,
|
|
36601
|
+
payload: {
|
|
36602
|
+
fieldName: fieldName,
|
|
36603
|
+
value: value
|
|
36604
|
+
}
|
|
36605
|
+
};
|
|
36606
|
+
};
|
|
36607
|
+
};
|
|
36608
|
+
var CLEAR = "form/CLEAR";
|
|
36609
|
+
|
|
36610
|
+
var _clear = function clear() {
|
|
36611
|
+
return {
|
|
36612
|
+
type: CLEAR
|
|
36613
|
+
};
|
|
36614
|
+
};
|
|
36615
|
+
var ADD_VALIDATOR = "field/ADD_VALIDATOR";
|
|
35609
36616
|
|
|
35610
|
-
|
|
35611
|
-
|
|
36617
|
+
var _addValidator = function addValidator(fieldName) {
|
|
36618
|
+
return function (validator) {
|
|
36619
|
+
return {
|
|
36620
|
+
type: ADD_VALIDATOR,
|
|
36621
|
+
payload: {
|
|
36622
|
+
fieldName: fieldName,
|
|
36623
|
+
validator: validator
|
|
36624
|
+
}
|
|
36625
|
+
};
|
|
36626
|
+
};
|
|
36627
|
+
};
|
|
36628
|
+
var createFormReducer = function createFormReducer(formConfig) {
|
|
36629
|
+
return function (state, action) {
|
|
36630
|
+
if (state === void 0) {
|
|
36631
|
+
state = createInitialState(formConfig);
|
|
36632
|
+
}
|
|
35612
36633
|
|
|
35613
|
-
|
|
35614
|
-
|
|
35615
|
-
|
|
35616
|
-
|
|
35617
|
-
|
|
36634
|
+
switch (action.type) {
|
|
36635
|
+
case SET:
|
|
36636
|
+
var changedFieldName = action.payload.fieldName;
|
|
36637
|
+
var newRawValue = action.payload.value;
|
|
36638
|
+
return produce(state, function (draftState) {
|
|
36639
|
+
var originalValue = draftState[changedFieldName].rawValue;
|
|
36640
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
36641
|
+
|
|
36642
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
36643
|
+
// If the change violates constraints, revert the change
|
|
36644
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
36645
|
+
return draftState;
|
|
36646
|
+
}
|
|
35618
36647
|
|
|
35619
|
-
|
|
35620
|
-
|
|
35621
|
-
|
|
35622
|
-
|
|
35623
|
-
|
|
35624
|
-
|
|
35625
|
-
|
|
35626
|
-
|
|
35627
|
-
|
|
35628
|
-
|
|
35629
|
-
|
|
35630
|
-
|
|
35631
|
-
|
|
35632
|
-
// If the change violates constraints, revert the change
|
|
35633
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
35634
|
-
return draftState;
|
|
35635
|
-
}
|
|
36648
|
+
var fields = Object.entries(draftState);
|
|
36649
|
+
|
|
36650
|
+
for (var _i3 = 0, _fields = fields; _i3 < _fields.length; _i3++) {
|
|
36651
|
+
var entry = _fields[_i3];
|
|
36652
|
+
var fieldName = entry[0];
|
|
36653
|
+
var field = entry[1];
|
|
36654
|
+
var errors = computeErrors(fieldName, draftState);
|
|
36655
|
+
var dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
36656
|
+
draftState[fieldName].errors = errors;
|
|
36657
|
+
draftState[fieldName].dirty = dirty;
|
|
36658
|
+
draftState[fieldName].hasErrors = errors.length > 0;
|
|
36659
|
+
}
|
|
36660
|
+
});
|
|
35636
36661
|
|
|
35637
|
-
|
|
35638
|
-
|
|
35639
|
-
|
|
35640
|
-
|
|
35641
|
-
|
|
35642
|
-
|
|
35643
|
-
|
|
35644
|
-
draftState[
|
|
35645
|
-
|
|
35646
|
-
|
|
35647
|
-
|
|
35648
|
-
|
|
35649
|
-
|
|
35650
|
-
|
|
35651
|
-
|
|
35652
|
-
|
|
35653
|
-
|
|
35654
|
-
|
|
35655
|
-
|
|
35656
|
-
|
|
35657
|
-
|
|
35658
|
-
let fieldName = entry[0];
|
|
35659
|
-
let field = entry[1];
|
|
35660
|
-
let errors = computeErrors(fieldName, draftState);
|
|
35661
|
-
let dirty = field.dirty;
|
|
35662
|
-
draftState[fieldName].errors = errors;
|
|
35663
|
-
draftState[fieldName].dirty = dirty;
|
|
35664
|
-
draftState[fieldName].hasErrors = errors.length > 0;
|
|
35665
|
-
}
|
|
35666
|
-
});
|
|
35667
|
-
default:
|
|
35668
|
-
return state;
|
|
35669
|
-
}
|
|
35670
|
-
};
|
|
36662
|
+
case CLEAR:
|
|
36663
|
+
return createInitialState(formConfig);
|
|
36664
|
+
|
|
36665
|
+
case ADD_VALIDATOR:
|
|
36666
|
+
var fieldWithOverride = action.payload.fieldName;
|
|
36667
|
+
var newValidator = action.payload.validator;
|
|
36668
|
+
return produce(state, function (draftState) {
|
|
36669
|
+
draftState[fieldWithOverride].validators.push(newValidator);
|
|
36670
|
+
var fields = Object.entries(draftState);
|
|
36671
|
+
|
|
36672
|
+
for (var _i4 = 0, _fields2 = fields; _i4 < _fields2.length; _i4++) {
|
|
36673
|
+
var entry = _fields2[_i4];
|
|
36674
|
+
var fieldName = entry[0];
|
|
36675
|
+
var field = entry[1];
|
|
36676
|
+
var errors = computeErrors(fieldName, draftState);
|
|
36677
|
+
var dirty = field.dirty;
|
|
36678
|
+
draftState[fieldName].errors = errors;
|
|
36679
|
+
draftState[fieldName].dirty = dirty;
|
|
36680
|
+
draftState[fieldName].hasErrors = errors.length > 0;
|
|
36681
|
+
}
|
|
36682
|
+
});
|
|
35671
36683
|
|
|
35672
|
-
|
|
36684
|
+
default:
|
|
36685
|
+
return state;
|
|
36686
|
+
}
|
|
36687
|
+
};
|
|
36688
|
+
};
|
|
36689
|
+
var createMapDispatchToProps = function createMapDispatchToProps(formConfig) {
|
|
35673
36690
|
// Do memo-ization
|
|
35674
|
-
|
|
35675
|
-
|
|
35676
|
-
return dispatch
|
|
36691
|
+
var cachedDispatch;
|
|
36692
|
+
var cacheValue;
|
|
36693
|
+
return function (dispatch) {
|
|
35677
36694
|
if (dispatch == cachedDispatch) {
|
|
35678
36695
|
return cacheValue;
|
|
35679
36696
|
}
|
|
35680
|
-
|
|
36697
|
+
|
|
36698
|
+
var dispatchObj = {};
|
|
35681
36699
|
dispatchObj.fields = {};
|
|
35682
|
-
|
|
35683
|
-
|
|
36700
|
+
var keys = Object.keys(formConfig);
|
|
36701
|
+
|
|
36702
|
+
var _loop = function _loop() {
|
|
36703
|
+
var fieldName = _keys[_i5];
|
|
35684
36704
|
dispatchObj.fields[fieldName] = {
|
|
35685
|
-
set:
|
|
35686
|
-
|
|
36705
|
+
set: function set(value) {
|
|
36706
|
+
return dispatch(_set(fieldName)(value));
|
|
36707
|
+
},
|
|
36708
|
+
addValidator: function addValidator(validator) {
|
|
36709
|
+
return dispatch(_addValidator(fieldName)(validator));
|
|
36710
|
+
}
|
|
35687
36711
|
};
|
|
36712
|
+
};
|
|
36713
|
+
|
|
36714
|
+
for (var _i5 = 0, _keys = keys; _i5 < _keys.length; _i5++) {
|
|
36715
|
+
_loop();
|
|
35688
36716
|
}
|
|
35689
|
-
|
|
36717
|
+
|
|
36718
|
+
dispatchObj.form = {
|
|
36719
|
+
clear: function clear() {
|
|
36720
|
+
return dispatch(_clear());
|
|
36721
|
+
}
|
|
36722
|
+
};
|
|
35690
36723
|
cachedDispatch = dispatch;
|
|
35691
|
-
cacheValue = {
|
|
36724
|
+
cacheValue = {
|
|
36725
|
+
actions: dispatchObj
|
|
36726
|
+
};
|
|
35692
36727
|
return cacheValue;
|
|
35693
36728
|
};
|
|
35694
36729
|
};
|
|
35695
|
-
|
|
35696
|
-
|
|
35697
|
-
|
|
35698
|
-
|
|
35699
|
-
|
|
35700
|
-
|
|
35701
|
-
|
|
35702
|
-
|
|
36730
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
36731
|
+
return {
|
|
36732
|
+
fields: state
|
|
36733
|
+
};
|
|
36734
|
+
};
|
|
36735
|
+
var createFormState = function createFormState(formConfig) {
|
|
36736
|
+
return {
|
|
36737
|
+
reducer: createFormReducer(formConfig),
|
|
36738
|
+
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
36739
|
+
mapStateToProps: mapStateToProps
|
|
36740
|
+
};
|
|
36741
|
+
};
|
|
35703
36742
|
|
|
35704
36743
|
const formatDelimiter = "_";
|
|
35705
36744
|
const phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
@@ -35985,18 +37024,9 @@ ChangePasswordForm.reducer = reducer$1;
|
|
|
35985
37024
|
ChangePasswordForm.mapStateToProps = mapStateToProps$2;
|
|
35986
37025
|
ChangePasswordForm.mapDispatchToProps = mapDispatchToProps$1;
|
|
35987
37026
|
|
|
35988
|
-
var MATCH = wellKnownSymbol('match');
|
|
35989
|
-
|
|
35990
|
-
// `IsRegExp` abstract operation
|
|
35991
|
-
// https://tc39.es/ecma262/#sec-isregexp
|
|
35992
|
-
var isRegexp = function (it) {
|
|
35993
|
-
var isRegExp;
|
|
35994
|
-
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
35995
|
-
};
|
|
35996
|
-
|
|
35997
37027
|
var REPLACE$1 = wellKnownSymbol('replace');
|
|
35998
|
-
var RegExpPrototype$
|
|
35999
|
-
var max$
|
|
37028
|
+
var RegExpPrototype$3 = RegExp.prototype;
|
|
37029
|
+
var max$3 = Math.max;
|
|
36000
37030
|
|
|
36001
37031
|
var stringIndexOf = function (string, searchValue, fromIndex) {
|
|
36002
37032
|
if (fromIndex > string.length) return -1;
|
|
@@ -36016,7 +37046,7 @@ _export({ target: 'String', proto: true }, {
|
|
|
36016
37046
|
if (searchValue != null) {
|
|
36017
37047
|
IS_REG_EXP = isRegexp(searchValue);
|
|
36018
37048
|
if (IS_REG_EXP) {
|
|
36019
|
-
flags = toString_1(requireObjectCoercible('flags' in RegExpPrototype$
|
|
37049
|
+
flags = toString_1(requireObjectCoercible('flags' in RegExpPrototype$3
|
|
36020
37050
|
? searchValue.flags
|
|
36021
37051
|
: regexpFlags.call(searchValue)
|
|
36022
37052
|
));
|
|
@@ -36032,7 +37062,7 @@ _export({ target: 'String', proto: true }, {
|
|
|
36032
37062
|
functionalReplace = isCallable(replaceValue);
|
|
36033
37063
|
if (!functionalReplace) replaceValue = toString_1(replaceValue);
|
|
36034
37064
|
searchLength = searchString.length;
|
|
36035
|
-
advanceBy = max$
|
|
37065
|
+
advanceBy = max$3(1, searchLength);
|
|
36036
37066
|
position = stringIndexOf(string, searchString, 0);
|
|
36037
37067
|
while (position !== -1) {
|
|
36038
37068
|
if (functionalReplace) {
|
|
@@ -42229,7 +43259,7 @@ var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "
|
|
|
42229
43259
|
|
|
42230
43260
|
|
|
42231
43261
|
|
|
42232
|
-
var index$
|
|
43262
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
42233
43263
|
__proto__: null,
|
|
42234
43264
|
colors: colors,
|
|
42235
43265
|
fontWeights: style_constants
|
|
@@ -42237,7 +43267,7 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
42237
43267
|
|
|
42238
43268
|
|
|
42239
43269
|
|
|
42240
|
-
var index$
|
|
43270
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
42241
43271
|
__proto__: null,
|
|
42242
43272
|
formats: formats,
|
|
42243
43273
|
general: general,
|
|
@@ -42401,8 +43431,8 @@ exports.WarningIconXS = WarningIconXS;
|
|
|
42401
43431
|
exports.WelcomeModule = WelcomeModule$1;
|
|
42402
43432
|
exports.WorkflowTile = WorkflowTile;
|
|
42403
43433
|
exports.cardRegistry = cardRegistry;
|
|
42404
|
-
exports.constants = index$
|
|
43434
|
+
exports.constants = index$5;
|
|
42405
43435
|
exports.createPartialAmountFormState = createPartialAmountFormState;
|
|
42406
|
-
exports.util = index$
|
|
43436
|
+
exports.util = index$6;
|
|
42407
43437
|
exports.withWindowSize = withWindowSize;
|
|
42408
43438
|
//# sourceMappingURL=index.cjs.js.map
|