@krainovsd/js-helpers 0.2.2

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.
Files changed (77) hide show
  1. package/README.md +23 -0
  2. package/lib/cjs/index.cjs +2914 -0
  3. package/lib/cjs/index.cjs.map +1 -0
  4. package/lib/esm/index.js +2909 -0
  5. package/lib/esm/index.js.map +1 -0
  6. package/package.json +79 -0
  7. package/tmp/constants/api.d.ts +4 -0
  8. package/tmp/constants/colors.d.ts +6 -0
  9. package/tmp/constants/date.d.ts +8 -0
  10. package/tmp/constants/environment.d.ts +6 -0
  11. package/tmp/constants/fields.d.ts +8 -0
  12. package/tmp/constants/index.d.ts +5 -0
  13. package/tmp/index.d.ts +4 -0
  14. package/tmp/lib/api/core.d.ts +19 -0
  15. package/tmp/lib/api/index.d.ts +1 -0
  16. package/tmp/lib/api/middlewares/auth-middleware.d.ts +2 -0
  17. package/tmp/lib/api/middlewares/console-middleware.d.ts +2 -0
  18. package/tmp/lib/api/middlewares/index.d.ts +2 -0
  19. package/tmp/lib/api/token-request.d.ts +2 -0
  20. package/tmp/lib/browser/download-file.d.ts +7 -0
  21. package/tmp/lib/browser/download-json.d.ts +1 -0
  22. package/tmp/lib/browser/index.d.ts +3 -0
  23. package/tmp/lib/browser/read-file.d.ts +1 -0
  24. package/tmp/lib/colors/get-color-format.d.ts +1 -0
  25. package/tmp/lib/colors/index.d.ts +6 -0
  26. package/tmp/lib/colors/take-opacity-colors.d.ts +1 -0
  27. package/tmp/lib/colors/transform-hex-to-rgb.d.ts +1 -0
  28. package/tmp/lib/colors/transform-rgb-to-rgba.d.ts +1 -0
  29. package/tmp/lib/colors/transform-rgba-to-rgb.d.ts +1 -0
  30. package/tmp/lib/colors/transform-to-color.d.ts +2 -0
  31. package/tmp/lib/date/date-difference.d.ts +2 -0
  32. package/tmp/lib/date/date-format.d.ts +1 -0
  33. package/tmp/lib/date/get-date-by-rules.d.ts +2 -0
  34. package/tmp/lib/date/get-today.d.ts +4 -0
  35. package/tmp/lib/date/get-tomorrow.d.ts +1 -0
  36. package/tmp/lib/date/get-yesterday.d.ts +1 -0
  37. package/tmp/lib/date/index.d.ts +9 -0
  38. package/tmp/lib/date/is-today.d.ts +2 -0
  39. package/tmp/lib/date/is-tomorrow.d.ts +2 -0
  40. package/tmp/lib/date/is-yesterday.d.ts +2 -0
  41. package/tmp/lib/index.d.ts +5 -0
  42. package/tmp/lib/typings/check-type.d.ts +1 -0
  43. package/tmp/lib/typings/index.d.ts +11 -0
  44. package/tmp/lib/typings/is-array.d.ts +1 -0
  45. package/tmp/lib/typings/is-boolean.d.ts +1 -0
  46. package/tmp/lib/typings/is-date.d.ts +1 -0
  47. package/tmp/lib/typings/is-id.d.ts +1 -0
  48. package/tmp/lib/typings/is-null.d.ts +1 -0
  49. package/tmp/lib/typings/is-nullable.d.ts +1 -0
  50. package/tmp/lib/typings/is-number.d.ts +1 -0
  51. package/tmp/lib/typings/is-object.d.ts +1 -0
  52. package/tmp/lib/typings/is-string.d.ts +1 -0
  53. package/tmp/lib/typings/is-undefined.d.ts +1 -0
  54. package/tmp/lib/utils/array-to-map-by-key.d.ts +1 -0
  55. package/tmp/lib/utils/build-query-string.d.ts +2 -0
  56. package/tmp/lib/utils/create-url-with-params.d.ts +7 -0
  57. package/tmp/lib/utils/field-view-format.d.ts +2 -0
  58. package/tmp/lib/utils/get-by-path.d.ts +1 -0
  59. package/tmp/lib/utils/get-file-name-from-header.d.ts +1 -0
  60. package/tmp/lib/utils/index.d.ts +16 -0
  61. package/tmp/lib/utils/json-parse.d.ts +1 -0
  62. package/tmp/lib/utils/limit-stream-of-requests.d.ts +14 -0
  63. package/tmp/lib/utils/random-number.d.ts +1 -0
  64. package/tmp/lib/utils/random-string.d.ts +1 -0
  65. package/tmp/lib/utils/set-by-path.d.ts +1 -0
  66. package/tmp/lib/utils/sync-object-values.d.ts +1 -0
  67. package/tmp/lib/utils/transform-to-number.d.ts +1 -0
  68. package/tmp/lib/utils/trim-url.d.ts +1 -0
  69. package/tmp/lib/utils/wait-until.d.ts +1 -0
  70. package/tmp/lib/utils/wait.d.ts +1 -0
  71. package/tmp/libs.d.ts +2 -0
  72. package/tmp/types/api.d.ts +33 -0
  73. package/tmp/types/colors.d.ts +3 -0
  74. package/tmp/types/common.d.ts +2 -0
  75. package/tmp/types/date.d.ts +7 -0
  76. package/tmp/types/fields.d.ts +3 -0
  77. package/tmp/types/index.d.ts +5 -0
@@ -0,0 +1,2909 @@
1
+ const DATE_TYPES = {
2
+ Days: "days",
3
+ Months: "months",
4
+ Years: "years",
5
+ Seconds: "seconds",
6
+ Minutes: "minutes",
7
+ Hours: "hours",
8
+ };
9
+
10
+ const API_MIDDLEWARES = {
11
+ Auth: "auth",
12
+ Logger: "logger",
13
+ };
14
+
15
+ /* eslint-disable no-restricted-globals */
16
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
17
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
18
+ const IS_JEST = typeof process != "undefined" && process.env.JEST_WORKER_ID !== undefined;
19
+ const IS_BUN = typeof process !== "undefined" && process.versions != null && process.versions.bun != null;
20
+ const IS_DENO = // @ts-expect-error
21
+ typeof Deno !== "undefined" &&
22
+ // @ts-expect-error
23
+ typeof Deno.version !== "undefined" &&
24
+ // @ts-expect-error
25
+ typeof Deno.version.deno !== "undefined";
26
+ const IS_NODE = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
27
+ const IS_WEB_WORKER = typeof self === "object" &&
28
+ self.constructor &&
29
+ self.constructor.name === "DedicatedWorkerGlobalScope";
30
+ const IS_BROWSER = typeof window !== "undefined" && typeof window.document !== "undefined";
31
+
32
+ const COLOR_FORMATS = {
33
+ Hex: "HEX",
34
+ Rgb: "RGB",
35
+ Rgba: "RGBA",
36
+ Hsl: "HSL",
37
+ };
38
+
39
+ const FIELD_TYPES = {
40
+ Date: "date",
41
+ Time: "time",
42
+ DateTime: "dateTime",
43
+ String: "string",
44
+ Number: "number",
45
+ Array: "array",
46
+ };
47
+
48
+ const index$6 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
49
+ __proto__: null,
50
+ API_MIDDLEWARES,
51
+ COLOR_FORMATS,
52
+ DATE_TYPES,
53
+ FIELD_TYPES,
54
+ IS_BROWSER,
55
+ IS_BUN,
56
+ IS_DENO,
57
+ IS_JEST,
58
+ IS_NODE,
59
+ IS_WEB_WORKER
60
+ }, Symbol.toStringTag, { value: 'Module' }));
61
+
62
+ const waitUntil = (condition, checkInterval = 100) => {
63
+ return new Promise((resolve) => {
64
+ const interval = setInterval(() => {
65
+ if (condition())
66
+ return;
67
+ clearInterval(interval);
68
+ resolve(true);
69
+ }, checkInterval);
70
+ });
71
+ };
72
+
73
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
74
+
75
+ function getDefaultExportFromCjs (x) {
76
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
77
+ }
78
+
79
+ /**
80
+ * Checks if `value` is classified as an `Array` object.
81
+ *
82
+ * @static
83
+ * @memberOf _
84
+ * @since 0.1.0
85
+ * @category Lang
86
+ * @param {*} value The value to check.
87
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
88
+ * @example
89
+ *
90
+ * _.isArray([1, 2, 3]);
91
+ * // => true
92
+ *
93
+ * _.isArray(document.body.children);
94
+ * // => false
95
+ *
96
+ * _.isArray('abc');
97
+ * // => false
98
+ *
99
+ * _.isArray(_.noop);
100
+ * // => false
101
+ */
102
+
103
+ var isArray_1;
104
+ var hasRequiredIsArray;
105
+
106
+ function requireIsArray () {
107
+ if (hasRequiredIsArray) return isArray_1;
108
+ hasRequiredIsArray = 1;
109
+ var isArray = Array.isArray;
110
+
111
+ isArray_1 = isArray;
112
+ return isArray_1;
113
+ }
114
+
115
+ /** Detect free variable `global` from Node.js. */
116
+
117
+ var _freeGlobal;
118
+ var hasRequired_freeGlobal;
119
+
120
+ function require_freeGlobal () {
121
+ if (hasRequired_freeGlobal) return _freeGlobal;
122
+ hasRequired_freeGlobal = 1;
123
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
124
+
125
+ _freeGlobal = freeGlobal;
126
+ return _freeGlobal;
127
+ }
128
+
129
+ var _root;
130
+ var hasRequired_root;
131
+
132
+ function require_root () {
133
+ if (hasRequired_root) return _root;
134
+ hasRequired_root = 1;
135
+ var freeGlobal = require_freeGlobal();
136
+
137
+ /** Detect free variable `self`. */
138
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
139
+
140
+ /** Used as a reference to the global object. */
141
+ var root = freeGlobal || freeSelf || Function('return this')();
142
+
143
+ _root = root;
144
+ return _root;
145
+ }
146
+
147
+ var _Symbol;
148
+ var hasRequired_Symbol;
149
+
150
+ function require_Symbol () {
151
+ if (hasRequired_Symbol) return _Symbol;
152
+ hasRequired_Symbol = 1;
153
+ var root = require_root();
154
+
155
+ /** Built-in value references. */
156
+ var Symbol = root.Symbol;
157
+
158
+ _Symbol = Symbol;
159
+ return _Symbol;
160
+ }
161
+
162
+ var _getRawTag;
163
+ var hasRequired_getRawTag;
164
+
165
+ function require_getRawTag () {
166
+ if (hasRequired_getRawTag) return _getRawTag;
167
+ hasRequired_getRawTag = 1;
168
+ var Symbol = require_Symbol();
169
+
170
+ /** Used for built-in method references. */
171
+ var objectProto = Object.prototype;
172
+
173
+ /** Used to check objects for own properties. */
174
+ var hasOwnProperty = objectProto.hasOwnProperty;
175
+
176
+ /**
177
+ * Used to resolve the
178
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
179
+ * of values.
180
+ */
181
+ var nativeObjectToString = objectProto.toString;
182
+
183
+ /** Built-in value references. */
184
+ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
185
+
186
+ /**
187
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
188
+ *
189
+ * @private
190
+ * @param {*} value The value to query.
191
+ * @returns {string} Returns the raw `toStringTag`.
192
+ */
193
+ function getRawTag(value) {
194
+ var isOwn = hasOwnProperty.call(value, symToStringTag),
195
+ tag = value[symToStringTag];
196
+
197
+ try {
198
+ value[symToStringTag] = undefined;
199
+ var unmasked = true;
200
+ } catch (e) {}
201
+
202
+ var result = nativeObjectToString.call(value);
203
+ if (unmasked) {
204
+ if (isOwn) {
205
+ value[symToStringTag] = tag;
206
+ } else {
207
+ delete value[symToStringTag];
208
+ }
209
+ }
210
+ return result;
211
+ }
212
+
213
+ _getRawTag = getRawTag;
214
+ return _getRawTag;
215
+ }
216
+
217
+ /** Used for built-in method references. */
218
+
219
+ var _objectToString;
220
+ var hasRequired_objectToString;
221
+
222
+ function require_objectToString () {
223
+ if (hasRequired_objectToString) return _objectToString;
224
+ hasRequired_objectToString = 1;
225
+ var objectProto = Object.prototype;
226
+
227
+ /**
228
+ * Used to resolve the
229
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
230
+ * of values.
231
+ */
232
+ var nativeObjectToString = objectProto.toString;
233
+
234
+ /**
235
+ * Converts `value` to a string using `Object.prototype.toString`.
236
+ *
237
+ * @private
238
+ * @param {*} value The value to convert.
239
+ * @returns {string} Returns the converted string.
240
+ */
241
+ function objectToString(value) {
242
+ return nativeObjectToString.call(value);
243
+ }
244
+
245
+ _objectToString = objectToString;
246
+ return _objectToString;
247
+ }
248
+
249
+ var _baseGetTag;
250
+ var hasRequired_baseGetTag;
251
+
252
+ function require_baseGetTag () {
253
+ if (hasRequired_baseGetTag) return _baseGetTag;
254
+ hasRequired_baseGetTag = 1;
255
+ var Symbol = require_Symbol(),
256
+ getRawTag = require_getRawTag(),
257
+ objectToString = require_objectToString();
258
+
259
+ /** `Object#toString` result references. */
260
+ var nullTag = '[object Null]',
261
+ undefinedTag = '[object Undefined]';
262
+
263
+ /** Built-in value references. */
264
+ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
265
+
266
+ /**
267
+ * The base implementation of `getTag` without fallbacks for buggy environments.
268
+ *
269
+ * @private
270
+ * @param {*} value The value to query.
271
+ * @returns {string} Returns the `toStringTag`.
272
+ */
273
+ function baseGetTag(value) {
274
+ if (value == null) {
275
+ return value === undefined ? undefinedTag : nullTag;
276
+ }
277
+ return (symToStringTag && symToStringTag in Object(value))
278
+ ? getRawTag(value)
279
+ : objectToString(value);
280
+ }
281
+
282
+ _baseGetTag = baseGetTag;
283
+ return _baseGetTag;
284
+ }
285
+
286
+ /**
287
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
288
+ * and has a `typeof` result of "object".
289
+ *
290
+ * @static
291
+ * @memberOf _
292
+ * @since 4.0.0
293
+ * @category Lang
294
+ * @param {*} value The value to check.
295
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
296
+ * @example
297
+ *
298
+ * _.isObjectLike({});
299
+ * // => true
300
+ *
301
+ * _.isObjectLike([1, 2, 3]);
302
+ * // => true
303
+ *
304
+ * _.isObjectLike(_.noop);
305
+ * // => false
306
+ *
307
+ * _.isObjectLike(null);
308
+ * // => false
309
+ */
310
+
311
+ var isObjectLike_1;
312
+ var hasRequiredIsObjectLike;
313
+
314
+ function requireIsObjectLike () {
315
+ if (hasRequiredIsObjectLike) return isObjectLike_1;
316
+ hasRequiredIsObjectLike = 1;
317
+ function isObjectLike(value) {
318
+ return value != null && typeof value == 'object';
319
+ }
320
+
321
+ isObjectLike_1 = isObjectLike;
322
+ return isObjectLike_1;
323
+ }
324
+
325
+ var isSymbol_1;
326
+ var hasRequiredIsSymbol;
327
+
328
+ function requireIsSymbol () {
329
+ if (hasRequiredIsSymbol) return isSymbol_1;
330
+ hasRequiredIsSymbol = 1;
331
+ var baseGetTag = require_baseGetTag(),
332
+ isObjectLike = requireIsObjectLike();
333
+
334
+ /** `Object#toString` result references. */
335
+ var symbolTag = '[object Symbol]';
336
+
337
+ /**
338
+ * Checks if `value` is classified as a `Symbol` primitive or object.
339
+ *
340
+ * @static
341
+ * @memberOf _
342
+ * @since 4.0.0
343
+ * @category Lang
344
+ * @param {*} value The value to check.
345
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
346
+ * @example
347
+ *
348
+ * _.isSymbol(Symbol.iterator);
349
+ * // => true
350
+ *
351
+ * _.isSymbol('abc');
352
+ * // => false
353
+ */
354
+ function isSymbol(value) {
355
+ return typeof value == 'symbol' ||
356
+ (isObjectLike(value) && baseGetTag(value) == symbolTag);
357
+ }
358
+
359
+ isSymbol_1 = isSymbol;
360
+ return isSymbol_1;
361
+ }
362
+
363
+ var _isKey;
364
+ var hasRequired_isKey;
365
+
366
+ function require_isKey () {
367
+ if (hasRequired_isKey) return _isKey;
368
+ hasRequired_isKey = 1;
369
+ var isArray = requireIsArray(),
370
+ isSymbol = requireIsSymbol();
371
+
372
+ /** Used to match property names within property paths. */
373
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
374
+ reIsPlainProp = /^\w*$/;
375
+
376
+ /**
377
+ * Checks if `value` is a property name and not a property path.
378
+ *
379
+ * @private
380
+ * @param {*} value The value to check.
381
+ * @param {Object} [object] The object to query keys on.
382
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
383
+ */
384
+ function isKey(value, object) {
385
+ if (isArray(value)) {
386
+ return false;
387
+ }
388
+ var type = typeof value;
389
+ if (type == 'number' || type == 'symbol' || type == 'boolean' ||
390
+ value == null || isSymbol(value)) {
391
+ return true;
392
+ }
393
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
394
+ (object != null && value in Object(object));
395
+ }
396
+
397
+ _isKey = isKey;
398
+ return _isKey;
399
+ }
400
+
401
+ /**
402
+ * Checks if `value` is the
403
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
404
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
405
+ *
406
+ * @static
407
+ * @memberOf _
408
+ * @since 0.1.0
409
+ * @category Lang
410
+ * @param {*} value The value to check.
411
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
412
+ * @example
413
+ *
414
+ * _.isObject({});
415
+ * // => true
416
+ *
417
+ * _.isObject([1, 2, 3]);
418
+ * // => true
419
+ *
420
+ * _.isObject(_.noop);
421
+ * // => true
422
+ *
423
+ * _.isObject(null);
424
+ * // => false
425
+ */
426
+
427
+ var isObject_1;
428
+ var hasRequiredIsObject;
429
+
430
+ function requireIsObject () {
431
+ if (hasRequiredIsObject) return isObject_1;
432
+ hasRequiredIsObject = 1;
433
+ function isObject(value) {
434
+ var type = typeof value;
435
+ return value != null && (type == 'object' || type == 'function');
436
+ }
437
+
438
+ isObject_1 = isObject;
439
+ return isObject_1;
440
+ }
441
+
442
+ var isFunction_1;
443
+ var hasRequiredIsFunction;
444
+
445
+ function requireIsFunction () {
446
+ if (hasRequiredIsFunction) return isFunction_1;
447
+ hasRequiredIsFunction = 1;
448
+ var baseGetTag = require_baseGetTag(),
449
+ isObject = requireIsObject();
450
+
451
+ /** `Object#toString` result references. */
452
+ var asyncTag = '[object AsyncFunction]',
453
+ funcTag = '[object Function]',
454
+ genTag = '[object GeneratorFunction]',
455
+ proxyTag = '[object Proxy]';
456
+
457
+ /**
458
+ * Checks if `value` is classified as a `Function` object.
459
+ *
460
+ * @static
461
+ * @memberOf _
462
+ * @since 0.1.0
463
+ * @category Lang
464
+ * @param {*} value The value to check.
465
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
466
+ * @example
467
+ *
468
+ * _.isFunction(_);
469
+ * // => true
470
+ *
471
+ * _.isFunction(/abc/);
472
+ * // => false
473
+ */
474
+ function isFunction(value) {
475
+ if (!isObject(value)) {
476
+ return false;
477
+ }
478
+ // The use of `Object#toString` avoids issues with the `typeof` operator
479
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
480
+ var tag = baseGetTag(value);
481
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
482
+ }
483
+
484
+ isFunction_1 = isFunction;
485
+ return isFunction_1;
486
+ }
487
+
488
+ var _coreJsData;
489
+ var hasRequired_coreJsData;
490
+
491
+ function require_coreJsData () {
492
+ if (hasRequired_coreJsData) return _coreJsData;
493
+ hasRequired_coreJsData = 1;
494
+ var root = require_root();
495
+
496
+ /** Used to detect overreaching core-js shims. */
497
+ var coreJsData = root['__core-js_shared__'];
498
+
499
+ _coreJsData = coreJsData;
500
+ return _coreJsData;
501
+ }
502
+
503
+ var _isMasked;
504
+ var hasRequired_isMasked;
505
+
506
+ function require_isMasked () {
507
+ if (hasRequired_isMasked) return _isMasked;
508
+ hasRequired_isMasked = 1;
509
+ var coreJsData = require_coreJsData();
510
+
511
+ /** Used to detect methods masquerading as native. */
512
+ var maskSrcKey = (function() {
513
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
514
+ return uid ? ('Symbol(src)_1.' + uid) : '';
515
+ }());
516
+
517
+ /**
518
+ * Checks if `func` has its source masked.
519
+ *
520
+ * @private
521
+ * @param {Function} func The function to check.
522
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
523
+ */
524
+ function isMasked(func) {
525
+ return !!maskSrcKey && (maskSrcKey in func);
526
+ }
527
+
528
+ _isMasked = isMasked;
529
+ return _isMasked;
530
+ }
531
+
532
+ /** Used for built-in method references. */
533
+
534
+ var _toSource;
535
+ var hasRequired_toSource;
536
+
537
+ function require_toSource () {
538
+ if (hasRequired_toSource) return _toSource;
539
+ hasRequired_toSource = 1;
540
+ var funcProto = Function.prototype;
541
+
542
+ /** Used to resolve the decompiled source of functions. */
543
+ var funcToString = funcProto.toString;
544
+
545
+ /**
546
+ * Converts `func` to its source code.
547
+ *
548
+ * @private
549
+ * @param {Function} func The function to convert.
550
+ * @returns {string} Returns the source code.
551
+ */
552
+ function toSource(func) {
553
+ if (func != null) {
554
+ try {
555
+ return funcToString.call(func);
556
+ } catch (e) {}
557
+ try {
558
+ return (func + '');
559
+ } catch (e) {}
560
+ }
561
+ return '';
562
+ }
563
+
564
+ _toSource = toSource;
565
+ return _toSource;
566
+ }
567
+
568
+ var _baseIsNative;
569
+ var hasRequired_baseIsNative;
570
+
571
+ function require_baseIsNative () {
572
+ if (hasRequired_baseIsNative) return _baseIsNative;
573
+ hasRequired_baseIsNative = 1;
574
+ var isFunction = requireIsFunction(),
575
+ isMasked = require_isMasked(),
576
+ isObject = requireIsObject(),
577
+ toSource = require_toSource();
578
+
579
+ /**
580
+ * Used to match `RegExp`
581
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
582
+ */
583
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
584
+
585
+ /** Used to detect host constructors (Safari). */
586
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
587
+
588
+ /** Used for built-in method references. */
589
+ var funcProto = Function.prototype,
590
+ objectProto = Object.prototype;
591
+
592
+ /** Used to resolve the decompiled source of functions. */
593
+ var funcToString = funcProto.toString;
594
+
595
+ /** Used to check objects for own properties. */
596
+ var hasOwnProperty = objectProto.hasOwnProperty;
597
+
598
+ /** Used to detect if a method is native. */
599
+ var reIsNative = RegExp('^' +
600
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
601
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
602
+ );
603
+
604
+ /**
605
+ * The base implementation of `_.isNative` without bad shim checks.
606
+ *
607
+ * @private
608
+ * @param {*} value The value to check.
609
+ * @returns {boolean} Returns `true` if `value` is a native function,
610
+ * else `false`.
611
+ */
612
+ function baseIsNative(value) {
613
+ if (!isObject(value) || isMasked(value)) {
614
+ return false;
615
+ }
616
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
617
+ return pattern.test(toSource(value));
618
+ }
619
+
620
+ _baseIsNative = baseIsNative;
621
+ return _baseIsNative;
622
+ }
623
+
624
+ /**
625
+ * Gets the value at `key` of `object`.
626
+ *
627
+ * @private
628
+ * @param {Object} [object] The object to query.
629
+ * @param {string} key The key of the property to get.
630
+ * @returns {*} Returns the property value.
631
+ */
632
+
633
+ var _getValue;
634
+ var hasRequired_getValue;
635
+
636
+ function require_getValue () {
637
+ if (hasRequired_getValue) return _getValue;
638
+ hasRequired_getValue = 1;
639
+ function getValue(object, key) {
640
+ return object == null ? undefined : object[key];
641
+ }
642
+
643
+ _getValue = getValue;
644
+ return _getValue;
645
+ }
646
+
647
+ var _getNative;
648
+ var hasRequired_getNative;
649
+
650
+ function require_getNative () {
651
+ if (hasRequired_getNative) return _getNative;
652
+ hasRequired_getNative = 1;
653
+ var baseIsNative = require_baseIsNative(),
654
+ getValue = require_getValue();
655
+
656
+ /**
657
+ * Gets the native function at `key` of `object`.
658
+ *
659
+ * @private
660
+ * @param {Object} object The object to query.
661
+ * @param {string} key The key of the method to get.
662
+ * @returns {*} Returns the function if it's native, else `undefined`.
663
+ */
664
+ function getNative(object, key) {
665
+ var value = getValue(object, key);
666
+ return baseIsNative(value) ? value : undefined;
667
+ }
668
+
669
+ _getNative = getNative;
670
+ return _getNative;
671
+ }
672
+
673
+ var _nativeCreate;
674
+ var hasRequired_nativeCreate;
675
+
676
+ function require_nativeCreate () {
677
+ if (hasRequired_nativeCreate) return _nativeCreate;
678
+ hasRequired_nativeCreate = 1;
679
+ var getNative = require_getNative();
680
+
681
+ /* Built-in method references that are verified to be native. */
682
+ var nativeCreate = getNative(Object, 'create');
683
+
684
+ _nativeCreate = nativeCreate;
685
+ return _nativeCreate;
686
+ }
687
+
688
+ var _hashClear;
689
+ var hasRequired_hashClear;
690
+
691
+ function require_hashClear () {
692
+ if (hasRequired_hashClear) return _hashClear;
693
+ hasRequired_hashClear = 1;
694
+ var nativeCreate = require_nativeCreate();
695
+
696
+ /**
697
+ * Removes all key-value entries from the hash.
698
+ *
699
+ * @private
700
+ * @name clear
701
+ * @memberOf Hash
702
+ */
703
+ function hashClear() {
704
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
705
+ this.size = 0;
706
+ }
707
+
708
+ _hashClear = hashClear;
709
+ return _hashClear;
710
+ }
711
+
712
+ /**
713
+ * Removes `key` and its value from the hash.
714
+ *
715
+ * @private
716
+ * @name delete
717
+ * @memberOf Hash
718
+ * @param {Object} hash The hash to modify.
719
+ * @param {string} key The key of the value to remove.
720
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
721
+ */
722
+
723
+ var _hashDelete;
724
+ var hasRequired_hashDelete;
725
+
726
+ function require_hashDelete () {
727
+ if (hasRequired_hashDelete) return _hashDelete;
728
+ hasRequired_hashDelete = 1;
729
+ function hashDelete(key) {
730
+ var result = this.has(key) && delete this.__data__[key];
731
+ this.size -= result ? 1 : 0;
732
+ return result;
733
+ }
734
+
735
+ _hashDelete = hashDelete;
736
+ return _hashDelete;
737
+ }
738
+
739
+ var _hashGet;
740
+ var hasRequired_hashGet;
741
+
742
+ function require_hashGet () {
743
+ if (hasRequired_hashGet) return _hashGet;
744
+ hasRequired_hashGet = 1;
745
+ var nativeCreate = require_nativeCreate();
746
+
747
+ /** Used to stand-in for `undefined` hash values. */
748
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
749
+
750
+ /** Used for built-in method references. */
751
+ var objectProto = Object.prototype;
752
+
753
+ /** Used to check objects for own properties. */
754
+ var hasOwnProperty = objectProto.hasOwnProperty;
755
+
756
+ /**
757
+ * Gets the hash value for `key`.
758
+ *
759
+ * @private
760
+ * @name get
761
+ * @memberOf Hash
762
+ * @param {string} key The key of the value to get.
763
+ * @returns {*} Returns the entry value.
764
+ */
765
+ function hashGet(key) {
766
+ var data = this.__data__;
767
+ if (nativeCreate) {
768
+ var result = data[key];
769
+ return result === HASH_UNDEFINED ? undefined : result;
770
+ }
771
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
772
+ }
773
+
774
+ _hashGet = hashGet;
775
+ return _hashGet;
776
+ }
777
+
778
+ var _hashHas;
779
+ var hasRequired_hashHas;
780
+
781
+ function require_hashHas () {
782
+ if (hasRequired_hashHas) return _hashHas;
783
+ hasRequired_hashHas = 1;
784
+ var nativeCreate = require_nativeCreate();
785
+
786
+ /** Used for built-in method references. */
787
+ var objectProto = Object.prototype;
788
+
789
+ /** Used to check objects for own properties. */
790
+ var hasOwnProperty = objectProto.hasOwnProperty;
791
+
792
+ /**
793
+ * Checks if a hash value for `key` exists.
794
+ *
795
+ * @private
796
+ * @name has
797
+ * @memberOf Hash
798
+ * @param {string} key The key of the entry to check.
799
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
800
+ */
801
+ function hashHas(key) {
802
+ var data = this.__data__;
803
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
804
+ }
805
+
806
+ _hashHas = hashHas;
807
+ return _hashHas;
808
+ }
809
+
810
+ var _hashSet;
811
+ var hasRequired_hashSet;
812
+
813
+ function require_hashSet () {
814
+ if (hasRequired_hashSet) return _hashSet;
815
+ hasRequired_hashSet = 1;
816
+ var nativeCreate = require_nativeCreate();
817
+
818
+ /** Used to stand-in for `undefined` hash values. */
819
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
820
+
821
+ /**
822
+ * Sets the hash `key` to `value`.
823
+ *
824
+ * @private
825
+ * @name set
826
+ * @memberOf Hash
827
+ * @param {string} key The key of the value to set.
828
+ * @param {*} value The value to set.
829
+ * @returns {Object} Returns the hash instance.
830
+ */
831
+ function hashSet(key, value) {
832
+ var data = this.__data__;
833
+ this.size += this.has(key) ? 0 : 1;
834
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
835
+ return this;
836
+ }
837
+
838
+ _hashSet = hashSet;
839
+ return _hashSet;
840
+ }
841
+
842
+ var _Hash;
843
+ var hasRequired_Hash;
844
+
845
+ function require_Hash () {
846
+ if (hasRequired_Hash) return _Hash;
847
+ hasRequired_Hash = 1;
848
+ var hashClear = require_hashClear(),
849
+ hashDelete = require_hashDelete(),
850
+ hashGet = require_hashGet(),
851
+ hashHas = require_hashHas(),
852
+ hashSet = require_hashSet();
853
+
854
+ /**
855
+ * Creates a hash object.
856
+ *
857
+ * @private
858
+ * @constructor
859
+ * @param {Array} [entries] The key-value pairs to cache.
860
+ */
861
+ function Hash(entries) {
862
+ var index = -1,
863
+ length = entries == null ? 0 : entries.length;
864
+
865
+ this.clear();
866
+ while (++index < length) {
867
+ var entry = entries[index];
868
+ this.set(entry[0], entry[1]);
869
+ }
870
+ }
871
+
872
+ // Add methods to `Hash`.
873
+ Hash.prototype.clear = hashClear;
874
+ Hash.prototype['delete'] = hashDelete;
875
+ Hash.prototype.get = hashGet;
876
+ Hash.prototype.has = hashHas;
877
+ Hash.prototype.set = hashSet;
878
+
879
+ _Hash = Hash;
880
+ return _Hash;
881
+ }
882
+
883
+ /**
884
+ * Removes all key-value entries from the list cache.
885
+ *
886
+ * @private
887
+ * @name clear
888
+ * @memberOf ListCache
889
+ */
890
+
891
+ var _listCacheClear;
892
+ var hasRequired_listCacheClear;
893
+
894
+ function require_listCacheClear () {
895
+ if (hasRequired_listCacheClear) return _listCacheClear;
896
+ hasRequired_listCacheClear = 1;
897
+ function listCacheClear() {
898
+ this.__data__ = [];
899
+ this.size = 0;
900
+ }
901
+
902
+ _listCacheClear = listCacheClear;
903
+ return _listCacheClear;
904
+ }
905
+
906
+ /**
907
+ * Performs a
908
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
909
+ * comparison between two values to determine if they are equivalent.
910
+ *
911
+ * @static
912
+ * @memberOf _
913
+ * @since 4.0.0
914
+ * @category Lang
915
+ * @param {*} value The value to compare.
916
+ * @param {*} other The other value to compare.
917
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
918
+ * @example
919
+ *
920
+ * var object = { 'a': 1 };
921
+ * var other = { 'a': 1 };
922
+ *
923
+ * _.eq(object, object);
924
+ * // => true
925
+ *
926
+ * _.eq(object, other);
927
+ * // => false
928
+ *
929
+ * _.eq('a', 'a');
930
+ * // => true
931
+ *
932
+ * _.eq('a', Object('a'));
933
+ * // => false
934
+ *
935
+ * _.eq(NaN, NaN);
936
+ * // => true
937
+ */
938
+
939
+ var eq_1;
940
+ var hasRequiredEq;
941
+
942
+ function requireEq () {
943
+ if (hasRequiredEq) return eq_1;
944
+ hasRequiredEq = 1;
945
+ function eq(value, other) {
946
+ return value === other || (value !== value && other !== other);
947
+ }
948
+
949
+ eq_1 = eq;
950
+ return eq_1;
951
+ }
952
+
953
+ var _assocIndexOf;
954
+ var hasRequired_assocIndexOf;
955
+
956
+ function require_assocIndexOf () {
957
+ if (hasRequired_assocIndexOf) return _assocIndexOf;
958
+ hasRequired_assocIndexOf = 1;
959
+ var eq = requireEq();
960
+
961
+ /**
962
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
963
+ *
964
+ * @private
965
+ * @param {Array} array The array to inspect.
966
+ * @param {*} key The key to search for.
967
+ * @returns {number} Returns the index of the matched value, else `-1`.
968
+ */
969
+ function assocIndexOf(array, key) {
970
+ var length = array.length;
971
+ while (length--) {
972
+ if (eq(array[length][0], key)) {
973
+ return length;
974
+ }
975
+ }
976
+ return -1;
977
+ }
978
+
979
+ _assocIndexOf = assocIndexOf;
980
+ return _assocIndexOf;
981
+ }
982
+
983
+ var _listCacheDelete;
984
+ var hasRequired_listCacheDelete;
985
+
986
+ function require_listCacheDelete () {
987
+ if (hasRequired_listCacheDelete) return _listCacheDelete;
988
+ hasRequired_listCacheDelete = 1;
989
+ var assocIndexOf = require_assocIndexOf();
990
+
991
+ /** Used for built-in method references. */
992
+ var arrayProto = Array.prototype;
993
+
994
+ /** Built-in value references. */
995
+ var splice = arrayProto.splice;
996
+
997
+ /**
998
+ * Removes `key` and its value from the list cache.
999
+ *
1000
+ * @private
1001
+ * @name delete
1002
+ * @memberOf ListCache
1003
+ * @param {string} key The key of the value to remove.
1004
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1005
+ */
1006
+ function listCacheDelete(key) {
1007
+ var data = this.__data__,
1008
+ index = assocIndexOf(data, key);
1009
+
1010
+ if (index < 0) {
1011
+ return false;
1012
+ }
1013
+ var lastIndex = data.length - 1;
1014
+ if (index == lastIndex) {
1015
+ data.pop();
1016
+ } else {
1017
+ splice.call(data, index, 1);
1018
+ }
1019
+ --this.size;
1020
+ return true;
1021
+ }
1022
+
1023
+ _listCacheDelete = listCacheDelete;
1024
+ return _listCacheDelete;
1025
+ }
1026
+
1027
+ var _listCacheGet;
1028
+ var hasRequired_listCacheGet;
1029
+
1030
+ function require_listCacheGet () {
1031
+ if (hasRequired_listCacheGet) return _listCacheGet;
1032
+ hasRequired_listCacheGet = 1;
1033
+ var assocIndexOf = require_assocIndexOf();
1034
+
1035
+ /**
1036
+ * Gets the list cache value for `key`.
1037
+ *
1038
+ * @private
1039
+ * @name get
1040
+ * @memberOf ListCache
1041
+ * @param {string} key The key of the value to get.
1042
+ * @returns {*} Returns the entry value.
1043
+ */
1044
+ function listCacheGet(key) {
1045
+ var data = this.__data__,
1046
+ index = assocIndexOf(data, key);
1047
+
1048
+ return index < 0 ? undefined : data[index][1];
1049
+ }
1050
+
1051
+ _listCacheGet = listCacheGet;
1052
+ return _listCacheGet;
1053
+ }
1054
+
1055
+ var _listCacheHas;
1056
+ var hasRequired_listCacheHas;
1057
+
1058
+ function require_listCacheHas () {
1059
+ if (hasRequired_listCacheHas) return _listCacheHas;
1060
+ hasRequired_listCacheHas = 1;
1061
+ var assocIndexOf = require_assocIndexOf();
1062
+
1063
+ /**
1064
+ * Checks if a list cache value for `key` exists.
1065
+ *
1066
+ * @private
1067
+ * @name has
1068
+ * @memberOf ListCache
1069
+ * @param {string} key The key of the entry to check.
1070
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1071
+ */
1072
+ function listCacheHas(key) {
1073
+ return assocIndexOf(this.__data__, key) > -1;
1074
+ }
1075
+
1076
+ _listCacheHas = listCacheHas;
1077
+ return _listCacheHas;
1078
+ }
1079
+
1080
+ var _listCacheSet;
1081
+ var hasRequired_listCacheSet;
1082
+
1083
+ function require_listCacheSet () {
1084
+ if (hasRequired_listCacheSet) return _listCacheSet;
1085
+ hasRequired_listCacheSet = 1;
1086
+ var assocIndexOf = require_assocIndexOf();
1087
+
1088
+ /**
1089
+ * Sets the list cache `key` to `value`.
1090
+ *
1091
+ * @private
1092
+ * @name set
1093
+ * @memberOf ListCache
1094
+ * @param {string} key The key of the value to set.
1095
+ * @param {*} value The value to set.
1096
+ * @returns {Object} Returns the list cache instance.
1097
+ */
1098
+ function listCacheSet(key, value) {
1099
+ var data = this.__data__,
1100
+ index = assocIndexOf(data, key);
1101
+
1102
+ if (index < 0) {
1103
+ ++this.size;
1104
+ data.push([key, value]);
1105
+ } else {
1106
+ data[index][1] = value;
1107
+ }
1108
+ return this;
1109
+ }
1110
+
1111
+ _listCacheSet = listCacheSet;
1112
+ return _listCacheSet;
1113
+ }
1114
+
1115
+ var _ListCache;
1116
+ var hasRequired_ListCache;
1117
+
1118
+ function require_ListCache () {
1119
+ if (hasRequired_ListCache) return _ListCache;
1120
+ hasRequired_ListCache = 1;
1121
+ var listCacheClear = require_listCacheClear(),
1122
+ listCacheDelete = require_listCacheDelete(),
1123
+ listCacheGet = require_listCacheGet(),
1124
+ listCacheHas = require_listCacheHas(),
1125
+ listCacheSet = require_listCacheSet();
1126
+
1127
+ /**
1128
+ * Creates an list cache object.
1129
+ *
1130
+ * @private
1131
+ * @constructor
1132
+ * @param {Array} [entries] The key-value pairs to cache.
1133
+ */
1134
+ function ListCache(entries) {
1135
+ var index = -1,
1136
+ length = entries == null ? 0 : entries.length;
1137
+
1138
+ this.clear();
1139
+ while (++index < length) {
1140
+ var entry = entries[index];
1141
+ this.set(entry[0], entry[1]);
1142
+ }
1143
+ }
1144
+
1145
+ // Add methods to `ListCache`.
1146
+ ListCache.prototype.clear = listCacheClear;
1147
+ ListCache.prototype['delete'] = listCacheDelete;
1148
+ ListCache.prototype.get = listCacheGet;
1149
+ ListCache.prototype.has = listCacheHas;
1150
+ ListCache.prototype.set = listCacheSet;
1151
+
1152
+ _ListCache = ListCache;
1153
+ return _ListCache;
1154
+ }
1155
+
1156
+ var _Map;
1157
+ var hasRequired_Map;
1158
+
1159
+ function require_Map () {
1160
+ if (hasRequired_Map) return _Map;
1161
+ hasRequired_Map = 1;
1162
+ var getNative = require_getNative(),
1163
+ root = require_root();
1164
+
1165
+ /* Built-in method references that are verified to be native. */
1166
+ var Map = getNative(root, 'Map');
1167
+
1168
+ _Map = Map;
1169
+ return _Map;
1170
+ }
1171
+
1172
+ var _mapCacheClear;
1173
+ var hasRequired_mapCacheClear;
1174
+
1175
+ function require_mapCacheClear () {
1176
+ if (hasRequired_mapCacheClear) return _mapCacheClear;
1177
+ hasRequired_mapCacheClear = 1;
1178
+ var Hash = require_Hash(),
1179
+ ListCache = require_ListCache(),
1180
+ Map = require_Map();
1181
+
1182
+ /**
1183
+ * Removes all key-value entries from the map.
1184
+ *
1185
+ * @private
1186
+ * @name clear
1187
+ * @memberOf MapCache
1188
+ */
1189
+ function mapCacheClear() {
1190
+ this.size = 0;
1191
+ this.__data__ = {
1192
+ 'hash': new Hash,
1193
+ 'map': new (Map || ListCache),
1194
+ 'string': new Hash
1195
+ };
1196
+ }
1197
+
1198
+ _mapCacheClear = mapCacheClear;
1199
+ return _mapCacheClear;
1200
+ }
1201
+
1202
+ /**
1203
+ * Checks if `value` is suitable for use as unique object key.
1204
+ *
1205
+ * @private
1206
+ * @param {*} value The value to check.
1207
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1208
+ */
1209
+
1210
+ var _isKeyable;
1211
+ var hasRequired_isKeyable;
1212
+
1213
+ function require_isKeyable () {
1214
+ if (hasRequired_isKeyable) return _isKeyable;
1215
+ hasRequired_isKeyable = 1;
1216
+ function isKeyable(value) {
1217
+ var type = typeof value;
1218
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1219
+ ? (value !== '__proto__')
1220
+ : (value === null);
1221
+ }
1222
+
1223
+ _isKeyable = isKeyable;
1224
+ return _isKeyable;
1225
+ }
1226
+
1227
+ var _getMapData;
1228
+ var hasRequired_getMapData;
1229
+
1230
+ function require_getMapData () {
1231
+ if (hasRequired_getMapData) return _getMapData;
1232
+ hasRequired_getMapData = 1;
1233
+ var isKeyable = require_isKeyable();
1234
+
1235
+ /**
1236
+ * Gets the data for `map`.
1237
+ *
1238
+ * @private
1239
+ * @param {Object} map The map to query.
1240
+ * @param {string} key The reference key.
1241
+ * @returns {*} Returns the map data.
1242
+ */
1243
+ function getMapData(map, key) {
1244
+ var data = map.__data__;
1245
+ return isKeyable(key)
1246
+ ? data[typeof key == 'string' ? 'string' : 'hash']
1247
+ : data.map;
1248
+ }
1249
+
1250
+ _getMapData = getMapData;
1251
+ return _getMapData;
1252
+ }
1253
+
1254
+ var _mapCacheDelete;
1255
+ var hasRequired_mapCacheDelete;
1256
+
1257
+ function require_mapCacheDelete () {
1258
+ if (hasRequired_mapCacheDelete) return _mapCacheDelete;
1259
+ hasRequired_mapCacheDelete = 1;
1260
+ var getMapData = require_getMapData();
1261
+
1262
+ /**
1263
+ * Removes `key` and its value from the map.
1264
+ *
1265
+ * @private
1266
+ * @name delete
1267
+ * @memberOf MapCache
1268
+ * @param {string} key The key of the value to remove.
1269
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1270
+ */
1271
+ function mapCacheDelete(key) {
1272
+ var result = getMapData(this, key)['delete'](key);
1273
+ this.size -= result ? 1 : 0;
1274
+ return result;
1275
+ }
1276
+
1277
+ _mapCacheDelete = mapCacheDelete;
1278
+ return _mapCacheDelete;
1279
+ }
1280
+
1281
+ var _mapCacheGet;
1282
+ var hasRequired_mapCacheGet;
1283
+
1284
+ function require_mapCacheGet () {
1285
+ if (hasRequired_mapCacheGet) return _mapCacheGet;
1286
+ hasRequired_mapCacheGet = 1;
1287
+ var getMapData = require_getMapData();
1288
+
1289
+ /**
1290
+ * Gets the map value for `key`.
1291
+ *
1292
+ * @private
1293
+ * @name get
1294
+ * @memberOf MapCache
1295
+ * @param {string} key The key of the value to get.
1296
+ * @returns {*} Returns the entry value.
1297
+ */
1298
+ function mapCacheGet(key) {
1299
+ return getMapData(this, key).get(key);
1300
+ }
1301
+
1302
+ _mapCacheGet = mapCacheGet;
1303
+ return _mapCacheGet;
1304
+ }
1305
+
1306
+ var _mapCacheHas;
1307
+ var hasRequired_mapCacheHas;
1308
+
1309
+ function require_mapCacheHas () {
1310
+ if (hasRequired_mapCacheHas) return _mapCacheHas;
1311
+ hasRequired_mapCacheHas = 1;
1312
+ var getMapData = require_getMapData();
1313
+
1314
+ /**
1315
+ * Checks if a map value for `key` exists.
1316
+ *
1317
+ * @private
1318
+ * @name has
1319
+ * @memberOf MapCache
1320
+ * @param {string} key The key of the entry to check.
1321
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1322
+ */
1323
+ function mapCacheHas(key) {
1324
+ return getMapData(this, key).has(key);
1325
+ }
1326
+
1327
+ _mapCacheHas = mapCacheHas;
1328
+ return _mapCacheHas;
1329
+ }
1330
+
1331
+ var _mapCacheSet;
1332
+ var hasRequired_mapCacheSet;
1333
+
1334
+ function require_mapCacheSet () {
1335
+ if (hasRequired_mapCacheSet) return _mapCacheSet;
1336
+ hasRequired_mapCacheSet = 1;
1337
+ var getMapData = require_getMapData();
1338
+
1339
+ /**
1340
+ * Sets the map `key` to `value`.
1341
+ *
1342
+ * @private
1343
+ * @name set
1344
+ * @memberOf MapCache
1345
+ * @param {string} key The key of the value to set.
1346
+ * @param {*} value The value to set.
1347
+ * @returns {Object} Returns the map cache instance.
1348
+ */
1349
+ function mapCacheSet(key, value) {
1350
+ var data = getMapData(this, key),
1351
+ size = data.size;
1352
+
1353
+ data.set(key, value);
1354
+ this.size += data.size == size ? 0 : 1;
1355
+ return this;
1356
+ }
1357
+
1358
+ _mapCacheSet = mapCacheSet;
1359
+ return _mapCacheSet;
1360
+ }
1361
+
1362
+ var _MapCache;
1363
+ var hasRequired_MapCache;
1364
+
1365
+ function require_MapCache () {
1366
+ if (hasRequired_MapCache) return _MapCache;
1367
+ hasRequired_MapCache = 1;
1368
+ var mapCacheClear = require_mapCacheClear(),
1369
+ mapCacheDelete = require_mapCacheDelete(),
1370
+ mapCacheGet = require_mapCacheGet(),
1371
+ mapCacheHas = require_mapCacheHas(),
1372
+ mapCacheSet = require_mapCacheSet();
1373
+
1374
+ /**
1375
+ * Creates a map cache object to store key-value pairs.
1376
+ *
1377
+ * @private
1378
+ * @constructor
1379
+ * @param {Array} [entries] The key-value pairs to cache.
1380
+ */
1381
+ function MapCache(entries) {
1382
+ var index = -1,
1383
+ length = entries == null ? 0 : entries.length;
1384
+
1385
+ this.clear();
1386
+ while (++index < length) {
1387
+ var entry = entries[index];
1388
+ this.set(entry[0], entry[1]);
1389
+ }
1390
+ }
1391
+
1392
+ // Add methods to `MapCache`.
1393
+ MapCache.prototype.clear = mapCacheClear;
1394
+ MapCache.prototype['delete'] = mapCacheDelete;
1395
+ MapCache.prototype.get = mapCacheGet;
1396
+ MapCache.prototype.has = mapCacheHas;
1397
+ MapCache.prototype.set = mapCacheSet;
1398
+
1399
+ _MapCache = MapCache;
1400
+ return _MapCache;
1401
+ }
1402
+
1403
+ var memoize_1;
1404
+ var hasRequiredMemoize;
1405
+
1406
+ function requireMemoize () {
1407
+ if (hasRequiredMemoize) return memoize_1;
1408
+ hasRequiredMemoize = 1;
1409
+ var MapCache = require_MapCache();
1410
+
1411
+ /** Error message constants. */
1412
+ var FUNC_ERROR_TEXT = 'Expected a function';
1413
+
1414
+ /**
1415
+ * Creates a function that memoizes the result of `func`. If `resolver` is
1416
+ * provided, it determines the cache key for storing the result based on the
1417
+ * arguments provided to the memoized function. By default, the first argument
1418
+ * provided to the memoized function is used as the map cache key. The `func`
1419
+ * is invoked with the `this` binding of the memoized function.
1420
+ *
1421
+ * **Note:** The cache is exposed as the `cache` property on the memoized
1422
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
1423
+ * constructor with one whose instances implement the
1424
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
1425
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
1426
+ *
1427
+ * @static
1428
+ * @memberOf _
1429
+ * @since 0.1.0
1430
+ * @category Function
1431
+ * @param {Function} func The function to have its output memoized.
1432
+ * @param {Function} [resolver] The function to resolve the cache key.
1433
+ * @returns {Function} Returns the new memoized function.
1434
+ * @example
1435
+ *
1436
+ * var object = { 'a': 1, 'b': 2 };
1437
+ * var other = { 'c': 3, 'd': 4 };
1438
+ *
1439
+ * var values = _.memoize(_.values);
1440
+ * values(object);
1441
+ * // => [1, 2]
1442
+ *
1443
+ * values(other);
1444
+ * // => [3, 4]
1445
+ *
1446
+ * object.a = 2;
1447
+ * values(object);
1448
+ * // => [1, 2]
1449
+ *
1450
+ * // Modify the result cache.
1451
+ * values.cache.set(object, ['a', 'b']);
1452
+ * values(object);
1453
+ * // => ['a', 'b']
1454
+ *
1455
+ * // Replace `_.memoize.Cache`.
1456
+ * _.memoize.Cache = WeakMap;
1457
+ */
1458
+ function memoize(func, resolver) {
1459
+ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
1460
+ throw new TypeError(FUNC_ERROR_TEXT);
1461
+ }
1462
+ var memoized = function() {
1463
+ var args = arguments,
1464
+ key = resolver ? resolver.apply(this, args) : args[0],
1465
+ cache = memoized.cache;
1466
+
1467
+ if (cache.has(key)) {
1468
+ return cache.get(key);
1469
+ }
1470
+ var result = func.apply(this, args);
1471
+ memoized.cache = cache.set(key, result) || cache;
1472
+ return result;
1473
+ };
1474
+ memoized.cache = new (memoize.Cache || MapCache);
1475
+ return memoized;
1476
+ }
1477
+
1478
+ // Expose `MapCache`.
1479
+ memoize.Cache = MapCache;
1480
+
1481
+ memoize_1 = memoize;
1482
+ return memoize_1;
1483
+ }
1484
+
1485
+ var _memoizeCapped;
1486
+ var hasRequired_memoizeCapped;
1487
+
1488
+ function require_memoizeCapped () {
1489
+ if (hasRequired_memoizeCapped) return _memoizeCapped;
1490
+ hasRequired_memoizeCapped = 1;
1491
+ var memoize = requireMemoize();
1492
+
1493
+ /** Used as the maximum memoize cache size. */
1494
+ var MAX_MEMOIZE_SIZE = 500;
1495
+
1496
+ /**
1497
+ * A specialized version of `_.memoize` which clears the memoized function's
1498
+ * cache when it exceeds `MAX_MEMOIZE_SIZE`.
1499
+ *
1500
+ * @private
1501
+ * @param {Function} func The function to have its output memoized.
1502
+ * @returns {Function} Returns the new memoized function.
1503
+ */
1504
+ function memoizeCapped(func) {
1505
+ var result = memoize(func, function(key) {
1506
+ if (cache.size === MAX_MEMOIZE_SIZE) {
1507
+ cache.clear();
1508
+ }
1509
+ return key;
1510
+ });
1511
+
1512
+ var cache = result.cache;
1513
+ return result;
1514
+ }
1515
+
1516
+ _memoizeCapped = memoizeCapped;
1517
+ return _memoizeCapped;
1518
+ }
1519
+
1520
+ var _stringToPath;
1521
+ var hasRequired_stringToPath;
1522
+
1523
+ function require_stringToPath () {
1524
+ if (hasRequired_stringToPath) return _stringToPath;
1525
+ hasRequired_stringToPath = 1;
1526
+ var memoizeCapped = require_memoizeCapped();
1527
+
1528
+ /** Used to match property names within property paths. */
1529
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1530
+
1531
+ /** Used to match backslashes in property paths. */
1532
+ var reEscapeChar = /\\(\\)?/g;
1533
+
1534
+ /**
1535
+ * Converts `string` to a property path array.
1536
+ *
1537
+ * @private
1538
+ * @param {string} string The string to convert.
1539
+ * @returns {Array} Returns the property path array.
1540
+ */
1541
+ var stringToPath = memoizeCapped(function(string) {
1542
+ var result = [];
1543
+ if (string.charCodeAt(0) === 46 /* . */) {
1544
+ result.push('');
1545
+ }
1546
+ string.replace(rePropName, function(match, number, quote, subString) {
1547
+ result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
1548
+ });
1549
+ return result;
1550
+ });
1551
+
1552
+ _stringToPath = stringToPath;
1553
+ return _stringToPath;
1554
+ }
1555
+
1556
+ /**
1557
+ * A specialized version of `_.map` for arrays without support for iteratee
1558
+ * shorthands.
1559
+ *
1560
+ * @private
1561
+ * @param {Array} [array] The array to iterate over.
1562
+ * @param {Function} iteratee The function invoked per iteration.
1563
+ * @returns {Array} Returns the new mapped array.
1564
+ */
1565
+
1566
+ var _arrayMap;
1567
+ var hasRequired_arrayMap;
1568
+
1569
+ function require_arrayMap () {
1570
+ if (hasRequired_arrayMap) return _arrayMap;
1571
+ hasRequired_arrayMap = 1;
1572
+ function arrayMap(array, iteratee) {
1573
+ var index = -1,
1574
+ length = array == null ? 0 : array.length,
1575
+ result = Array(length);
1576
+
1577
+ while (++index < length) {
1578
+ result[index] = iteratee(array[index], index, array);
1579
+ }
1580
+ return result;
1581
+ }
1582
+
1583
+ _arrayMap = arrayMap;
1584
+ return _arrayMap;
1585
+ }
1586
+
1587
+ var _baseToString;
1588
+ var hasRequired_baseToString;
1589
+
1590
+ function require_baseToString () {
1591
+ if (hasRequired_baseToString) return _baseToString;
1592
+ hasRequired_baseToString = 1;
1593
+ var Symbol = require_Symbol(),
1594
+ arrayMap = require_arrayMap(),
1595
+ isArray = requireIsArray(),
1596
+ isSymbol = requireIsSymbol();
1597
+
1598
+ /** Used as references for various `Number` constants. */
1599
+ var INFINITY = 1 / 0;
1600
+
1601
+ /** Used to convert symbols to primitives and strings. */
1602
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
1603
+ symbolToString = symbolProto ? symbolProto.toString : undefined;
1604
+
1605
+ /**
1606
+ * The base implementation of `_.toString` which doesn't convert nullish
1607
+ * values to empty strings.
1608
+ *
1609
+ * @private
1610
+ * @param {*} value The value to process.
1611
+ * @returns {string} Returns the string.
1612
+ */
1613
+ function baseToString(value) {
1614
+ // Exit early for strings to avoid a performance hit in some environments.
1615
+ if (typeof value == 'string') {
1616
+ return value;
1617
+ }
1618
+ if (isArray(value)) {
1619
+ // Recursively convert values (susceptible to call stack limits).
1620
+ return arrayMap(value, baseToString) + '';
1621
+ }
1622
+ if (isSymbol(value)) {
1623
+ return symbolToString ? symbolToString.call(value) : '';
1624
+ }
1625
+ var result = (value + '');
1626
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
1627
+ }
1628
+
1629
+ _baseToString = baseToString;
1630
+ return _baseToString;
1631
+ }
1632
+
1633
+ var toString_1;
1634
+ var hasRequiredToString;
1635
+
1636
+ function requireToString () {
1637
+ if (hasRequiredToString) return toString_1;
1638
+ hasRequiredToString = 1;
1639
+ var baseToString = require_baseToString();
1640
+
1641
+ /**
1642
+ * Converts `value` to a string. An empty string is returned for `null`
1643
+ * and `undefined` values. The sign of `-0` is preserved.
1644
+ *
1645
+ * @static
1646
+ * @memberOf _
1647
+ * @since 4.0.0
1648
+ * @category Lang
1649
+ * @param {*} value The value to convert.
1650
+ * @returns {string} Returns the converted string.
1651
+ * @example
1652
+ *
1653
+ * _.toString(null);
1654
+ * // => ''
1655
+ *
1656
+ * _.toString(-0);
1657
+ * // => '-0'
1658
+ *
1659
+ * _.toString([1, 2, 3]);
1660
+ * // => '1,2,3'
1661
+ */
1662
+ function toString(value) {
1663
+ return value == null ? '' : baseToString(value);
1664
+ }
1665
+
1666
+ toString_1 = toString;
1667
+ return toString_1;
1668
+ }
1669
+
1670
+ var _castPath;
1671
+ var hasRequired_castPath;
1672
+
1673
+ function require_castPath () {
1674
+ if (hasRequired_castPath) return _castPath;
1675
+ hasRequired_castPath = 1;
1676
+ var isArray = requireIsArray(),
1677
+ isKey = require_isKey(),
1678
+ stringToPath = require_stringToPath(),
1679
+ toString = requireToString();
1680
+
1681
+ /**
1682
+ * Casts `value` to a path array if it's not one.
1683
+ *
1684
+ * @private
1685
+ * @param {*} value The value to inspect.
1686
+ * @param {Object} [object] The object to query keys on.
1687
+ * @returns {Array} Returns the cast property path array.
1688
+ */
1689
+ function castPath(value, object) {
1690
+ if (isArray(value)) {
1691
+ return value;
1692
+ }
1693
+ return isKey(value, object) ? [value] : stringToPath(toString(value));
1694
+ }
1695
+
1696
+ _castPath = castPath;
1697
+ return _castPath;
1698
+ }
1699
+
1700
+ var _toKey;
1701
+ var hasRequired_toKey;
1702
+
1703
+ function require_toKey () {
1704
+ if (hasRequired_toKey) return _toKey;
1705
+ hasRequired_toKey = 1;
1706
+ var isSymbol = requireIsSymbol();
1707
+
1708
+ /** Used as references for various `Number` constants. */
1709
+ var INFINITY = 1 / 0;
1710
+
1711
+ /**
1712
+ * Converts `value` to a string key if it's not a string or symbol.
1713
+ *
1714
+ * @private
1715
+ * @param {*} value The value to inspect.
1716
+ * @returns {string|symbol} Returns the key.
1717
+ */
1718
+ function toKey(value) {
1719
+ if (typeof value == 'string' || isSymbol(value)) {
1720
+ return value;
1721
+ }
1722
+ var result = (value + '');
1723
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
1724
+ }
1725
+
1726
+ _toKey = toKey;
1727
+ return _toKey;
1728
+ }
1729
+
1730
+ var _baseGet;
1731
+ var hasRequired_baseGet;
1732
+
1733
+ function require_baseGet () {
1734
+ if (hasRequired_baseGet) return _baseGet;
1735
+ hasRequired_baseGet = 1;
1736
+ var castPath = require_castPath(),
1737
+ toKey = require_toKey();
1738
+
1739
+ /**
1740
+ * The base implementation of `_.get` without support for default values.
1741
+ *
1742
+ * @private
1743
+ * @param {Object} object The object to query.
1744
+ * @param {Array|string} path The path of the property to get.
1745
+ * @returns {*} Returns the resolved value.
1746
+ */
1747
+ function baseGet(object, path) {
1748
+ path = castPath(path, object);
1749
+
1750
+ var index = 0,
1751
+ length = path.length;
1752
+
1753
+ while (object != null && index < length) {
1754
+ object = object[toKey(path[index++])];
1755
+ }
1756
+ return (index && index == length) ? object : undefined;
1757
+ }
1758
+
1759
+ _baseGet = baseGet;
1760
+ return _baseGet;
1761
+ }
1762
+
1763
+ var get_1;
1764
+ var hasRequiredGet;
1765
+
1766
+ function requireGet () {
1767
+ if (hasRequiredGet) return get_1;
1768
+ hasRequiredGet = 1;
1769
+ var baseGet = require_baseGet();
1770
+
1771
+ /**
1772
+ * Gets the value at `path` of `object`. If the resolved value is
1773
+ * `undefined`, the `defaultValue` is returned in its place.
1774
+ *
1775
+ * @static
1776
+ * @memberOf _
1777
+ * @since 3.7.0
1778
+ * @category Object
1779
+ * @param {Object} object The object to query.
1780
+ * @param {Array|string} path The path of the property to get.
1781
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
1782
+ * @returns {*} Returns the resolved value.
1783
+ * @example
1784
+ *
1785
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
1786
+ *
1787
+ * _.get(object, 'a[0].b.c');
1788
+ * // => 3
1789
+ *
1790
+ * _.get(object, ['a', '0', 'b', 'c']);
1791
+ * // => 3
1792
+ *
1793
+ * _.get(object, 'a.b.c', 'default');
1794
+ * // => 'default'
1795
+ */
1796
+ function get(object, path, defaultValue) {
1797
+ var result = object == null ? undefined : baseGet(object, path);
1798
+ return result === undefined ? defaultValue : result;
1799
+ }
1800
+
1801
+ get_1 = get;
1802
+ return get_1;
1803
+ }
1804
+
1805
+ var getExports = requireGet();
1806
+ const get = /*@__PURE__*/getDefaultExportFromCjs(getExports);
1807
+
1808
+ function checkType(value, condition) {
1809
+ if (condition) {
1810
+ return true;
1811
+ }
1812
+ return false;
1813
+ }
1814
+
1815
+ function isArray(value) {
1816
+ return Boolean(value && Array.isArray(value));
1817
+ }
1818
+
1819
+ function isBoolean(value) {
1820
+ return typeof value === "boolean";
1821
+ }
1822
+
1823
+ function isNumber(value) {
1824
+ return typeof value === "number" && !Number.isNaN(value);
1825
+ }
1826
+
1827
+ function isString(value) {
1828
+ return typeof value === "string";
1829
+ }
1830
+
1831
+ function isId(value) {
1832
+ return isNumber(value) || isString(value);
1833
+ }
1834
+
1835
+ function isNull(value) {
1836
+ return value === null;
1837
+ }
1838
+
1839
+ function isNullable(value) {
1840
+ return typeof value === "undefined" || value === null;
1841
+ }
1842
+
1843
+ function isObject(value) {
1844
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
1845
+ }
1846
+
1847
+ function isUndefined(value) {
1848
+ return typeof value === "undefined";
1849
+ }
1850
+
1851
+ function isDate(value) {
1852
+ if (value instanceof Date)
1853
+ return !Number.isNaN(value.valueOf());
1854
+ return false;
1855
+ }
1856
+
1857
+ const index$5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1858
+ __proto__: null,
1859
+ checkType,
1860
+ isArray,
1861
+ isBoolean,
1862
+ isDate,
1863
+ isId,
1864
+ isNull,
1865
+ isNullable,
1866
+ isNumber,
1867
+ isObject,
1868
+ isString,
1869
+ isUndefined
1870
+ }, Symbol.toStringTag, { value: 'Module' }));
1871
+
1872
+ function getByPath(data, path, defaultValue = undefined) {
1873
+ if ((!isObject(data) && !isArray(data)) || !isString(path))
1874
+ return defaultValue;
1875
+ return get(data, path, defaultValue);
1876
+ }
1877
+
1878
+ var dayjs_min$1 = {exports: {}};
1879
+
1880
+ var dayjs_min = dayjs_min$1.exports;
1881
+
1882
+ var hasRequiredDayjs_min;
1883
+
1884
+ function requireDayjs_min () {
1885
+ if (hasRequiredDayjs_min) return dayjs_min$1.exports;
1886
+ hasRequiredDayjs_min = 1;
1887
+ (function (module, exports) {
1888
+ !function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
1889
+ } (dayjs_min$1));
1890
+ return dayjs_min$1.exports;
1891
+ }
1892
+
1893
+ var dayjs_minExports = requireDayjs_min();
1894
+ const dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
1895
+
1896
+ function dateDifference(type, firstDate, secondDate = new Date(), float = false) {
1897
+ const first = dayjs(firstDate);
1898
+ return first.diff(secondDate, type, float);
1899
+ }
1900
+
1901
+ function getDateByRules(rules, date = new Date()) {
1902
+ let result = new Date(date);
1903
+ for (const rule of rules) {
1904
+ result = getDate(rule.increment, rule.type, result);
1905
+ }
1906
+ return result;
1907
+ }
1908
+ function getDate(increment, type, date = new Date()) {
1909
+ const result = new Date(date);
1910
+ switch (type) {
1911
+ case DATE_TYPES.Days: {
1912
+ result.setDate(result.getDate() + increment);
1913
+ return result;
1914
+ }
1915
+ case DATE_TYPES.Months: {
1916
+ result.setMonth(result.getMonth() + increment);
1917
+ return result;
1918
+ }
1919
+ case DATE_TYPES.Years: {
1920
+ result.setFullYear(result.getFullYear() + increment);
1921
+ return result;
1922
+ }
1923
+ case DATE_TYPES.Seconds: {
1924
+ result.setSeconds(result.getSeconds() + increment);
1925
+ return result;
1926
+ }
1927
+ case DATE_TYPES.Minutes: {
1928
+ result.setMinutes(result.getMinutes() + increment);
1929
+ return result;
1930
+ }
1931
+ case DATE_TYPES.Hours: {
1932
+ result.setHours(result.getHours() + increment);
1933
+ return result;
1934
+ }
1935
+ default:
1936
+ return result;
1937
+ }
1938
+ }
1939
+
1940
+ function getToday() {
1941
+ const startToday = new Date();
1942
+ startToday.setHours(0, 0, 0, 0);
1943
+ const endToday = new Date();
1944
+ endToday.setHours(23, 59, 59, 999);
1945
+ return { startToday, endToday };
1946
+ }
1947
+
1948
+ function getTomorrow() {
1949
+ const tomorrow = new Date();
1950
+ tomorrow.setHours(0, 0, 0, 0);
1951
+ tomorrow.setDate(tomorrow.getDate() + 1);
1952
+ return tomorrow;
1953
+ }
1954
+
1955
+ function getYesterday() {
1956
+ const yesterday = new Date();
1957
+ yesterday.setHours(0, 0, 0, 0);
1958
+ yesterday.setDate(yesterday.getDate() - 1);
1959
+ return yesterday;
1960
+ }
1961
+
1962
+ var isToday$2 = {exports: {}};
1963
+
1964
+ var isToday$1 = isToday$2.exports;
1965
+
1966
+ var hasRequiredIsToday;
1967
+
1968
+ function requireIsToday () {
1969
+ if (hasRequiredIsToday) return isToday$2.exports;
1970
+ hasRequiredIsToday = 1;
1971
+ (function (module, exports) {
1972
+ !function(e,o){module.exports=o();}(isToday$1,(function(){return function(e,o,t){o.prototype.isToday=function(){var e="YYYY-MM-DD",o=t();return this.format(e)===o.format(e)};}}));
1973
+ } (isToday$2));
1974
+ return isToday$2.exports;
1975
+ }
1976
+
1977
+ var isTodayExports = requireIsToday();
1978
+ const todayPlugin = /*@__PURE__*/getDefaultExportFromCjs(isTodayExports);
1979
+
1980
+ dayjs.extend(todayPlugin);
1981
+ function isToday(date) {
1982
+ try {
1983
+ return dayjs(date).isToday();
1984
+ }
1985
+ catch {
1986
+ return false;
1987
+ }
1988
+ }
1989
+
1990
+ var isTomorrow$2 = {exports: {}};
1991
+
1992
+ var isTomorrow$1 = isTomorrow$2.exports;
1993
+
1994
+ var hasRequiredIsTomorrow;
1995
+
1996
+ function requireIsTomorrow () {
1997
+ if (hasRequiredIsTomorrow) return isTomorrow$2.exports;
1998
+ hasRequiredIsTomorrow = 1;
1999
+ (function (module, exports) {
2000
+ !function(o,e){module.exports=e();}(isTomorrow$1,(function(){return function(o,e,t){e.prototype.isTomorrow=function(){var o="YYYY-MM-DD",e=t().add(1,"day");return this.format(o)===e.format(o)};}}));
2001
+ } (isTomorrow$2));
2002
+ return isTomorrow$2.exports;
2003
+ }
2004
+
2005
+ var isTomorrowExports = requireIsTomorrow();
2006
+ const tomorrowPlugin = /*@__PURE__*/getDefaultExportFromCjs(isTomorrowExports);
2007
+
2008
+ dayjs.extend(tomorrowPlugin);
2009
+ function isTomorrow(date) {
2010
+ try {
2011
+ return dayjs(date).isTomorrow();
2012
+ }
2013
+ catch {
2014
+ return false;
2015
+ }
2016
+ }
2017
+
2018
+ var isYesterday$2 = {exports: {}};
2019
+
2020
+ var isYesterday$1 = isYesterday$2.exports;
2021
+
2022
+ var hasRequiredIsYesterday;
2023
+
2024
+ function requireIsYesterday () {
2025
+ if (hasRequiredIsYesterday) return isYesterday$2.exports;
2026
+ hasRequiredIsYesterday = 1;
2027
+ (function (module, exports) {
2028
+ !function(e,t){module.exports=t();}(isYesterday$1,(function(){return function(e,t,n){t.prototype.isYesterday=function(){var e="YYYY-MM-DD",t=n().subtract(1,"day");return this.format(e)===t.format(e)};}}));
2029
+ } (isYesterday$2));
2030
+ return isYesterday$2.exports;
2031
+ }
2032
+
2033
+ var isYesterdayExports = requireIsYesterday();
2034
+ const yesterdayPlugin = /*@__PURE__*/getDefaultExportFromCjs(isYesterdayExports);
2035
+
2036
+ dayjs.extend(yesterdayPlugin);
2037
+ function isYesterday(date) {
2038
+ try {
2039
+ return dayjs(date).isYesterday();
2040
+ }
2041
+ catch {
2042
+ return false;
2043
+ }
2044
+ }
2045
+
2046
+ function dateFormat(date, format) {
2047
+ const correctDate = new Date(date);
2048
+ if (!isDate(correctDate))
2049
+ return "";
2050
+ return dayjs(correctDate).format(format);
2051
+ }
2052
+
2053
+ const index$4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2054
+ __proto__: null,
2055
+ dateDifference,
2056
+ dateFormat,
2057
+ getDateByRules,
2058
+ getToday,
2059
+ getTomorrow,
2060
+ getYesterday,
2061
+ isToday,
2062
+ isTomorrow,
2063
+ isYesterday
2064
+ }, Symbol.toStringTag, { value: 'Module' }));
2065
+
2066
+ function transformToNumber(value) {
2067
+ let result;
2068
+ if (isString(value))
2069
+ result = parseInt(value, 10);
2070
+ else
2071
+ result = Number(value);
2072
+ return Number.isNaN(result) ? 0 : result;
2073
+ }
2074
+
2075
+ function fieldViewFormat(field, type = "string") {
2076
+ switch (type) {
2077
+ case FIELD_TYPES.Array: {
2078
+ return isArray(field) ? field.join(", ") : "";
2079
+ }
2080
+ case FIELD_TYPES.Date: {
2081
+ return isString(field) || isNumber(field) || isDate(field)
2082
+ ? dateFormat(field, "DD.MM.YYYY")
2083
+ : "";
2084
+ }
2085
+ case FIELD_TYPES.DateTime: {
2086
+ return isString(field) || isNumber(field) || isDate(field)
2087
+ ? dateFormat(field, "DD.MM.YYYY HH:mm")
2088
+ : "";
2089
+ }
2090
+ case FIELD_TYPES.Number: {
2091
+ return isString(field) || isNumber(field) || isBoolean(field)
2092
+ ? String(transformToNumber(field))
2093
+ : "";
2094
+ }
2095
+ case FIELD_TYPES.String: {
2096
+ return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : "";
2097
+ }
2098
+ case FIELD_TYPES.Time: {
2099
+ return isString(field) || isNumber(field) || isDate(field) ? dateFormat(field, "HH:mm") : "";
2100
+ }
2101
+ default: {
2102
+ return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : "";
2103
+ }
2104
+ }
2105
+ }
2106
+
2107
+ var _defineProperty;
2108
+ var hasRequired_defineProperty;
2109
+
2110
+ function require_defineProperty () {
2111
+ if (hasRequired_defineProperty) return _defineProperty;
2112
+ hasRequired_defineProperty = 1;
2113
+ var getNative = require_getNative();
2114
+
2115
+ var defineProperty = (function() {
2116
+ try {
2117
+ var func = getNative(Object, 'defineProperty');
2118
+ func({}, '', {});
2119
+ return func;
2120
+ } catch (e) {}
2121
+ }());
2122
+
2123
+ _defineProperty = defineProperty;
2124
+ return _defineProperty;
2125
+ }
2126
+
2127
+ var _baseAssignValue;
2128
+ var hasRequired_baseAssignValue;
2129
+
2130
+ function require_baseAssignValue () {
2131
+ if (hasRequired_baseAssignValue) return _baseAssignValue;
2132
+ hasRequired_baseAssignValue = 1;
2133
+ var defineProperty = require_defineProperty();
2134
+
2135
+ /**
2136
+ * The base implementation of `assignValue` and `assignMergeValue` without
2137
+ * value checks.
2138
+ *
2139
+ * @private
2140
+ * @param {Object} object The object to modify.
2141
+ * @param {string} key The key of the property to assign.
2142
+ * @param {*} value The value to assign.
2143
+ */
2144
+ function baseAssignValue(object, key, value) {
2145
+ if (key == '__proto__' && defineProperty) {
2146
+ defineProperty(object, key, {
2147
+ 'configurable': true,
2148
+ 'enumerable': true,
2149
+ 'value': value,
2150
+ 'writable': true
2151
+ });
2152
+ } else {
2153
+ object[key] = value;
2154
+ }
2155
+ }
2156
+
2157
+ _baseAssignValue = baseAssignValue;
2158
+ return _baseAssignValue;
2159
+ }
2160
+
2161
+ var _assignValue;
2162
+ var hasRequired_assignValue;
2163
+
2164
+ function require_assignValue () {
2165
+ if (hasRequired_assignValue) return _assignValue;
2166
+ hasRequired_assignValue = 1;
2167
+ var baseAssignValue = require_baseAssignValue(),
2168
+ eq = requireEq();
2169
+
2170
+ /** Used for built-in method references. */
2171
+ var objectProto = Object.prototype;
2172
+
2173
+ /** Used to check objects for own properties. */
2174
+ var hasOwnProperty = objectProto.hasOwnProperty;
2175
+
2176
+ /**
2177
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
2178
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2179
+ * for equality comparisons.
2180
+ *
2181
+ * @private
2182
+ * @param {Object} object The object to modify.
2183
+ * @param {string} key The key of the property to assign.
2184
+ * @param {*} value The value to assign.
2185
+ */
2186
+ function assignValue(object, key, value) {
2187
+ var objValue = object[key];
2188
+ if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
2189
+ (value === undefined && !(key in object))) {
2190
+ baseAssignValue(object, key, value);
2191
+ }
2192
+ }
2193
+
2194
+ _assignValue = assignValue;
2195
+ return _assignValue;
2196
+ }
2197
+
2198
+ /** Used as references for various `Number` constants. */
2199
+
2200
+ var _isIndex;
2201
+ var hasRequired_isIndex;
2202
+
2203
+ function require_isIndex () {
2204
+ if (hasRequired_isIndex) return _isIndex;
2205
+ hasRequired_isIndex = 1;
2206
+ var MAX_SAFE_INTEGER = 9007199254740991;
2207
+
2208
+ /** Used to detect unsigned integer values. */
2209
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
2210
+
2211
+ /**
2212
+ * Checks if `value` is a valid array-like index.
2213
+ *
2214
+ * @private
2215
+ * @param {*} value The value to check.
2216
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
2217
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
2218
+ */
2219
+ function isIndex(value, length) {
2220
+ var type = typeof value;
2221
+ length = length == null ? MAX_SAFE_INTEGER : length;
2222
+
2223
+ return !!length &&
2224
+ (type == 'number' ||
2225
+ (type != 'symbol' && reIsUint.test(value))) &&
2226
+ (value > -1 && value % 1 == 0 && value < length);
2227
+ }
2228
+
2229
+ _isIndex = isIndex;
2230
+ return _isIndex;
2231
+ }
2232
+
2233
+ var _baseSet;
2234
+ var hasRequired_baseSet;
2235
+
2236
+ function require_baseSet () {
2237
+ if (hasRequired_baseSet) return _baseSet;
2238
+ hasRequired_baseSet = 1;
2239
+ var assignValue = require_assignValue(),
2240
+ castPath = require_castPath(),
2241
+ isIndex = require_isIndex(),
2242
+ isObject = requireIsObject(),
2243
+ toKey = require_toKey();
2244
+
2245
+ /**
2246
+ * The base implementation of `_.set`.
2247
+ *
2248
+ * @private
2249
+ * @param {Object} object The object to modify.
2250
+ * @param {Array|string} path The path of the property to set.
2251
+ * @param {*} value The value to set.
2252
+ * @param {Function} [customizer] The function to customize path creation.
2253
+ * @returns {Object} Returns `object`.
2254
+ */
2255
+ function baseSet(object, path, value, customizer) {
2256
+ if (!isObject(object)) {
2257
+ return object;
2258
+ }
2259
+ path = castPath(path, object);
2260
+
2261
+ var index = -1,
2262
+ length = path.length,
2263
+ lastIndex = length - 1,
2264
+ nested = object;
2265
+
2266
+ while (nested != null && ++index < length) {
2267
+ var key = toKey(path[index]),
2268
+ newValue = value;
2269
+
2270
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
2271
+ return object;
2272
+ }
2273
+
2274
+ if (index != lastIndex) {
2275
+ var objValue = nested[key];
2276
+ newValue = customizer ? customizer(objValue, key, nested) : undefined;
2277
+ if (newValue === undefined) {
2278
+ newValue = isObject(objValue)
2279
+ ? objValue
2280
+ : (isIndex(path[index + 1]) ? [] : {});
2281
+ }
2282
+ }
2283
+ assignValue(nested, key, newValue);
2284
+ nested = nested[key];
2285
+ }
2286
+ return object;
2287
+ }
2288
+
2289
+ _baseSet = baseSet;
2290
+ return _baseSet;
2291
+ }
2292
+
2293
+ var set_1;
2294
+ var hasRequiredSet;
2295
+
2296
+ function requireSet () {
2297
+ if (hasRequiredSet) return set_1;
2298
+ hasRequiredSet = 1;
2299
+ var baseSet = require_baseSet();
2300
+
2301
+ /**
2302
+ * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
2303
+ * it's created. Arrays are created for missing index properties while objects
2304
+ * are created for all other missing properties. Use `_.setWith` to customize
2305
+ * `path` creation.
2306
+ *
2307
+ * **Note:** This method mutates `object`.
2308
+ *
2309
+ * @static
2310
+ * @memberOf _
2311
+ * @since 3.7.0
2312
+ * @category Object
2313
+ * @param {Object} object The object to modify.
2314
+ * @param {Array|string} path The path of the property to set.
2315
+ * @param {*} value The value to set.
2316
+ * @returns {Object} Returns `object`.
2317
+ * @example
2318
+ *
2319
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
2320
+ *
2321
+ * _.set(object, 'a[0].b.c', 4);
2322
+ * console.log(object.a[0].b.c);
2323
+ * // => 4
2324
+ *
2325
+ * _.set(object, ['x', '0', 'y', 'z'], 5);
2326
+ * console.log(object.x[0].y.z);
2327
+ * // => 5
2328
+ */
2329
+ function set(object, path, value) {
2330
+ return object == null ? object : baseSet(object, path, value);
2331
+ }
2332
+
2333
+ set_1 = set;
2334
+ return set_1;
2335
+ }
2336
+
2337
+ var setExports = requireSet();
2338
+ const set = /*@__PURE__*/getDefaultExportFromCjs(setExports);
2339
+
2340
+ function setByPath(data, path, value) {
2341
+ try {
2342
+ if (!isObject(data) && !isArray(data))
2343
+ throw new Error("bad data");
2344
+ set(data, path, value);
2345
+ }
2346
+ catch (error) {
2347
+ // eslint-disable-next-line no-console
2348
+ console.warn(error);
2349
+ }
2350
+ }
2351
+
2352
+ function jsonParse(json) {
2353
+ if (!isString(json))
2354
+ return null;
2355
+ try {
2356
+ return JSON.parse(json);
2357
+ }
2358
+ catch {
2359
+ return null;
2360
+ }
2361
+ }
2362
+
2363
+ const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
2364
+ function randomString(length = 10, allowCharacters = characters) {
2365
+ let result = "";
2366
+ let counter = 0;
2367
+ while (counter < length) {
2368
+ result += allowCharacters.charAt(Math.floor(Math.random() * allowCharacters.length));
2369
+ counter += 1;
2370
+ }
2371
+ return result;
2372
+ }
2373
+
2374
+ function wait(delay) {
2375
+ return new Promise((resolve) => {
2376
+ setTimeout(() => {
2377
+ resolve(true);
2378
+ }, delay);
2379
+ });
2380
+ }
2381
+
2382
+ function buildQueryString(params) {
2383
+ const queryString = [];
2384
+ for (const [key, value] of Object.entries(params)) {
2385
+ if (isObject(value) || value == undefined)
2386
+ continue;
2387
+ if (isArray(value)) {
2388
+ for (const item of value) {
2389
+ if (item != undefined && !isObject(item))
2390
+ queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(item))}`);
2391
+ }
2392
+ }
2393
+ else {
2394
+ queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
2395
+ }
2396
+ }
2397
+ return queryString.join("&");
2398
+ }
2399
+
2400
+ function createURLWithParams(options) {
2401
+ const url = options.baseURL.replace(/\/$/, "").replace(/\?$/, "");
2402
+ if (!options.params) {
2403
+ return url;
2404
+ }
2405
+ const queryString = buildQueryString(options.params);
2406
+ return `${url}?${queryString}`;
2407
+ }
2408
+
2409
+ function trimUrl(url) {
2410
+ return url.replace(/^\//, "").replace(/\/$/, "");
2411
+ }
2412
+
2413
+ function arrayToMapByKey(array, key) {
2414
+ const map = {};
2415
+ for (const item of array) {
2416
+ const keyValue = item[key];
2417
+ if (isId(keyValue))
2418
+ map[keyValue] = item;
2419
+ }
2420
+ return map;
2421
+ }
2422
+
2423
+ function syncObjectValues(oldObj, newObj, exception = []) {
2424
+ for (const field in newObj) {
2425
+ if (exception.includes(field))
2426
+ continue;
2427
+ const oldValue = getByPath(oldObj, field, undefined);
2428
+ const newValue = getByPath(newObj, field, undefined);
2429
+ if (isUndefined(oldValue) || isUndefined(newValue))
2430
+ continue;
2431
+ if (oldValue === newValue)
2432
+ continue;
2433
+ setByPath(oldObj, field, newValue);
2434
+ }
2435
+ }
2436
+
2437
+ function randomNumber(min, max) {
2438
+ min = Math.ceil(min);
2439
+ max = Math.floor(max);
2440
+ return Math.floor(Math.random() * (max - min) + min);
2441
+ }
2442
+
2443
+ const filenameVariables = ["filename=", "filename*=UTF-8''"];
2444
+ function getFileNameFromHeader(header) {
2445
+ const name = header
2446
+ .split(";")
2447
+ .find((info) => ~info.indexOf(filenameVariables[0]) || ~info.indexOf(filenameVariables[1]))
2448
+ ?.replace(filenameVariables[0], "")
2449
+ ?.replace(filenameVariables[1], "")
2450
+ ?.replace(/"/g, "")
2451
+ ?.trim();
2452
+ return name ? decodeURI(name) : null;
2453
+ }
2454
+
2455
+ function limitStreamOfRequests({ countRequests, maxCountInParallel, promiseGetter, refetchAfterError, resultCb, collectResult, maxTryCount = 3, }) {
2456
+ let isStopped = false;
2457
+ return {
2458
+ cancel: () => {
2459
+ isStopped = true;
2460
+ },
2461
+ promise: new Promise((resolve) => {
2462
+ let currentRequests = 0;
2463
+ let currentResponses = 0;
2464
+ const results = [];
2465
+ for (let i = 0; i < maxCountInParallel; i++) {
2466
+ request(promiseGetter(++currentRequests), currentRequests);
2467
+ }
2468
+ function request(promise, position, tryCount = 1) {
2469
+ if (isStopped)
2470
+ return void resolve(results);
2471
+ if (currentResponses === countRequests)
2472
+ return void resolve(results);
2473
+ if (position > countRequests || promise == undefined)
2474
+ return;
2475
+ promise
2476
+ .then((result) => {
2477
+ if (isStopped)
2478
+ return void resolve(results);
2479
+ if (collectResult)
2480
+ results.push(result);
2481
+ if (resultCb)
2482
+ resultCb(result);
2483
+ currentResponses++;
2484
+ request(promiseGetter(++currentRequests), currentRequests);
2485
+ })
2486
+ .catch(() => {
2487
+ if (isStopped)
2488
+ return void resolve(results);
2489
+ if (refetchAfterError && maxTryCount > tryCount) {
2490
+ void wait(1000).then(() => request(promiseGetter(position), position, tryCount + 1));
2491
+ }
2492
+ else {
2493
+ currentResponses++;
2494
+ request(promiseGetter(++currentRequests), currentRequests);
2495
+ }
2496
+ });
2497
+ }
2498
+ }),
2499
+ };
2500
+ }
2501
+
2502
+ const index$3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2503
+ __proto__: null,
2504
+ arrayToMapByKey,
2505
+ buildQueryString,
2506
+ createURLWithParams,
2507
+ fieldViewFormat,
2508
+ getByPath,
2509
+ getFileNameFromHeader,
2510
+ jsonParse,
2511
+ limitStreamOfRequests,
2512
+ randomNumber,
2513
+ randomString,
2514
+ setByPath,
2515
+ syncObjectValues,
2516
+ transformToNumber,
2517
+ trimUrl,
2518
+ wait,
2519
+ waitUntil
2520
+ }, Symbol.toStringTag, { value: 'Module' }));
2521
+
2522
+ function downloadFile({ data, fileName, mimeType }) {
2523
+ if (!IS_BROWSER && !IS_JEST)
2524
+ return null;
2525
+ const name = getFileNameFromHeader(fileName);
2526
+ if (!name)
2527
+ throw new Error("Bad filename");
2528
+ const blob = new Blob([data], {
2529
+ type: mimeType,
2530
+ });
2531
+ const downloadUrl = window.URL.createObjectURL(blob);
2532
+ const link = document.createElement("a");
2533
+ link.style.display = "none";
2534
+ link.download = name;
2535
+ link.href = downloadUrl;
2536
+ document.body.appendChild(link);
2537
+ link.click();
2538
+ document.body.removeChild(link);
2539
+ link.remove();
2540
+ window.URL.revokeObjectURL(downloadUrl);
2541
+ return null;
2542
+ }
2543
+
2544
+ function downloadJson(data, name) {
2545
+ if (!IS_BROWSER && !IS_JEST)
2546
+ return null;
2547
+ const url = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(data))}`;
2548
+ const link = document.createElement("a");
2549
+ link.style.display = "none";
2550
+ link.download = name;
2551
+ link.href = url;
2552
+ document.body.appendChild(link);
2553
+ link.click();
2554
+ document.body.removeChild(link);
2555
+ link.remove();
2556
+ }
2557
+
2558
+ function readFile(file) {
2559
+ return new Promise((resolve) => {
2560
+ if (!IS_BROWSER && !IS_JEST) {
2561
+ resolve(null);
2562
+ return;
2563
+ }
2564
+ const reader = new FileReader();
2565
+ reader.readAsText(file);
2566
+ reader.onload = () => {
2567
+ resolve(reader.result);
2568
+ };
2569
+ reader.onerror = () => {
2570
+ resolve(null);
2571
+ };
2572
+ });
2573
+ }
2574
+
2575
+ const index$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2576
+ __proto__: null,
2577
+ downloadFile,
2578
+ downloadJson,
2579
+ readFile
2580
+ }, Symbol.toStringTag, { value: 'Module' }));
2581
+
2582
+ const tokenRequest = async (options) => {
2583
+ try {
2584
+ const response = await fetch(options.authTokenUrl, {
2585
+ method: "GET",
2586
+ });
2587
+ if (!response.ok) {
2588
+ throw new Error(`HTTP error! Status: ${response.status}`);
2589
+ }
2590
+ const result = (await response.json());
2591
+ const { expiresToken, token } = transformData(result, options.pathToToken, options.pathToExpires);
2592
+ localStorage.setItem(options.storageExpiresTokenName, expiresToken);
2593
+ localStorage.setItem(options.storageTokenName, token);
2594
+ return token;
2595
+ }
2596
+ catch (error) {
2597
+ // eslint-disable-next-line no-console
2598
+ console.log(error);
2599
+ window.location.replace(options.authRedirectUrl);
2600
+ return null;
2601
+ }
2602
+ };
2603
+ function transformData(data, pathToToken, pathToExpires) {
2604
+ if (!isObject(data))
2605
+ throw new Error("Bad response data");
2606
+ const token = getByPath(data, pathToToken);
2607
+ const expiresToken = getByPath(data, pathToExpires);
2608
+ if ((!isString(expiresToken) && !isNumber(expiresToken)) || !isString(token))
2609
+ throw new Error("Bad response data");
2610
+ return {
2611
+ expiresToken: String(expiresToken),
2612
+ token,
2613
+ };
2614
+ }
2615
+
2616
+ let isFetchingAccessToken = false;
2617
+ const generateAuthMiddleWare = (options) => async (request) => {
2618
+ if (!options.authRedirectUrl ||
2619
+ !options.authRedirectUrl ||
2620
+ !options.storageExpiresTokenName ||
2621
+ !options.storageTokenName ||
2622
+ !options.pathToExpires ||
2623
+ !options.pathToToken) {
2624
+ // eslint-disable-next-line no-console
2625
+ console.error("Auth middleware hasn't required options");
2626
+ return;
2627
+ }
2628
+ const isSameOrigin = !request.path.includes("http") && !request.path.includes("https");
2629
+ if (request.token && !isSameOrigin) {
2630
+ request.headers = {
2631
+ ...request.headers,
2632
+ Authorization: `Bearer ${request.token}`,
2633
+ };
2634
+ return;
2635
+ }
2636
+ if (isFetchingAccessToken)
2637
+ await waitUntil(() => isFetchingAccessToken);
2638
+ const expires = localStorage.getItem(options.storageExpiresTokenName);
2639
+ let token = localStorage.getItem(options.storageTokenName);
2640
+ if (!expires || Date.now() > +expires || !token) {
2641
+ isFetchingAccessToken = true;
2642
+ token = await tokenRequest(options);
2643
+ isFetchingAccessToken = false;
2644
+ }
2645
+ if (!isSameOrigin)
2646
+ request.headers = {
2647
+ ...request.headers,
2648
+ Authorization: `Bearer ${token}`,
2649
+ };
2650
+ };
2651
+
2652
+ const consoleMiddleware = (response) => {
2653
+ return new Promise((resolve) => {
2654
+ // eslint-disable-next-line no-console
2655
+ console.log(response);
2656
+ resolve(true);
2657
+ });
2658
+ };
2659
+
2660
+ function generateMiddlewares(activeMiddlewares, middlewareOptions) {
2661
+ const selectedMiddlewares = [];
2662
+ for (const key of activeMiddlewares) {
2663
+ switch (key) {
2664
+ case API_MIDDLEWARES.Auth: {
2665
+ if (middlewareOptions.auth && (IS_BROWSER || IS_JEST))
2666
+ selectedMiddlewares.push(generateAuthMiddleWare(middlewareOptions.auth));
2667
+ continue;
2668
+ }
2669
+ case API_MIDDLEWARES.Logger: {
2670
+ selectedMiddlewares.push(consoleMiddleware);
2671
+ continue;
2672
+ }
2673
+ default: {
2674
+ continue;
2675
+ }
2676
+ }
2677
+ }
2678
+ return function executeMiddlewares(request) {
2679
+ return new Promise((resolve) => {
2680
+ void (async () => {
2681
+ for (const middleware of selectedMiddlewares) {
2682
+ // eslint-disable-next-line no-await-in-loop
2683
+ await middleware(request);
2684
+ }
2685
+ resolve(1);
2686
+ })();
2687
+ });
2688
+ };
2689
+ }
2690
+
2691
+ class ResponseError extends Error {
2692
+ status;
2693
+ description;
2694
+ constructor({ message, status, description }) {
2695
+ super(message);
2696
+ this.status = status;
2697
+ this.description = description;
2698
+ }
2699
+ }
2700
+ function generateRequestsInstance(activeMiddlewares, middlewareOptions) {
2701
+ const executeMiddlewares = generateMiddlewares(activeMiddlewares || [], middlewareOptions || {});
2702
+ async function handleRequest(request, responseWithStatus) {
2703
+ if (request.delay) {
2704
+ await wait(request.delay);
2705
+ }
2706
+ if (request.mock) {
2707
+ const transformedResult = request.transformIncomingData
2708
+ ? request.transformIncomingData(request.mock)
2709
+ : request.mock;
2710
+ return responseWithStatus ? { data: transformedResult, status: 200 } : transformedResult;
2711
+ }
2712
+ await executeMiddlewares(request);
2713
+ const { method, body, path, params, headers } = request;
2714
+ const trimedPath = path.replace(/^\//, "").replace(/\/$/, "");
2715
+ const fullPath = trimedPath.includes("http") || trimedPath.includes("https")
2716
+ ? trimedPath
2717
+ : `${window.location.origin}/${trimedPath}`;
2718
+ const url = createURLWithParams({ baseURL: fullPath, params });
2719
+ let preparedBody = body;
2720
+ if (body && !(preparedBody instanceof FormData)) {
2721
+ if (request.transformOutcomingData) {
2722
+ preparedBody = request.transformOutcomingData(body);
2723
+ }
2724
+ if (isObject(body) || isArray(body))
2725
+ preparedBody = JSON.stringify(preparedBody);
2726
+ }
2727
+ let response;
2728
+ if (IS_BROWSER || IS_JEST) {
2729
+ response = await fetch(url, {
2730
+ method,
2731
+ body: preparedBody,
2732
+ headers: {
2733
+ ...(body instanceof FormData
2734
+ ? {}
2735
+ : { "Content-Type": "application/json; charset=UTF-8" }),
2736
+ ...headers,
2737
+ },
2738
+ signal: request.signal,
2739
+ });
2740
+ }
2741
+ if (IS_NODE && !IS_JEST) {
2742
+ const nodeFetch = (await import('node-fetch')).default;
2743
+ response = await nodeFetch(url, {
2744
+ method,
2745
+ body: preparedBody,
2746
+ headers: {
2747
+ ...(body instanceof FormData
2748
+ ? {}
2749
+ : { "Content-Type": "application/json; charset=UTF-8" }),
2750
+ ...headers,
2751
+ },
2752
+ signal: request.signal,
2753
+ });
2754
+ }
2755
+ if (!response) {
2756
+ throw new Error("hasn't response");
2757
+ }
2758
+ if (!response.ok) {
2759
+ throw new ResponseError({
2760
+ status: response.status,
2761
+ message: `HTTP error! Status: ${response.status}`,
2762
+ });
2763
+ }
2764
+ if (request.downloadFile) {
2765
+ const data = await response.blob();
2766
+ const mimeType = response.headers.get("content-type");
2767
+ const fileName = response.headers.get("content-disposition");
2768
+ if (!mimeType || !fileName)
2769
+ throw new Error("Download Error! Empty info!");
2770
+ if (IS_BROWSER)
2771
+ downloadFile({
2772
+ data,
2773
+ fileName,
2774
+ mimeType,
2775
+ });
2776
+ return responseWithStatus
2777
+ ? {
2778
+ data: data,
2779
+ status: response.status,
2780
+ }
2781
+ : data;
2782
+ }
2783
+ if (request.withoutResponse)
2784
+ return responseWithStatus ? { data: true, status: response.status } : true;
2785
+ const result = (await response.json());
2786
+ const transformedResult = request.transformIncomingData
2787
+ ? request.transformIncomingData(result)
2788
+ : result;
2789
+ return responseWithStatus
2790
+ ? { data: transformedResult, status: response.status }
2791
+ : transformedResult;
2792
+ }
2793
+ async function requestApi(request) {
2794
+ return handleRequest(request, false);
2795
+ }
2796
+ async function requestApiWithStatus(request) {
2797
+ return handleRequest(request, true);
2798
+ }
2799
+ return {
2800
+ requestApi,
2801
+ requestApiWithStatus,
2802
+ };
2803
+ }
2804
+
2805
+ const index$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2806
+ __proto__: null,
2807
+ ResponseError,
2808
+ generateRequestsInstance
2809
+ }, Symbol.toStringTag, { value: 'Module' }));
2810
+
2811
+ function getColorFormat(color) {
2812
+ if (color.startsWith("#")) {
2813
+ return COLOR_FORMATS.Hex;
2814
+ }
2815
+ if (color.startsWith("rgba")) {
2816
+ return COLOR_FORMATS.Rgba;
2817
+ }
2818
+ if (color.startsWith("rgb")) {
2819
+ return COLOR_FORMATS.Rgb;
2820
+ }
2821
+ if (color.startsWith("hsl")) {
2822
+ return COLOR_FORMATS.Hsl;
2823
+ }
2824
+ }
2825
+
2826
+ function transformHEXtoRGB(hex) {
2827
+ return `rgb(${hex.match(/\w\w/g)?.map((x) => +`0x${x}`)})`;
2828
+ }
2829
+
2830
+ function transformRGBtoRGBA(rgb, opacity) {
2831
+ const code = rgb.match(/\d+/g);
2832
+ code?.push(String(opacity / 100));
2833
+ return `rgba(${code?.join(",")})`;
2834
+ }
2835
+
2836
+ function transformRGBAtoRGB(rgba) {
2837
+ const code = rgba.match(/\d+/g);
2838
+ code?.splice(3);
2839
+ return `rgb(${code?.join(",")})`;
2840
+ }
2841
+
2842
+ function takeOpacityColors(color, opacities) {
2843
+ let rgbColor = color;
2844
+ if (!rgbColor)
2845
+ return [];
2846
+ if (getColorFormat(rgbColor) === COLOR_FORMATS.Hex) {
2847
+ rgbColor = transformHEXtoRGB(rgbColor);
2848
+ }
2849
+ else if (getColorFormat(rgbColor) === COLOR_FORMATS.Rgba) {
2850
+ rgbColor = transformRGBAtoRGB(rgbColor);
2851
+ }
2852
+ if (getColorFormat(rgbColor) !== COLOR_FORMATS.Rgb)
2853
+ return [];
2854
+ return [...opacities.map((opacity) => transformRGBtoRGBA(rgbColor, opacity))];
2855
+ }
2856
+
2857
+ function transformToColor(currentColor, defaultColor = "black", defaultFormat = COLOR_FORMATS.Hex) {
2858
+ if (!isString(currentColor))
2859
+ return defaultColor;
2860
+ let correctColor = currentColor;
2861
+ if (!getColorFormat(correctColor)) {
2862
+ switch (defaultFormat) {
2863
+ case COLOR_FORMATS.Hex: {
2864
+ correctColor = `#${correctColor}`;
2865
+ break;
2866
+ }
2867
+ case COLOR_FORMATS.Rgb: {
2868
+ correctColor = `rgb(${correctColor})`;
2869
+ break;
2870
+ }
2871
+ case COLOR_FORMATS.Rgba: {
2872
+ correctColor = `rgba(${correctColor})`;
2873
+ break;
2874
+ }
2875
+ case COLOR_FORMATS.Hsl: {
2876
+ correctColor = `hsl(${correctColor})`;
2877
+ break;
2878
+ }
2879
+ default: {
2880
+ correctColor = `#${correctColor}`;
2881
+ break;
2882
+ }
2883
+ }
2884
+ }
2885
+ return correctColor;
2886
+ }
2887
+
2888
+ const index = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2889
+ __proto__: null,
2890
+ getColorFormat,
2891
+ takeOpacityColors,
2892
+ transformHEXtoRGB,
2893
+ transformRGBAtoRGB,
2894
+ transformRGBtoRGBA,
2895
+ transformToColor
2896
+ }, Symbol.toStringTag, { value: 'Module' }));
2897
+
2898
+ const libs = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2899
+ __proto__: null,
2900
+ api: index$1,
2901
+ browser: index$2,
2902
+ colors: index,
2903
+ constants: index$6,
2904
+ date: index$4,
2905
+ utils: index$3
2906
+ }, Symbol.toStringTag, { value: 'Module' }));
2907
+
2908
+ export { libs as helpers, index$5 as typings };
2909
+ //# sourceMappingURL=index.js.map