UNPKG

342 kBJavaScriptView Raw
1/**
2 * vue-good-table v2.21.6
3 * (c) 2018-present xaksis <shay@crayonbits.com>
4 * https://github.com/xaksis/vue-good-table
5 * Released under the MIT License.
6 */
7
8(function (global, factory) {
9 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
10 typeof define === 'function' && define.amd ? define(['exports'], factory) :
11 (global = global || self, factory(global['vue-good-table'] = {}));
12}(this, (function (exports) { 'use strict';
13
14 function _typeof(obj) {
15 "@babel/helpers - typeof";
16
17 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
18 _typeof = function (obj) {
19 return typeof obj;
20 };
21 } else {
22 _typeof = function (obj) {
23 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
24 };
25 }
26
27 return _typeof(obj);
28 }
29
30 function _defineProperty(obj, key, value) {
31 if (key in obj) {
32 Object.defineProperty(obj, key, {
33 value: value,
34 enumerable: true,
35 configurable: true,
36 writable: true
37 });
38 } else {
39 obj[key] = value;
40 }
41
42 return obj;
43 }
44
45 function _slicedToArray(arr, i) {
46 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
47 }
48
49 function _toConsumableArray(arr) {
50 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
51 }
52
53 function _arrayWithoutHoles(arr) {
54 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
55 }
56
57 function _arrayWithHoles(arr) {
58 if (Array.isArray(arr)) return arr;
59 }
60
61 function _iterableToArray(iter) {
62 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
63 }
64
65 function _iterableToArrayLimit(arr, i) {
66 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
67 var _arr = [];
68 var _n = true;
69 var _d = false;
70 var _e = undefined;
71
72 try {
73 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
74 _arr.push(_s.value);
75
76 if (i && _arr.length === i) break;
77 }
78 } catch (err) {
79 _d = true;
80 _e = err;
81 } finally {
82 try {
83 if (!_n && _i["return"] != null) _i["return"]();
84 } finally {
85 if (_d) throw _e;
86 }
87 }
88
89 return _arr;
90 }
91
92 function _unsupportedIterableToArray(o, minLen) {
93 if (!o) return;
94 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
95 var n = Object.prototype.toString.call(o).slice(8, -1);
96 if (n === "Object" && o.constructor) n = o.constructor.name;
97 if (n === "Map" || n === "Set") return Array.from(o);
98 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
99 }
100
101 function _arrayLikeToArray(arr, len) {
102 if (len == null || len > arr.length) len = arr.length;
103
104 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
105
106 return arr2;
107 }
108
109 function _nonIterableSpread() {
110 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
111 }
112
113 function _nonIterableRest() {
114 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
115 }
116
117 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
118
119 function createCommonjsModule(fn, module) {
120 return module = { exports: {} }, fn(module, module.exports), module.exports;
121 }
122
123 var lodash_isequal = createCommonjsModule(function (module, exports) {
124 /**
125 * Lodash (Custom Build) <https://lodash.com/>
126 * Build: `lodash modularize exports="npm" -o ./`
127 * Copyright JS Foundation and other contributors <https://js.foundation/>
128 * Released under MIT license <https://lodash.com/license>
129 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
130 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
131 */
132
133 /** Used as the size to enable large array optimizations. */
134 var LARGE_ARRAY_SIZE = 200;
135
136 /** Used to stand-in for `undefined` hash values. */
137 var HASH_UNDEFINED = '__lodash_hash_undefined__';
138
139 /** Used to compose bitmasks for value comparisons. */
140 var COMPARE_PARTIAL_FLAG = 1,
141 COMPARE_UNORDERED_FLAG = 2;
142
143 /** Used as references for various `Number` constants. */
144 var MAX_SAFE_INTEGER = 9007199254740991;
145
146 /** `Object#toString` result references. */
147 var argsTag = '[object Arguments]',
148 arrayTag = '[object Array]',
149 asyncTag = '[object AsyncFunction]',
150 boolTag = '[object Boolean]',
151 dateTag = '[object Date]',
152 errorTag = '[object Error]',
153 funcTag = '[object Function]',
154 genTag = '[object GeneratorFunction]',
155 mapTag = '[object Map]',
156 numberTag = '[object Number]',
157 nullTag = '[object Null]',
158 objectTag = '[object Object]',
159 promiseTag = '[object Promise]',
160 proxyTag = '[object Proxy]',
161 regexpTag = '[object RegExp]',
162 setTag = '[object Set]',
163 stringTag = '[object String]',
164 symbolTag = '[object Symbol]',
165 undefinedTag = '[object Undefined]',
166 weakMapTag = '[object WeakMap]';
167
168 var arrayBufferTag = '[object ArrayBuffer]',
169 dataViewTag = '[object DataView]',
170 float32Tag = '[object Float32Array]',
171 float64Tag = '[object Float64Array]',
172 int8Tag = '[object Int8Array]',
173 int16Tag = '[object Int16Array]',
174 int32Tag = '[object Int32Array]',
175 uint8Tag = '[object Uint8Array]',
176 uint8ClampedTag = '[object Uint8ClampedArray]',
177 uint16Tag = '[object Uint16Array]',
178 uint32Tag = '[object Uint32Array]';
179
180 /**
181 * Used to match `RegExp`
182 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
183 */
184 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
185
186 /** Used to detect host constructors (Safari). */
187 var reIsHostCtor = /^\[object .+?Constructor\]$/;
188
189 /** Used to detect unsigned integer values. */
190 var reIsUint = /^(?:0|[1-9]\d*)$/;
191
192 /** Used to identify `toStringTag` values of typed arrays. */
193 var typedArrayTags = {};
194 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
195 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
196 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
197 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
198 typedArrayTags[uint32Tag] = true;
199 typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
200 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
201 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
202 typedArrayTags[errorTag] = typedArrayTags[funcTag] =
203 typedArrayTags[mapTag] = typedArrayTags[numberTag] =
204 typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
205 typedArrayTags[setTag] = typedArrayTags[stringTag] =
206 typedArrayTags[weakMapTag] = false;
207
208 /** Detect free variable `global` from Node.js. */
209 var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
210
211 /** Detect free variable `self`. */
212 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
213
214 /** Used as a reference to the global object. */
215 var root = freeGlobal || freeSelf || Function('return this')();
216
217 /** Detect free variable `exports`. */
218 var freeExports = exports && !exports.nodeType && exports;
219
220 /** Detect free variable `module`. */
221 var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
222
223 /** Detect the popular CommonJS extension `module.exports`. */
224 var moduleExports = freeModule && freeModule.exports === freeExports;
225
226 /** Detect free variable `process` from Node.js. */
227 var freeProcess = moduleExports && freeGlobal.process;
228
229 /** Used to access faster Node.js helpers. */
230 var nodeUtil = (function() {
231 try {
232 return freeProcess && freeProcess.binding && freeProcess.binding('util');
233 } catch (e) {}
234 }());
235
236 /* Node.js helper references. */
237 var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
238
239 /**
240 * A specialized version of `_.filter` for arrays without support for
241 * iteratee shorthands.
242 *
243 * @private
244 * @param {Array} [array] The array to iterate over.
245 * @param {Function} predicate The function invoked per iteration.
246 * @returns {Array} Returns the new filtered array.
247 */
248 function arrayFilter(array, predicate) {
249 var index = -1,
250 length = array == null ? 0 : array.length,
251 resIndex = 0,
252 result = [];
253
254 while (++index < length) {
255 var value = array[index];
256 if (predicate(value, index, array)) {
257 result[resIndex++] = value;
258 }
259 }
260 return result;
261 }
262
263 /**
264 * Appends the elements of `values` to `array`.
265 *
266 * @private
267 * @param {Array} array The array to modify.
268 * @param {Array} values The values to append.
269 * @returns {Array} Returns `array`.
270 */
271 function arrayPush(array, values) {
272 var index = -1,
273 length = values.length,
274 offset = array.length;
275
276 while (++index < length) {
277 array[offset + index] = values[index];
278 }
279 return array;
280 }
281
282 /**
283 * A specialized version of `_.some` for arrays without support for iteratee
284 * shorthands.
285 *
286 * @private
287 * @param {Array} [array] The array to iterate over.
288 * @param {Function} predicate The function invoked per iteration.
289 * @returns {boolean} Returns `true` if any element passes the predicate check,
290 * else `false`.
291 */
292 function arraySome(array, predicate) {
293 var index = -1,
294 length = array == null ? 0 : array.length;
295
296 while (++index < length) {
297 if (predicate(array[index], index, array)) {
298 return true;
299 }
300 }
301 return false;
302 }
303
304 /**
305 * The base implementation of `_.times` without support for iteratee shorthands
306 * or max array length checks.
307 *
308 * @private
309 * @param {number} n The number of times to invoke `iteratee`.
310 * @param {Function} iteratee The function invoked per iteration.
311 * @returns {Array} Returns the array of results.
312 */
313 function baseTimes(n, iteratee) {
314 var index = -1,
315 result = Array(n);
316
317 while (++index < n) {
318 result[index] = iteratee(index);
319 }
320 return result;
321 }
322
323 /**
324 * The base implementation of `_.unary` without support for storing metadata.
325 *
326 * @private
327 * @param {Function} func The function to cap arguments for.
328 * @returns {Function} Returns the new capped function.
329 */
330 function baseUnary(func) {
331 return function(value) {
332 return func(value);
333 };
334 }
335
336 /**
337 * Checks if a `cache` value for `key` exists.
338 *
339 * @private
340 * @param {Object} cache The cache to query.
341 * @param {string} key The key of the entry to check.
342 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
343 */
344 function cacheHas(cache, key) {
345 return cache.has(key);
346 }
347
348 /**
349 * Gets the value at `key` of `object`.
350 *
351 * @private
352 * @param {Object} [object] The object to query.
353 * @param {string} key The key of the property to get.
354 * @returns {*} Returns the property value.
355 */
356 function getValue(object, key) {
357 return object == null ? undefined : object[key];
358 }
359
360 /**
361 * Converts `map` to its key-value pairs.
362 *
363 * @private
364 * @param {Object} map The map to convert.
365 * @returns {Array} Returns the key-value pairs.
366 */
367 function mapToArray(map) {
368 var index = -1,
369 result = Array(map.size);
370
371 map.forEach(function(value, key) {
372 result[++index] = [key, value];
373 });
374 return result;
375 }
376
377 /**
378 * Creates a unary function that invokes `func` with its argument transformed.
379 *
380 * @private
381 * @param {Function} func The function to wrap.
382 * @param {Function} transform The argument transform.
383 * @returns {Function} Returns the new function.
384 */
385 function overArg(func, transform) {
386 return function(arg) {
387 return func(transform(arg));
388 };
389 }
390
391 /**
392 * Converts `set` to an array of its values.
393 *
394 * @private
395 * @param {Object} set The set to convert.
396 * @returns {Array} Returns the values.
397 */
398 function setToArray(set) {
399 var index = -1,
400 result = Array(set.size);
401
402 set.forEach(function(value) {
403 result[++index] = value;
404 });
405 return result;
406 }
407
408 /** Used for built-in method references. */
409 var arrayProto = Array.prototype,
410 funcProto = Function.prototype,
411 objectProto = Object.prototype;
412
413 /** Used to detect overreaching core-js shims. */
414 var coreJsData = root['__core-js_shared__'];
415
416 /** Used to resolve the decompiled source of functions. */
417 var funcToString = funcProto.toString;
418
419 /** Used to check objects for own properties. */
420 var hasOwnProperty = objectProto.hasOwnProperty;
421
422 /** Used to detect methods masquerading as native. */
423 var maskSrcKey = (function() {
424 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
425 return uid ? ('Symbol(src)_1.' + uid) : '';
426 }());
427
428 /**
429 * Used to resolve the
430 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
431 * of values.
432 */
433 var nativeObjectToString = objectProto.toString;
434
435 /** Used to detect if a method is native. */
436 var reIsNative = RegExp('^' +
437 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
438 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
439 );
440
441 /** Built-in value references. */
442 var Buffer = moduleExports ? root.Buffer : undefined,
443 Symbol = root.Symbol,
444 Uint8Array = root.Uint8Array,
445 propertyIsEnumerable = objectProto.propertyIsEnumerable,
446 splice = arrayProto.splice,
447 symToStringTag = Symbol ? Symbol.toStringTag : undefined;
448
449 /* Built-in method references for those with the same name as other `lodash` methods. */
450 var nativeGetSymbols = Object.getOwnPropertySymbols,
451 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
452 nativeKeys = overArg(Object.keys, Object);
453
454 /* Built-in method references that are verified to be native. */
455 var DataView = getNative(root, 'DataView'),
456 Map = getNative(root, 'Map'),
457 Promise = getNative(root, 'Promise'),
458 Set = getNative(root, 'Set'),
459 WeakMap = getNative(root, 'WeakMap'),
460 nativeCreate = getNative(Object, 'create');
461
462 /** Used to detect maps, sets, and weakmaps. */
463 var dataViewCtorString = toSource(DataView),
464 mapCtorString = toSource(Map),
465 promiseCtorString = toSource(Promise),
466 setCtorString = toSource(Set),
467 weakMapCtorString = toSource(WeakMap);
468
469 /** Used to convert symbols to primitives and strings. */
470 var symbolProto = Symbol ? Symbol.prototype : undefined,
471 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
472
473 /**
474 * Creates a hash object.
475 *
476 * @private
477 * @constructor
478 * @param {Array} [entries] The key-value pairs to cache.
479 */
480 function Hash(entries) {
481 var index = -1,
482 length = entries == null ? 0 : entries.length;
483
484 this.clear();
485 while (++index < length) {
486 var entry = entries[index];
487 this.set(entry[0], entry[1]);
488 }
489 }
490
491 /**
492 * Removes all key-value entries from the hash.
493 *
494 * @private
495 * @name clear
496 * @memberOf Hash
497 */
498 function hashClear() {
499 this.__data__ = nativeCreate ? nativeCreate(null) : {};
500 this.size = 0;
501 }
502
503 /**
504 * Removes `key` and its value from the hash.
505 *
506 * @private
507 * @name delete
508 * @memberOf Hash
509 * @param {Object} hash The hash to modify.
510 * @param {string} key The key of the value to remove.
511 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
512 */
513 function hashDelete(key) {
514 var result = this.has(key) && delete this.__data__[key];
515 this.size -= result ? 1 : 0;
516 return result;
517 }
518
519 /**
520 * Gets the hash value for `key`.
521 *
522 * @private
523 * @name get
524 * @memberOf Hash
525 * @param {string} key The key of the value to get.
526 * @returns {*} Returns the entry value.
527 */
528 function hashGet(key) {
529 var data = this.__data__;
530 if (nativeCreate) {
531 var result = data[key];
532 return result === HASH_UNDEFINED ? undefined : result;
533 }
534 return hasOwnProperty.call(data, key) ? data[key] : undefined;
535 }
536
537 /**
538 * Checks if a hash value for `key` exists.
539 *
540 * @private
541 * @name has
542 * @memberOf Hash
543 * @param {string} key The key of the entry to check.
544 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
545 */
546 function hashHas(key) {
547 var data = this.__data__;
548 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
549 }
550
551 /**
552 * Sets the hash `key` to `value`.
553 *
554 * @private
555 * @name set
556 * @memberOf Hash
557 * @param {string} key The key of the value to set.
558 * @param {*} value The value to set.
559 * @returns {Object} Returns the hash instance.
560 */
561 function hashSet(key, value) {
562 var data = this.__data__;
563 this.size += this.has(key) ? 0 : 1;
564 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
565 return this;
566 }
567
568 // Add methods to `Hash`.
569 Hash.prototype.clear = hashClear;
570 Hash.prototype['delete'] = hashDelete;
571 Hash.prototype.get = hashGet;
572 Hash.prototype.has = hashHas;
573 Hash.prototype.set = hashSet;
574
575 /**
576 * Creates an list cache object.
577 *
578 * @private
579 * @constructor
580 * @param {Array} [entries] The key-value pairs to cache.
581 */
582 function ListCache(entries) {
583 var index = -1,
584 length = entries == null ? 0 : entries.length;
585
586 this.clear();
587 while (++index < length) {
588 var entry = entries[index];
589 this.set(entry[0], entry[1]);
590 }
591 }
592
593 /**
594 * Removes all key-value entries from the list cache.
595 *
596 * @private
597 * @name clear
598 * @memberOf ListCache
599 */
600 function listCacheClear() {
601 this.__data__ = [];
602 this.size = 0;
603 }
604
605 /**
606 * Removes `key` and its value from the list cache.
607 *
608 * @private
609 * @name delete
610 * @memberOf ListCache
611 * @param {string} key The key of the value to remove.
612 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
613 */
614 function listCacheDelete(key) {
615 var data = this.__data__,
616 index = assocIndexOf(data, key);
617
618 if (index < 0) {
619 return false;
620 }
621 var lastIndex = data.length - 1;
622 if (index == lastIndex) {
623 data.pop();
624 } else {
625 splice.call(data, index, 1);
626 }
627 --this.size;
628 return true;
629 }
630
631 /**
632 * Gets the list cache value for `key`.
633 *
634 * @private
635 * @name get
636 * @memberOf ListCache
637 * @param {string} key The key of the value to get.
638 * @returns {*} Returns the entry value.
639 */
640 function listCacheGet(key) {
641 var data = this.__data__,
642 index = assocIndexOf(data, key);
643
644 return index < 0 ? undefined : data[index][1];
645 }
646
647 /**
648 * Checks if a list cache value for `key` exists.
649 *
650 * @private
651 * @name has
652 * @memberOf ListCache
653 * @param {string} key The key of the entry to check.
654 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
655 */
656 function listCacheHas(key) {
657 return assocIndexOf(this.__data__, key) > -1;
658 }
659
660 /**
661 * Sets the list cache `key` to `value`.
662 *
663 * @private
664 * @name set
665 * @memberOf ListCache
666 * @param {string} key The key of the value to set.
667 * @param {*} value The value to set.
668 * @returns {Object} Returns the list cache instance.
669 */
670 function listCacheSet(key, value) {
671 var data = this.__data__,
672 index = assocIndexOf(data, key);
673
674 if (index < 0) {
675 ++this.size;
676 data.push([key, value]);
677 } else {
678 data[index][1] = value;
679 }
680 return this;
681 }
682
683 // Add methods to `ListCache`.
684 ListCache.prototype.clear = listCacheClear;
685 ListCache.prototype['delete'] = listCacheDelete;
686 ListCache.prototype.get = listCacheGet;
687 ListCache.prototype.has = listCacheHas;
688 ListCache.prototype.set = listCacheSet;
689
690 /**
691 * Creates a map cache object to store key-value pairs.
692 *
693 * @private
694 * @constructor
695 * @param {Array} [entries] The key-value pairs to cache.
696 */
697 function MapCache(entries) {
698 var index = -1,
699 length = entries == null ? 0 : entries.length;
700
701 this.clear();
702 while (++index < length) {
703 var entry = entries[index];
704 this.set(entry[0], entry[1]);
705 }
706 }
707
708 /**
709 * Removes all key-value entries from the map.
710 *
711 * @private
712 * @name clear
713 * @memberOf MapCache
714 */
715 function mapCacheClear() {
716 this.size = 0;
717 this.__data__ = {
718 'hash': new Hash,
719 'map': new (Map || ListCache),
720 'string': new Hash
721 };
722 }
723
724 /**
725 * Removes `key` and its value from the map.
726 *
727 * @private
728 * @name delete
729 * @memberOf MapCache
730 * @param {string} key The key of the value to remove.
731 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
732 */
733 function mapCacheDelete(key) {
734 var result = getMapData(this, key)['delete'](key);
735 this.size -= result ? 1 : 0;
736 return result;
737 }
738
739 /**
740 * Gets the map value for `key`.
741 *
742 * @private
743 * @name get
744 * @memberOf MapCache
745 * @param {string} key The key of the value to get.
746 * @returns {*} Returns the entry value.
747 */
748 function mapCacheGet(key) {
749 return getMapData(this, key).get(key);
750 }
751
752 /**
753 * Checks if a map value for `key` exists.
754 *
755 * @private
756 * @name has
757 * @memberOf MapCache
758 * @param {string} key The key of the entry to check.
759 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
760 */
761 function mapCacheHas(key) {
762 return getMapData(this, key).has(key);
763 }
764
765 /**
766 * Sets the map `key` to `value`.
767 *
768 * @private
769 * @name set
770 * @memberOf MapCache
771 * @param {string} key The key of the value to set.
772 * @param {*} value The value to set.
773 * @returns {Object} Returns the map cache instance.
774 */
775 function mapCacheSet(key, value) {
776 var data = getMapData(this, key),
777 size = data.size;
778
779 data.set(key, value);
780 this.size += data.size == size ? 0 : 1;
781 return this;
782 }
783
784 // Add methods to `MapCache`.
785 MapCache.prototype.clear = mapCacheClear;
786 MapCache.prototype['delete'] = mapCacheDelete;
787 MapCache.prototype.get = mapCacheGet;
788 MapCache.prototype.has = mapCacheHas;
789 MapCache.prototype.set = mapCacheSet;
790
791 /**
792 *
793 * Creates an array cache object to store unique values.
794 *
795 * @private
796 * @constructor
797 * @param {Array} [values] The values to cache.
798 */
799 function SetCache(values) {
800 var index = -1,
801 length = values == null ? 0 : values.length;
802
803 this.__data__ = new MapCache;
804 while (++index < length) {
805 this.add(values[index]);
806 }
807 }
808
809 /**
810 * Adds `value` to the array cache.
811 *
812 * @private
813 * @name add
814 * @memberOf SetCache
815 * @alias push
816 * @param {*} value The value to cache.
817 * @returns {Object} Returns the cache instance.
818 */
819 function setCacheAdd(value) {
820 this.__data__.set(value, HASH_UNDEFINED);
821 return this;
822 }
823
824 /**
825 * Checks if `value` is in the array cache.
826 *
827 * @private
828 * @name has
829 * @memberOf SetCache
830 * @param {*} value The value to search for.
831 * @returns {number} Returns `true` if `value` is found, else `false`.
832 */
833 function setCacheHas(value) {
834 return this.__data__.has(value);
835 }
836
837 // Add methods to `SetCache`.
838 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
839 SetCache.prototype.has = setCacheHas;
840
841 /**
842 * Creates a stack cache object to store key-value pairs.
843 *
844 * @private
845 * @constructor
846 * @param {Array} [entries] The key-value pairs to cache.
847 */
848 function Stack(entries) {
849 var data = this.__data__ = new ListCache(entries);
850 this.size = data.size;
851 }
852
853 /**
854 * Removes all key-value entries from the stack.
855 *
856 * @private
857 * @name clear
858 * @memberOf Stack
859 */
860 function stackClear() {
861 this.__data__ = new ListCache;
862 this.size = 0;
863 }
864
865 /**
866 * Removes `key` and its value from the stack.
867 *
868 * @private
869 * @name delete
870 * @memberOf Stack
871 * @param {string} key The key of the value to remove.
872 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
873 */
874 function stackDelete(key) {
875 var data = this.__data__,
876 result = data['delete'](key);
877
878 this.size = data.size;
879 return result;
880 }
881
882 /**
883 * Gets the stack value for `key`.
884 *
885 * @private
886 * @name get
887 * @memberOf Stack
888 * @param {string} key The key of the value to get.
889 * @returns {*} Returns the entry value.
890 */
891 function stackGet(key) {
892 return this.__data__.get(key);
893 }
894
895 /**
896 * Checks if a stack value for `key` exists.
897 *
898 * @private
899 * @name has
900 * @memberOf Stack
901 * @param {string} key The key of the entry to check.
902 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
903 */
904 function stackHas(key) {
905 return this.__data__.has(key);
906 }
907
908 /**
909 * Sets the stack `key` to `value`.
910 *
911 * @private
912 * @name set
913 * @memberOf Stack
914 * @param {string} key The key of the value to set.
915 * @param {*} value The value to set.
916 * @returns {Object} Returns the stack cache instance.
917 */
918 function stackSet(key, value) {
919 var data = this.__data__;
920 if (data instanceof ListCache) {
921 var pairs = data.__data__;
922 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
923 pairs.push([key, value]);
924 this.size = ++data.size;
925 return this;
926 }
927 data = this.__data__ = new MapCache(pairs);
928 }
929 data.set(key, value);
930 this.size = data.size;
931 return this;
932 }
933
934 // Add methods to `Stack`.
935 Stack.prototype.clear = stackClear;
936 Stack.prototype['delete'] = stackDelete;
937 Stack.prototype.get = stackGet;
938 Stack.prototype.has = stackHas;
939 Stack.prototype.set = stackSet;
940
941 /**
942 * Creates an array of the enumerable property names of the array-like `value`.
943 *
944 * @private
945 * @param {*} value The value to query.
946 * @param {boolean} inherited Specify returning inherited property names.
947 * @returns {Array} Returns the array of property names.
948 */
949 function arrayLikeKeys(value, inherited) {
950 var isArr = isArray(value),
951 isArg = !isArr && isArguments(value),
952 isBuff = !isArr && !isArg && isBuffer(value),
953 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
954 skipIndexes = isArr || isArg || isBuff || isType,
955 result = skipIndexes ? baseTimes(value.length, String) : [],
956 length = result.length;
957
958 for (var key in value) {
959 if ((inherited || hasOwnProperty.call(value, key)) &&
960 !(skipIndexes && (
961 // Safari 9 has enumerable `arguments.length` in strict mode.
962 key == 'length' ||
963 // Node.js 0.10 has enumerable non-index properties on buffers.
964 (isBuff && (key == 'offset' || key == 'parent')) ||
965 // PhantomJS 2 has enumerable non-index properties on typed arrays.
966 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
967 // Skip index properties.
968 isIndex(key, length)
969 ))) {
970 result.push(key);
971 }
972 }
973 return result;
974 }
975
976 /**
977 * Gets the index at which the `key` is found in `array` of key-value pairs.
978 *
979 * @private
980 * @param {Array} array The array to inspect.
981 * @param {*} key The key to search for.
982 * @returns {number} Returns the index of the matched value, else `-1`.
983 */
984 function assocIndexOf(array, key) {
985 var length = array.length;
986 while (length--) {
987 if (eq(array[length][0], key)) {
988 return length;
989 }
990 }
991 return -1;
992 }
993
994 /**
995 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
996 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
997 * symbols of `object`.
998 *
999 * @private
1000 * @param {Object} object The object to query.
1001 * @param {Function} keysFunc The function to get the keys of `object`.
1002 * @param {Function} symbolsFunc The function to get the symbols of `object`.
1003 * @returns {Array} Returns the array of property names and symbols.
1004 */
1005 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1006 var result = keysFunc(object);
1007 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1008 }
1009
1010 /**
1011 * The base implementation of `getTag` without fallbacks for buggy environments.
1012 *
1013 * @private
1014 * @param {*} value The value to query.
1015 * @returns {string} Returns the `toStringTag`.
1016 */
1017 function baseGetTag(value) {
1018 if (value == null) {
1019 return value === undefined ? undefinedTag : nullTag;
1020 }
1021 return (symToStringTag && symToStringTag in Object(value))
1022 ? getRawTag(value)
1023 : objectToString(value);
1024 }
1025
1026 /**
1027 * The base implementation of `_.isArguments`.
1028 *
1029 * @private
1030 * @param {*} value The value to check.
1031 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1032 */
1033 function baseIsArguments(value) {
1034 return isObjectLike(value) && baseGetTag(value) == argsTag;
1035 }
1036
1037 /**
1038 * The base implementation of `_.isEqual` which supports partial comparisons
1039 * and tracks traversed objects.
1040 *
1041 * @private
1042 * @param {*} value The value to compare.
1043 * @param {*} other The other value to compare.
1044 * @param {boolean} bitmask The bitmask flags.
1045 * 1 - Unordered comparison
1046 * 2 - Partial comparison
1047 * @param {Function} [customizer] The function to customize comparisons.
1048 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
1049 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1050 */
1051 function baseIsEqual(value, other, bitmask, customizer, stack) {
1052 if (value === other) {
1053 return true;
1054 }
1055 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
1056 return value !== value && other !== other;
1057 }
1058 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1059 }
1060
1061 /**
1062 * A specialized version of `baseIsEqual` for arrays and objects which performs
1063 * deep comparisons and tracks traversed objects enabling objects with circular
1064 * references to be compared.
1065 *
1066 * @private
1067 * @param {Object} object The object to compare.
1068 * @param {Object} other The other object to compare.
1069 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1070 * @param {Function} customizer The function to customize comparisons.
1071 * @param {Function} equalFunc The function to determine equivalents of values.
1072 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
1073 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1074 */
1075 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1076 var objIsArr = isArray(object),
1077 othIsArr = isArray(other),
1078 objTag = objIsArr ? arrayTag : getTag(object),
1079 othTag = othIsArr ? arrayTag : getTag(other);
1080
1081 objTag = objTag == argsTag ? objectTag : objTag;
1082 othTag = othTag == argsTag ? objectTag : othTag;
1083
1084 var objIsObj = objTag == objectTag,
1085 othIsObj = othTag == objectTag,
1086 isSameTag = objTag == othTag;
1087
1088 if (isSameTag && isBuffer(object)) {
1089 if (!isBuffer(other)) {
1090 return false;
1091 }
1092 objIsArr = true;
1093 objIsObj = false;
1094 }
1095 if (isSameTag && !objIsObj) {
1096 stack || (stack = new Stack);
1097 return (objIsArr || isTypedArray(object))
1098 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
1099 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1100 }
1101 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1102 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
1103 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
1104
1105 if (objIsWrapped || othIsWrapped) {
1106 var objUnwrapped = objIsWrapped ? object.value() : object,
1107 othUnwrapped = othIsWrapped ? other.value() : other;
1108
1109 stack || (stack = new Stack);
1110 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1111 }
1112 }
1113 if (!isSameTag) {
1114 return false;
1115 }
1116 stack || (stack = new Stack);
1117 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1118 }
1119
1120 /**
1121 * The base implementation of `_.isNative` without bad shim checks.
1122 *
1123 * @private
1124 * @param {*} value The value to check.
1125 * @returns {boolean} Returns `true` if `value` is a native function,
1126 * else `false`.
1127 */
1128 function baseIsNative(value) {
1129 if (!isObject(value) || isMasked(value)) {
1130 return false;
1131 }
1132 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1133 return pattern.test(toSource(value));
1134 }
1135
1136 /**
1137 * The base implementation of `_.isTypedArray` without Node.js optimizations.
1138 *
1139 * @private
1140 * @param {*} value The value to check.
1141 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1142 */
1143 function baseIsTypedArray(value) {
1144 return isObjectLike(value) &&
1145 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1146 }
1147
1148 /**
1149 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1150 *
1151 * @private
1152 * @param {Object} object The object to query.
1153 * @returns {Array} Returns the array of property names.
1154 */
1155 function baseKeys(object) {
1156 if (!isPrototype(object)) {
1157 return nativeKeys(object);
1158 }
1159 var result = [];
1160 for (var key in Object(object)) {
1161 if (hasOwnProperty.call(object, key) && key != 'constructor') {
1162 result.push(key);
1163 }
1164 }
1165 return result;
1166 }
1167
1168 /**
1169 * A specialized version of `baseIsEqualDeep` for arrays with support for
1170 * partial deep comparisons.
1171 *
1172 * @private
1173 * @param {Array} array The array to compare.
1174 * @param {Array} other The other array to compare.
1175 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1176 * @param {Function} customizer The function to customize comparisons.
1177 * @param {Function} equalFunc The function to determine equivalents of values.
1178 * @param {Object} stack Tracks traversed `array` and `other` objects.
1179 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1180 */
1181 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1182 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1183 arrLength = array.length,
1184 othLength = other.length;
1185
1186 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1187 return false;
1188 }
1189 // Assume cyclic values are equal.
1190 var stacked = stack.get(array);
1191 if (stacked && stack.get(other)) {
1192 return stacked == other;
1193 }
1194 var index = -1,
1195 result = true,
1196 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1197
1198 stack.set(array, other);
1199 stack.set(other, array);
1200
1201 // Ignore non-index properties.
1202 while (++index < arrLength) {
1203 var arrValue = array[index],
1204 othValue = other[index];
1205
1206 if (customizer) {
1207 var compared = isPartial
1208 ? customizer(othValue, arrValue, index, other, array, stack)
1209 : customizer(arrValue, othValue, index, array, other, stack);
1210 }
1211 if (compared !== undefined) {
1212 if (compared) {
1213 continue;
1214 }
1215 result = false;
1216 break;
1217 }
1218 // Recursively compare arrays (susceptible to call stack limits).
1219 if (seen) {
1220 if (!arraySome(other, function(othValue, othIndex) {
1221 if (!cacheHas(seen, othIndex) &&
1222 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1223 return seen.push(othIndex);
1224 }
1225 })) {
1226 result = false;
1227 break;
1228 }
1229 } else if (!(
1230 arrValue === othValue ||
1231 equalFunc(arrValue, othValue, bitmask, customizer, stack)
1232 )) {
1233 result = false;
1234 break;
1235 }
1236 }
1237 stack['delete'](array);
1238 stack['delete'](other);
1239 return result;
1240 }
1241
1242 /**
1243 * A specialized version of `baseIsEqualDeep` for comparing objects of
1244 * the same `toStringTag`.
1245 *
1246 * **Note:** This function only supports comparing values with tags of
1247 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1248 *
1249 * @private
1250 * @param {Object} object The object to compare.
1251 * @param {Object} other The other object to compare.
1252 * @param {string} tag The `toStringTag` of the objects to compare.
1253 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1254 * @param {Function} customizer The function to customize comparisons.
1255 * @param {Function} equalFunc The function to determine equivalents of values.
1256 * @param {Object} stack Tracks traversed `object` and `other` objects.
1257 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1258 */
1259 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1260 switch (tag) {
1261 case dataViewTag:
1262 if ((object.byteLength != other.byteLength) ||
1263 (object.byteOffset != other.byteOffset)) {
1264 return false;
1265 }
1266 object = object.buffer;
1267 other = other.buffer;
1268
1269 case arrayBufferTag:
1270 if ((object.byteLength != other.byteLength) ||
1271 !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1272 return false;
1273 }
1274 return true;
1275
1276 case boolTag:
1277 case dateTag:
1278 case numberTag:
1279 // Coerce booleans to `1` or `0` and dates to milliseconds.
1280 // Invalid dates are coerced to `NaN`.
1281 return eq(+object, +other);
1282
1283 case errorTag:
1284 return object.name == other.name && object.message == other.message;
1285
1286 case regexpTag:
1287 case stringTag:
1288 // Coerce regexes to strings and treat strings, primitives and objects,
1289 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1290 // for more details.
1291 return object == (other + '');
1292
1293 case mapTag:
1294 var convert = mapToArray;
1295
1296 case setTag:
1297 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1298 convert || (convert = setToArray);
1299
1300 if (object.size != other.size && !isPartial) {
1301 return false;
1302 }
1303 // Assume cyclic values are equal.
1304 var stacked = stack.get(object);
1305 if (stacked) {
1306 return stacked == other;
1307 }
1308 bitmask |= COMPARE_UNORDERED_FLAG;
1309
1310 // Recursively compare objects (susceptible to call stack limits).
1311 stack.set(object, other);
1312 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1313 stack['delete'](object);
1314 return result;
1315
1316 case symbolTag:
1317 if (symbolValueOf) {
1318 return symbolValueOf.call(object) == symbolValueOf.call(other);
1319 }
1320 }
1321 return false;
1322 }
1323
1324 /**
1325 * A specialized version of `baseIsEqualDeep` for objects with support for
1326 * partial deep comparisons.
1327 *
1328 * @private
1329 * @param {Object} object The object to compare.
1330 * @param {Object} other The other object to compare.
1331 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1332 * @param {Function} customizer The function to customize comparisons.
1333 * @param {Function} equalFunc The function to determine equivalents of values.
1334 * @param {Object} stack Tracks traversed `object` and `other` objects.
1335 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1336 */
1337 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1338 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1339 objProps = getAllKeys(object),
1340 objLength = objProps.length,
1341 othProps = getAllKeys(other),
1342 othLength = othProps.length;
1343
1344 if (objLength != othLength && !isPartial) {
1345 return false;
1346 }
1347 var index = objLength;
1348 while (index--) {
1349 var key = objProps[index];
1350 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1351 return false;
1352 }
1353 }
1354 // Assume cyclic values are equal.
1355 var stacked = stack.get(object);
1356 if (stacked && stack.get(other)) {
1357 return stacked == other;
1358 }
1359 var result = true;
1360 stack.set(object, other);
1361 stack.set(other, object);
1362
1363 var skipCtor = isPartial;
1364 while (++index < objLength) {
1365 key = objProps[index];
1366 var objValue = object[key],
1367 othValue = other[key];
1368
1369 if (customizer) {
1370 var compared = isPartial
1371 ? customizer(othValue, objValue, key, other, object, stack)
1372 : customizer(objValue, othValue, key, object, other, stack);
1373 }
1374 // Recursively compare objects (susceptible to call stack limits).
1375 if (!(compared === undefined
1376 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1377 : compared
1378 )) {
1379 result = false;
1380 break;
1381 }
1382 skipCtor || (skipCtor = key == 'constructor');
1383 }
1384 if (result && !skipCtor) {
1385 var objCtor = object.constructor,
1386 othCtor = other.constructor;
1387
1388 // Non `Object` object instances with different constructors are not equal.
1389 if (objCtor != othCtor &&
1390 ('constructor' in object && 'constructor' in other) &&
1391 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1392 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1393 result = false;
1394 }
1395 }
1396 stack['delete'](object);
1397 stack['delete'](other);
1398 return result;
1399 }
1400
1401 /**
1402 * Creates an array of own enumerable property names and symbols of `object`.
1403 *
1404 * @private
1405 * @param {Object} object The object to query.
1406 * @returns {Array} Returns the array of property names and symbols.
1407 */
1408 function getAllKeys(object) {
1409 return baseGetAllKeys(object, keys, getSymbols);
1410 }
1411
1412 /**
1413 * Gets the data for `map`.
1414 *
1415 * @private
1416 * @param {Object} map The map to query.
1417 * @param {string} key The reference key.
1418 * @returns {*} Returns the map data.
1419 */
1420 function getMapData(map, key) {
1421 var data = map.__data__;
1422 return isKeyable(key)
1423 ? data[typeof key == 'string' ? 'string' : 'hash']
1424 : data.map;
1425 }
1426
1427 /**
1428 * Gets the native function at `key` of `object`.
1429 *
1430 * @private
1431 * @param {Object} object The object to query.
1432 * @param {string} key The key of the method to get.
1433 * @returns {*} Returns the function if it's native, else `undefined`.
1434 */
1435 function getNative(object, key) {
1436 var value = getValue(object, key);
1437 return baseIsNative(value) ? value : undefined;
1438 }
1439
1440 /**
1441 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1442 *
1443 * @private
1444 * @param {*} value The value to query.
1445 * @returns {string} Returns the raw `toStringTag`.
1446 */
1447 function getRawTag(value) {
1448 var isOwn = hasOwnProperty.call(value, symToStringTag),
1449 tag = value[symToStringTag];
1450
1451 try {
1452 value[symToStringTag] = undefined;
1453 var unmasked = true;
1454 } catch (e) {}
1455
1456 var result = nativeObjectToString.call(value);
1457 if (unmasked) {
1458 if (isOwn) {
1459 value[symToStringTag] = tag;
1460 } else {
1461 delete value[symToStringTag];
1462 }
1463 }
1464 return result;
1465 }
1466
1467 /**
1468 * Creates an array of the own enumerable symbols of `object`.
1469 *
1470 * @private
1471 * @param {Object} object The object to query.
1472 * @returns {Array} Returns the array of symbols.
1473 */
1474 var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1475 if (object == null) {
1476 return [];
1477 }
1478 object = Object(object);
1479 return arrayFilter(nativeGetSymbols(object), function(symbol) {
1480 return propertyIsEnumerable.call(object, symbol);
1481 });
1482 };
1483
1484 /**
1485 * Gets the `toStringTag` of `value`.
1486 *
1487 * @private
1488 * @param {*} value The value to query.
1489 * @returns {string} Returns the `toStringTag`.
1490 */
1491 var getTag = baseGetTag;
1492
1493 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1494 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1495 (Map && getTag(new Map) != mapTag) ||
1496 (Promise && getTag(Promise.resolve()) != promiseTag) ||
1497 (Set && getTag(new Set) != setTag) ||
1498 (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1499 getTag = function(value) {
1500 var result = baseGetTag(value),
1501 Ctor = result == objectTag ? value.constructor : undefined,
1502 ctorString = Ctor ? toSource(Ctor) : '';
1503
1504 if (ctorString) {
1505 switch (ctorString) {
1506 case dataViewCtorString: return dataViewTag;
1507 case mapCtorString: return mapTag;
1508 case promiseCtorString: return promiseTag;
1509 case setCtorString: return setTag;
1510 case weakMapCtorString: return weakMapTag;
1511 }
1512 }
1513 return result;
1514 };
1515 }
1516
1517 /**
1518 * Checks if `value` is a valid array-like index.
1519 *
1520 * @private
1521 * @param {*} value The value to check.
1522 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1523 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1524 */
1525 function isIndex(value, length) {
1526 length = length == null ? MAX_SAFE_INTEGER : length;
1527 return !!length &&
1528 (typeof value == 'number' || reIsUint.test(value)) &&
1529 (value > -1 && value % 1 == 0 && value < length);
1530 }
1531
1532 /**
1533 * Checks if `value` is suitable for use as unique object key.
1534 *
1535 * @private
1536 * @param {*} value The value to check.
1537 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1538 */
1539 function isKeyable(value) {
1540 var type = typeof value;
1541 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1542 ? (value !== '__proto__')
1543 : (value === null);
1544 }
1545
1546 /**
1547 * Checks if `func` has its source masked.
1548 *
1549 * @private
1550 * @param {Function} func The function to check.
1551 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1552 */
1553 function isMasked(func) {
1554 return !!maskSrcKey && (maskSrcKey in func);
1555 }
1556
1557 /**
1558 * Checks if `value` is likely a prototype object.
1559 *
1560 * @private
1561 * @param {*} value The value to check.
1562 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1563 */
1564 function isPrototype(value) {
1565 var Ctor = value && value.constructor,
1566 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1567
1568 return value === proto;
1569 }
1570
1571 /**
1572 * Converts `value` to a string using `Object.prototype.toString`.
1573 *
1574 * @private
1575 * @param {*} value The value to convert.
1576 * @returns {string} Returns the converted string.
1577 */
1578 function objectToString(value) {
1579 return nativeObjectToString.call(value);
1580 }
1581
1582 /**
1583 * Converts `func` to its source code.
1584 *
1585 * @private
1586 * @param {Function} func The function to convert.
1587 * @returns {string} Returns the source code.
1588 */
1589 function toSource(func) {
1590 if (func != null) {
1591 try {
1592 return funcToString.call(func);
1593 } catch (e) {}
1594 try {
1595 return (func + '');
1596 } catch (e) {}
1597 }
1598 return '';
1599 }
1600
1601 /**
1602 * Performs a
1603 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1604 * comparison between two values to determine if they are equivalent.
1605 *
1606 * @static
1607 * @memberOf _
1608 * @since 4.0.0
1609 * @category Lang
1610 * @param {*} value The value to compare.
1611 * @param {*} other The other value to compare.
1612 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1613 * @example
1614 *
1615 * var object = { 'a': 1 };
1616 * var other = { 'a': 1 };
1617 *
1618 * _.eq(object, object);
1619 * // => true
1620 *
1621 * _.eq(object, other);
1622 * // => false
1623 *
1624 * _.eq('a', 'a');
1625 * // => true
1626 *
1627 * _.eq('a', Object('a'));
1628 * // => false
1629 *
1630 * _.eq(NaN, NaN);
1631 * // => true
1632 */
1633 function eq(value, other) {
1634 return value === other || (value !== value && other !== other);
1635 }
1636
1637 /**
1638 * Checks if `value` is likely an `arguments` object.
1639 *
1640 * @static
1641 * @memberOf _
1642 * @since 0.1.0
1643 * @category Lang
1644 * @param {*} value The value to check.
1645 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1646 * else `false`.
1647 * @example
1648 *
1649 * _.isArguments(function() { return arguments; }());
1650 * // => true
1651 *
1652 * _.isArguments([1, 2, 3]);
1653 * // => false
1654 */
1655 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1656 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1657 !propertyIsEnumerable.call(value, 'callee');
1658 };
1659
1660 /**
1661 * Checks if `value` is classified as an `Array` object.
1662 *
1663 * @static
1664 * @memberOf _
1665 * @since 0.1.0
1666 * @category Lang
1667 * @param {*} value The value to check.
1668 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1669 * @example
1670 *
1671 * _.isArray([1, 2, 3]);
1672 * // => true
1673 *
1674 * _.isArray(document.body.children);
1675 * // => false
1676 *
1677 * _.isArray('abc');
1678 * // => false
1679 *
1680 * _.isArray(_.noop);
1681 * // => false
1682 */
1683 var isArray = Array.isArray;
1684
1685 /**
1686 * Checks if `value` is array-like. A value is considered array-like if it's
1687 * not a function and has a `value.length` that's an integer greater than or
1688 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1689 *
1690 * @static
1691 * @memberOf _
1692 * @since 4.0.0
1693 * @category Lang
1694 * @param {*} value The value to check.
1695 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1696 * @example
1697 *
1698 * _.isArrayLike([1, 2, 3]);
1699 * // => true
1700 *
1701 * _.isArrayLike(document.body.children);
1702 * // => true
1703 *
1704 * _.isArrayLike('abc');
1705 * // => true
1706 *
1707 * _.isArrayLike(_.noop);
1708 * // => false
1709 */
1710 function isArrayLike(value) {
1711 return value != null && isLength(value.length) && !isFunction(value);
1712 }
1713
1714 /**
1715 * Checks if `value` is a buffer.
1716 *
1717 * @static
1718 * @memberOf _
1719 * @since 4.3.0
1720 * @category Lang
1721 * @param {*} value The value to check.
1722 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1723 * @example
1724 *
1725 * _.isBuffer(new Buffer(2));
1726 * // => true
1727 *
1728 * _.isBuffer(new Uint8Array(2));
1729 * // => false
1730 */
1731 var isBuffer = nativeIsBuffer || stubFalse;
1732
1733 /**
1734 * Performs a deep comparison between two values to determine if they are
1735 * equivalent.
1736 *
1737 * **Note:** This method supports comparing arrays, array buffers, booleans,
1738 * date objects, error objects, maps, numbers, `Object` objects, regexes,
1739 * sets, strings, symbols, and typed arrays. `Object` objects are compared
1740 * by their own, not inherited, enumerable properties. Functions and DOM
1741 * nodes are compared by strict equality, i.e. `===`.
1742 *
1743 * @static
1744 * @memberOf _
1745 * @since 0.1.0
1746 * @category Lang
1747 * @param {*} value The value to compare.
1748 * @param {*} other The other value to compare.
1749 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1750 * @example
1751 *
1752 * var object = { 'a': 1 };
1753 * var other = { 'a': 1 };
1754 *
1755 * _.isEqual(object, other);
1756 * // => true
1757 *
1758 * object === other;
1759 * // => false
1760 */
1761 function isEqual(value, other) {
1762 return baseIsEqual(value, other);
1763 }
1764
1765 /**
1766 * Checks if `value` is classified as a `Function` object.
1767 *
1768 * @static
1769 * @memberOf _
1770 * @since 0.1.0
1771 * @category Lang
1772 * @param {*} value The value to check.
1773 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1774 * @example
1775 *
1776 * _.isFunction(_);
1777 * // => true
1778 *
1779 * _.isFunction(/abc/);
1780 * // => false
1781 */
1782 function isFunction(value) {
1783 if (!isObject(value)) {
1784 return false;
1785 }
1786 // The use of `Object#toString` avoids issues with the `typeof` operator
1787 // in Safari 9 which returns 'object' for typed arrays and other constructors.
1788 var tag = baseGetTag(value);
1789 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1790 }
1791
1792 /**
1793 * Checks if `value` is a valid array-like length.
1794 *
1795 * **Note:** This method is loosely based on
1796 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1797 *
1798 * @static
1799 * @memberOf _
1800 * @since 4.0.0
1801 * @category Lang
1802 * @param {*} value The value to check.
1803 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1804 * @example
1805 *
1806 * _.isLength(3);
1807 * // => true
1808 *
1809 * _.isLength(Number.MIN_VALUE);
1810 * // => false
1811 *
1812 * _.isLength(Infinity);
1813 * // => false
1814 *
1815 * _.isLength('3');
1816 * // => false
1817 */
1818 function isLength(value) {
1819 return typeof value == 'number' &&
1820 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1821 }
1822
1823 /**
1824 * Checks if `value` is the
1825 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1826 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1827 *
1828 * @static
1829 * @memberOf _
1830 * @since 0.1.0
1831 * @category Lang
1832 * @param {*} value The value to check.
1833 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1834 * @example
1835 *
1836 * _.isObject({});
1837 * // => true
1838 *
1839 * _.isObject([1, 2, 3]);
1840 * // => true
1841 *
1842 * _.isObject(_.noop);
1843 * // => true
1844 *
1845 * _.isObject(null);
1846 * // => false
1847 */
1848 function isObject(value) {
1849 var type = typeof value;
1850 return value != null && (type == 'object' || type == 'function');
1851 }
1852
1853 /**
1854 * Checks if `value` is object-like. A value is object-like if it's not `null`
1855 * and has a `typeof` result of "object".
1856 *
1857 * @static
1858 * @memberOf _
1859 * @since 4.0.0
1860 * @category Lang
1861 * @param {*} value The value to check.
1862 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1863 * @example
1864 *
1865 * _.isObjectLike({});
1866 * // => true
1867 *
1868 * _.isObjectLike([1, 2, 3]);
1869 * // => true
1870 *
1871 * _.isObjectLike(_.noop);
1872 * // => false
1873 *
1874 * _.isObjectLike(null);
1875 * // => false
1876 */
1877 function isObjectLike(value) {
1878 return value != null && typeof value == 'object';
1879 }
1880
1881 /**
1882 * Checks if `value` is classified as a typed array.
1883 *
1884 * @static
1885 * @memberOf _
1886 * @since 3.0.0
1887 * @category Lang
1888 * @param {*} value The value to check.
1889 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1890 * @example
1891 *
1892 * _.isTypedArray(new Uint8Array);
1893 * // => true
1894 *
1895 * _.isTypedArray([]);
1896 * // => false
1897 */
1898 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1899
1900 /**
1901 * Creates an array of the own enumerable property names of `object`.
1902 *
1903 * **Note:** Non-object values are coerced to objects. See the
1904 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1905 * for more details.
1906 *
1907 * @static
1908 * @since 0.1.0
1909 * @memberOf _
1910 * @category Object
1911 * @param {Object} object The object to query.
1912 * @returns {Array} Returns the array of property names.
1913 * @example
1914 *
1915 * function Foo() {
1916 * this.a = 1;
1917 * this.b = 2;
1918 * }
1919 *
1920 * Foo.prototype.c = 3;
1921 *
1922 * _.keys(new Foo);
1923 * // => ['a', 'b'] (iteration order is not guaranteed)
1924 *
1925 * _.keys('hi');
1926 * // => ['0', '1']
1927 */
1928 function keys(object) {
1929 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1930 }
1931
1932 /**
1933 * This method returns a new empty array.
1934 *
1935 * @static
1936 * @memberOf _
1937 * @since 4.13.0
1938 * @category Util
1939 * @returns {Array} Returns the new empty array.
1940 * @example
1941 *
1942 * var arrays = _.times(2, _.stubArray);
1943 *
1944 * console.log(arrays);
1945 * // => [[], []]
1946 *
1947 * console.log(arrays[0] === arrays[1]);
1948 * // => false
1949 */
1950 function stubArray() {
1951 return [];
1952 }
1953
1954 /**
1955 * This method returns `false`.
1956 *
1957 * @static
1958 * @memberOf _
1959 * @since 4.13.0
1960 * @category Util
1961 * @returns {boolean} Returns `false`.
1962 * @example
1963 *
1964 * _.times(2, _.stubFalse);
1965 * // => [false, false]
1966 */
1967 function stubFalse() {
1968 return false;
1969 }
1970
1971 module.exports = isEqual;
1972 });
1973
1974 // all diacritics
1975 var diacritics =
1976 {
1977 'a' : ['a','à','á','â','ã','ä','å','æ','ā','ă','ą','ǎ','ǟ','ǡ','ǻ','ȁ','ȃ','ȧ','ɐ','ɑ','ɒ','ͣ','а','ӑ','ӓ','ᵃ','ᵄ','ᶏ','ḁ','ẚ','ạ','ả','ấ','ầ','ẩ','ẫ','ậ','ắ','ằ','ẳ','ẵ','ặ','ₐ','ⱥ','a'],
1978 'A' : ['A','À','Á','Â','Ã','Ä','Å','Ā','Ă','Ą','Ǎ','Ǟ','Ǡ','Ǻ','Ȁ','Ȃ','Ȧ','Ⱥ','А','Ӑ','Ӓ','ᴀ','ᴬ','Ḁ','Ạ','Ả','Ấ','Ầ','Ẩ','Ẫ','Ậ','Ắ','Ằ','Ẳ','Ẵ','Ặ','A'],
1979
1980 'b' : ['b','ƀ','ƃ','ɓ','ᖯ','ᵇ','ᵬ','ᶀ','ḃ','ḅ','ḇ','b'],
1981 'B' : ['B','Ɓ','Ƃ','Ƀ','ʙ','ᛒ','ᴃ','ᴮ','ᴯ','Ḃ','Ḅ','Ḇ','B'],
1982
1983 'c' : ['c','ç','ć','ĉ','ċ','č','ƈ','ȼ','ɕ','ͨ','ᴄ','ᶜ','ḉ','ↄ','c'],
1984 'C' : ['C','Ç','Ć','Ĉ','Ċ','Č','Ƈ','Ȼ','ʗ','Ḉ','C'],
1985
1986 'd' : ['d','ď','đ','Ƌ','ƌ','ȡ','ɖ','ɗ','ͩ','ᵈ','ᵭ','ᶁ','ᶑ','ḋ','ḍ','ḏ','ḑ','ḓ','d'],
1987 'D' : ['D','Ď','Đ','Ɖ','Ɗ','ᴰ','Ḋ','Ḍ','Ḏ','Ḑ','Ḓ','D'],
1988
1989 'e' : ['e','è','é','ê','ë','ē','ĕ','ė','ę','ě','ǝ','ȅ','ȇ','ȩ','ɇ','ɘ','ͤ','ᵉ','ᶒ','ḕ','ḗ','ḙ','ḛ','ḝ','ẹ','ẻ','ẽ','ế','ề','ể','ễ','ệ','ₑ','e'],
1990 'E' : ['E','È','É','Ê','Ë','Ē','Ĕ','Ė','Ę','Ě','Œ','Ǝ','Ɛ','Ȅ','Ȇ','Ȩ','Ɇ','ɛ','ɜ','ɶ','Є','Э','э','є','Ӭ','ӭ','ᴇ','ᴈ','ᴱ','ᴲ','ᵋ','ᵌ','ᶓ','ᶔ','ᶟ','Ḕ','Ḗ','Ḙ','Ḛ','Ḝ','Ẹ','Ẻ','Ẽ','Ế','Ề','Ể','Ễ','Ệ','E','𐐁','𐐩'],
1991
1992 'f' : ['f','ƒ','ᵮ','ᶂ','ᶠ','ḟ','f'],
1993 'F' : ['F','Ƒ','Ḟ','ⅎ','F'],
1994
1995 'g' : ['g','ĝ','ğ','ġ','ģ','ǥ','ǧ','ǵ','ɠ','ɡ','ᵍ','ᵷ','ᵹ','ᶃ','ᶢ','ḡ','g'],
1996 'G' : ['G','Ĝ','Ğ','Ġ','Ģ','Ɠ','Ǥ','Ǧ','Ǵ','ɢ','ʛ','ᴳ','Ḡ','G'],
1997
1998 'h' : ['h','ĥ','ħ','ƕ','ȟ','ɥ','ɦ','ʮ','ʯ','ʰ','ʱ','ͪ','Һ','һ','ᑋ','ᶣ','ḣ','ḥ','ḧ','ḩ','ḫ','ⱨ','h'],
1999 'H' : ['H','Ĥ','Ħ','Ȟ','ʜ','ᕼ','ᚺ','ᚻ','ᴴ','Ḣ','Ḥ','Ḧ','Ḩ','Ḫ','Ⱨ','H'],
2000
2001 'i' : ['i','ì','í','î','ï','ĩ','ī','ĭ','į','ǐ','ȉ','ȋ','ɨ','ͥ','ᴉ','ᵎ','ᵢ','ᶖ','ᶤ','ḭ','ḯ','ỉ','ị','i'],
2002 'I' : ['I','Ì','Í','Î','Ï','Ĩ','Ī','Ĭ','Į','İ','Ǐ','Ȉ','Ȋ','ɪ','І','ᴵ','ᵻ','ᶦ','ᶧ','Ḭ','Ḯ','Ỉ','Ị','I'],
2003
2004 'j' : ['j','ĵ','ǰ','ɉ','ʝ','ʲ','ᶡ','ᶨ','j'],
2005 'J' : ['J','Ĵ','ᴊ','ᴶ','J'],
2006
2007 'k' : ['k','ķ','ƙ','ǩ','ʞ','ᵏ','ᶄ','ḱ','ḳ','ḵ','ⱪ','k'],
2008 'K' : ['K','Ķ','Ƙ','Ǩ','ᴷ','Ḱ','Ḳ','Ḵ','Ⱪ','K'],
2009
2010 'l' : ['l','ĺ','ļ','ľ','ŀ','ł','ƚ','ȴ','ɫ','ɬ','ɭ','ˡ','ᶅ','ᶩ','ᶪ','ḷ','ḹ','ḻ','ḽ','ℓ','ⱡ'],
2011 'L' : ['L','Ĺ','Ļ','Ľ','Ŀ','Ł','Ƚ','ʟ','ᴌ','ᴸ','ᶫ','Ḷ','Ḹ','Ḻ','Ḽ','Ⱡ','Ɫ'],
2012
2013 'm' : ['m','ɯ','ɰ','ɱ','ͫ','ᴟ','ᵐ','ᵚ','ᵯ','ᶆ','ᶬ','ᶭ','ḿ','ṁ','ṃ','㎡','㎥','m'],
2014 'M' : ['M','Ɯ','ᴍ','ᴹ','Ḿ','Ṁ','Ṃ','M'],
2015
2016 'n' : ['n','ñ','ń','ņ','ň','ʼn','ƞ','ǹ','ȵ','ɲ','ɳ','ᵰ','ᶇ','ᶮ','ᶯ','ṅ','ṇ','ṉ','ṋ','ⁿ','n'],
2017 'N' : ['N','Ñ','Ń','Ņ','Ň','Ɲ','Ǹ','Ƞ','ɴ','ᴎ','ᴺ','ᴻ','ᶰ','Ṅ','Ṇ','Ṉ','Ṋ','N'],
2018
2019 'o' : ['o','ò','ó','ô','õ','ö','ø','ō','ŏ','ő','ơ','ǒ','ǫ','ǭ','ǿ','ȍ','ȏ','ȫ','ȭ','ȯ','ȱ','ɵ','ͦ','о','ӧ','ө','ᴏ','ᴑ','ᴓ','ᴼ','ᵒ','ᶱ','ṍ','ṏ','ṑ','ṓ','ọ','ỏ','ố','ồ','ổ','ỗ','ộ','ớ','ờ','ở','ỡ','ợ','ₒ','o','𐐬'],
2020 'O' : ['O','Ò','Ó','Ô','Õ','Ö','Ø','Ō','Ŏ','Ő','Ɵ','Ơ','Ǒ','Ǫ','Ǭ','Ǿ','Ȍ','Ȏ','Ȫ','Ȭ','Ȯ','Ȱ','О','Ӧ','Ө','Ṍ','Ṏ','Ṑ','Ṓ','Ọ','Ỏ','Ố','Ồ','Ổ','Ỗ','Ộ','Ớ','Ờ','Ở','Ỡ','Ợ','O','𐐄'],
2021
2022 'p' : ['p','ᵖ','ᵱ','ᵽ','ᶈ','ṕ','ṗ','p'],
2023 'P' : ['P','Ƥ','ᴘ','ᴾ','Ṕ','Ṗ','Ᵽ','P'],
2024
2025 'q' : ['q','ɋ','ʠ','ᛩ','q'],
2026 'Q' : ['Q','Ɋ','Q'],
2027
2028 'r' : ['r','ŕ','ŗ','ř','ȑ','ȓ','ɍ','ɹ','ɻ','ʳ','ʴ','ʵ','ͬ','ᵣ','ᵲ','ᶉ','ṙ','ṛ','ṝ','ṟ'],
2029 'R' : ['R','Ŕ','Ŗ','Ř','Ʀ','Ȑ','Ȓ','Ɍ','ʀ','ʁ','ʶ','ᚱ','ᴙ','ᴚ','ᴿ','Ṙ','Ṛ','Ṝ','Ṟ','Ɽ'],
2030
2031 's' : ['s','ś','ŝ','ş','š','ș','ʂ','ᔆ','ᶊ','ṡ','ṣ','ṥ','ṧ','ṩ','s'],
2032 'S' : ['S','Ś','Ŝ','Ş','Š','Ș','ȿ','ˢ','ᵴ','Ṡ','Ṣ','Ṥ','Ṧ','Ṩ','S'],
2033
2034 't' : ['t','ţ','ť','ŧ','ƫ','ƭ','ț','ʇ','ͭ','ᵀ','ᵗ','ᵵ','ᶵ','ṫ','ṭ','ṯ','ṱ','ẗ','t'],
2035 'T' : ['T','Ţ','Ť','Ƭ','Ʈ','Ț','Ⱦ','ᴛ','ᵀ','Ṫ','Ṭ','Ṯ','Ṱ','T'],
2036
2037 'u' : ['u','ù','ú','û','ü','ũ','ū','ŭ','ů','ű','ų','ư','ǔ','ǖ','ǘ','ǚ','ǜ','ȕ','ȗ','ͧ','ߎ','ᵘ','ᵤ','ṳ','ṵ','ṷ','ṹ','ṻ','ụ','ủ','ứ','ừ','ử','ữ','ự','u'],
2038 'U' : ['U','Ù','Ú','Û','Ü','Ũ','Ū','Ŭ','Ů','Ű','Ų','Ư','Ǔ','Ǖ','Ǘ','Ǚ','Ǜ','Ȕ','Ȗ','Ʉ','ᴜ','ᵁ','ᵾ','Ṳ','Ṵ','Ṷ','Ṹ','Ṻ','Ụ','Ủ','Ứ','Ừ','Ử','Ữ','Ự','U'],
2039
2040 'v' : ['v','ʋ','ͮ','ᵛ','ᵥ','ᶹ','ṽ','ṿ','ⱱ','v','ⱴ'],
2041 'V' : ['V','Ʋ','Ʌ','ʌ','ᴠ','ᶌ','Ṽ','Ṿ','V'],
2042
2043 'w' : ['w','ŵ','ʷ','ᵂ','ẁ','ẃ','ẅ','ẇ','ẉ','ẘ','ⱳ','w'],
2044 'W' : ['W','Ŵ','ʍ','ᴡ','Ẁ','Ẃ','Ẅ','Ẇ','Ẉ','Ⱳ','W'],
2045
2046 'x' : ['x','̽','͓','ᶍ','ͯ','ẋ','ẍ','ₓ','x'],
2047 'X' : ['X','ˣ','ͯ','Ẋ','Ẍ','☒','✕','✖','✗','✘','X'],
2048
2049 'y' : ['y','ý','ÿ','ŷ','ȳ','ɏ','ʸ','ẏ','ỳ','ỵ','ỷ','ỹ','y'],
2050 'Y' : ['Y','Ý','Ŷ','Ÿ','Ƴ','ƴ','Ȳ','Ɏ','ʎ','ʏ','Ẏ','Ỳ','Ỵ','Ỷ','Ỹ','Y'],
2051
2052 'z' : ['z','ź','ż','ž','ƶ','ȥ','ɀ','ʐ','ʑ','ᙆ','ᙇ','ᶻ','ᶼ','ᶽ','ẑ','ẓ','ẕ','ⱬ','z'],
2053 'Z' : ['Z','Ź','Ż','Ž','Ƶ','Ȥ','ᴢ','ᵶ','Ẑ','Ẓ','Ẕ','Ⱬ','Z']
2054 };
2055
2056 /*
2057 * Main function of the module which removes all diacritics from the received text
2058 */
2059 var diacriticless = function (text) {
2060 var result = [];
2061
2062 // iterate over all the characters of the received text
2063 for(var i=0; i<text.length; i++) {
2064 var searchChar = text.charAt(i);
2065 var foundChar = false;
2066
2067 // iterate over all the diacritics
2068 for(var key in diacritics) {
2069 var indexChar = diacritics[key].indexOf(searchChar);
2070
2071 // check if the current character is a diacritic
2072 if (indexChar !== -1) {
2073 // as the character is a diacritic, adds into the result array, the key of the found diacritic
2074 result.push(key);
2075 foundChar = true;
2076 break;
2077 }
2078 }
2079
2080 // check if the character was not found
2081 if (!foundChar) {
2082 // as the character was not found, returns it
2083 result.push(searchChar);
2084 }
2085 }
2086
2087 return result.join("");
2088 };
2089
2090 var escapeRegExp = function escapeRegExp(str) {
2091 return str.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
2092 };
2093
2094 var defaultType = {
2095 format: function format(x) {
2096 return x;
2097 },
2098 filterPredicate: function filterPredicate(rowval, filter) {
2099 var skipDiacritics = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2100 var fromDropdown = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2101
2102 // take care of nulls
2103 if (typeof rowval === 'undefined' || rowval === null) {
2104 return false;
2105 } // row value
2106
2107
2108 var rowValue = skipDiacritics ? String(rowval).toLowerCase() : diacriticless(escapeRegExp(String(rowval)).toLowerCase()); // search term
2109
2110 var searchTerm = skipDiacritics ? filter.toLowerCase() : diacriticless(escapeRegExp(filter).toLowerCase()); // comparison
2111
2112 return fromDropdown ? rowValue === searchTerm : rowValue.indexOf(searchTerm) > -1;
2113 },
2114 compare: function compare(x, y) {
2115 function cook(d) {
2116 if (typeof d === 'undefined' || d === null) return '';
2117 return diacriticless(d.toLowerCase());
2118 }
2119
2120 x = cook(x);
2121 y = cook(y);
2122 if (x < y) return -1;
2123 if (x > y) return 1;
2124 return 0;
2125 }
2126 };
2127
2128 var DEFAULT_SORT_TYPE = 'asc';
2129 var SORT_TYPES = {
2130 Ascending: 'asc',
2131 Descending: 'desc',
2132 None: 'none'
2133 };
2134 var PAGINATION_MODES = {
2135 Pages: 'pages',
2136 Records: 'records'
2137 };
2138 var DEFAULT_ROWS_PER_PAGE_DROPDOWN = [10, 20, 30, 40, 50];
2139
2140 //
2141 var script = {
2142 name: 'VgtPaginationPageInfo',
2143 props: {
2144 currentPage: {
2145 "default": 1
2146 },
2147 lastPage: {
2148 "default": 1
2149 },
2150 totalRecords: {
2151 "default": 0
2152 },
2153 ofText: {
2154 "default": 'of',
2155 type: String
2156 },
2157 pageText: {
2158 "default": 'page',
2159 type: String
2160 },
2161 currentPerPage: {},
2162 mode: {
2163 "default": PAGINATION_MODES.Records
2164 },
2165 infoFn: {
2166 "default": null
2167 }
2168 },
2169 data: function data() {
2170 return {
2171 id: this.getId()
2172 };
2173 },
2174 computed: {
2175 pageInfo: function pageInfo() {
2176 return "".concat(this.ofText, " ").concat(this.lastPage);
2177 },
2178 firstRecordOnPage: function firstRecordOnPage() {
2179 return (this.currentPage - 1) * this.currentPerPage + 1;
2180 },
2181 lastRecordOnPage: function lastRecordOnPage() {
2182 return Math.min(this.totalRecords, this.currentPage * this.currentPerPage);
2183 },
2184 recordInfo: function recordInfo() {
2185 var first = this.firstRecordOnPage;
2186 var last = this.lastRecordOnPage;
2187
2188 if (last === 0) {
2189 first = 0;
2190 }
2191
2192 return "".concat(first, " - ").concat(last, " ").concat(this.ofText, " ").concat(this.totalRecords);
2193 },
2194 infoParams: function infoParams() {
2195 return {
2196 firstRecordOnPage: this.firstRecordOnPage,
2197 lastRecordOnPage: this.lastRecordOnPage,
2198 totalRecords: this.totalRecords,
2199 currentPage: this.currentPage,
2200 totalPages: this.lastPage
2201 };
2202 }
2203 },
2204 methods: {
2205 getId: function getId() {
2206 return "vgt-page-input-".concat(Math.floor(Math.random() * Date.now()));
2207 },
2208 changePage: function changePage(event) {
2209 var value = parseInt(event.target.value, 10); //! invalid number
2210
2211 if (Number.isNaN(value) || value > this.lastPage || value < 1) {
2212 event.target.value = this.currentPage;
2213 return false;
2214 } //* valid number
2215
2216
2217 event.target.value = value;
2218 this.$emit('page-changed', value);
2219 }
2220 },
2221 mounted: function mounted() {},
2222 components: {}
2223 };
2224
2225 function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
2226 if (typeof shadowMode !== 'boolean') {
2227 createInjectorSSR = createInjector;
2228 createInjector = shadowMode;
2229 shadowMode = false;
2230 }
2231 // Vue.extend constructor export interop.
2232 const options = typeof script === 'function' ? script.options : script;
2233 // render functions
2234 if (template && template.render) {
2235 options.render = template.render;
2236 options.staticRenderFns = template.staticRenderFns;
2237 options._compiled = true;
2238 // functional template
2239 if (isFunctionalTemplate) {
2240 options.functional = true;
2241 }
2242 }
2243 // scopedId
2244 if (scopeId) {
2245 options._scopeId = scopeId;
2246 }
2247 let hook;
2248 if (moduleIdentifier) {
2249 // server build
2250 hook = function (context) {
2251 // 2.3 injection
2252 context =
2253 context || // cached call
2254 (this.$vnode && this.$vnode.ssrContext) || // stateful
2255 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
2256 // 2.2 with runInNewContext: true
2257 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
2258 context = __VUE_SSR_CONTEXT__;
2259 }
2260 // inject component styles
2261 if (style) {
2262 style.call(this, createInjectorSSR(context));
2263 }
2264 // register component module identifier for async chunk inference
2265 if (context && context._registeredComponents) {
2266 context._registeredComponents.add(moduleIdentifier);
2267 }
2268 };
2269 // used by ssr in case component is cached and beforeCreate
2270 // never gets called
2271 options._ssrRegister = hook;
2272 }
2273 else if (style) {
2274 hook = shadowMode
2275 ? function (context) {
2276 style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
2277 }
2278 : function (context) {
2279 style.call(this, createInjector(context));
2280 };
2281 }
2282 if (hook) {
2283 if (options.functional) {
2284 // register for functional component in vue file
2285 const originalRender = options.render;
2286 options.render = function renderWithStyleInjection(h, context) {
2287 hook.call(context);
2288 return originalRender(h, context);
2289 };
2290 }
2291 else {
2292 // inject component registration as beforeCreate hook
2293 const existing = options.beforeCreate;
2294 options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
2295 }
2296 }
2297 return script;
2298 }
2299
2300 /* script */
2301 var __vue_script__ = script;
2302 /* template */
2303
2304 var __vue_render__ = function __vue_render__() {
2305 var _vm = this;
2306
2307 var _h = _vm.$createElement;
2308
2309 var _c = _vm._self._c || _h;
2310
2311 return _c('div', {
2312 staticClass: "footer__navigation__page-info"
2313 }, [_vm.infoFn ? _c('div', [_vm._v("\n " + _vm._s(_vm.infoFn(_vm.infoParams)) + "\n ")]) : _vm.mode === 'pages' ? _c('form', {
2314 on: {
2315 "submit": function submit($event) {
2316 $event.preventDefault();
2317 }
2318 }
2319 }, [_c('label', {
2320 staticClass: "page-info__label",
2321 attrs: {
2322 "for": _vm.id
2323 }
2324 }, [_c('span', [_vm._v(_vm._s(_vm.pageText))]), _vm._v(" "), _c('input', {
2325 staticClass: "footer__navigation__page-info__current-entry",
2326 attrs: {
2327 "id": _vm.id,
2328 "aria-describedby": "change-page-hint",
2329 "aria-controls": "vgb-table",
2330 "type": "text"
2331 },
2332 domProps: {
2333 "value": _vm.currentPage
2334 },
2335 on: {
2336 "keyup": function keyup($event) {
2337 if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
2338 return null;
2339 }
2340
2341 $event.stopPropagation();
2342 return _vm.changePage($event);
2343 }
2344 }
2345 }), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.pageInfo))])]), _vm._v(" "), _c('span', {
2346 staticStyle: {
2347 "display": "none"
2348 },
2349 attrs: {
2350 "id": "change-page-hint"
2351 }
2352 }, [_vm._v("\n Type a page number and press Enter to change the page.\n ")])]) : _c('div', [_vm._v("\n " + _vm._s(_vm.recordInfo) + "\n ")])]);
2353 };
2354
2355 var __vue_staticRenderFns__ = [];
2356 /* style */
2357
2358 var __vue_inject_styles__ = undefined;
2359 /* scoped */
2360
2361 var __vue_scope_id__ = "data-v-375daa9e";
2362 /* module identifier */
2363
2364 var __vue_module_identifier__ = undefined;
2365 /* functional template */
2366
2367 var __vue_is_functional_template__ = false;
2368 /* style inject */
2369
2370 /* style inject SSR */
2371
2372 /* style inject shadow dom */
2373
2374 var __vue_component__ = /*#__PURE__*/normalizeComponent({
2375 render: __vue_render__,
2376 staticRenderFns: __vue_staticRenderFns__
2377 }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
2378
2379 //
2380 var script$1 = {
2381 name: 'VgtPagination',
2382 props: {
2383 styleClass: {
2384 "default": 'table table-bordered'
2385 },
2386 total: {
2387 "default": null
2388 },
2389 perPage: {},
2390 rtl: {
2391 "default": false
2392 },
2393 perPageDropdownEnabled: {
2394 "default": true
2395 },
2396 customRowsPerPageDropdown: {
2397 "default": function _default() {
2398 return [];
2399 }
2400 },
2401 paginateDropdownAllowAll: {
2402 "default": true
2403 },
2404 mode: {
2405 "default": PAGINATION_MODES.Records
2406 },
2407 // text options
2408 nextText: {
2409 "default": 'Next'
2410 },
2411 prevText: {
2412 "default": 'Prev'
2413 },
2414 rowsPerPageText: {
2415 "default": 'Rows per page:'
2416 },
2417 ofText: {
2418 "default": 'of'
2419 },
2420 pageText: {
2421 "default": 'page'
2422 },
2423 allText: {
2424 "default": 'All'
2425 },
2426 infoFn: {
2427 "default": null
2428 }
2429 },
2430 data: function data() {
2431 return {
2432 id: this.getId(),
2433 currentPage: 1,
2434 prevPage: 0,
2435 currentPerPage: 10,
2436 rowsPerPageOptions: []
2437 };
2438 },
2439 watch: {
2440 perPage: {
2441 handler: function handler(newValue, oldValue) {
2442 this.handlePerPage();
2443 this.perPageChanged(oldValue);
2444 },
2445 immediate: true
2446 },
2447 customRowsPerPageDropdown: function customRowsPerPageDropdown() {
2448 this.handlePerPage();
2449 },
2450 total: {
2451 handler: function handler(newValue, oldValue) {
2452 if (this.rowsPerPageOptions.indexOf(this.currentPerPage) === -1) {
2453 this.currentPerPage = newValue;
2454 }
2455 }
2456 }
2457 },
2458 computed: {
2459 // Number of pages
2460 pagesCount: function pagesCount() {
2461 var quotient = Math.floor(this.total / this.currentPerPage);
2462 var remainder = this.total % this.currentPerPage;
2463 return remainder === 0 ? quotient : quotient + 1;
2464 },
2465 // Can go to next page
2466 nextIsPossible: function nextIsPossible() {
2467 return this.currentPage < this.pagesCount;
2468 },
2469 // Can go to previous page
2470 prevIsPossible: function prevIsPossible() {
2471 return this.currentPage > 1;
2472 }
2473 },
2474 methods: {
2475 getId: function getId() {
2476 return "vgt-select-rpp-".concat(Math.floor(Math.random() * Date.now()));
2477 },
2478 // Change current page
2479 changePage: function changePage(pageNumber) {
2480 var emit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2481
2482 if (pageNumber > 0 && this.total > this.currentPerPage * (pageNumber - 1)) {
2483 this.prevPage = this.currentPage;
2484 this.currentPage = pageNumber;
2485 if (emit) this.pageChanged();
2486 }
2487 },
2488 // Go to next page
2489 nextPage: function nextPage() {
2490 if (this.nextIsPossible) {
2491 this.prevPage = this.currentPage;
2492 ++this.currentPage;
2493 this.pageChanged();
2494 }
2495 },
2496 // Go to previous page
2497 previousPage: function previousPage() {
2498 if (this.prevIsPossible) {
2499 this.prevPage = this.currentPage;
2500 --this.currentPage;
2501 this.pageChanged();
2502 }
2503 },
2504 // Indicate page changing
2505 pageChanged: function pageChanged() {
2506 this.$emit('page-changed', {
2507 currentPage: this.currentPage,
2508 prevPage: this.prevPage
2509 });
2510 },
2511 // Indicate per page changing
2512 perPageChanged: function perPageChanged(oldValue) {
2513 // go back to first page
2514 if (oldValue) {
2515 //* only emit if this isn't first initialization
2516 this.$emit('per-page-changed', {
2517 currentPerPage: this.currentPerPage
2518 });
2519 }
2520
2521 this.changePage(1, false);
2522 },
2523 // Handle per page changing
2524 handlePerPage: function handlePerPage() {
2525 //* if there's a custom dropdown then we use that
2526 if (this.customRowsPerPageDropdown !== null && Array.isArray(this.customRowsPerPageDropdown) && this.customRowsPerPageDropdown.length !== 0) {
2527 this.rowsPerPageOptions = JSON.parse(JSON.stringify(this.customRowsPerPageDropdown));
2528 } else {
2529 //* otherwise we use the default rows per page dropdown
2530 this.rowsPerPageOptions = JSON.parse(JSON.stringify(DEFAULT_ROWS_PER_PAGE_DROPDOWN));
2531 }
2532
2533 if (this.perPage) {
2534 this.currentPerPage = this.perPage; // if perPage doesn't already exist, we add it
2535
2536 var found = false;
2537
2538 for (var i = 0; i < this.rowsPerPageOptions.length; i++) {
2539 if (this.rowsPerPageOptions[i] === this.perPage) {
2540 found = true;
2541 }
2542 }
2543
2544 if (!found && this.perPage !== -1) {
2545 this.rowsPerPageOptions.unshift(this.perPage);
2546 }
2547 } else {
2548 // reset to default
2549 this.currentPerPage = 10;
2550 }
2551 }
2552 },
2553 mounted: function mounted() {},
2554 components: {
2555 'pagination-page-info': __vue_component__
2556 }
2557 };
2558
2559 /* script */
2560 var __vue_script__$1 = script$1;
2561 /* template */
2562
2563 var __vue_render__$1 = function __vue_render__() {
2564 var _vm = this;
2565
2566 var _h = _vm.$createElement;
2567
2568 var _c = _vm._self._c || _h;
2569
2570 return _c('div', {
2571 staticClass: "vgt-wrap__footer vgt-clearfix"
2572 }, [_vm.perPageDropdownEnabled ? _c('div', {
2573 staticClass: "footer__row-count vgt-pull-left"
2574 }, [_c('form', [_c('label', {
2575 staticClass: "footer__row-count__label",
2576 attrs: {
2577 "for": _vm.id
2578 }
2579 }, [_vm._v(_vm._s(_vm.rowsPerPageText) + ":")]), _vm._v(" "), _c('select', {
2580 directives: [{
2581 name: "model",
2582 rawName: "v-model",
2583 value: _vm.currentPerPage,
2584 expression: "currentPerPage"
2585 }],
2586 staticClass: "footer__row-count__select",
2587 attrs: {
2588 "id": _vm.id,
2589 "autocomplete": "off",
2590 "name": "perPageSelect",
2591 "aria-controls": "vgt-table"
2592 },
2593 on: {
2594 "change": [function ($event) {
2595 var $$selectedVal = Array.prototype.filter.call($event.target.options, function (o) {
2596 return o.selected;
2597 }).map(function (o) {
2598 var val = "_value" in o ? o._value : o.value;
2599 return val;
2600 });
2601 _vm.currentPerPage = $event.target.multiple ? $$selectedVal : $$selectedVal[0];
2602 }, _vm.perPageChanged]
2603 }
2604 }, [_vm._l(_vm.rowsPerPageOptions, function (option, idx) {
2605 return _c('option', {
2606 key: idx,
2607 domProps: {
2608 "value": option
2609 }
2610 }, [_vm._v("\n " + _vm._s(option) + "\n ")]);
2611 }), _vm._v(" "), _vm.paginateDropdownAllowAll ? _c('option', {
2612 domProps: {
2613 "value": _vm.total
2614 }
2615 }, [_vm._v(_vm._s(_vm.allText))]) : _vm._e()], 2)])]) : _vm._e(), _vm._v(" "), _c('div', {
2616 staticClass: "footer__navigation vgt-pull-right"
2617 }, [_c('pagination-page-info', {
2618 attrs: {
2619 "total-records": _vm.total,
2620 "last-page": _vm.pagesCount,
2621 "current-page": _vm.currentPage,
2622 "current-per-page": _vm.currentPerPage,
2623 "of-text": _vm.ofText,
2624 "page-text": _vm.pageText,
2625 "info-fn": _vm.infoFn,
2626 "mode": _vm.mode
2627 },
2628 on: {
2629 "page-changed": _vm.changePage
2630 }
2631 }), _vm._v(" "), _c('button', {
2632 staticClass: "footer__navigation__page-btn",
2633 "class": {
2634 disabled: !_vm.prevIsPossible
2635 },
2636 attrs: {
2637 "type": "button",
2638 "aria-controls": "vgt-table"
2639 },
2640 on: {
2641 "click": function click($event) {
2642 $event.preventDefault();
2643 $event.stopPropagation();
2644 return _vm.previousPage($event);
2645 }
2646 }
2647 }, [_c('span', {
2648 staticClass: "chevron",
2649 "class": {
2650 'left': !_vm.rtl,
2651 'right': _vm.rtl
2652 },
2653 attrs: {
2654 "aria-hidden": "true"
2655 }
2656 }), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.prevText))])]), _vm._v(" "), _c('button', {
2657 staticClass: "footer__navigation__page-btn",
2658 "class": {
2659 disabled: !_vm.nextIsPossible
2660 },
2661 attrs: {
2662 "type": "button",
2663 "aria-controls": "vgt-table"
2664 },
2665 on: {
2666 "click": function click($event) {
2667 $event.preventDefault();
2668 $event.stopPropagation();
2669 return _vm.nextPage($event);
2670 }
2671 }
2672 }, [_c('span', [_vm._v(_vm._s(_vm.nextText))]), _vm._v(" "), _c('span', {
2673 staticClass: "chevron",
2674 "class": {
2675 'right': !_vm.rtl,
2676 'left': _vm.rtl
2677 },
2678 attrs: {
2679 "aria-hidden": "true"
2680 }
2681 })])], 1)]);
2682 };
2683
2684 var __vue_staticRenderFns__$1 = [];
2685 /* style */
2686
2687 var __vue_inject_styles__$1 = undefined;
2688 /* scoped */
2689
2690 var __vue_scope_id__$1 = undefined;
2691 /* module identifier */
2692
2693 var __vue_module_identifier__$1 = undefined;
2694 /* functional template */
2695
2696 var __vue_is_functional_template__$1 = false;
2697 /* style inject */
2698
2699 /* style inject SSR */
2700
2701 /* style inject shadow dom */
2702
2703 var __vue_component__$1 = /*#__PURE__*/normalizeComponent({
2704 render: __vue_render__$1,
2705 staticRenderFns: __vue_staticRenderFns__$1
2706 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
2707
2708 //
2709 //
2710 //
2711 //
2712 //
2713 //
2714 //
2715 //
2716 //
2717 //
2718 //
2719 //
2720 //
2721 //
2722 //
2723 //
2724 //
2725 //
2726 //
2727 //
2728 //
2729 //
2730 //
2731 //
2732 //
2733 //
2734 //
2735 //
2736 var script$2 = {
2737 name: 'VgtGlobalSearch',
2738 props: ['value', 'searchEnabled', 'globalSearchPlaceholder'],
2739 data: function data() {
2740 return {
2741 globalSearchTerm: null,
2742 id: this.getId()
2743 };
2744 },
2745 computed: {
2746 showControlBar: function showControlBar() {
2747 if (this.searchEnabled) return true;
2748 if (this.$slots && this.$slots['internal-table-actions']) return true;
2749 return false;
2750 }
2751 },
2752 methods: {
2753 updateValue: function updateValue(value) {
2754 this.$emit('input', value);
2755 this.$emit('on-keyup', value);
2756 },
2757 entered: function entered(value) {
2758 this.$emit('on-enter', value);
2759 },
2760 getId: function getId() {
2761 return "vgt-search-".concat(Math.floor(Math.random() * Date.now()));
2762 }
2763 }
2764 };
2765
2766 /* script */
2767 var __vue_script__$2 = script$2;
2768 /* template */
2769
2770 var __vue_render__$2 = function __vue_render__() {
2771 var _vm = this;
2772
2773 var _h = _vm.$createElement;
2774
2775 var _c = _vm._self._c || _h;
2776
2777 return _vm.showControlBar ? _c('div', {
2778 staticClass: "vgt-global-search vgt-clearfix"
2779 }, [_c('div', {
2780 staticClass: "vgt-global-search__input vgt-pull-left"
2781 }, [_vm.searchEnabled ? _c('form', {
2782 attrs: {
2783 "role": "search"
2784 },
2785 on: {
2786 "submit": function submit($event) {
2787 $event.preventDefault();
2788 }
2789 }
2790 }, [_c('label', {
2791 attrs: {
2792 "for": _vm.id
2793 }
2794 }, [_vm._m(0), _vm._v(" "), _c('span', {
2795 staticClass: "sr-only"
2796 }, [_vm._v("Search")])]), _vm._v(" "), _c('input', {
2797 staticClass: "vgt-input vgt-pull-left",
2798 attrs: {
2799 "id": _vm.id,
2800 "type": "text",
2801 "placeholder": null
2802 },
2803 domProps: {
2804 "value": _vm.value
2805 },
2806 on: {
2807 "input": function input($event) {
2808 return _vm.updateValue($event.target.value);
2809 },
2810 "keyup": function keyup($event) {
2811 if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
2812 return null;
2813 }
2814
2815 return _vm.entered($event.target.value);
2816 }
2817 }
2818 })]) : _vm._e()]), _vm._v(" "), _c('div', {
2819 staticClass: "vgt-global-search__actions vgt-pull-right"
2820 }, [_vm._t("internal-table-actions")], 2)]) : _vm._e();
2821 };
2822
2823 var __vue_staticRenderFns__$2 = [function () {
2824 var _vm = this;
2825
2826 var _h = _vm.$createElement;
2827
2828 var _c = _vm._self._c || _h;
2829
2830 return _c('span', {
2831 staticClass: "input__icon",
2832 attrs: {
2833 "aria-hidden": "true"
2834 }
2835 }, [_c('div', {
2836 staticClass: "magnifying-glass"
2837 })]);
2838 }];
2839 /* style */
2840
2841 var __vue_inject_styles__$2 = undefined;
2842 /* scoped */
2843
2844 var __vue_scope_id__$2 = undefined;
2845 /* module identifier */
2846
2847 var __vue_module_identifier__$2 = undefined;
2848 /* functional template */
2849
2850 var __vue_is_functional_template__$2 = false;
2851 /* style inject */
2852
2853 /* style inject SSR */
2854
2855 /* style inject shadow dom */
2856
2857 var __vue_component__$2 = /*#__PURE__*/normalizeComponent({
2858 render: __vue_render__$2,
2859 staticRenderFns: __vue_staticRenderFns__$2
2860 }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
2861
2862 //
2863 //
2864 //
2865 //
2866 //
2867 //
2868 //
2869 //
2870 //
2871 //
2872 //
2873 //
2874 //
2875 //
2876 //
2877 //
2878 //
2879 //
2880 //
2881 //
2882 //
2883 //
2884 //
2885 //
2886 //
2887 //
2888 //
2889 //
2890 //
2891 //
2892 //
2893 //
2894 //
2895 //
2896 //
2897 //
2898 //
2899 //
2900 //
2901 //
2902 //
2903 //
2904 //
2905 //
2906 //
2907 //
2908 //
2909 //
2910 //
2911 //
2912 //
2913 //
2914 //
2915 //
2916 //
2917 //
2918 //
2919 //
2920 //
2921 //
2922 //
2923 var script$3 = {
2924 name: 'VgtFilterRow',
2925 props: ['lineNumbers', 'columns', 'typedColumns', 'globalSearchEnabled', 'selectable', 'mode'],
2926 watch: {
2927 columns: {
2928 handler: function handler(newValue, oldValue) {
2929 this.populateInitialFilters();
2930 },
2931 deep: true,
2932 immediate: true
2933 }
2934 },
2935 data: function data() {
2936 return {
2937 columnFilters: {},
2938 timer: null
2939 };
2940 },
2941 computed: {
2942 // to create a filter row, we need to
2943 // make sure that there is atleast 1 column
2944 // that requires filtering
2945 hasFilterRow: function hasFilterRow() {
2946 // if (this.mode === 'remote' || !this.globalSearchEnabled) {
2947 for (var i = 0; i < this.columns.length; i++) {
2948 var col = this.columns[i];
2949
2950 if (col.filterOptions && col.filterOptions.enabled) {
2951 return true;
2952 }
2953 } // }
2954
2955
2956 return false;
2957 }
2958 },
2959 methods: {
2960 fieldKey: function fieldKey(field) {
2961 if (typeof field === 'function' && field.name) {
2962 return field.name;
2963 }
2964
2965 return field;
2966 },
2967 reset: function reset() {
2968 var emitEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2969 this.columnFilters = {};
2970
2971 if (emitEvent) {
2972 this.$emit('filter-changed', this.columnFilters);
2973 }
2974 },
2975 isFilterable: function isFilterable(column) {
2976 return column.filterOptions && column.filterOptions.enabled;
2977 },
2978 isDropdown: function isDropdown(column) {
2979 return this.isFilterable(column) && column.filterOptions.filterDropdownItems && column.filterOptions.filterDropdownItems.length;
2980 },
2981 isDropdownObjects: function isDropdownObjects(column) {
2982 return this.isDropdown(column) && _typeof(column.filterOptions.filterDropdownItems[0]) === 'object';
2983 },
2984 isDropdownArray: function isDropdownArray(column) {
2985 return this.isDropdown(column) && _typeof(column.filterOptions.filterDropdownItems[0]) !== 'object';
2986 },
2987 getClasses: function getClasses(column) {
2988 var firstClass = 'filter-th';
2989 return column.filterOptions && column.filterOptions.styleClass ? [firstClass].concat(_toConsumableArray(column.filterOptions.styleClass.split(' '))).join(' ') : firstClass;
2990 },
2991 // get column's defined placeholder or default one
2992 getPlaceholder: function getPlaceholder(column) {
2993 var placeholder = this.isFilterable(column) && column.filterOptions.placeholder || "Filter ".concat(column.label);
2994 return placeholder;
2995 },
2996 getName: function getName(column) {
2997 return "vgt-".concat(this.fieldKey(column.field));
2998 },
2999 updateFiltersOnEnter: function updateFiltersOnEnter(column, value) {
3000 if (this.timer) clearTimeout(this.timer);
3001 this.updateFiltersImmediately(column.field, value);
3002 },
3003 updateFiltersOnKeyup: function updateFiltersOnKeyup(column, value) {
3004 // if the trigger is enter, we don't filter on keyup
3005 if (column.filterOptions.trigger === 'enter') return;
3006 this.updateFilters(column, value);
3007 },
3008 updateSlotFilter: function updateSlotFilter(column, value) {
3009 var fieldToFilter = column.filterOptions.slotFilterField || column.field;
3010
3011 if (typeof column.filterOptions.formatValue === 'function') {
3012 value = column.filterOptions.formatValue(value);
3013 }
3014
3015 this.updateFiltersImmediately(fieldToFilter, value);
3016 },
3017 // since vue doesn't detect property addition and deletion, we
3018 // need to create helper function to set property etc
3019 updateFilters: function updateFilters(column, value) {
3020 var _this = this;
3021
3022 if (this.timer) clearTimeout(this.timer);
3023 this.timer = setTimeout(function () {
3024 _this.updateFiltersImmediately(column.field, value);
3025 }, 400);
3026 },
3027 updateFiltersImmediately: function updateFiltersImmediately(field, value) {
3028 this.$set(this.columnFilters, this.fieldKey(field), value);
3029 this.$emit('filter-changed', this.columnFilters);
3030 },
3031 populateInitialFilters: function populateInitialFilters() {
3032 for (var i = 0; i < this.columns.length; i++) {
3033 var col = this.columns[i]; // lets see if there are initial
3034 // filters supplied by user
3035
3036 if (this.isFilterable(col) && typeof col.filterOptions.filterValue !== 'undefined' && col.filterOptions.filterValue !== null) {
3037 this.$set(this.columnFilters, this.fieldKey(col.field), col.filterOptions.filterValue); // this.updateFilters(col, col.filterOptions.filterValue);
3038 // this.$set(col.filterOptions, 'filterValue', undefined);
3039 }
3040 } //* lets emit event once all filters are set
3041
3042
3043 this.$emit('filter-changed', this.columnFilters);
3044 }
3045 }
3046 };
3047
3048 /* script */
3049 var __vue_script__$3 = script$3;
3050 /* template */
3051
3052 var __vue_render__$3 = function __vue_render__() {
3053 var _vm = this;
3054
3055 var _h = _vm.$createElement;
3056
3057 var _c = _vm._self._c || _h;
3058
3059 return _vm.hasFilterRow ? _c('tr', [_vm.lineNumbers ? _c('th') : _vm._e(), _vm._v(" "), _vm.selectable ? _c('th') : _vm._e(), _vm._v(" "), _vm._l(_vm.columns, function (column, index) {
3060 return !column.hidden ? _c('th', {
3061 key: index,
3062 "class": _vm.getClasses(column)
3063 }, [_vm._t("column-filter", [_vm.isFilterable(column) ? _c('div', [!_vm.isDropdown(column) ? _c('input', {
3064 staticClass: "vgt-input",
3065 attrs: {
3066 "name": _vm.getName(column),
3067 "type": "text",
3068 "placeholder": _vm.getPlaceholder(column)
3069 },
3070 domProps: {
3071 "value": _vm.columnFilters[_vm.fieldKey(column.field)]
3072 },
3073 on: {
3074 "keyup": function keyup($event) {
3075 if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
3076 return null;
3077 }
3078
3079 return _vm.updateFiltersOnEnter(column, $event.target.value);
3080 },
3081 "input": function input($event) {
3082 return _vm.updateFiltersOnKeyup(column, $event.target.value);
3083 }
3084 }
3085 }) : _vm._e(), _vm._v(" "), _vm.isDropdownArray(column) ? _c('select', {
3086 staticClass: "vgt-select",
3087 attrs: {
3088 "name": _vm.getName(column)
3089 },
3090 domProps: {
3091 "value": _vm.columnFilters[_vm.fieldKey(column.field)]
3092 },
3093 on: {
3094 "change": function change($event) {
3095 return _vm.updateFiltersImmediately(column.field, $event.target.value);
3096 }
3097 }
3098 }, [_c('option', {
3099 key: "-1",
3100 attrs: {
3101 "value": ""
3102 }
3103 }, [_vm._v(_vm._s(_vm.getPlaceholder(column)))]), _vm._v(" "), _vm._l(column.filterOptions.filterDropdownItems, function (option, i) {
3104 return _c('option', {
3105 key: i,
3106 domProps: {
3107 "value": option
3108 }
3109 }, [_vm._v("\n " + _vm._s(option) + "\n ")]);
3110 })], 2) : _vm._e(), _vm._v(" "), _vm.isDropdownObjects(column) ? _c('select', {
3111 staticClass: "vgt-select",
3112 attrs: {
3113 "name": _vm.getName(column)
3114 },
3115 domProps: {
3116 "value": _vm.columnFilters[_vm.fieldKey(column.field)]
3117 },
3118 on: {
3119 "change": function change($event) {
3120 return _vm.updateFiltersImmediately(column.field, $event.target.value);
3121 }
3122 }
3123 }, [_c('option', {
3124 key: "-1",
3125 attrs: {
3126 "value": ""
3127 }
3128 }, [_vm._v(_vm._s(_vm.getPlaceholder(column)))]), _vm._v(" "), _vm._l(column.filterOptions.filterDropdownItems, function (option, i) {
3129 return _c('option', {
3130 key: i,
3131 domProps: {
3132 "value": option.value
3133 }
3134 }, [_vm._v(_vm._s(option.text))]);
3135 })], 2) : _vm._e()]) : _vm._e()], {
3136 "column": column,
3137 "updateFilters": _vm.updateSlotFilter
3138 })], 2) : _vm._e();
3139 })], 2) : _vm._e();
3140 };
3141
3142 var __vue_staticRenderFns__$3 = [];
3143 /* style */
3144
3145 var __vue_inject_styles__$3 = undefined;
3146 /* scoped */
3147
3148 var __vue_scope_id__$3 = "data-v-6869bf1c";
3149 /* module identifier */
3150
3151 var __vue_module_identifier__$3 = undefined;
3152 /* functional template */
3153
3154 var __vue_is_functional_template__$3 = false;
3155 /* style inject */
3156
3157 /* style inject SSR */
3158
3159 /* style inject shadow dom */
3160
3161 var __vue_component__$3 = /*#__PURE__*/normalizeComponent({
3162 render: __vue_render__$3,
3163 staticRenderFns: __vue_staticRenderFns__$3
3164 }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
3165
3166 function getColumnFirstSortType(column) {
3167 return column.firstSortType || DEFAULT_SORT_TYPE;
3168 }
3169
3170 function getCurrentPrimarySort(sortArray, column) {
3171 return sortArray.length === 1 && sortArray[0].field === column.field ? sortArray[0].type : undefined;
3172 }
3173
3174 function getNextSort(currentSort) {
3175 if (currentSort === SORT_TYPES.Ascending) {
3176 return SORT_TYPES.Descending;
3177 }
3178
3179 return SORT_TYPES.Ascending;
3180 }
3181
3182 function getIndex(sortArray, column) {
3183 for (var i = 0; i < sortArray.length; i++) {
3184 if (column.field === sortArray[i].field) return i;
3185 }
3186
3187 return -1;
3188 }
3189
3190 var primarySort = function primarySort(sortArray, column) {
3191 var currentPrimarySort = getCurrentPrimarySort(sortArray, column);
3192 var nextPrimarySort = getNextSort(currentPrimarySort);
3193 return [{
3194 field: column.field,
3195 type: currentPrimarySort ? nextPrimarySort : getColumnFirstSortType(column)
3196 }];
3197 };
3198
3199 var secondarySort = function secondarySort(sortArray, column) {
3200 var index = getIndex(sortArray, column);
3201
3202 if (index === -1) {
3203 sortArray.push({
3204 field: column.field,
3205 type: getColumnFirstSortType(column)
3206 });
3207 } else {
3208 sortArray[index].type = getNextSort(sortArray[index].type);
3209 }
3210
3211 return sortArray;
3212 };
3213
3214 //
3215 var script$4 = {
3216 name: 'VgtTableHeader',
3217 props: {
3218 lineNumbers: {
3219 "default": false,
3220 type: Boolean
3221 },
3222 selectable: {
3223 "default": false,
3224 type: Boolean
3225 },
3226 allSelected: {
3227 "default": false,
3228 type: Boolean
3229 },
3230 allSelectedIndeterminate: {
3231 "default": false,
3232 type: Boolean
3233 },
3234 columns: {
3235 type: Array
3236 },
3237 mode: {
3238 type: String
3239 },
3240 typedColumns: {},
3241 //* Sort related
3242 sortable: {
3243 type: Boolean
3244 },
3245 // sortColumn: {
3246 // type: Number,
3247 // },
3248 // sortType: {
3249 // type: String,
3250 // },
3251 // utility functions
3252 // isSortableColumn: {
3253 // type: Function,
3254 // },
3255 getClasses: {
3256 type: Function
3257 },
3258 //* search related
3259 searchEnabled: {
3260 type: Boolean
3261 },
3262 tableRef: {},
3263 paginated: {}
3264 },
3265 watch: {
3266 columns: {
3267 handler: function handler() {
3268 this.setColumnStyles();
3269 },
3270 immediate: true
3271 },
3272 tableRef: {
3273 handler: function handler() {
3274 this.setColumnStyles();
3275 },
3276 immediate: true
3277 },
3278 paginated: {
3279 handler: function handler() {
3280 if (this.tableRef) {
3281 this.setColumnStyles();
3282 }
3283 },
3284 deep: true
3285 }
3286 },
3287 data: function data() {
3288 return {
3289 checkBoxThStyle: {},
3290 lineNumberThStyle: {},
3291 columnStyles: [],
3292 sorts: [],
3293 ro: null
3294 };
3295 },
3296 computed: {},
3297 methods: {
3298 reset: function reset() {
3299 this.$refs['filter-row'].reset(true);
3300 },
3301 toggleSelectAll: function toggleSelectAll() {
3302 this.$emit('on-toggle-select-all');
3303 },
3304 isSortableColumn: function isSortableColumn(column) {
3305 var sortable = column.sortable;
3306 var isSortable = typeof sortable === 'boolean' ? sortable : this.sortable;
3307 return isSortable;
3308 },
3309 sort: function sort(e, column) {
3310 //* if column is not sortable, return right here
3311 if (!this.isSortableColumn(column)) return;
3312
3313 if (e.shiftKey) {
3314 this.sorts = secondarySort(this.sorts, column);
3315 } else {
3316 this.sorts = primarySort(this.sorts, column);
3317 }
3318
3319 this.$emit('on-sort-change', this.sorts);
3320 },
3321 setInitialSort: function setInitialSort(sorts) {
3322 this.sorts = sorts;
3323 this.$emit('on-sort-change', this.sorts);
3324 },
3325 getColumnSort: function getColumnSort(column) {
3326 for (var i = 0; i < this.sorts.length; i += 1) {
3327 if (this.sorts[i].field === column.field) {
3328 return this.sorts[i].type || 'asc';
3329 }
3330 }
3331
3332 return null;
3333 },
3334 getColumnSortLong: function getColumnSortLong(column) {
3335 return this.getColumnSort(column) === 'asc' ? 'ascending' : 'descending';
3336 },
3337 getHeaderClasses: function getHeaderClasses(column, index) {
3338 var classes = Object.assign({}, this.getClasses(index, 'th'), {
3339 sortable: this.isSortableColumn(column),
3340 'sorting sorting-desc': this.getColumnSort(column) === 'desc',
3341 'sorting sorting-asc': this.getColumnSort(column) === 'asc'
3342 });
3343 return classes;
3344 },
3345 filterRows: function filterRows(columnFilters) {
3346 this.$emit('filter-changed', columnFilters);
3347 },
3348 getWidthStyle: function getWidthStyle(dom) {
3349 if (window && window.getComputedStyle && dom) {
3350 var cellStyle = window.getComputedStyle(dom, null);
3351 return {
3352 width: cellStyle.width
3353 };
3354 }
3355
3356 return {
3357 width: 'auto'
3358 };
3359 },
3360 setColumnStyles: function setColumnStyles() {
3361 var colStyles = [];
3362
3363 for (var i = 0; i < this.columns.length; i++) {
3364 if (this.tableRef) {
3365 var skip = 0;
3366 if (this.selectable) skip++;
3367 if (this.lineNumbers) skip++;
3368 var cell = this.tableRef.rows[0].cells[i + skip];
3369 colStyles.push(this.getWidthStyle(cell));
3370 } else {
3371 colStyles.push({
3372 minWidth: this.columns[i].width ? this.columns[i].width : 'auto',
3373 maxWidth: this.columns[i].width ? this.columns[i].width : 'auto',
3374 width: this.columns[i].width ? this.columns[i].width : 'auto'
3375 });
3376 }
3377 }
3378
3379 this.columnStyles = colStyles;
3380 },
3381 getColumnStyle: function getColumnStyle(column, index) {
3382 var styleObject = {
3383 minWidth: column.width ? column.width : 'auto',
3384 maxWidth: column.width ? column.width : 'auto',
3385 width: column.width ? column.width : 'auto'
3386 }; //* if fixed header we need to get width from original table
3387
3388 if (this.tableRef) {
3389 if (this.selectable) index++;
3390 if (this.lineNumbers) index++;
3391 var cell = this.tableRef.rows[0].cells[index];
3392 var cellStyle = window.getComputedStyle(cell, null);
3393 styleObject.width = cellStyle.width;
3394 }
3395
3396 return styleObject;
3397 }
3398 },
3399 mounted: function mounted() {
3400 var _this = this;
3401
3402 this.$nextTick(function () {
3403 // We're going to watch the parent element for resize events, and calculate column widths if it changes
3404 if (ResizeObserver) {
3405 _this.ro = new ResizeObserver(function () {
3406 _this.setColumnStyles();
3407 });
3408
3409 _this.ro.observe(_this.$parent.$el); // If this is a fixed-header table, we want to observe each column header from the non-fixed header.
3410 // You can imagine two columns swapping widths, which wouldn't cause the above to trigger.
3411 // This gets the first tr element of the primary table header, and iterates through its children (the th elements)
3412
3413
3414 if (_this.tableRef) {
3415 Array.from(_this.$parent.$refs['table-header-primary'].$el.children[0].children).forEach(function (header) {
3416 _this.ro.observe(header);
3417 });
3418 }
3419 }
3420 });
3421 },
3422 beforeDestroy: function beforeDestroy() {
3423 if (this.ro) {
3424 this.ro.disconnect();
3425 }
3426 },
3427 components: {
3428 'vgt-filter-row': __vue_component__$3
3429 }
3430 };
3431
3432 /* script */
3433 var __vue_script__$4 = script$4;
3434 /* template */
3435
3436 var __vue_render__$4 = function __vue_render__() {
3437 var _vm = this;
3438
3439 var _h = _vm.$createElement;
3440
3441 var _c = _vm._self._c || _h;
3442
3443 return _c('thead', [_c('tr', [_vm.lineNumbers ? _c('th', {
3444 staticClass: "line-numbers",
3445 attrs: {
3446 "scope": "col"
3447 }
3448 }) : _vm._e(), _vm._v(" "), _vm.selectable ? _c('th', {
3449 staticClass: "vgt-checkbox-col",
3450 attrs: {
3451 "scope": "col"
3452 }
3453 }, [_c('input', {
3454 attrs: {
3455 "type": "checkbox"
3456 },
3457 domProps: {
3458 "checked": _vm.allSelected,
3459 "indeterminate": _vm.allSelectedIndeterminate
3460 },
3461 on: {
3462 "change": _vm.toggleSelectAll
3463 }
3464 })]) : _vm._e(), _vm._v(" "), _vm._l(_vm.columns, function (column, index) {
3465 return !column.hidden ? _c('th', {
3466 key: index,
3467 "class": _vm.getHeaderClasses(column, index),
3468 style: _vm.columnStyles[index],
3469 attrs: {
3470 "scope": "col",
3471 "aria-sort": _vm.getColumnSortLong(column),
3472 "aria-controls": "col-" + index
3473 }
3474 }, [_vm._t("table-column", [_vm._v("\n " + _vm._s(column.label) + "\n ")], {
3475 "column": column
3476 }), _vm._v(" "), _vm.isSortableColumn(column) ? _c('button', {
3477 on: {
3478 "click": function click($event) {
3479 return _vm.sort($event, column);
3480 }
3481 }
3482 }, [_c('span', {
3483 staticClass: "sr-only"
3484 }, [_vm._v("\n Sort table by " + _vm._s(column.label) + " in " + _vm._s(_vm.getColumnSortLong(column)) + " order\n ")])]) : _vm._e()], 2) : _vm._e();
3485 })], 2), _vm._v(" "), _c("vgt-filter-row", {
3486 ref: "filter-row",
3487 tag: "tr",
3488 attrs: {
3489 "global-search-enabled": _vm.searchEnabled,
3490 "line-numbers": _vm.lineNumbers,
3491 "selectable": _vm.selectable,
3492 "columns": _vm.columns,
3493 "mode": _vm.mode,
3494 "typed-columns": _vm.typedColumns
3495 },
3496 on: {
3497 "filter-changed": _vm.filterRows
3498 },
3499 scopedSlots: _vm._u([{
3500 key: "column-filter",
3501 fn: function fn(props) {
3502 return [_vm._t("column-filter", null, {
3503 "column": props.column,
3504 "updateFilters": props.updateFilters
3505 })];
3506 }
3507 }], null, true)
3508 })], 1);
3509 };
3510
3511 var __vue_staticRenderFns__$4 = [];
3512 /* style */
3513
3514 var __vue_inject_styles__$4 = undefined;
3515 /* scoped */
3516
3517 var __vue_scope_id__$4 = undefined;
3518 /* module identifier */
3519
3520 var __vue_module_identifier__$4 = undefined;
3521 /* functional template */
3522
3523 var __vue_is_functional_template__$4 = false;
3524 /* style inject */
3525
3526 /* style inject SSR */
3527
3528 /* style inject shadow dom */
3529
3530 var __vue_component__$4 = /*#__PURE__*/normalizeComponent({
3531 render: __vue_render__$4,
3532 staticRenderFns: __vue_staticRenderFns__$4
3533 }, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
3534
3535 //
3536 //
3537 //
3538 //
3539 //
3540 //
3541 //
3542 //
3543 //
3544 //
3545 //
3546 //
3547 //
3548 //
3549 //
3550 //
3551 //
3552 //
3553 //
3554 //
3555 //
3556 //
3557 //
3558 //
3559 //
3560 //
3561 //
3562 //
3563 //
3564 //
3565 //
3566 //
3567 //
3568 //
3569 //
3570 //
3571 //
3572 //
3573 //
3574 //
3575 //
3576 //
3577 //
3578 //
3579 //
3580 //
3581 //
3582 //
3583 //
3584 //
3585 //
3586 //
3587 //
3588 //
3589 //
3590 //
3591 //
3592 //
3593 //
3594 //
3595 //
3596 //
3597 //
3598 //
3599 //
3600 //
3601 //
3602 //
3603 //
3604 //
3605 //
3606 //
3607 //
3608 //
3609 var script$5 = {
3610 name: 'VgtHeaderRow',
3611 props: {
3612 headerRow: {
3613 type: Object
3614 },
3615 columns: {
3616 type: Array
3617 },
3618 lineNumbers: {
3619 type: Boolean
3620 },
3621 selectable: {
3622 type: Boolean
3623 },
3624 selectAllByGroup: {
3625 type: Boolean
3626 },
3627 collapsable: {
3628 type: [Boolean, Number],
3629 "default": false
3630 },
3631 collectFormatted: {
3632 type: Function
3633 },
3634 formattedRow: {
3635 type: Function
3636 },
3637 getClasses: {
3638 type: Function
3639 },
3640 fullColspan: {
3641 type: Number
3642 },
3643 groupIndex: {
3644 type: Number
3645 }
3646 },
3647 data: function data() {
3648 return {};
3649 },
3650 computed: {
3651 allSelected: function allSelected() {
3652 var headerRow = this.headerRow,
3653 groupChildObject = this.groupChildObject;
3654 return headerRow.children.filter(function (row) {
3655 return row.vgtSelected;
3656 }).length === headerRow.children.length;
3657 }
3658 },
3659 methods: {
3660 columnCollapsable: function columnCollapsable(currentIndex) {
3661 if (this.collapsable === true) {
3662 return currentIndex === 0;
3663 }
3664
3665 return currentIndex === this.collapsable;
3666 },
3667 toggleSelectGroup: function toggleSelectGroup(event) {
3668 this.$emit('on-select-group-change', {
3669 groupIndex: this.groupIndex,
3670 checked: event.target.checked
3671 });
3672 }
3673 },
3674 mounted: function mounted() {},
3675 components: {}
3676 };
3677
3678 /* script */
3679 var __vue_script__$5 = script$5;
3680 /* template */
3681
3682 var __vue_render__$5 = function __vue_render__() {
3683 var _vm = this;
3684
3685 var _h = _vm.$createElement;
3686
3687 var _c = _vm._self._c || _h;
3688
3689 return _c('tr', [_vm.headerRow.mode === 'span' ? _c('th', {
3690 staticClass: "vgt-left-align vgt-row-header",
3691 attrs: {
3692 "colspan": _vm.fullColspan
3693 }
3694 }, [_vm.selectAllByGroup ? [_vm._t("table-header-group-select", [_c('input', {
3695 attrs: {
3696 "type": "checkbox"
3697 },
3698 domProps: {
3699 "checked": _vm.allSelected
3700 },
3701 on: {
3702 "change": function change($event) {
3703 return _vm.toggleSelectGroup($event);
3704 }
3705 }
3706 })], {
3707 "columns": _vm.columns,
3708 "row": _vm.headerRow
3709 })] : _vm._e(), _vm._v(" "), _c('span', {
3710 on: {
3711 "click": function click($event) {
3712 _vm.collapsable ? _vm.$emit('vgtExpand', !_vm.headerRow.vgtIsExpanded) : function () {};
3713 }
3714 }
3715 }, [_vm.collapsable ? _c('span', {
3716 staticClass: "triangle",
3717 "class": {
3718 'expand': _vm.headerRow.vgtIsExpanded
3719 }
3720 }) : _vm._e(), _vm._v(" "), _vm._t("table-header-row", [_vm.headerRow.html ? _c('span', {
3721 domProps: {
3722 "innerHTML": _vm._s(_vm.headerRow.label)
3723 }
3724 }) : _c('span', [_vm._v("\n " + _vm._s(_vm.headerRow.label) + "\n ")])], {
3725 "row": _vm.headerRow
3726 })], 2)], 2) : _vm._e(), _vm._v(" "), _vm.headerRow.mode !== 'span' && _vm.lineNumbers ? _c('th', {
3727 staticClass: "vgt-row-header"
3728 }) : _vm._e(), _vm._v(" "), _vm.headerRow.mode !== 'span' && _vm.selectable ? _c('th', {
3729 staticClass: "vgt-row-header"
3730 }, [_vm.selectAllByGroup ? [_vm._t("table-header-group-select", [_c('input', {
3731 attrs: {
3732 "type": "checkbox"
3733 },
3734 domProps: {
3735 "checked": _vm.allSelected
3736 },
3737 on: {
3738 "change": function change($event) {
3739 return _vm.toggleSelectGroup($event);
3740 }
3741 }
3742 })], {
3743 "columns": _vm.columns,
3744 "row": _vm.headerRow
3745 })] : _vm._e()], 2) : _vm._e(), _vm._v(" "), _vm._l(_vm.columns, function (column, i) {
3746 return _vm.headerRow.mode !== 'span' && !column.hidden ? _c('th', {
3747 key: i,
3748 staticClass: "vgt-row-header",
3749 "class": _vm.getClasses(i, 'td'),
3750 on: {
3751 "click": function click($event) {
3752 _vm.columnCollapsable(i) ? _vm.$emit('vgtExpand', !_vm.headerRow.vgtIsExpanded) : function () {};
3753 }
3754 }
3755 }, [_vm.columnCollapsable(i) ? _c('span', {
3756 staticClass: "triangle",
3757 "class": {
3758 'expand': _vm.headerRow.vgtIsExpanded
3759 }
3760 }) : _vm._e(), _vm._v(" "), _vm._t("table-header-row", [!column.html ? _c('span', [_vm._v("\n " + _vm._s(_vm.collectFormatted(_vm.headerRow, column, true)) + "\n ")]) : _vm._e(), _vm._v(" "), column.html ? _c('span', {
3761 domProps: {
3762 "innerHTML": _vm._s(_vm.collectFormatted(_vm.headerRow, column, true))
3763 }
3764 }) : _vm._e()], {
3765 "row": _vm.headerRow,
3766 "column": column,
3767 "formattedRow": _vm.formattedRow(_vm.headerRow, true)
3768 })], 2) : _vm._e();
3769 })], 2);
3770 };
3771
3772 var __vue_staticRenderFns__$5 = [];
3773 /* style */
3774
3775 var __vue_inject_styles__$5 = undefined;
3776 /* scoped */
3777
3778 var __vue_scope_id__$5 = undefined;
3779 /* module identifier */
3780
3781 var __vue_module_identifier__$5 = undefined;
3782 /* functional template */
3783
3784 var __vue_is_functional_template__$5 = false;
3785 /* style inject */
3786
3787 /* style inject SSR */
3788
3789 /* style inject shadow dom */
3790
3791 var __vue_component__$5 = /*#__PURE__*/normalizeComponent({
3792 render: __vue_render__$5,
3793 staticRenderFns: __vue_staticRenderFns__$5
3794 }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
3795
3796 function toInteger(dirtyNumber) {
3797 if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
3798 return NaN;
3799 }
3800
3801 var number = Number(dirtyNumber);
3802
3803 if (isNaN(number)) {
3804 return number;
3805 }
3806
3807 return number < 0 ? Math.ceil(number) : Math.floor(number);
3808 }
3809
3810 function requiredArgs(required, args) {
3811 if (args.length < required) {
3812 throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
3813 }
3814 }
3815
3816 /**
3817 * @name toDate
3818 * @category Common Helpers
3819 * @summary Convert the given argument to an instance of Date.
3820 *
3821 * @description
3822 * Convert the given argument to an instance of Date.
3823 *
3824 * If the argument is an instance of Date, the function returns its clone.
3825 *
3826 * If the argument is a number, it is treated as a timestamp.
3827 *
3828 * If the argument is none of the above, the function returns Invalid Date.
3829 *
3830 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
3831 *
3832 * @param {Date|Number} argument - the value to convert
3833 * @returns {Date} the parsed date in the local time zone
3834 * @throws {TypeError} 1 argument required
3835 *
3836 * @example
3837 * // Clone the date:
3838 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
3839 * //=> Tue Feb 11 2014 11:30:30
3840 *
3841 * @example
3842 * // Convert the timestamp to date:
3843 * const result = toDate(1392098430000)
3844 * //=> Tue Feb 11 2014 11:30:30
3845 */
3846
3847 function toDate(argument) {
3848 requiredArgs(1, arguments);
3849 var argStr = Object.prototype.toString.call(argument); // Clone the date
3850
3851 if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
3852 // Prevent the date to lose the milliseconds when passed to new Date() in IE10
3853 return new Date(argument.getTime());
3854 } else if (typeof argument === 'number' || argStr === '[object Number]') {
3855 return new Date(argument);
3856 } else {
3857 if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
3858 // eslint-disable-next-line no-console
3859 console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
3860
3861 console.warn(new Error().stack);
3862 }
3863
3864 return new Date(NaN);
3865 }
3866 }
3867
3868 /**
3869 * @name addMilliseconds
3870 * @category Millisecond Helpers
3871 * @summary Add the specified number of milliseconds to the given date.
3872 *
3873 * @description
3874 * Add the specified number of milliseconds to the given date.
3875 *
3876 * ### v2.0.0 breaking changes:
3877 *
3878 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
3879 *
3880 * @param {Date|Number} date - the date to be changed
3881 * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
3882 * @returns {Date} the new date with the milliseconds added
3883 * @throws {TypeError} 2 arguments required
3884 *
3885 * @example
3886 * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
3887 * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
3888 * //=> Thu Jul 10 2014 12:45:30.750
3889 */
3890
3891 function addMilliseconds(dirtyDate, dirtyAmount) {
3892 requiredArgs(2, arguments);
3893 var timestamp = toDate(dirtyDate).getTime();
3894 var amount = toInteger(dirtyAmount);
3895 return new Date(timestamp + amount);
3896 }
3897
3898 var MILLISECONDS_IN_MINUTE = 60000;
3899
3900 function getDateMillisecondsPart(date) {
3901 return date.getTime() % MILLISECONDS_IN_MINUTE;
3902 }
3903 /**
3904 * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
3905 * They usually appear for dates that denote time before the timezones were introduced
3906 * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
3907 * and GMT+01:00:00 after that date)
3908 *
3909 * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
3910 * which would lead to incorrect calculations.
3911 *
3912 * This function returns the timezone offset in milliseconds that takes seconds in account.
3913 */
3914
3915
3916 function getTimezoneOffsetInMilliseconds(dirtyDate) {
3917 var date = new Date(dirtyDate.getTime());
3918 var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
3919 date.setSeconds(0, 0);
3920 var hasNegativeUTCOffset = baseTimezoneOffset > 0;
3921 var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
3922 return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
3923 }
3924
3925 /**
3926 * @name compareAsc
3927 * @category Common Helpers
3928 * @summary Compare the two dates and return -1, 0 or 1.
3929 *
3930 * @description
3931 * Compare the two dates and return 1 if the first date is after the second,
3932 * -1 if the first date is before the second or 0 if dates are equal.
3933 *
3934 * ### v2.0.0 breaking changes:
3935 *
3936 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
3937 *
3938 * @param {Date|Number} dateLeft - the first date to compare
3939 * @param {Date|Number} dateRight - the second date to compare
3940 * @returns {Number} the result of the comparison
3941 * @throws {TypeError} 2 arguments required
3942 *
3943 * @example
3944 * // Compare 11 February 1987 and 10 July 1989:
3945 * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
3946 * //=> -1
3947 *
3948 * @example
3949 * // Sort the array of dates:
3950 * const result = [
3951 * new Date(1995, 6, 2),
3952 * new Date(1987, 1, 11),
3953 * new Date(1989, 6, 10)
3954 * ].sort(compareAsc)
3955 * //=> [
3956 * // Wed Feb 11 1987 00:00:00,
3957 * // Mon Jul 10 1989 00:00:00,
3958 * // Sun Jul 02 1995 00:00:00
3959 * // ]
3960 */
3961
3962 function compareAsc(dirtyDateLeft, dirtyDateRight) {
3963 requiredArgs(2, arguments);
3964 var dateLeft = toDate(dirtyDateLeft);
3965 var dateRight = toDate(dirtyDateRight);
3966 var diff = dateLeft.getTime() - dateRight.getTime();
3967
3968 if (diff < 0) {
3969 return -1;
3970 } else if (diff > 0) {
3971 return 1; // Return 0 if diff is 0; return NaN if diff is NaN
3972 } else {
3973 return diff;
3974 }
3975 }
3976
3977 /**
3978 * @name isValid
3979 * @category Common Helpers
3980 * @summary Is the given date valid?
3981 *
3982 * @description
3983 * Returns false if argument is Invalid Date and true otherwise.
3984 * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
3985 * Invalid Date is a Date, whose time value is NaN.
3986 *
3987 * Time value of Date: http://es5.github.io/#x15.9.1.1
3988 *
3989 * ### v2.0.0 breaking changes:
3990 *
3991 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
3992 *
3993 * - Now `isValid` doesn't throw an exception
3994 * if the first argument is not an instance of Date.
3995 * Instead, argument is converted beforehand using `toDate`.
3996 *
3997 * Examples:
3998 *
3999 * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
4000 * |---------------------------|---------------|---------------|
4001 * | `new Date()` | `true` | `true` |
4002 * | `new Date('2016-01-01')` | `true` | `true` |
4003 * | `new Date('')` | `false` | `false` |
4004 * | `new Date(1488370835081)` | `true` | `true` |
4005 * | `new Date(NaN)` | `false` | `false` |
4006 * | `'2016-01-01'` | `TypeError` | `false` |
4007 * | `''` | `TypeError` | `false` |
4008 * | `1488370835081` | `TypeError` | `true` |
4009 * | `NaN` | `TypeError` | `false` |
4010 *
4011 * We introduce this change to make *date-fns* consistent with ECMAScript behavior
4012 * that try to coerce arguments to the expected type
4013 * (which is also the case with other *date-fns* functions).
4014 *
4015 * @param {*} date - the date to check
4016 * @returns {Boolean} the date is valid
4017 * @throws {TypeError} 1 argument required
4018 *
4019 * @example
4020 * // For the valid date:
4021 * var result = isValid(new Date(2014, 1, 31))
4022 * //=> true
4023 *
4024 * @example
4025 * // For the value, convertable into a date:
4026 * var result = isValid(1393804800000)
4027 * //=> true
4028 *
4029 * @example
4030 * // For the invalid date:
4031 * var result = isValid(new Date(''))
4032 * //=> false
4033 */
4034
4035 function isValid(dirtyDate) {
4036 requiredArgs(1, arguments);
4037 var date = toDate(dirtyDate);
4038 return !isNaN(date);
4039 }
4040
4041 var formatDistanceLocale = {
4042 lessThanXSeconds: {
4043 one: 'less than a second',
4044 other: 'less than {{count}} seconds'
4045 },
4046 xSeconds: {
4047 one: '1 second',
4048 other: '{{count}} seconds'
4049 },
4050 halfAMinute: 'half a minute',
4051 lessThanXMinutes: {
4052 one: 'less than a minute',
4053 other: 'less than {{count}} minutes'
4054 },
4055 xMinutes: {
4056 one: '1 minute',
4057 other: '{{count}} minutes'
4058 },
4059 aboutXHours: {
4060 one: 'about 1 hour',
4061 other: 'about {{count}} hours'
4062 },
4063 xHours: {
4064 one: '1 hour',
4065 other: '{{count}} hours'
4066 },
4067 xDays: {
4068 one: '1 day',
4069 other: '{{count}} days'
4070 },
4071 aboutXWeeks: {
4072 one: 'about 1 week',
4073 other: 'about {{count}} weeks'
4074 },
4075 xWeeks: {
4076 one: '1 week',
4077 other: '{{count}} weeks'
4078 },
4079 aboutXMonths: {
4080 one: 'about 1 month',
4081 other: 'about {{count}} months'
4082 },
4083 xMonths: {
4084 one: '1 month',
4085 other: '{{count}} months'
4086 },
4087 aboutXYears: {
4088 one: 'about 1 year',
4089 other: 'about {{count}} years'
4090 },
4091 xYears: {
4092 one: '1 year',
4093 other: '{{count}} years'
4094 },
4095 overXYears: {
4096 one: 'over 1 year',
4097 other: 'over {{count}} years'
4098 },
4099 almostXYears: {
4100 one: 'almost 1 year',
4101 other: 'almost {{count}} years'
4102 }
4103 };
4104 function formatDistance(token, count, options) {
4105 options = options || {};
4106 var result;
4107
4108 if (typeof formatDistanceLocale[token] === 'string') {
4109 result = formatDistanceLocale[token];
4110 } else if (count === 1) {
4111 result = formatDistanceLocale[token].one;
4112 } else {
4113 result = formatDistanceLocale[token].other.replace('{{count}}', count);
4114 }
4115
4116 if (options.addSuffix) {
4117 if (options.comparison > 0) {
4118 return 'in ' + result;
4119 } else {
4120 return result + ' ago';
4121 }
4122 }
4123
4124 return result;
4125 }
4126
4127 function buildFormatLongFn(args) {
4128 return function (dirtyOptions) {
4129 var options = dirtyOptions || {};
4130 var width = options.width ? String(options.width) : args.defaultWidth;
4131 var format = args.formats[width] || args.formats[args.defaultWidth];
4132 return format;
4133 };
4134 }
4135
4136 var dateFormats = {
4137 full: 'EEEE, MMMM do, y',
4138 long: 'MMMM do, y',
4139 medium: 'MMM d, y',
4140 short: 'MM/dd/yyyy'
4141 };
4142 var timeFormats = {
4143 full: 'h:mm:ss a zzzz',
4144 long: 'h:mm:ss a z',
4145 medium: 'h:mm:ss a',
4146 short: 'h:mm a'
4147 };
4148 var dateTimeFormats = {
4149 full: "{{date}} 'at' {{time}}",
4150 long: "{{date}} 'at' {{time}}",
4151 medium: '{{date}}, {{time}}',
4152 short: '{{date}}, {{time}}'
4153 };
4154 var formatLong = {
4155 date: buildFormatLongFn({
4156 formats: dateFormats,
4157 defaultWidth: 'full'
4158 }),
4159 time: buildFormatLongFn({
4160 formats: timeFormats,
4161 defaultWidth: 'full'
4162 }),
4163 dateTime: buildFormatLongFn({
4164 formats: dateTimeFormats,
4165 defaultWidth: 'full'
4166 })
4167 };
4168
4169 var formatRelativeLocale = {
4170 lastWeek: "'last' eeee 'at' p",
4171 yesterday: "'yesterday at' p",
4172 today: "'today at' p",
4173 tomorrow: "'tomorrow at' p",
4174 nextWeek: "eeee 'at' p",
4175 other: 'P'
4176 };
4177 function formatRelative(token, _date, _baseDate, _options) {
4178 return formatRelativeLocale[token];
4179 }
4180
4181 function buildLocalizeFn(args) {
4182 return function (dirtyIndex, dirtyOptions) {
4183 var options = dirtyOptions || {};
4184 var context = options.context ? String(options.context) : 'standalone';
4185 var valuesArray;
4186
4187 if (context === 'formatting' && args.formattingValues) {
4188 var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
4189 var width = options.width ? String(options.width) : defaultWidth;
4190 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
4191 } else {
4192 var _defaultWidth = args.defaultWidth;
4193
4194 var _width = options.width ? String(options.width) : args.defaultWidth;
4195
4196 valuesArray = args.values[_width] || args.values[_defaultWidth];
4197 }
4198
4199 var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
4200 return valuesArray[index];
4201 };
4202 }
4203
4204 var eraValues = {
4205 narrow: ['B', 'A'],
4206 abbreviated: ['BC', 'AD'],
4207 wide: ['Before Christ', 'Anno Domini']
4208 };
4209 var quarterValues = {
4210 narrow: ['1', '2', '3', '4'],
4211 abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
4212 wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
4213 // If you are making a new locale based on this one, check if the same is true for the language you're working on.
4214 // Generally, formatted dates should look like they are in the middle of a sentence,
4215 // e.g. in Spanish language the weekdays and months should be in the lowercase.
4216
4217 };
4218 var monthValues = {
4219 narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
4220 abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
4221 wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
4222 };
4223 var dayValues = {
4224 narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
4225 short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
4226 abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
4227 wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
4228 };
4229 var dayPeriodValues = {
4230 narrow: {
4231 am: 'a',
4232 pm: 'p',
4233 midnight: 'mi',
4234 noon: 'n',
4235 morning: 'morning',
4236 afternoon: 'afternoon',
4237 evening: 'evening',
4238 night: 'night'
4239 },
4240 abbreviated: {
4241 am: 'AM',
4242 pm: 'PM',
4243 midnight: 'midnight',
4244 noon: 'noon',
4245 morning: 'morning',
4246 afternoon: 'afternoon',
4247 evening: 'evening',
4248 night: 'night'
4249 },
4250 wide: {
4251 am: 'a.m.',
4252 pm: 'p.m.',
4253 midnight: 'midnight',
4254 noon: 'noon',
4255 morning: 'morning',
4256 afternoon: 'afternoon',
4257 evening: 'evening',
4258 night: 'night'
4259 }
4260 };
4261 var formattingDayPeriodValues = {
4262 narrow: {
4263 am: 'a',
4264 pm: 'p',
4265 midnight: 'mi',
4266 noon: 'n',
4267 morning: 'in the morning',
4268 afternoon: 'in the afternoon',
4269 evening: 'in the evening',
4270 night: 'at night'
4271 },
4272 abbreviated: {
4273 am: 'AM',
4274 pm: 'PM',
4275 midnight: 'midnight',
4276 noon: 'noon',
4277 morning: 'in the morning',
4278 afternoon: 'in the afternoon',
4279 evening: 'in the evening',
4280 night: 'at night'
4281 },
4282 wide: {
4283 am: 'a.m.',
4284 pm: 'p.m.',
4285 midnight: 'midnight',
4286 noon: 'noon',
4287 morning: 'in the morning',
4288 afternoon: 'in the afternoon',
4289 evening: 'in the evening',
4290 night: 'at night'
4291 }
4292 };
4293
4294 function ordinalNumber(dirtyNumber, _dirtyOptions) {
4295 var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
4296 // if they are different for different grammatical genders,
4297 // use `options.unit`:
4298 //
4299 // var options = dirtyOptions || {}
4300 // var unit = String(options.unit)
4301 //
4302 // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
4303 // 'day', 'hour', 'minute', 'second'
4304
4305 var rem100 = number % 100;
4306
4307 if (rem100 > 20 || rem100 < 10) {
4308 switch (rem100 % 10) {
4309 case 1:
4310 return number + 'st';
4311
4312 case 2:
4313 return number + 'nd';
4314
4315 case 3:
4316 return number + 'rd';
4317 }
4318 }
4319
4320 return number + 'th';
4321 }
4322
4323 var localize = {
4324 ordinalNumber: ordinalNumber,
4325 era: buildLocalizeFn({
4326 values: eraValues,
4327 defaultWidth: 'wide'
4328 }),
4329 quarter: buildLocalizeFn({
4330 values: quarterValues,
4331 defaultWidth: 'wide',
4332 argumentCallback: function (quarter) {
4333 return Number(quarter) - 1;
4334 }
4335 }),
4336 month: buildLocalizeFn({
4337 values: monthValues,
4338 defaultWidth: 'wide'
4339 }),
4340 day: buildLocalizeFn({
4341 values: dayValues,
4342 defaultWidth: 'wide'
4343 }),
4344 dayPeriod: buildLocalizeFn({
4345 values: dayPeriodValues,
4346 defaultWidth: 'wide',
4347 formattingValues: formattingDayPeriodValues,
4348 defaultFormattingWidth: 'wide'
4349 })
4350 };
4351
4352 function buildMatchPatternFn(args) {
4353 return function (dirtyString, dirtyOptions) {
4354 var string = String(dirtyString);
4355 var options = dirtyOptions || {};
4356 var matchResult = string.match(args.matchPattern);
4357
4358 if (!matchResult) {
4359 return null;
4360 }
4361
4362 var matchedString = matchResult[0];
4363 var parseResult = string.match(args.parsePattern);
4364
4365 if (!parseResult) {
4366 return null;
4367 }
4368
4369 var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
4370 value = options.valueCallback ? options.valueCallback(value) : value;
4371 return {
4372 value: value,
4373 rest: string.slice(matchedString.length)
4374 };
4375 };
4376 }
4377
4378 function buildMatchFn(args) {
4379 return function (dirtyString, dirtyOptions) {
4380 var string = String(dirtyString);
4381 var options = dirtyOptions || {};
4382 var width = options.width;
4383 var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
4384 var matchResult = string.match(matchPattern);
4385
4386 if (!matchResult) {
4387 return null;
4388 }
4389
4390 var matchedString = matchResult[0];
4391 var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
4392 var value;
4393
4394 if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
4395 value = findIndex(parsePatterns, function (pattern) {
4396 return pattern.test(matchedString);
4397 });
4398 } else {
4399 value = findKey(parsePatterns, function (pattern) {
4400 return pattern.test(matchedString);
4401 });
4402 }
4403
4404 value = args.valueCallback ? args.valueCallback(value) : value;
4405 value = options.valueCallback ? options.valueCallback(value) : value;
4406 return {
4407 value: value,
4408 rest: string.slice(matchedString.length)
4409 };
4410 };
4411 }
4412
4413 function findKey(object, predicate) {
4414 for (var key in object) {
4415 if (object.hasOwnProperty(key) && predicate(object[key])) {
4416 return key;
4417 }
4418 }
4419 }
4420
4421 function findIndex(array, predicate) {
4422 for (var key = 0; key < array.length; key++) {
4423 if (predicate(array[key])) {
4424 return key;
4425 }
4426 }
4427 }
4428
4429 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
4430 var parseOrdinalNumberPattern = /\d+/i;
4431 var matchEraPatterns = {
4432 narrow: /^(b|a)/i,
4433 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
4434 wide: /^(before christ|before common era|anno domini|common era)/i
4435 };
4436 var parseEraPatterns = {
4437 any: [/^b/i, /^(a|c)/i]
4438 };
4439 var matchQuarterPatterns = {
4440 narrow: /^[1234]/i,
4441 abbreviated: /^q[1234]/i,
4442 wide: /^[1234](th|st|nd|rd)? quarter/i
4443 };
4444 var parseQuarterPatterns = {
4445 any: [/1/i, /2/i, /3/i, /4/i]
4446 };
4447 var matchMonthPatterns = {
4448 narrow: /^[jfmasond]/i,
4449 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
4450 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
4451 };
4452 var parseMonthPatterns = {
4453 narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
4454 any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
4455 };
4456 var matchDayPatterns = {
4457 narrow: /^[smtwf]/i,
4458 short: /^(su|mo|tu|we|th|fr|sa)/i,
4459 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
4460 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
4461 };
4462 var parseDayPatterns = {
4463 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
4464 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
4465 };
4466 var matchDayPeriodPatterns = {
4467 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
4468 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
4469 };
4470 var parseDayPeriodPatterns = {
4471 any: {
4472 am: /^a/i,
4473 pm: /^p/i,
4474 midnight: /^mi/i,
4475 noon: /^no/i,
4476 morning: /morning/i,
4477 afternoon: /afternoon/i,
4478 evening: /evening/i,
4479 night: /night/i
4480 }
4481 };
4482 var match = {
4483 ordinalNumber: buildMatchPatternFn({
4484 matchPattern: matchOrdinalNumberPattern,
4485 parsePattern: parseOrdinalNumberPattern,
4486 valueCallback: function (value) {
4487 return parseInt(value, 10);
4488 }
4489 }),
4490 era: buildMatchFn({
4491 matchPatterns: matchEraPatterns,
4492 defaultMatchWidth: 'wide',
4493 parsePatterns: parseEraPatterns,
4494 defaultParseWidth: 'any'
4495 }),
4496 quarter: buildMatchFn({
4497 matchPatterns: matchQuarterPatterns,
4498 defaultMatchWidth: 'wide',
4499 parsePatterns: parseQuarterPatterns,
4500 defaultParseWidth: 'any',
4501 valueCallback: function (index) {
4502 return index + 1;
4503 }
4504 }),
4505 month: buildMatchFn({
4506 matchPatterns: matchMonthPatterns,
4507 defaultMatchWidth: 'wide',
4508 parsePatterns: parseMonthPatterns,
4509 defaultParseWidth: 'any'
4510 }),
4511 day: buildMatchFn({
4512 matchPatterns: matchDayPatterns,
4513 defaultMatchWidth: 'wide',
4514 parsePatterns: parseDayPatterns,
4515 defaultParseWidth: 'any'
4516 }),
4517 dayPeriod: buildMatchFn({
4518 matchPatterns: matchDayPeriodPatterns,
4519 defaultMatchWidth: 'any',
4520 parsePatterns: parseDayPeriodPatterns,
4521 defaultParseWidth: 'any'
4522 })
4523 };
4524
4525 /**
4526 * @type {Locale}
4527 * @category Locales
4528 * @summary English locale (United States).
4529 * @language English
4530 * @iso-639-2 eng
4531 * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
4532 * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
4533 */
4534
4535 var locale = {
4536 code: 'en-US',
4537 formatDistance: formatDistance,
4538 formatLong: formatLong,
4539 formatRelative: formatRelative,
4540 localize: localize,
4541 match: match,
4542 options: {
4543 weekStartsOn: 0
4544 /* Sunday */
4545 ,
4546 firstWeekContainsDate: 1
4547 }
4548 };
4549
4550 /**
4551 * @name subMilliseconds
4552 * @category Millisecond Helpers
4553 * @summary Subtract the specified number of milliseconds from the given date.
4554 *
4555 * @description
4556 * Subtract the specified number of milliseconds from the given date.
4557 *
4558 * ### v2.0.0 breaking changes:
4559 *
4560 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
4561 *
4562 * @param {Date|Number} date - the date to be changed
4563 * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
4564 * @returns {Date} the new date with the milliseconds subtracted
4565 * @throws {TypeError} 2 arguments required
4566 *
4567 * @example
4568 * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
4569 * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
4570 * //=> Thu Jul 10 2014 12:45:29.250
4571 */
4572
4573 function subMilliseconds(dirtyDate, dirtyAmount) {
4574 requiredArgs(2, arguments);
4575 var amount = toInteger(dirtyAmount);
4576 return addMilliseconds(dirtyDate, -amount);
4577 }
4578
4579 function addLeadingZeros(number, targetLength) {
4580 var sign = number < 0 ? '-' : '';
4581 var output = Math.abs(number).toString();
4582
4583 while (output.length < targetLength) {
4584 output = '0' + output;
4585 }
4586
4587 return sign + output;
4588 }
4589
4590 /*
4591 * | | Unit | | Unit |
4592 * |-----|--------------------------------|-----|--------------------------------|
4593 * | a | AM, PM | A* | |
4594 * | d | Day of month | D | |
4595 * | h | Hour [1-12] | H | Hour [0-23] |
4596 * | m | Minute | M | Month |
4597 * | s | Second | S | Fraction of second |
4598 * | y | Year (abs) | Y | |
4599 *
4600 * Letters marked by * are not implemented but reserved by Unicode standard.
4601 */
4602
4603 var formatters = {
4604 // Year
4605 y: function (date, token) {
4606 // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
4607 // | Year | y | yy | yyy | yyyy | yyyyy |
4608 // |----------|-------|----|-------|-------|-------|
4609 // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
4610 // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
4611 // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
4612 // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
4613 // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
4614 var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
4615
4616 var year = signedYear > 0 ? signedYear : 1 - signedYear;
4617 return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
4618 },
4619 // Month
4620 M: function (date, token) {
4621 var month = date.getUTCMonth();
4622 return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
4623 },
4624 // Day of the month
4625 d: function (date, token) {
4626 return addLeadingZeros(date.getUTCDate(), token.length);
4627 },
4628 // AM or PM
4629 a: function (date, token) {
4630 var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
4631
4632 switch (token) {
4633 case 'a':
4634 case 'aa':
4635 return dayPeriodEnumValue.toUpperCase();
4636
4637 case 'aaa':
4638 return dayPeriodEnumValue;
4639
4640 case 'aaaaa':
4641 return dayPeriodEnumValue[0];
4642
4643 case 'aaaa':
4644 default:
4645 return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
4646 }
4647 },
4648 // Hour [1-12]
4649 h: function (date, token) {
4650 return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
4651 },
4652 // Hour [0-23]
4653 H: function (date, token) {
4654 return addLeadingZeros(date.getUTCHours(), token.length);
4655 },
4656 // Minute
4657 m: function (date, token) {
4658 return addLeadingZeros(date.getUTCMinutes(), token.length);
4659 },
4660 // Second
4661 s: function (date, token) {
4662 return addLeadingZeros(date.getUTCSeconds(), token.length);
4663 },
4664 // Fraction of second
4665 S: function (date, token) {
4666 var numberOfDigits = token.length;
4667 var milliseconds = date.getUTCMilliseconds();
4668 var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
4669 return addLeadingZeros(fractionalSeconds, token.length);
4670 }
4671 };
4672
4673 var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
4674 // See issue: https://github.com/date-fns/date-fns/issues/376
4675
4676 function getUTCDayOfYear(dirtyDate) {
4677 requiredArgs(1, arguments);
4678 var date = toDate(dirtyDate);
4679 var timestamp = date.getTime();
4680 date.setUTCMonth(0, 1);
4681 date.setUTCHours(0, 0, 0, 0);
4682 var startOfYearTimestamp = date.getTime();
4683 var difference = timestamp - startOfYearTimestamp;
4684 return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
4685 }
4686
4687 // See issue: https://github.com/date-fns/date-fns/issues/376
4688
4689 function startOfUTCISOWeek(dirtyDate) {
4690 requiredArgs(1, arguments);
4691 var weekStartsOn = 1;
4692 var date = toDate(dirtyDate);
4693 var day = date.getUTCDay();
4694 var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
4695 date.setUTCDate(date.getUTCDate() - diff);
4696 date.setUTCHours(0, 0, 0, 0);
4697 return date;
4698 }
4699
4700 // See issue: https://github.com/date-fns/date-fns/issues/376
4701
4702 function getUTCISOWeekYear(dirtyDate) {
4703 requiredArgs(1, arguments);
4704 var date = toDate(dirtyDate);
4705 var year = date.getUTCFullYear();
4706 var fourthOfJanuaryOfNextYear = new Date(0);
4707 fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
4708 fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
4709 var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
4710 var fourthOfJanuaryOfThisYear = new Date(0);
4711 fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
4712 fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
4713 var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
4714
4715 if (date.getTime() >= startOfNextYear.getTime()) {
4716 return year + 1;
4717 } else if (date.getTime() >= startOfThisYear.getTime()) {
4718 return year;
4719 } else {
4720 return year - 1;
4721 }
4722 }
4723
4724 // See issue: https://github.com/date-fns/date-fns/issues/376
4725
4726 function startOfUTCISOWeekYear(dirtyDate) {
4727 requiredArgs(1, arguments);
4728 var year = getUTCISOWeekYear(dirtyDate);
4729 var fourthOfJanuary = new Date(0);
4730 fourthOfJanuary.setUTCFullYear(year, 0, 4);
4731 fourthOfJanuary.setUTCHours(0, 0, 0, 0);
4732 var date = startOfUTCISOWeek(fourthOfJanuary);
4733 return date;
4734 }
4735
4736 var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
4737 // See issue: https://github.com/date-fns/date-fns/issues/376
4738
4739 function getUTCISOWeek(dirtyDate) {
4740 requiredArgs(1, arguments);
4741 var date = toDate(dirtyDate);
4742 var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
4743 // because the number of milliseconds in a week is not constant
4744 // (e.g. it's different in the week of the daylight saving time clock shift)
4745
4746 return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
4747 }
4748
4749 // See issue: https://github.com/date-fns/date-fns/issues/376
4750
4751 function startOfUTCWeek(dirtyDate, dirtyOptions) {
4752 requiredArgs(1, arguments);
4753 var options = dirtyOptions || {};
4754 var locale = options.locale;
4755 var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
4756 var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
4757 var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
4758
4759 if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
4760 throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
4761 }
4762
4763 var date = toDate(dirtyDate);
4764 var day = date.getUTCDay();
4765 var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
4766 date.setUTCDate(date.getUTCDate() - diff);
4767 date.setUTCHours(0, 0, 0, 0);
4768 return date;
4769 }
4770
4771 // See issue: https://github.com/date-fns/date-fns/issues/376
4772
4773 function getUTCWeekYear(dirtyDate, dirtyOptions) {
4774 requiredArgs(1, arguments);
4775 var date = toDate(dirtyDate, dirtyOptions);
4776 var year = date.getUTCFullYear();
4777 var options = dirtyOptions || {};
4778 var locale = options.locale;
4779 var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
4780 var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
4781 var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
4782
4783 if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
4784 throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
4785 }
4786
4787 var firstWeekOfNextYear = new Date(0);
4788 firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
4789 firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
4790 var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
4791 var firstWeekOfThisYear = new Date(0);
4792 firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
4793 firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
4794 var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
4795
4796 if (date.getTime() >= startOfNextYear.getTime()) {
4797 return year + 1;
4798 } else if (date.getTime() >= startOfThisYear.getTime()) {
4799 return year;
4800 } else {
4801 return year - 1;
4802 }
4803 }
4804
4805 // See issue: https://github.com/date-fns/date-fns/issues/376
4806
4807 function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
4808 requiredArgs(1, arguments);
4809 var options = dirtyOptions || {};
4810 var locale = options.locale;
4811 var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
4812 var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
4813 var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
4814 var year = getUTCWeekYear(dirtyDate, dirtyOptions);
4815 var firstWeek = new Date(0);
4816 firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
4817 firstWeek.setUTCHours(0, 0, 0, 0);
4818 var date = startOfUTCWeek(firstWeek, dirtyOptions);
4819 return date;
4820 }
4821
4822 var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
4823 // See issue: https://github.com/date-fns/date-fns/issues/376
4824
4825 function getUTCWeek(dirtyDate, options) {
4826 requiredArgs(1, arguments);
4827 var date = toDate(dirtyDate);
4828 var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
4829 // because the number of milliseconds in a week is not constant
4830 // (e.g. it's different in the week of the daylight saving time clock shift)
4831
4832 return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
4833 }
4834
4835 var dayPeriodEnum = {
4836 am: 'am',
4837 pm: 'pm',
4838 midnight: 'midnight',
4839 noon: 'noon',
4840 morning: 'morning',
4841 afternoon: 'afternoon',
4842 evening: 'evening',
4843 night: 'night'
4844 /*
4845 * | | Unit | | Unit |
4846 * |-----|--------------------------------|-----|--------------------------------|
4847 * | a | AM, PM | A* | Milliseconds in day |
4848 * | b | AM, PM, noon, midnight | B | Flexible day period |
4849 * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
4850 * | d | Day of month | D | Day of year |
4851 * | e | Local day of week | E | Day of week |
4852 * | f | | F* | Day of week in month |
4853 * | g* | Modified Julian day | G | Era |
4854 * | h | Hour [1-12] | H | Hour [0-23] |
4855 * | i! | ISO day of week | I! | ISO week of year |
4856 * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
4857 * | k | Hour [1-24] | K | Hour [0-11] |
4858 * | l* | (deprecated) | L | Stand-alone month |
4859 * | m | Minute | M | Month |
4860 * | n | | N | |
4861 * | o! | Ordinal number modifier | O | Timezone (GMT) |
4862 * | p! | Long localized time | P! | Long localized date |
4863 * | q | Stand-alone quarter | Q | Quarter |
4864 * | r* | Related Gregorian year | R! | ISO week-numbering year |
4865 * | s | Second | S | Fraction of second |
4866 * | t! | Seconds timestamp | T! | Milliseconds timestamp |
4867 * | u | Extended year | U* | Cyclic year |
4868 * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
4869 * | w | Local week of year | W* | Week of month |
4870 * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
4871 * | y | Year (abs) | Y | Local week-numbering year |
4872 * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
4873 *
4874 * Letters marked by * are not implemented but reserved by Unicode standard.
4875 *
4876 * Letters marked by ! are non-standard, but implemented by date-fns:
4877 * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
4878 * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
4879 * i.e. 7 for Sunday, 1 for Monday, etc.
4880 * - `I` is ISO week of year, as opposed to `w` which is local week of year.
4881 * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
4882 * `R` is supposed to be used in conjunction with `I` and `i`
4883 * for universal ISO week-numbering date, whereas
4884 * `Y` is supposed to be used in conjunction with `w` and `e`
4885 * for week-numbering date specific to the locale.
4886 * - `P` is long localized date format
4887 * - `p` is long localized time format
4888 */
4889
4890 };
4891 var formatters$1 = {
4892 // Era
4893 G: function (date, token, localize) {
4894 var era = date.getUTCFullYear() > 0 ? 1 : 0;
4895
4896 switch (token) {
4897 // AD, BC
4898 case 'G':
4899 case 'GG':
4900 case 'GGG':
4901 return localize.era(era, {
4902 width: 'abbreviated'
4903 });
4904 // A, B
4905
4906 case 'GGGGG':
4907 return localize.era(era, {
4908 width: 'narrow'
4909 });
4910 // Anno Domini, Before Christ
4911
4912 case 'GGGG':
4913 default:
4914 return localize.era(era, {
4915 width: 'wide'
4916 });
4917 }
4918 },
4919 // Year
4920 y: function (date, token, localize) {
4921 // Ordinal number
4922 if (token === 'yo') {
4923 var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
4924
4925 var year = signedYear > 0 ? signedYear : 1 - signedYear;
4926 return localize.ordinalNumber(year, {
4927 unit: 'year'
4928 });
4929 }
4930
4931 return formatters.y(date, token);
4932 },
4933 // Local week-numbering year
4934 Y: function (date, token, localize, options) {
4935 var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
4936
4937 var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
4938
4939 if (token === 'YY') {
4940 var twoDigitYear = weekYear % 100;
4941 return addLeadingZeros(twoDigitYear, 2);
4942 } // Ordinal number
4943
4944
4945 if (token === 'Yo') {
4946 return localize.ordinalNumber(weekYear, {
4947 unit: 'year'
4948 });
4949 } // Padding
4950
4951
4952 return addLeadingZeros(weekYear, token.length);
4953 },
4954 // ISO week-numbering year
4955 R: function (date, token) {
4956 var isoWeekYear = getUTCISOWeekYear(date); // Padding
4957
4958 return addLeadingZeros(isoWeekYear, token.length);
4959 },
4960 // Extended year. This is a single number designating the year of this calendar system.
4961 // The main difference between `y` and `u` localizers are B.C. years:
4962 // | Year | `y` | `u` |
4963 // |------|-----|-----|
4964 // | AC 1 | 1 | 1 |
4965 // | BC 1 | 1 | 0 |
4966 // | BC 2 | 2 | -1 |
4967 // Also `yy` always returns the last two digits of a year,
4968 // while `uu` pads single digit years to 2 characters and returns other years unchanged.
4969 u: function (date, token) {
4970 var year = date.getUTCFullYear();
4971 return addLeadingZeros(year, token.length);
4972 },
4973 // Quarter
4974 Q: function (date, token, localize) {
4975 var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
4976
4977 switch (token) {
4978 // 1, 2, 3, 4
4979 case 'Q':
4980 return String(quarter);
4981 // 01, 02, 03, 04
4982
4983 case 'QQ':
4984 return addLeadingZeros(quarter, 2);
4985 // 1st, 2nd, 3rd, 4th
4986
4987 case 'Qo':
4988 return localize.ordinalNumber(quarter, {
4989 unit: 'quarter'
4990 });
4991 // Q1, Q2, Q3, Q4
4992
4993 case 'QQQ':
4994 return localize.quarter(quarter, {
4995 width: 'abbreviated',
4996 context: 'formatting'
4997 });
4998 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
4999
5000 case 'QQQQQ':
5001 return localize.quarter(quarter, {
5002 width: 'narrow',
5003 context: 'formatting'
5004 });
5005 // 1st quarter, 2nd quarter, ...
5006
5007 case 'QQQQ':
5008 default:
5009 return localize.quarter(quarter, {
5010 width: 'wide',
5011 context: 'formatting'
5012 });
5013 }
5014 },
5015 // Stand-alone quarter
5016 q: function (date, token, localize) {
5017 var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
5018
5019 switch (token) {
5020 // 1, 2, 3, 4
5021 case 'q':
5022 return String(quarter);
5023 // 01, 02, 03, 04
5024
5025 case 'qq':
5026 return addLeadingZeros(quarter, 2);
5027 // 1st, 2nd, 3rd, 4th
5028
5029 case 'qo':
5030 return localize.ordinalNumber(quarter, {
5031 unit: 'quarter'
5032 });
5033 // Q1, Q2, Q3, Q4
5034
5035 case 'qqq':
5036 return localize.quarter(quarter, {
5037 width: 'abbreviated',
5038 context: 'standalone'
5039 });
5040 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
5041
5042 case 'qqqqq':
5043 return localize.quarter(quarter, {
5044 width: 'narrow',
5045 context: 'standalone'
5046 });
5047 // 1st quarter, 2nd quarter, ...
5048
5049 case 'qqqq':
5050 default:
5051 return localize.quarter(quarter, {
5052 width: 'wide',
5053 context: 'standalone'
5054 });
5055 }
5056 },
5057 // Month
5058 M: function (date, token, localize) {
5059 var month = date.getUTCMonth();
5060
5061 switch (token) {
5062 case 'M':
5063 case 'MM':
5064 return formatters.M(date, token);
5065 // 1st, 2nd, ..., 12th
5066
5067 case 'Mo':
5068 return localize.ordinalNumber(month + 1, {
5069 unit: 'month'
5070 });
5071 // Jan, Feb, ..., Dec
5072
5073 case 'MMM':
5074 return localize.month(month, {
5075 width: 'abbreviated',
5076 context: 'formatting'
5077 });
5078 // J, F, ..., D
5079
5080 case 'MMMMM':
5081 return localize.month(month, {
5082 width: 'narrow',
5083 context: 'formatting'
5084 });
5085 // January, February, ..., December
5086
5087 case 'MMMM':
5088 default:
5089 return localize.month(month, {
5090 width: 'wide',
5091 context: 'formatting'
5092 });
5093 }
5094 },
5095 // Stand-alone month
5096 L: function (date, token, localize) {
5097 var month = date.getUTCMonth();
5098
5099 switch (token) {
5100 // 1, 2, ..., 12
5101 case 'L':
5102 return String(month + 1);
5103 // 01, 02, ..., 12
5104
5105 case 'LL':
5106 return addLeadingZeros(month + 1, 2);
5107 // 1st, 2nd, ..., 12th
5108
5109 case 'Lo':
5110 return localize.ordinalNumber(month + 1, {
5111 unit: 'month'
5112 });
5113 // Jan, Feb, ..., Dec
5114
5115 case 'LLL':
5116 return localize.month(month, {
5117 width: 'abbreviated',
5118 context: 'standalone'
5119 });
5120 // J, F, ..., D
5121
5122 case 'LLLLL':
5123 return localize.month(month, {
5124 width: 'narrow',
5125 context: 'standalone'
5126 });
5127 // January, February, ..., December
5128
5129 case 'LLLL':
5130 default:
5131 return localize.month(month, {
5132 width: 'wide',
5133 context: 'standalone'
5134 });
5135 }
5136 },
5137 // Local week of year
5138 w: function (date, token, localize, options) {
5139 var week = getUTCWeek(date, options);
5140
5141 if (token === 'wo') {
5142 return localize.ordinalNumber(week, {
5143 unit: 'week'
5144 });
5145 }
5146
5147 return addLeadingZeros(week, token.length);
5148 },
5149 // ISO week of year
5150 I: function (date, token, localize) {
5151 var isoWeek = getUTCISOWeek(date);
5152
5153 if (token === 'Io') {
5154 return localize.ordinalNumber(isoWeek, {
5155 unit: 'week'
5156 });
5157 }
5158
5159 return addLeadingZeros(isoWeek, token.length);
5160 },
5161 // Day of the month
5162 d: function (date, token, localize) {
5163 if (token === 'do') {
5164 return localize.ordinalNumber(date.getUTCDate(), {
5165 unit: 'date'
5166 });
5167 }
5168
5169 return formatters.d(date, token);
5170 },
5171 // Day of year
5172 D: function (date, token, localize) {
5173 var dayOfYear = getUTCDayOfYear(date);
5174
5175 if (token === 'Do') {
5176 return localize.ordinalNumber(dayOfYear, {
5177 unit: 'dayOfYear'
5178 });
5179 }
5180
5181 return addLeadingZeros(dayOfYear, token.length);
5182 },
5183 // Day of week
5184 E: function (date, token, localize) {
5185 var dayOfWeek = date.getUTCDay();
5186
5187 switch (token) {
5188 // Tue
5189 case 'E':
5190 case 'EE':
5191 case 'EEE':
5192 return localize.day(dayOfWeek, {
5193 width: 'abbreviated',
5194 context: 'formatting'
5195 });
5196 // T
5197
5198 case 'EEEEE':
5199 return localize.day(dayOfWeek, {
5200 width: 'narrow',
5201 context: 'formatting'
5202 });
5203 // Tu
5204
5205 case 'EEEEEE':
5206 return localize.day(dayOfWeek, {
5207 width: 'short',
5208 context: 'formatting'
5209 });
5210 // Tuesday
5211
5212 case 'EEEE':
5213 default:
5214 return localize.day(dayOfWeek, {
5215 width: 'wide',
5216 context: 'formatting'
5217 });
5218 }
5219 },
5220 // Local day of week
5221 e: function (date, token, localize, options) {
5222 var dayOfWeek = date.getUTCDay();
5223 var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
5224
5225 switch (token) {
5226 // Numerical value (Nth day of week with current locale or weekStartsOn)
5227 case 'e':
5228 return String(localDayOfWeek);
5229 // Padded numerical value
5230
5231 case 'ee':
5232 return addLeadingZeros(localDayOfWeek, 2);
5233 // 1st, 2nd, ..., 7th
5234
5235 case 'eo':
5236 return localize.ordinalNumber(localDayOfWeek, {
5237 unit: 'day'
5238 });
5239
5240 case 'eee':
5241 return localize.day(dayOfWeek, {
5242 width: 'abbreviated',
5243 context: 'formatting'
5244 });
5245 // T
5246
5247 case 'eeeee':
5248 return localize.day(dayOfWeek, {
5249 width: 'narrow',
5250 context: 'formatting'
5251 });
5252 // Tu
5253
5254 case 'eeeeee':
5255 return localize.day(dayOfWeek, {
5256 width: 'short',
5257 context: 'formatting'
5258 });
5259 // Tuesday
5260
5261 case 'eeee':
5262 default:
5263 return localize.day(dayOfWeek, {
5264 width: 'wide',
5265 context: 'formatting'
5266 });
5267 }
5268 },
5269 // Stand-alone local day of week
5270 c: function (date, token, localize, options) {
5271 var dayOfWeek = date.getUTCDay();
5272 var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
5273
5274 switch (token) {
5275 // Numerical value (same as in `e`)
5276 case 'c':
5277 return String(localDayOfWeek);
5278 // Padded numerical value
5279
5280 case 'cc':
5281 return addLeadingZeros(localDayOfWeek, token.length);
5282 // 1st, 2nd, ..., 7th
5283
5284 case 'co':
5285 return localize.ordinalNumber(localDayOfWeek, {
5286 unit: 'day'
5287 });
5288
5289 case 'ccc':
5290 return localize.day(dayOfWeek, {
5291 width: 'abbreviated',
5292 context: 'standalone'
5293 });
5294 // T
5295
5296 case 'ccccc':
5297 return localize.day(dayOfWeek, {
5298 width: 'narrow',
5299 context: 'standalone'
5300 });
5301 // Tu
5302
5303 case 'cccccc':
5304 return localize.day(dayOfWeek, {
5305 width: 'short',
5306 context: 'standalone'
5307 });
5308 // Tuesday
5309
5310 case 'cccc':
5311 default:
5312 return localize.day(dayOfWeek, {
5313 width: 'wide',
5314 context: 'standalone'
5315 });
5316 }
5317 },
5318 // ISO day of week
5319 i: function (date, token, localize) {
5320 var dayOfWeek = date.getUTCDay();
5321 var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
5322
5323 switch (token) {
5324 // 2
5325 case 'i':
5326 return String(isoDayOfWeek);
5327 // 02
5328
5329 case 'ii':
5330 return addLeadingZeros(isoDayOfWeek, token.length);
5331 // 2nd
5332
5333 case 'io':
5334 return localize.ordinalNumber(isoDayOfWeek, {
5335 unit: 'day'
5336 });
5337 // Tue
5338
5339 case 'iii':
5340 return localize.day(dayOfWeek, {
5341 width: 'abbreviated',
5342 context: 'formatting'
5343 });
5344 // T
5345
5346 case 'iiiii':
5347 return localize.day(dayOfWeek, {
5348 width: 'narrow',
5349 context: 'formatting'
5350 });
5351 // Tu
5352
5353 case 'iiiiii':
5354 return localize.day(dayOfWeek, {
5355 width: 'short',
5356 context: 'formatting'
5357 });
5358 // Tuesday
5359
5360 case 'iiii':
5361 default:
5362 return localize.day(dayOfWeek, {
5363 width: 'wide',
5364 context: 'formatting'
5365 });
5366 }
5367 },
5368 // AM or PM
5369 a: function (date, token, localize) {
5370 var hours = date.getUTCHours();
5371 var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
5372
5373 switch (token) {
5374 case 'a':
5375 case 'aa':
5376 return localize.dayPeriod(dayPeriodEnumValue, {
5377 width: 'abbreviated',
5378 context: 'formatting'
5379 });
5380
5381 case 'aaa':
5382 return localize.dayPeriod(dayPeriodEnumValue, {
5383 width: 'abbreviated',
5384 context: 'formatting'
5385 }).toLowerCase();
5386
5387 case 'aaaaa':
5388 return localize.dayPeriod(dayPeriodEnumValue, {
5389 width: 'narrow',
5390 context: 'formatting'
5391 });
5392
5393 case 'aaaa':
5394 default:
5395 return localize.dayPeriod(dayPeriodEnumValue, {
5396 width: 'wide',
5397 context: 'formatting'
5398 });
5399 }
5400 },
5401 // AM, PM, midnight, noon
5402 b: function (date, token, localize) {
5403 var hours = date.getUTCHours();
5404 var dayPeriodEnumValue;
5405
5406 if (hours === 12) {
5407 dayPeriodEnumValue = dayPeriodEnum.noon;
5408 } else if (hours === 0) {
5409 dayPeriodEnumValue = dayPeriodEnum.midnight;
5410 } else {
5411 dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
5412 }
5413
5414 switch (token) {
5415 case 'b':
5416 case 'bb':
5417 return localize.dayPeriod(dayPeriodEnumValue, {
5418 width: 'abbreviated',
5419 context: 'formatting'
5420 });
5421
5422 case 'bbb':
5423 return localize.dayPeriod(dayPeriodEnumValue, {
5424 width: 'abbreviated',
5425 context: 'formatting'
5426 }).toLowerCase();
5427
5428 case 'bbbbb':
5429 return localize.dayPeriod(dayPeriodEnumValue, {
5430 width: 'narrow',
5431 context: 'formatting'
5432 });
5433
5434 case 'bbbb':
5435 default:
5436 return localize.dayPeriod(dayPeriodEnumValue, {
5437 width: 'wide',
5438 context: 'formatting'
5439 });
5440 }
5441 },
5442 // in the morning, in the afternoon, in the evening, at night
5443 B: function (date, token, localize) {
5444 var hours = date.getUTCHours();
5445 var dayPeriodEnumValue;
5446
5447 if (hours >= 17) {
5448 dayPeriodEnumValue = dayPeriodEnum.evening;
5449 } else if (hours >= 12) {
5450 dayPeriodEnumValue = dayPeriodEnum.afternoon;
5451 } else if (hours >= 4) {
5452 dayPeriodEnumValue = dayPeriodEnum.morning;
5453 } else {
5454 dayPeriodEnumValue = dayPeriodEnum.night;
5455 }
5456
5457 switch (token) {
5458 case 'B':
5459 case 'BB':
5460 case 'BBB':
5461 return localize.dayPeriod(dayPeriodEnumValue, {
5462 width: 'abbreviated',
5463 context: 'formatting'
5464 });
5465
5466 case 'BBBBB':
5467 return localize.dayPeriod(dayPeriodEnumValue, {
5468 width: 'narrow',
5469 context: 'formatting'
5470 });
5471
5472 case 'BBBB':
5473 default:
5474 return localize.dayPeriod(dayPeriodEnumValue, {
5475 width: 'wide',
5476 context: 'formatting'
5477 });
5478 }
5479 },
5480 // Hour [1-12]
5481 h: function (date, token, localize) {
5482 if (token === 'ho') {
5483 var hours = date.getUTCHours() % 12;
5484 if (hours === 0) hours = 12;
5485 return localize.ordinalNumber(hours, {
5486 unit: 'hour'
5487 });
5488 }
5489
5490 return formatters.h(date, token);
5491 },
5492 // Hour [0-23]
5493 H: function (date, token, localize) {
5494 if (token === 'Ho') {
5495 return localize.ordinalNumber(date.getUTCHours(), {
5496 unit: 'hour'
5497 });
5498 }
5499
5500 return formatters.H(date, token);
5501 },
5502 // Hour [0-11]
5503 K: function (date, token, localize) {
5504 var hours = date.getUTCHours() % 12;
5505
5506 if (token === 'Ko') {
5507 return localize.ordinalNumber(hours, {
5508 unit: 'hour'
5509 });
5510 }
5511
5512 return addLeadingZeros(hours, token.length);
5513 },
5514 // Hour [1-24]
5515 k: function (date, token, localize) {
5516 var hours = date.getUTCHours();
5517 if (hours === 0) hours = 24;
5518
5519 if (token === 'ko') {
5520 return localize.ordinalNumber(hours, {
5521 unit: 'hour'
5522 });
5523 }
5524
5525 return addLeadingZeros(hours, token.length);
5526 },
5527 // Minute
5528 m: function (date, token, localize) {
5529 if (token === 'mo') {
5530 return localize.ordinalNumber(date.getUTCMinutes(), {
5531 unit: 'minute'
5532 });
5533 }
5534
5535 return formatters.m(date, token);
5536 },
5537 // Second
5538 s: function (date, token, localize) {
5539 if (token === 'so') {
5540 return localize.ordinalNumber(date.getUTCSeconds(), {
5541 unit: 'second'
5542 });
5543 }
5544
5545 return formatters.s(date, token);
5546 },
5547 // Fraction of second
5548 S: function (date, token) {
5549 return formatters.S(date, token);
5550 },
5551 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
5552 X: function (date, token, _localize, options) {
5553 var originalDate = options._originalDate || date;
5554 var timezoneOffset = originalDate.getTimezoneOffset();
5555
5556 if (timezoneOffset === 0) {
5557 return 'Z';
5558 }
5559
5560 switch (token) {
5561 // Hours and optional minutes
5562 case 'X':
5563 return formatTimezoneWithOptionalMinutes(timezoneOffset);
5564 // Hours, minutes and optional seconds without `:` delimiter
5565 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
5566 // so this token always has the same output as `XX`
5567
5568 case 'XXXX':
5569 case 'XX':
5570 // Hours and minutes without `:` delimiter
5571 return formatTimezone(timezoneOffset);
5572 // Hours, minutes and optional seconds with `:` delimiter
5573 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
5574 // so this token always has the same output as `XXX`
5575
5576 case 'XXXXX':
5577 case 'XXX': // Hours and minutes with `:` delimiter
5578
5579 default:
5580 return formatTimezone(timezoneOffset, ':');
5581 }
5582 },
5583 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
5584 x: function (date, token, _localize, options) {
5585 var originalDate = options._originalDate || date;
5586 var timezoneOffset = originalDate.getTimezoneOffset();
5587
5588 switch (token) {
5589 // Hours and optional minutes
5590 case 'x':
5591 return formatTimezoneWithOptionalMinutes(timezoneOffset);
5592 // Hours, minutes and optional seconds without `:` delimiter
5593 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
5594 // so this token always has the same output as `xx`
5595
5596 case 'xxxx':
5597 case 'xx':
5598 // Hours and minutes without `:` delimiter
5599 return formatTimezone(timezoneOffset);
5600 // Hours, minutes and optional seconds with `:` delimiter
5601 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
5602 // so this token always has the same output as `xxx`
5603
5604 case 'xxxxx':
5605 case 'xxx': // Hours and minutes with `:` delimiter
5606
5607 default:
5608 return formatTimezone(timezoneOffset, ':');
5609 }
5610 },
5611 // Timezone (GMT)
5612 O: function (date, token, _localize, options) {
5613 var originalDate = options._originalDate || date;
5614 var timezoneOffset = originalDate.getTimezoneOffset();
5615
5616 switch (token) {
5617 // Short
5618 case 'O':
5619 case 'OO':
5620 case 'OOO':
5621 return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
5622 // Long
5623
5624 case 'OOOO':
5625 default:
5626 return 'GMT' + formatTimezone(timezoneOffset, ':');
5627 }
5628 },
5629 // Timezone (specific non-location)
5630 z: function (date, token, _localize, options) {
5631 var originalDate = options._originalDate || date;
5632 var timezoneOffset = originalDate.getTimezoneOffset();
5633
5634 switch (token) {
5635 // Short
5636 case 'z':
5637 case 'zz':
5638 case 'zzz':
5639 return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
5640 // Long
5641
5642 case 'zzzz':
5643 default:
5644 return 'GMT' + formatTimezone(timezoneOffset, ':');
5645 }
5646 },
5647 // Seconds timestamp
5648 t: function (date, token, _localize, options) {
5649 var originalDate = options._originalDate || date;
5650 var timestamp = Math.floor(originalDate.getTime() / 1000);
5651 return addLeadingZeros(timestamp, token.length);
5652 },
5653 // Milliseconds timestamp
5654 T: function (date, token, _localize, options) {
5655 var originalDate = options._originalDate || date;
5656 var timestamp = originalDate.getTime();
5657 return addLeadingZeros(timestamp, token.length);
5658 }
5659 };
5660
5661 function formatTimezoneShort(offset, dirtyDelimiter) {
5662 var sign = offset > 0 ? '-' : '+';
5663 var absOffset = Math.abs(offset);
5664 var hours = Math.floor(absOffset / 60);
5665 var minutes = absOffset % 60;
5666
5667 if (minutes === 0) {
5668 return sign + String(hours);
5669 }
5670
5671 var delimiter = dirtyDelimiter || '';
5672 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
5673 }
5674
5675 function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
5676 if (offset % 60 === 0) {
5677 var sign = offset > 0 ? '-' : '+';
5678 return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
5679 }
5680
5681 return formatTimezone(offset, dirtyDelimiter);
5682 }
5683
5684 function formatTimezone(offset, dirtyDelimiter) {
5685 var delimiter = dirtyDelimiter || '';
5686 var sign = offset > 0 ? '-' : '+';
5687 var absOffset = Math.abs(offset);
5688 var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
5689 var minutes = addLeadingZeros(absOffset % 60, 2);
5690 return sign + hours + delimiter + minutes;
5691 }
5692
5693 function dateLongFormatter(pattern, formatLong) {
5694 switch (pattern) {
5695 case 'P':
5696 return formatLong.date({
5697 width: 'short'
5698 });
5699
5700 case 'PP':
5701 return formatLong.date({
5702 width: 'medium'
5703 });
5704
5705 case 'PPP':
5706 return formatLong.date({
5707 width: 'long'
5708 });
5709
5710 case 'PPPP':
5711 default:
5712 return formatLong.date({
5713 width: 'full'
5714 });
5715 }
5716 }
5717
5718 function timeLongFormatter(pattern, formatLong) {
5719 switch (pattern) {
5720 case 'p':
5721 return formatLong.time({
5722 width: 'short'
5723 });
5724
5725 case 'pp':
5726 return formatLong.time({
5727 width: 'medium'
5728 });
5729
5730 case 'ppp':
5731 return formatLong.time({
5732 width: 'long'
5733 });
5734
5735 case 'pppp':
5736 default:
5737 return formatLong.time({
5738 width: 'full'
5739 });
5740 }
5741 }
5742
5743 function dateTimeLongFormatter(pattern, formatLong) {
5744 var matchResult = pattern.match(/(P+)(p+)?/);
5745 var datePattern = matchResult[1];
5746 var timePattern = matchResult[2];
5747
5748 if (!timePattern) {
5749 return dateLongFormatter(pattern, formatLong);
5750 }
5751
5752 var dateTimeFormat;
5753
5754 switch (datePattern) {
5755 case 'P':
5756 dateTimeFormat = formatLong.dateTime({
5757 width: 'short'
5758 });
5759 break;
5760
5761 case 'PP':
5762 dateTimeFormat = formatLong.dateTime({
5763 width: 'medium'
5764 });
5765 break;
5766
5767 case 'PPP':
5768 dateTimeFormat = formatLong.dateTime({
5769 width: 'long'
5770 });
5771 break;
5772
5773 case 'PPPP':
5774 default:
5775 dateTimeFormat = formatLong.dateTime({
5776 width: 'full'
5777 });
5778 break;
5779 }
5780
5781 return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
5782 }
5783
5784 var longFormatters = {
5785 p: timeLongFormatter,
5786 P: dateTimeLongFormatter
5787 };
5788
5789 var protectedDayOfYearTokens = ['D', 'DD'];
5790 var protectedWeekYearTokens = ['YY', 'YYYY'];
5791 function isProtectedDayOfYearToken(token) {
5792 return protectedDayOfYearTokens.indexOf(token) !== -1;
5793 }
5794 function isProtectedWeekYearToken(token) {
5795 return protectedWeekYearTokens.indexOf(token) !== -1;
5796 }
5797 function throwProtectedError(token, format, input) {
5798 if (token === 'YYYY') {
5799 throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
5800 } else if (token === 'YY') {
5801 throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
5802 } else if (token === 'D') {
5803 throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
5804 } else if (token === 'DD') {
5805 throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
5806 }
5807 }
5808
5809 // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
5810 // (one of the certain letters followed by `o`)
5811 // - (\w)\1* matches any sequences of the same letter
5812 // - '' matches two quote characters in a row
5813 // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
5814 // except a single quote symbol, which ends the sequence.
5815 // Two quote characters do not end the sequence.
5816 // If there is no matching single quote
5817 // then the sequence will continue until the end of the string.
5818 // - . matches any single character unmatched by previous parts of the RegExps
5819
5820 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
5821 // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
5822
5823 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
5824 var escapedStringRegExp = /^'([^]*?)'?$/;
5825 var doubleQuoteRegExp = /''/g;
5826 var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
5827 /**
5828 * @name format
5829 * @category Common Helpers
5830 * @summary Format the date.
5831 *
5832 * @description
5833 * Return the formatted date string in the given format. The result may vary by locale.
5834 *
5835 * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
5836 * > See: https://git.io/fxCyr
5837 *
5838 * The characters wrapped between two single quotes characters (') are escaped.
5839 * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
5840 * (see the last example)
5841 *
5842 * Format of the string is based on Unicode Technical Standard #35:
5843 * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
5844 * with a few additions (see note 7 below the table).
5845 *
5846 * Accepted patterns:
5847 * | Unit | Pattern | Result examples | Notes |
5848 * |---------------------------------|---------|-----------------------------------|-------|
5849 * | Era | G..GGG | AD, BC | |
5850 * | | GGGG | Anno Domini, Before Christ | 2 |
5851 * | | GGGGG | A, B | |
5852 * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
5853 * | | yo | 44th, 1st, 0th, 17th | 5,7 |
5854 * | | yy | 44, 01, 00, 17 | 5 |
5855 * | | yyy | 044, 001, 1900, 2017 | 5 |
5856 * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
5857 * | | yyyyy | ... | 3,5 |
5858 * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
5859 * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
5860 * | | YY | 44, 01, 00, 17 | 5,8 |
5861 * | | YYY | 044, 001, 1900, 2017 | 5 |
5862 * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
5863 * | | YYYYY | ... | 3,5 |
5864 * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
5865 * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
5866 * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
5867 * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
5868 * | | RRRRR | ... | 3,5,7 |
5869 * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
5870 * | | uu | -43, 01, 1900, 2017 | 5 |
5871 * | | uuu | -043, 001, 1900, 2017 | 5 |
5872 * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
5873 * | | uuuuu | ... | 3,5 |
5874 * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
5875 * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
5876 * | | QQ | 01, 02, 03, 04 | |
5877 * | | QQQ | Q1, Q2, Q3, Q4 | |
5878 * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
5879 * | | QQQQQ | 1, 2, 3, 4 | 4 |
5880 * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
5881 * | | qo | 1st, 2nd, 3rd, 4th | 7 |
5882 * | | qq | 01, 02, 03, 04 | |
5883 * | | qqq | Q1, Q2, Q3, Q4 | |
5884 * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
5885 * | | qqqqq | 1, 2, 3, 4 | 4 |
5886 * | Month (formatting) | M | 1, 2, ..., 12 | |
5887 * | | Mo | 1st, 2nd, ..., 12th | 7 |
5888 * | | MM | 01, 02, ..., 12 | |
5889 * | | MMM | Jan, Feb, ..., Dec | |
5890 * | | MMMM | January, February, ..., December | 2 |
5891 * | | MMMMM | J, F, ..., D | |
5892 * | Month (stand-alone) | L | 1, 2, ..., 12 | |
5893 * | | Lo | 1st, 2nd, ..., 12th | 7 |
5894 * | | LL | 01, 02, ..., 12 | |
5895 * | | LLL | Jan, Feb, ..., Dec | |
5896 * | | LLLL | January, February, ..., December | 2 |
5897 * | | LLLLL | J, F, ..., D | |
5898 * | Local week of year | w | 1, 2, ..., 53 | |
5899 * | | wo | 1st, 2nd, ..., 53th | 7 |
5900 * | | ww | 01, 02, ..., 53 | |
5901 * | ISO week of year | I | 1, 2, ..., 53 | 7 |
5902 * | | Io | 1st, 2nd, ..., 53th | 7 |
5903 * | | II | 01, 02, ..., 53 | 7 |
5904 * | Day of month | d | 1, 2, ..., 31 | |
5905 * | | do | 1st, 2nd, ..., 31st | 7 |
5906 * | | dd | 01, 02, ..., 31 | |
5907 * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
5908 * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
5909 * | | DD | 01, 02, ..., 365, 366 | 9 |
5910 * | | DDD | 001, 002, ..., 365, 366 | |
5911 * | | DDDD | ... | 3 |
5912 * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
5913 * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
5914 * | | EEEEE | M, T, W, T, F, S, S | |
5915 * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
5916 * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
5917 * | | io | 1st, 2nd, ..., 7th | 7 |
5918 * | | ii | 01, 02, ..., 07 | 7 |
5919 * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
5920 * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
5921 * | | iiiii | M, T, W, T, F, S, S | 7 |
5922 * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
5923 * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
5924 * | | eo | 2nd, 3rd, ..., 1st | 7 |
5925 * | | ee | 02, 03, ..., 01 | |
5926 * | | eee | Mon, Tue, Wed, ..., Sun | |
5927 * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
5928 * | | eeeee | M, T, W, T, F, S, S | |
5929 * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
5930 * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
5931 * | | co | 2nd, 3rd, ..., 1st | 7 |
5932 * | | cc | 02, 03, ..., 01 | |
5933 * | | ccc | Mon, Tue, Wed, ..., Sun | |
5934 * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
5935 * | | ccccc | M, T, W, T, F, S, S | |
5936 * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
5937 * | AM, PM | a..aa | AM, PM | |
5938 * | | aaa | am, pm | |
5939 * | | aaaa | a.m., p.m. | 2 |
5940 * | | aaaaa | a, p | |
5941 * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
5942 * | | bbb | am, pm, noon, midnight | |
5943 * | | bbbb | a.m., p.m., noon, midnight | 2 |
5944 * | | bbbbb | a, p, n, mi | |
5945 * | Flexible day period | B..BBB | at night, in the morning, ... | |
5946 * | | BBBB | at night, in the morning, ... | 2 |
5947 * | | BBBBB | at night, in the morning, ... | |
5948 * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
5949 * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
5950 * | | hh | 01, 02, ..., 11, 12 | |
5951 * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
5952 * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
5953 * | | HH | 00, 01, 02, ..., 23 | |
5954 * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
5955 * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
5956 * | | KK | 01, 02, ..., 11, 00 | |
5957 * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
5958 * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
5959 * | | kk | 24, 01, 02, ..., 23 | |
5960 * | Minute | m | 0, 1, ..., 59 | |
5961 * | | mo | 0th, 1st, ..., 59th | 7 |
5962 * | | mm | 00, 01, ..., 59 | |
5963 * | Second | s | 0, 1, ..., 59 | |
5964 * | | so | 0th, 1st, ..., 59th | 7 |
5965 * | | ss | 00, 01, ..., 59 | |
5966 * | Fraction of second | S | 0, 1, ..., 9 | |
5967 * | | SS | 00, 01, ..., 99 | |
5968 * | | SSS | 000, 0001, ..., 999 | |
5969 * | | SSSS | ... | 3 |
5970 * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
5971 * | | XX | -0800, +0530, Z | |
5972 * | | XXX | -08:00, +05:30, Z | |
5973 * | | XXXX | -0800, +0530, Z, +123456 | 2 |
5974 * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
5975 * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
5976 * | | xx | -0800, +0530, +0000 | |
5977 * | | xxx | -08:00, +05:30, +00:00 | 2 |
5978 * | | xxxx | -0800, +0530, +0000, +123456 | |
5979 * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
5980 * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
5981 * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
5982 * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
5983 * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
5984 * | Seconds timestamp | t | 512969520 | 7 |
5985 * | | tt | ... | 3,7 |
5986 * | Milliseconds timestamp | T | 512969520900 | 7 |
5987 * | | TT | ... | 3,7 |
5988 * | Long localized date | P | 04/29/1453 | 7 |
5989 * | | PP | Apr 29, 1453 | 7 |
5990 * | | PPP | April 29th, 1453 | 7 |
5991 * | | PPPP | Friday, April 29th, 1453 | 2,7 |
5992 * | Long localized time | p | 12:00 AM | 7 |
5993 * | | pp | 12:00:00 AM | 7 |
5994 * | | ppp | 12:00:00 AM GMT+2 | 7 |
5995 * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
5996 * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
5997 * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
5998 * | | PPPppp | April 29th, 1453 at ... | 7 |
5999 * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
6000 * Notes:
6001 * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
6002 * are the same as "stand-alone" units, but are different in some languages.
6003 * "Formatting" units are declined according to the rules of the language
6004 * in the context of a date. "Stand-alone" units are always nominative singular:
6005 *
6006 * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
6007 *
6008 * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
6009 *
6010 * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
6011 * the single quote characters (see below).
6012 * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
6013 * the output will be the same as default pattern for this unit, usually
6014 * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
6015 * are marked with "2" in the last column of the table.
6016 *
6017 * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
6018 *
6019 * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
6020 *
6021 * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
6022 *
6023 * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
6024 *
6025 * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
6026 *
6027 * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
6028 * The output will be padded with zeros to match the length of the pattern.
6029 *
6030 * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
6031 *
6032 * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
6033 * These tokens represent the shortest form of the quarter.
6034 *
6035 * 5. The main difference between `y` and `u` patterns are B.C. years:
6036 *
6037 * | Year | `y` | `u` |
6038 * |------|-----|-----|
6039 * | AC 1 | 1 | 1 |
6040 * | BC 1 | 1 | 0 |
6041 * | BC 2 | 2 | -1 |
6042 *
6043 * Also `yy` always returns the last two digits of a year,
6044 * while `uu` pads single digit years to 2 characters and returns other years unchanged:
6045 *
6046 * | Year | `yy` | `uu` |
6047 * |------|------|------|
6048 * | 1 | 01 | 01 |
6049 * | 14 | 14 | 14 |
6050 * | 376 | 76 | 376 |
6051 * | 1453 | 53 | 1453 |
6052 *
6053 * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
6054 * except local week-numbering years are dependent on `options.weekStartsOn`
6055 * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
6056 * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
6057 *
6058 * 6. Specific non-location timezones are currently unavailable in `date-fns`,
6059 * so right now these tokens fall back to GMT timezones.
6060 *
6061 * 7. These patterns are not in the Unicode Technical Standard #35:
6062 * - `i`: ISO day of week
6063 * - `I`: ISO week of year
6064 * - `R`: ISO week-numbering year
6065 * - `t`: seconds timestamp
6066 * - `T`: milliseconds timestamp
6067 * - `o`: ordinal number modifier
6068 * - `P`: long localized date
6069 * - `p`: long localized time
6070 *
6071 * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
6072 * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
6073 *
6074 * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
6075 * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
6076 *
6077 * ### v2.0.0 breaking changes:
6078 *
6079 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
6080 *
6081 * - The second argument is now required for the sake of explicitness.
6082 *
6083 * ```javascript
6084 * // Before v2.0.0
6085 * format(new Date(2016, 0, 1))
6086 *
6087 * // v2.0.0 onward
6088 * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
6089 * ```
6090 *
6091 * - New format string API for `format` function
6092 * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
6093 * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
6094 *
6095 * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
6096 *
6097 * @param {Date|Number} date - the original date
6098 * @param {String} format - the string of tokens
6099 * @param {Object} [options] - an object with options.
6100 * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
6101 * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
6102 * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
6103 * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
6104 * see: https://git.io/fxCyr
6105 * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
6106 * see: https://git.io/fxCyr
6107 * @returns {String} the formatted date string
6108 * @throws {TypeError} 2 arguments required
6109 * @throws {RangeError} `date` must not be Invalid Date
6110 * @throws {RangeError} `options.locale` must contain `localize` property
6111 * @throws {RangeError} `options.locale` must contain `formatLong` property
6112 * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
6113 * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
6114 * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
6115 * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
6116 * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
6117 * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
6118 * @throws {RangeError} format string contains an unescaped latin alphabet character
6119 *
6120 * @example
6121 * // Represent 11 February 2014 in middle-endian format:
6122 * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
6123 * //=> '02/11/2014'
6124 *
6125 * @example
6126 * // Represent 2 July 2014 in Esperanto:
6127 * import { eoLocale } from 'date-fns/locale/eo'
6128 * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
6129 * locale: eoLocale
6130 * })
6131 * //=> '2-a de julio 2014'
6132 *
6133 * @example
6134 * // Escape string by single quote characters:
6135 * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
6136 * //=> "3 o'clock"
6137 */
6138
6139 function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
6140 requiredArgs(2, arguments);
6141 var formatStr = String(dirtyFormatStr);
6142 var options = dirtyOptions || {};
6143 var locale$1 = options.locale || locale;
6144 var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
6145 var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
6146 var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
6147
6148 if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
6149 throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
6150 }
6151
6152 var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
6153 var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
6154 var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
6155
6156 if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
6157 throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
6158 }
6159
6160 if (!locale$1.localize) {
6161 throw new RangeError('locale must contain localize property');
6162 }
6163
6164 if (!locale$1.formatLong) {
6165 throw new RangeError('locale must contain formatLong property');
6166 }
6167
6168 var originalDate = toDate(dirtyDate);
6169
6170 if (!isValid(originalDate)) {
6171 throw new RangeError('Invalid time value');
6172 } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
6173 // This ensures that when UTC functions will be implemented, locales will be compatible with them.
6174 // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
6175
6176
6177 var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
6178 var utcDate = subMilliseconds(originalDate, timezoneOffset);
6179 var formatterOptions = {
6180 firstWeekContainsDate: firstWeekContainsDate,
6181 weekStartsOn: weekStartsOn,
6182 locale: locale$1,
6183 _originalDate: originalDate
6184 };
6185 var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
6186 var firstCharacter = substring[0];
6187
6188 if (firstCharacter === 'p' || firstCharacter === 'P') {
6189 var longFormatter = longFormatters[firstCharacter];
6190 return longFormatter(substring, locale$1.formatLong, formatterOptions);
6191 }
6192
6193 return substring;
6194 }).join('').match(formattingTokensRegExp).map(function (substring) {
6195 // Replace two single quote characters with one single quote character
6196 if (substring === "''") {
6197 return "'";
6198 }
6199
6200 var firstCharacter = substring[0];
6201
6202 if (firstCharacter === "'") {
6203 return cleanEscapedString(substring);
6204 }
6205
6206 var formatter = formatters$1[firstCharacter];
6207
6208 if (formatter) {
6209 if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
6210 throwProtectedError(substring, dirtyFormatStr, dirtyDate);
6211 }
6212
6213 if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
6214 throwProtectedError(substring, dirtyFormatStr, dirtyDate);
6215 }
6216
6217 return formatter(utcDate, substring, locale$1.localize, formatterOptions);
6218 }
6219
6220 if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
6221 throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
6222 }
6223
6224 return substring;
6225 }).join('');
6226 return result;
6227 }
6228
6229 function cleanEscapedString(input) {
6230 return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
6231 }
6232
6233 function assign(target, dirtyObject) {
6234 if (target == null) {
6235 throw new TypeError('assign requires that input parameter not be null or undefined');
6236 }
6237
6238 dirtyObject = dirtyObject || {};
6239
6240 for (var property in dirtyObject) {
6241 if (dirtyObject.hasOwnProperty(property)) {
6242 target[property] = dirtyObject[property];
6243 }
6244 }
6245
6246 return target;
6247 }
6248
6249 // See issue: https://github.com/date-fns/date-fns/issues/376
6250
6251 function setUTCDay(dirtyDate, dirtyDay, dirtyOptions) {
6252 requiredArgs(2, arguments);
6253 var options = dirtyOptions || {};
6254 var locale = options.locale;
6255 var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
6256 var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
6257 var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
6258
6259 if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
6260 throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
6261 }
6262
6263 var date = toDate(dirtyDate);
6264 var day = toInteger(dirtyDay);
6265 var currentDay = date.getUTCDay();
6266 var remainder = day % 7;
6267 var dayIndex = (remainder + 7) % 7;
6268 var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
6269 date.setUTCDate(date.getUTCDate() + diff);
6270 return date;
6271 }
6272
6273 // See issue: https://github.com/date-fns/date-fns/issues/376
6274
6275 function setUTCISODay(dirtyDate, dirtyDay) {
6276 requiredArgs(2, arguments);
6277 var day = toInteger(dirtyDay);
6278
6279 if (day % 7 === 0) {
6280 day = day - 7;
6281 }
6282
6283 var weekStartsOn = 1;
6284 var date = toDate(dirtyDate);
6285 var currentDay = date.getUTCDay();
6286 var remainder = day % 7;
6287 var dayIndex = (remainder + 7) % 7;
6288 var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
6289 date.setUTCDate(date.getUTCDate() + diff);
6290 return date;
6291 }
6292
6293 // See issue: https://github.com/date-fns/date-fns/issues/376
6294
6295 function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
6296 requiredArgs(2, arguments);
6297 var date = toDate(dirtyDate);
6298 var isoWeek = toInteger(dirtyISOWeek);
6299 var diff = getUTCISOWeek(date) - isoWeek;
6300 date.setUTCDate(date.getUTCDate() - diff * 7);
6301 return date;
6302 }
6303
6304 // See issue: https://github.com/date-fns/date-fns/issues/376
6305
6306 function setUTCWeek(dirtyDate, dirtyWeek, options) {
6307 requiredArgs(2, arguments);
6308 var date = toDate(dirtyDate);
6309 var week = toInteger(dirtyWeek);
6310 var diff = getUTCWeek(date, options) - week;
6311 date.setUTCDate(date.getUTCDate() - diff * 7);
6312 return date;
6313 }
6314
6315 var MILLISECONDS_IN_HOUR = 3600000;
6316 var MILLISECONDS_IN_MINUTE$1 = 60000;
6317 var MILLISECONDS_IN_SECOND = 1000;
6318 var numericPatterns = {
6319 month: /^(1[0-2]|0?\d)/,
6320 // 0 to 12
6321 date: /^(3[0-1]|[0-2]?\d)/,
6322 // 0 to 31
6323 dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
6324 // 0 to 366
6325 week: /^(5[0-3]|[0-4]?\d)/,
6326 // 0 to 53
6327 hour23h: /^(2[0-3]|[0-1]?\d)/,
6328 // 0 to 23
6329 hour24h: /^(2[0-4]|[0-1]?\d)/,
6330 // 0 to 24
6331 hour11h: /^(1[0-1]|0?\d)/,
6332 // 0 to 11
6333 hour12h: /^(1[0-2]|0?\d)/,
6334 // 0 to 12
6335 minute: /^[0-5]?\d/,
6336 // 0 to 59
6337 second: /^[0-5]?\d/,
6338 // 0 to 59
6339 singleDigit: /^\d/,
6340 // 0 to 9
6341 twoDigits: /^\d{1,2}/,
6342 // 0 to 99
6343 threeDigits: /^\d{1,3}/,
6344 // 0 to 999
6345 fourDigits: /^\d{1,4}/,
6346 // 0 to 9999
6347 anyDigitsSigned: /^-?\d+/,
6348 singleDigitSigned: /^-?\d/,
6349 // 0 to 9, -0 to -9
6350 twoDigitsSigned: /^-?\d{1,2}/,
6351 // 0 to 99, -0 to -99
6352 threeDigitsSigned: /^-?\d{1,3}/,
6353 // 0 to 999, -0 to -999
6354 fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999
6355
6356 };
6357 var timezonePatterns = {
6358 basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
6359 basic: /^([+-])(\d{2})(\d{2})|Z/,
6360 basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
6361 extended: /^([+-])(\d{2}):(\d{2})|Z/,
6362 extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
6363 };
6364
6365 function parseNumericPattern(pattern, string, valueCallback) {
6366 var matchResult = string.match(pattern);
6367
6368 if (!matchResult) {
6369 return null;
6370 }
6371
6372 var value = parseInt(matchResult[0], 10);
6373 return {
6374 value: valueCallback ? valueCallback(value) : value,
6375 rest: string.slice(matchResult[0].length)
6376 };
6377 }
6378
6379 function parseTimezonePattern(pattern, string) {
6380 var matchResult = string.match(pattern);
6381
6382 if (!matchResult) {
6383 return null;
6384 } // Input is 'Z'
6385
6386
6387 if (matchResult[0] === 'Z') {
6388 return {
6389 value: 0,
6390 rest: string.slice(1)
6391 };
6392 }
6393
6394 var sign = matchResult[1] === '+' ? 1 : -1;
6395 var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
6396 var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
6397 var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
6398 return {
6399 value: sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE$1 + seconds * MILLISECONDS_IN_SECOND),
6400 rest: string.slice(matchResult[0].length)
6401 };
6402 }
6403
6404 function parseAnyDigitsSigned(string, valueCallback) {
6405 return parseNumericPattern(numericPatterns.anyDigitsSigned, string, valueCallback);
6406 }
6407
6408 function parseNDigits(n, string, valueCallback) {
6409 switch (n) {
6410 case 1:
6411 return parseNumericPattern(numericPatterns.singleDigit, string, valueCallback);
6412
6413 case 2:
6414 return parseNumericPattern(numericPatterns.twoDigits, string, valueCallback);
6415
6416 case 3:
6417 return parseNumericPattern(numericPatterns.threeDigits, string, valueCallback);
6418
6419 case 4:
6420 return parseNumericPattern(numericPatterns.fourDigits, string, valueCallback);
6421
6422 default:
6423 return parseNumericPattern(new RegExp('^\\d{1,' + n + '}'), string, valueCallback);
6424 }
6425 }
6426
6427 function parseNDigitsSigned(n, string, valueCallback) {
6428 switch (n) {
6429 case 1:
6430 return parseNumericPattern(numericPatterns.singleDigitSigned, string, valueCallback);
6431
6432 case 2:
6433 return parseNumericPattern(numericPatterns.twoDigitsSigned, string, valueCallback);
6434
6435 case 3:
6436 return parseNumericPattern(numericPatterns.threeDigitsSigned, string, valueCallback);
6437
6438 case 4:
6439 return parseNumericPattern(numericPatterns.fourDigitsSigned, string, valueCallback);
6440
6441 default:
6442 return parseNumericPattern(new RegExp('^-?\\d{1,' + n + '}'), string, valueCallback);
6443 }
6444 }
6445
6446 function dayPeriodEnumToHours(enumValue) {
6447 switch (enumValue) {
6448 case 'morning':
6449 return 4;
6450
6451 case 'evening':
6452 return 17;
6453
6454 case 'pm':
6455 case 'noon':
6456 case 'afternoon':
6457 return 12;
6458
6459 case 'am':
6460 case 'midnight':
6461 case 'night':
6462 default:
6463 return 0;
6464 }
6465 }
6466
6467 function normalizeTwoDigitYear(twoDigitYear, currentYear) {
6468 var isCommonEra = currentYear > 0; // Absolute number of the current year:
6469 // 1 -> 1 AC
6470 // 0 -> 1 BC
6471 // -1 -> 2 BC
6472
6473 var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
6474 var result;
6475
6476 if (absCurrentYear <= 50) {
6477 result = twoDigitYear || 100;
6478 } else {
6479 var rangeEnd = absCurrentYear + 50;
6480 var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
6481 var isPreviousCentury = twoDigitYear >= rangeEnd % 100;
6482 result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
6483 }
6484
6485 return isCommonEra ? result : 1 - result;
6486 }
6487
6488 var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
6489 var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // User for validation
6490
6491 function isLeapYearIndex(year) {
6492 return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
6493 }
6494 /*
6495 * | | Unit | | Unit |
6496 * |-----|--------------------------------|-----|--------------------------------|
6497 * | a | AM, PM | A* | Milliseconds in day |
6498 * | b | AM, PM, noon, midnight | B | Flexible day period |
6499 * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
6500 * | d | Day of month | D | Day of year |
6501 * | e | Local day of week | E | Day of week |
6502 * | f | | F* | Day of week in month |
6503 * | g* | Modified Julian day | G | Era |
6504 * | h | Hour [1-12] | H | Hour [0-23] |
6505 * | i! | ISO day of week | I! | ISO week of year |
6506 * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
6507 * | k | Hour [1-24] | K | Hour [0-11] |
6508 * | l* | (deprecated) | L | Stand-alone month |
6509 * | m | Minute | M | Month |
6510 * | n | | N | |
6511 * | o! | Ordinal number modifier | O* | Timezone (GMT) |
6512 * | p | | P | |
6513 * | q | Stand-alone quarter | Q | Quarter |
6514 * | r* | Related Gregorian year | R! | ISO week-numbering year |
6515 * | s | Second | S | Fraction of second |
6516 * | t! | Seconds timestamp | T! | Milliseconds timestamp |
6517 * | u | Extended year | U* | Cyclic year |
6518 * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
6519 * | w | Local week of year | W* | Week of month |
6520 * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
6521 * | y | Year (abs) | Y | Local week-numbering year |
6522 * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
6523 *
6524 * Letters marked by * are not implemented but reserved by Unicode standard.
6525 *
6526 * Letters marked by ! are non-standard, but implemented by date-fns:
6527 * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)
6528 * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
6529 * i.e. 7 for Sunday, 1 for Monday, etc.
6530 * - `I` is ISO week of year, as opposed to `w` which is local week of year.
6531 * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
6532 * `R` is supposed to be used in conjunction with `I` and `i`
6533 * for universal ISO week-numbering date, whereas
6534 * `Y` is supposed to be used in conjunction with `w` and `e`
6535 * for week-numbering date specific to the locale.
6536 */
6537
6538
6539 var parsers = {
6540 // Era
6541 G: {
6542 priority: 140,
6543 parse: function (string, token, match, _options) {
6544 switch (token) {
6545 // AD, BC
6546 case 'G':
6547 case 'GG':
6548 case 'GGG':
6549 return match.era(string, {
6550 width: 'abbreviated'
6551 }) || match.era(string, {
6552 width: 'narrow'
6553 });
6554 // A, B
6555
6556 case 'GGGGG':
6557 return match.era(string, {
6558 width: 'narrow'
6559 });
6560 // Anno Domini, Before Christ
6561
6562 case 'GGGG':
6563 default:
6564 return match.era(string, {
6565 width: 'wide'
6566 }) || match.era(string, {
6567 width: 'abbreviated'
6568 }) || match.era(string, {
6569 width: 'narrow'
6570 });
6571 }
6572 },
6573 set: function (date, flags, value, _options) {
6574 flags.era = value;
6575 date.setUTCFullYear(value, 0, 1);
6576 date.setUTCHours(0, 0, 0, 0);
6577 return date;
6578 },
6579 incompatibleTokens: ['R', 'u', 't', 'T']
6580 },
6581 // Year
6582 y: {
6583 // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
6584 // | Year | y | yy | yyy | yyyy | yyyyy |
6585 // |----------|-------|----|-------|-------|-------|
6586 // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
6587 // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
6588 // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
6589 // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
6590 // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
6591 priority: 130,
6592 parse: function (string, token, match, _options) {
6593 var valueCallback = function (year) {
6594 return {
6595 year: year,
6596 isTwoDigitYear: token === 'yy'
6597 };
6598 };
6599
6600 switch (token) {
6601 case 'y':
6602 return parseNDigits(4, string, valueCallback);
6603
6604 case 'yo':
6605 return match.ordinalNumber(string, {
6606 unit: 'year',
6607 valueCallback: valueCallback
6608 });
6609
6610 default:
6611 return parseNDigits(token.length, string, valueCallback);
6612 }
6613 },
6614 validate: function (_date, value, _options) {
6615 return value.isTwoDigitYear || value.year > 0;
6616 },
6617 set: function (date, flags, value, _options) {
6618 var currentYear = date.getUTCFullYear();
6619
6620 if (value.isTwoDigitYear) {
6621 var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
6622 date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);
6623 date.setUTCHours(0, 0, 0, 0);
6624 return date;
6625 }
6626
6627 var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
6628 date.setUTCFullYear(year, 0, 1);
6629 date.setUTCHours(0, 0, 0, 0);
6630 return date;
6631 },
6632 incompatibleTokens: ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']
6633 },
6634 // Local week-numbering year
6635 Y: {
6636 priority: 130,
6637 parse: function (string, token, match, _options) {
6638 var valueCallback = function (year) {
6639 return {
6640 year: year,
6641 isTwoDigitYear: token === 'YY'
6642 };
6643 };
6644
6645 switch (token) {
6646 case 'Y':
6647 return parseNDigits(4, string, valueCallback);
6648
6649 case 'Yo':
6650 return match.ordinalNumber(string, {
6651 unit: 'year',
6652 valueCallback: valueCallback
6653 });
6654
6655 default:
6656 return parseNDigits(token.length, string, valueCallback);
6657 }
6658 },
6659 validate: function (_date, value, _options) {
6660 return value.isTwoDigitYear || value.year > 0;
6661 },
6662 set: function (date, flags, value, options) {
6663 var currentYear = getUTCWeekYear(date, options);
6664
6665 if (value.isTwoDigitYear) {
6666 var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
6667 date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
6668 date.setUTCHours(0, 0, 0, 0);
6669 return startOfUTCWeek(date, options);
6670 }
6671
6672 var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
6673 date.setUTCFullYear(year, 0, options.firstWeekContainsDate);
6674 date.setUTCHours(0, 0, 0, 0);
6675 return startOfUTCWeek(date, options);
6676 },
6677 incompatibleTokens: ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']
6678 },
6679 // ISO week-numbering year
6680 R: {
6681 priority: 130,
6682 parse: function (string, token, _match, _options) {
6683 if (token === 'R') {
6684 return parseNDigitsSigned(4, string);
6685 }
6686
6687 return parseNDigitsSigned(token.length, string);
6688 },
6689 set: function (_date, _flags, value, _options) {
6690 var firstWeekOfYear = new Date(0);
6691 firstWeekOfYear.setUTCFullYear(value, 0, 4);
6692 firstWeekOfYear.setUTCHours(0, 0, 0, 0);
6693 return startOfUTCISOWeek(firstWeekOfYear);
6694 },
6695 incompatibleTokens: ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']
6696 },
6697 // Extended year
6698 u: {
6699 priority: 130,
6700 parse: function (string, token, _match, _options) {
6701 if (token === 'u') {
6702 return parseNDigitsSigned(4, string);
6703 }
6704
6705 return parseNDigitsSigned(token.length, string);
6706 },
6707 set: function (date, _flags, value, _options) {
6708 date.setUTCFullYear(value, 0, 1);
6709 date.setUTCHours(0, 0, 0, 0);
6710 return date;
6711 },
6712 incompatibleTokens: ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']
6713 },
6714 // Quarter
6715 Q: {
6716 priority: 120,
6717 parse: function (string, token, match, _options) {
6718 switch (token) {
6719 // 1, 2, 3, 4
6720 case 'Q':
6721 case 'QQ':
6722 // 01, 02, 03, 04
6723 return parseNDigits(token.length, string);
6724 // 1st, 2nd, 3rd, 4th
6725
6726 case 'Qo':
6727 return match.ordinalNumber(string, {
6728 unit: 'quarter'
6729 });
6730 // Q1, Q2, Q3, Q4
6731
6732 case 'QQQ':
6733 return match.quarter(string, {
6734 width: 'abbreviated',
6735 context: 'formatting'
6736 }) || match.quarter(string, {
6737 width: 'narrow',
6738 context: 'formatting'
6739 });
6740 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
6741
6742 case 'QQQQQ':
6743 return match.quarter(string, {
6744 width: 'narrow',
6745 context: 'formatting'
6746 });
6747 // 1st quarter, 2nd quarter, ...
6748
6749 case 'QQQQ':
6750 default:
6751 return match.quarter(string, {
6752 width: 'wide',
6753 context: 'formatting'
6754 }) || match.quarter(string, {
6755 width: 'abbreviated',
6756 context: 'formatting'
6757 }) || match.quarter(string, {
6758 width: 'narrow',
6759 context: 'formatting'
6760 });
6761 }
6762 },
6763 validate: function (_date, value, _options) {
6764 return value >= 1 && value <= 4;
6765 },
6766 set: function (date, _flags, value, _options) {
6767 date.setUTCMonth((value - 1) * 3, 1);
6768 date.setUTCHours(0, 0, 0, 0);
6769 return date;
6770 },
6771 incompatibleTokens: ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']
6772 },
6773 // Stand-alone quarter
6774 q: {
6775 priority: 120,
6776 parse: function (string, token, match, _options) {
6777 switch (token) {
6778 // 1, 2, 3, 4
6779 case 'q':
6780 case 'qq':
6781 // 01, 02, 03, 04
6782 return parseNDigits(token.length, string);
6783 // 1st, 2nd, 3rd, 4th
6784
6785 case 'qo':
6786 return match.ordinalNumber(string, {
6787 unit: 'quarter'
6788 });
6789 // Q1, Q2, Q3, Q4
6790
6791 case 'qqq':
6792 return match.quarter(string, {
6793 width: 'abbreviated',
6794 context: 'standalone'
6795 }) || match.quarter(string, {
6796 width: 'narrow',
6797 context: 'standalone'
6798 });
6799 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
6800
6801 case 'qqqqq':
6802 return match.quarter(string, {
6803 width: 'narrow',
6804 context: 'standalone'
6805 });
6806 // 1st quarter, 2nd quarter, ...
6807
6808 case 'qqqq':
6809 default:
6810 return match.quarter(string, {
6811 width: 'wide',
6812 context: 'standalone'
6813 }) || match.quarter(string, {
6814 width: 'abbreviated',
6815 context: 'standalone'
6816 }) || match.quarter(string, {
6817 width: 'narrow',
6818 context: 'standalone'
6819 });
6820 }
6821 },
6822 validate: function (_date, value, _options) {
6823 return value >= 1 && value <= 4;
6824 },
6825 set: function (date, _flags, value, _options) {
6826 date.setUTCMonth((value - 1) * 3, 1);
6827 date.setUTCHours(0, 0, 0, 0);
6828 return date;
6829 },
6830 incompatibleTokens: ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']
6831 },
6832 // Month
6833 M: {
6834 priority: 110,
6835 parse: function (string, token, match, _options) {
6836 var valueCallback = function (value) {
6837 return value - 1;
6838 };
6839
6840 switch (token) {
6841 // 1, 2, ..., 12
6842 case 'M':
6843 return parseNumericPattern(numericPatterns.month, string, valueCallback);
6844 // 01, 02, ..., 12
6845
6846 case 'MM':
6847 return parseNDigits(2, string, valueCallback);
6848 // 1st, 2nd, ..., 12th
6849
6850 case 'Mo':
6851 return match.ordinalNumber(string, {
6852 unit: 'month',
6853 valueCallback: valueCallback
6854 });
6855 // Jan, Feb, ..., Dec
6856
6857 case 'MMM':
6858 return match.month(string, {
6859 width: 'abbreviated',
6860 context: 'formatting'
6861 }) || match.month(string, {
6862 width: 'narrow',
6863 context: 'formatting'
6864 });
6865 // J, F, ..., D
6866
6867 case 'MMMMM':
6868 return match.month(string, {
6869 width: 'narrow',
6870 context: 'formatting'
6871 });
6872 // January, February, ..., December
6873
6874 case 'MMMM':
6875 default:
6876 return match.month(string, {
6877 width: 'wide',
6878 context: 'formatting'
6879 }) || match.month(string, {
6880 width: 'abbreviated',
6881 context: 'formatting'
6882 }) || match.month(string, {
6883 width: 'narrow',
6884 context: 'formatting'
6885 });
6886 }
6887 },
6888 validate: function (_date, value, _options) {
6889 return value >= 0 && value <= 11;
6890 },
6891 set: function (date, _flags, value, _options) {
6892 date.setUTCMonth(value, 1);
6893 date.setUTCHours(0, 0, 0, 0);
6894 return date;
6895 },
6896 incompatibleTokens: ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']
6897 },
6898 // Stand-alone month
6899 L: {
6900 priority: 110,
6901 parse: function (string, token, match, _options) {
6902 var valueCallback = function (value) {
6903 return value - 1;
6904 };
6905
6906 switch (token) {
6907 // 1, 2, ..., 12
6908 case 'L':
6909 return parseNumericPattern(numericPatterns.month, string, valueCallback);
6910 // 01, 02, ..., 12
6911
6912 case 'LL':
6913 return parseNDigits(2, string, valueCallback);
6914 // 1st, 2nd, ..., 12th
6915
6916 case 'Lo':
6917 return match.ordinalNumber(string, {
6918 unit: 'month',
6919 valueCallback: valueCallback
6920 });
6921 // Jan, Feb, ..., Dec
6922
6923 case 'LLL':
6924 return match.month(string, {
6925 width: 'abbreviated',
6926 context: 'standalone'
6927 }) || match.month(string, {
6928 width: 'narrow',
6929 context: 'standalone'
6930 });
6931 // J, F, ..., D
6932
6933 case 'LLLLL':
6934 return match.month(string, {
6935 width: 'narrow',
6936 context: 'standalone'
6937 });
6938 // January, February, ..., December
6939
6940 case 'LLLL':
6941 default:
6942 return match.month(string, {
6943 width: 'wide',
6944 context: 'standalone'
6945 }) || match.month(string, {
6946 width: 'abbreviated',
6947 context: 'standalone'
6948 }) || match.month(string, {
6949 width: 'narrow',
6950 context: 'standalone'
6951 });
6952 }
6953 },
6954 validate: function (_date, value, _options) {
6955 return value >= 0 && value <= 11;
6956 },
6957 set: function (date, _flags, value, _options) {
6958 date.setUTCMonth(value, 1);
6959 date.setUTCHours(0, 0, 0, 0);
6960 return date;
6961 },
6962 incompatibleTokens: ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']
6963 },
6964 // Local week of year
6965 w: {
6966 priority: 100,
6967 parse: function (string, token, match, _options) {
6968 switch (token) {
6969 case 'w':
6970 return parseNumericPattern(numericPatterns.week, string);
6971
6972 case 'wo':
6973 return match.ordinalNumber(string, {
6974 unit: 'week'
6975 });
6976
6977 default:
6978 return parseNDigits(token.length, string);
6979 }
6980 },
6981 validate: function (_date, value, _options) {
6982 return value >= 1 && value <= 53;
6983 },
6984 set: function (date, _flags, value, options) {
6985 return startOfUTCWeek(setUTCWeek(date, value, options), options);
6986 },
6987 incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']
6988 },
6989 // ISO week of year
6990 I: {
6991 priority: 100,
6992 parse: function (string, token, match, _options) {
6993 switch (token) {
6994 case 'I':
6995 return parseNumericPattern(numericPatterns.week, string);
6996
6997 case 'Io':
6998 return match.ordinalNumber(string, {
6999 unit: 'week'
7000 });
7001
7002 default:
7003 return parseNDigits(token.length, string);
7004 }
7005 },
7006 validate: function (_date, value, _options) {
7007 return value >= 1 && value <= 53;
7008 },
7009 set: function (date, _flags, value, options) {
7010 return startOfUTCISOWeek(setUTCISOWeek(date, value, options), options);
7011 },
7012 incompatibleTokens: ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']
7013 },
7014 // Day of the month
7015 d: {
7016 priority: 90,
7017 subPriority: 1,
7018 parse: function (string, token, match, _options) {
7019 switch (token) {
7020 case 'd':
7021 return parseNumericPattern(numericPatterns.date, string);
7022
7023 case 'do':
7024 return match.ordinalNumber(string, {
7025 unit: 'date'
7026 });
7027
7028 default:
7029 return parseNDigits(token.length, string);
7030 }
7031 },
7032 validate: function (date, value, _options) {
7033 var year = date.getUTCFullYear();
7034 var isLeapYear = isLeapYearIndex(year);
7035 var month = date.getUTCMonth();
7036
7037 if (isLeapYear) {
7038 return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
7039 } else {
7040 return value >= 1 && value <= DAYS_IN_MONTH[month];
7041 }
7042 },
7043 set: function (date, _flags, value, _options) {
7044 date.setUTCDate(value);
7045 date.setUTCHours(0, 0, 0, 0);
7046 return date;
7047 },
7048 incompatibleTokens: ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']
7049 },
7050 // Day of year
7051 D: {
7052 priority: 90,
7053 subPriority: 1,
7054 parse: function (string, token, match, _options) {
7055 switch (token) {
7056 case 'D':
7057 case 'DD':
7058 return parseNumericPattern(numericPatterns.dayOfYear, string);
7059
7060 case 'Do':
7061 return match.ordinalNumber(string, {
7062 unit: 'date'
7063 });
7064
7065 default:
7066 return parseNDigits(token.length, string);
7067 }
7068 },
7069 validate: function (date, value, _options) {
7070 var year = date.getUTCFullYear();
7071 var isLeapYear = isLeapYearIndex(year);
7072
7073 if (isLeapYear) {
7074 return value >= 1 && value <= 366;
7075 } else {
7076 return value >= 1 && value <= 365;
7077 }
7078 },
7079 set: function (date, _flags, value, _options) {
7080 date.setUTCMonth(0, value);
7081 date.setUTCHours(0, 0, 0, 0);
7082 return date;
7083 },
7084 incompatibleTokens: ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']
7085 },
7086 // Day of week
7087 E: {
7088 priority: 90,
7089 parse: function (string, token, match, _options) {
7090 switch (token) {
7091 // Tue
7092 case 'E':
7093 case 'EE':
7094 case 'EEE':
7095 return match.day(string, {
7096 width: 'abbreviated',
7097 context: 'formatting'
7098 }) || match.day(string, {
7099 width: 'short',
7100 context: 'formatting'
7101 }) || match.day(string, {
7102 width: 'narrow',
7103 context: 'formatting'
7104 });
7105 // T
7106
7107 case 'EEEEE':
7108 return match.day(string, {
7109 width: 'narrow',
7110 context: 'formatting'
7111 });
7112 // Tu
7113
7114 case 'EEEEEE':
7115 return match.day(string, {
7116 width: 'short',
7117 context: 'formatting'
7118 }) || match.day(string, {
7119 width: 'narrow',
7120 context: 'formatting'
7121 });
7122 // Tuesday
7123
7124 case 'EEEE':
7125 default:
7126 return match.day(string, {
7127 width: 'wide',
7128 context: 'formatting'
7129 }) || match.day(string, {
7130 width: 'abbreviated',
7131 context: 'formatting'
7132 }) || match.day(string, {
7133 width: 'short',
7134 context: 'formatting'
7135 }) || match.day(string, {
7136 width: 'narrow',
7137 context: 'formatting'
7138 });
7139 }
7140 },
7141 validate: function (_date, value, _options) {
7142 return value >= 0 && value <= 6;
7143 },
7144 set: function (date, _flags, value, options) {
7145 date = setUTCDay(date, value, options);
7146 date.setUTCHours(0, 0, 0, 0);
7147 return date;
7148 },
7149 incompatibleTokens: ['D', 'i', 'e', 'c', 't', 'T']
7150 },
7151 // Local day of week
7152 e: {
7153 priority: 90,
7154 parse: function (string, token, match, options) {
7155 var valueCallback = function (value) {
7156 var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
7157 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
7158 };
7159
7160 switch (token) {
7161 // 3
7162 case 'e':
7163 case 'ee':
7164 // 03
7165 return parseNDigits(token.length, string, valueCallback);
7166 // 3rd
7167
7168 case 'eo':
7169 return match.ordinalNumber(string, {
7170 unit: 'day',
7171 valueCallback: valueCallback
7172 });
7173 // Tue
7174
7175 case 'eee':
7176 return match.day(string, {
7177 width: 'abbreviated',
7178 context: 'formatting'
7179 }) || match.day(string, {
7180 width: 'short',
7181 context: 'formatting'
7182 }) || match.day(string, {
7183 width: 'narrow',
7184 context: 'formatting'
7185 });
7186 // T
7187
7188 case 'eeeee':
7189 return match.day(string, {
7190 width: 'narrow',
7191 context: 'formatting'
7192 });
7193 // Tu
7194
7195 case 'eeeeee':
7196 return match.day(string, {
7197 width: 'short',
7198 context: 'formatting'
7199 }) || match.day(string, {
7200 width: 'narrow',
7201 context: 'formatting'
7202 });
7203 // Tuesday
7204
7205 case 'eeee':
7206 default:
7207 return match.day(string, {
7208 width: 'wide',
7209 context: 'formatting'
7210 }) || match.day(string, {
7211 width: 'abbreviated',
7212 context: 'formatting'
7213 }) || match.day(string, {
7214 width: 'short',
7215 context: 'formatting'
7216 }) || match.day(string, {
7217 width: 'narrow',
7218 context: 'formatting'
7219 });
7220 }
7221 },
7222 validate: function (_date, value, _options) {
7223 return value >= 0 && value <= 6;
7224 },
7225 set: function (date, _flags, value, options) {
7226 date = setUTCDay(date, value, options);
7227 date.setUTCHours(0, 0, 0, 0);
7228 return date;
7229 },
7230 incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']
7231 },
7232 // Stand-alone local day of week
7233 c: {
7234 priority: 90,
7235 parse: function (string, token, match, options) {
7236 var valueCallback = function (value) {
7237 var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
7238 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
7239 };
7240
7241 switch (token) {
7242 // 3
7243 case 'c':
7244 case 'cc':
7245 // 03
7246 return parseNDigits(token.length, string, valueCallback);
7247 // 3rd
7248
7249 case 'co':
7250 return match.ordinalNumber(string, {
7251 unit: 'day',
7252 valueCallback: valueCallback
7253 });
7254 // Tue
7255
7256 case 'ccc':
7257 return match.day(string, {
7258 width: 'abbreviated',
7259 context: 'standalone'
7260 }) || match.day(string, {
7261 width: 'short',
7262 context: 'standalone'
7263 }) || match.day(string, {
7264 width: 'narrow',
7265 context: 'standalone'
7266 });
7267 // T
7268
7269 case 'ccccc':
7270 return match.day(string, {
7271 width: 'narrow',
7272 context: 'standalone'
7273 });
7274 // Tu
7275
7276 case 'cccccc':
7277 return match.day(string, {
7278 width: 'short',
7279 context: 'standalone'
7280 }) || match.day(string, {
7281 width: 'narrow',
7282 context: 'standalone'
7283 });
7284 // Tuesday
7285
7286 case 'cccc':
7287 default:
7288 return match.day(string, {
7289 width: 'wide',
7290 context: 'standalone'
7291 }) || match.day(string, {
7292 width: 'abbreviated',
7293 context: 'standalone'
7294 }) || match.day(string, {
7295 width: 'short',
7296 context: 'standalone'
7297 }) || match.day(string, {
7298 width: 'narrow',
7299 context: 'standalone'
7300 });
7301 }
7302 },
7303 validate: function (_date, value, _options) {
7304 return value >= 0 && value <= 6;
7305 },
7306 set: function (date, _flags, value, options) {
7307 date = setUTCDay(date, value, options);
7308 date.setUTCHours(0, 0, 0, 0);
7309 return date;
7310 },
7311 incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']
7312 },
7313 // ISO day of week
7314 i: {
7315 priority: 90,
7316 parse: function (string, token, match, _options) {
7317 var valueCallback = function (value) {
7318 if (value === 0) {
7319 return 7;
7320 }
7321
7322 return value;
7323 };
7324
7325 switch (token) {
7326 // 2
7327 case 'i':
7328 case 'ii':
7329 // 02
7330 return parseNDigits(token.length, string);
7331 // 2nd
7332
7333 case 'io':
7334 return match.ordinalNumber(string, {
7335 unit: 'day'
7336 });
7337 // Tue
7338
7339 case 'iii':
7340 return match.day(string, {
7341 width: 'abbreviated',
7342 context: 'formatting',
7343 valueCallback: valueCallback
7344 }) || match.day(string, {
7345 width: 'short',
7346 context: 'formatting',
7347 valueCallback: valueCallback
7348 }) || match.day(string, {
7349 width: 'narrow',
7350 context: 'formatting',
7351 valueCallback: valueCallback
7352 });
7353 // T
7354
7355 case 'iiiii':
7356 return match.day(string, {
7357 width: 'narrow',
7358 context: 'formatting',
7359 valueCallback: valueCallback
7360 });
7361 // Tu
7362
7363 case 'iiiiii':
7364 return match.day(string, {
7365 width: 'short',
7366 context: 'formatting',
7367 valueCallback: valueCallback
7368 }) || match.day(string, {
7369 width: 'narrow',
7370 context: 'formatting',
7371 valueCallback: valueCallback
7372 });
7373 // Tuesday
7374
7375 case 'iiii':
7376 default:
7377 return match.day(string, {
7378 width: 'wide',
7379 context: 'formatting',
7380 valueCallback: valueCallback
7381 }) || match.day(string, {
7382 width: 'abbreviated',
7383 context: 'formatting',
7384 valueCallback: valueCallback
7385 }) || match.day(string, {
7386 width: 'short',
7387 context: 'formatting',
7388 valueCallback: valueCallback
7389 }) || match.day(string, {
7390 width: 'narrow',
7391 context: 'formatting',
7392 valueCallback: valueCallback
7393 });
7394 }
7395 },
7396 validate: function (_date, value, _options) {
7397 return value >= 1 && value <= 7;
7398 },
7399 set: function (date, _flags, value, options) {
7400 date = setUTCISODay(date, value, options);
7401 date.setUTCHours(0, 0, 0, 0);
7402 return date;
7403 },
7404 incompatibleTokens: ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']
7405 },
7406 // AM or PM
7407 a: {
7408 priority: 80,
7409 parse: function (string, token, match, _options) {
7410 switch (token) {
7411 case 'a':
7412 case 'aa':
7413 case 'aaa':
7414 return match.dayPeriod(string, {
7415 width: 'abbreviated',
7416 context: 'formatting'
7417 }) || match.dayPeriod(string, {
7418 width: 'narrow',
7419 context: 'formatting'
7420 });
7421
7422 case 'aaaaa':
7423 return match.dayPeriod(string, {
7424 width: 'narrow',
7425 context: 'formatting'
7426 });
7427
7428 case 'aaaa':
7429 default:
7430 return match.dayPeriod(string, {
7431 width: 'wide',
7432 context: 'formatting'
7433 }) || match.dayPeriod(string, {
7434 width: 'abbreviated',
7435 context: 'formatting'
7436 }) || match.dayPeriod(string, {
7437 width: 'narrow',
7438 context: 'formatting'
7439 });
7440 }
7441 },
7442 set: function (date, _flags, value, _options) {
7443 date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
7444 return date;
7445 },
7446 incompatibleTokens: ['b', 'B', 'H', 'K', 'k', 't', 'T']
7447 },
7448 // AM, PM, midnight
7449 b: {
7450 priority: 80,
7451 parse: function (string, token, match, _options) {
7452 switch (token) {
7453 case 'b':
7454 case 'bb':
7455 case 'bbb':
7456 return match.dayPeriod(string, {
7457 width: 'abbreviated',
7458 context: 'formatting'
7459 }) || match.dayPeriod(string, {
7460 width: 'narrow',
7461 context: 'formatting'
7462 });
7463
7464 case 'bbbbb':
7465 return match.dayPeriod(string, {
7466 width: 'narrow',
7467 context: 'formatting'
7468 });
7469
7470 case 'bbbb':
7471 default:
7472 return match.dayPeriod(string, {
7473 width: 'wide',
7474 context: 'formatting'
7475 }) || match.dayPeriod(string, {
7476 width: 'abbreviated',
7477 context: 'formatting'
7478 }) || match.dayPeriod(string, {
7479 width: 'narrow',
7480 context: 'formatting'
7481 });
7482 }
7483 },
7484 set: function (date, _flags, value, _options) {
7485 date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
7486 return date;
7487 },
7488 incompatibleTokens: ['a', 'B', 'H', 'K', 'k', 't', 'T']
7489 },
7490 // in the morning, in the afternoon, in the evening, at night
7491 B: {
7492 priority: 80,
7493 parse: function (string, token, match, _options) {
7494 switch (token) {
7495 case 'B':
7496 case 'BB':
7497 case 'BBB':
7498 return match.dayPeriod(string, {
7499 width: 'abbreviated',
7500 context: 'formatting'
7501 }) || match.dayPeriod(string, {
7502 width: 'narrow',
7503 context: 'formatting'
7504 });
7505
7506 case 'BBBBB':
7507 return match.dayPeriod(string, {
7508 width: 'narrow',
7509 context: 'formatting'
7510 });
7511
7512 case 'BBBB':
7513 default:
7514 return match.dayPeriod(string, {
7515 width: 'wide',
7516 context: 'formatting'
7517 }) || match.dayPeriod(string, {
7518 width: 'abbreviated',
7519 context: 'formatting'
7520 }) || match.dayPeriod(string, {
7521 width: 'narrow',
7522 context: 'formatting'
7523 });
7524 }
7525 },
7526 set: function (date, _flags, value, _options) {
7527 date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
7528 return date;
7529 },
7530 incompatibleTokens: ['a', 'b', 't', 'T']
7531 },
7532 // Hour [1-12]
7533 h: {
7534 priority: 70,
7535 parse: function (string, token, match, _options) {
7536 switch (token) {
7537 case 'h':
7538 return parseNumericPattern(numericPatterns.hour12h, string);
7539
7540 case 'ho':
7541 return match.ordinalNumber(string, {
7542 unit: 'hour'
7543 });
7544
7545 default:
7546 return parseNDigits(token.length, string);
7547 }
7548 },
7549 validate: function (_date, value, _options) {
7550 return value >= 1 && value <= 12;
7551 },
7552 set: function (date, _flags, value, _options) {
7553 var isPM = date.getUTCHours() >= 12;
7554
7555 if (isPM && value < 12) {
7556 date.setUTCHours(value + 12, 0, 0, 0);
7557 } else if (!isPM && value === 12) {
7558 date.setUTCHours(0, 0, 0, 0);
7559 } else {
7560 date.setUTCHours(value, 0, 0, 0);
7561 }
7562
7563 return date;
7564 },
7565 incompatibleTokens: ['H', 'K', 'k', 't', 'T']
7566 },
7567 // Hour [0-23]
7568 H: {
7569 priority: 70,
7570 parse: function (string, token, match, _options) {
7571 switch (token) {
7572 case 'H':
7573 return parseNumericPattern(numericPatterns.hour23h, string);
7574
7575 case 'Ho':
7576 return match.ordinalNumber(string, {
7577 unit: 'hour'
7578 });
7579
7580 default:
7581 return parseNDigits(token.length, string);
7582 }
7583 },
7584 validate: function (_date, value, _options) {
7585 return value >= 0 && value <= 23;
7586 },
7587 set: function (date, _flags, value, _options) {
7588 date.setUTCHours(value, 0, 0, 0);
7589 return date;
7590 },
7591 incompatibleTokens: ['a', 'b', 'h', 'K', 'k', 't', 'T']
7592 },
7593 // Hour [0-11]
7594 K: {
7595 priority: 70,
7596 parse: function (string, token, match, _options) {
7597 switch (token) {
7598 case 'K':
7599 return parseNumericPattern(numericPatterns.hour11h, string);
7600
7601 case 'Ko':
7602 return match.ordinalNumber(string, {
7603 unit: 'hour'
7604 });
7605
7606 default:
7607 return parseNDigits(token.length, string);
7608 }
7609 },
7610 validate: function (_date, value, _options) {
7611 return value >= 0 && value <= 11;
7612 },
7613 set: function (date, _flags, value, _options) {
7614 var isPM = date.getUTCHours() >= 12;
7615
7616 if (isPM && value < 12) {
7617 date.setUTCHours(value + 12, 0, 0, 0);
7618 } else {
7619 date.setUTCHours(value, 0, 0, 0);
7620 }
7621
7622 return date;
7623 },
7624 incompatibleTokens: ['a', 'b', 'h', 'H', 'k', 't', 'T']
7625 },
7626 // Hour [1-24]
7627 k: {
7628 priority: 70,
7629 parse: function (string, token, match, _options) {
7630 switch (token) {
7631 case 'k':
7632 return parseNumericPattern(numericPatterns.hour24h, string);
7633
7634 case 'ko':
7635 return match.ordinalNumber(string, {
7636 unit: 'hour'
7637 });
7638
7639 default:
7640 return parseNDigits(token.length, string);
7641 }
7642 },
7643 validate: function (_date, value, _options) {
7644 return value >= 1 && value <= 24;
7645 },
7646 set: function (date, _flags, value, _options) {
7647 var hours = value <= 24 ? value % 24 : value;
7648 date.setUTCHours(hours, 0, 0, 0);
7649 return date;
7650 },
7651 incompatibleTokens: ['a', 'b', 'h', 'H', 'K', 't', 'T']
7652 },
7653 // Minute
7654 m: {
7655 priority: 60,
7656 parse: function (string, token, match, _options) {
7657 switch (token) {
7658 case 'm':
7659 return parseNumericPattern(numericPatterns.minute, string);
7660
7661 case 'mo':
7662 return match.ordinalNumber(string, {
7663 unit: 'minute'
7664 });
7665
7666 default:
7667 return parseNDigits(token.length, string);
7668 }
7669 },
7670 validate: function (_date, value, _options) {
7671 return value >= 0 && value <= 59;
7672 },
7673 set: function (date, _flags, value, _options) {
7674 date.setUTCMinutes(value, 0, 0);
7675 return date;
7676 },
7677 incompatibleTokens: ['t', 'T']
7678 },
7679 // Second
7680 s: {
7681 priority: 50,
7682 parse: function (string, token, match, _options) {
7683 switch (token) {
7684 case 's':
7685 return parseNumericPattern(numericPatterns.second, string);
7686
7687 case 'so':
7688 return match.ordinalNumber(string, {
7689 unit: 'second'
7690 });
7691
7692 default:
7693 return parseNDigits(token.length, string);
7694 }
7695 },
7696 validate: function (_date, value, _options) {
7697 return value >= 0 && value <= 59;
7698 },
7699 set: function (date, _flags, value, _options) {
7700 date.setUTCSeconds(value, 0);
7701 return date;
7702 },
7703 incompatibleTokens: ['t', 'T']
7704 },
7705 // Fraction of second
7706 S: {
7707 priority: 30,
7708 parse: function (string, token, _match, _options) {
7709 var valueCallback = function (value) {
7710 return Math.floor(value * Math.pow(10, -token.length + 3));
7711 };
7712
7713 return parseNDigits(token.length, string, valueCallback);
7714 },
7715 set: function (date, _flags, value, _options) {
7716 date.setUTCMilliseconds(value);
7717 return date;
7718 },
7719 incompatibleTokens: ['t', 'T']
7720 },
7721 // Timezone (ISO-8601. +00:00 is `'Z'`)
7722 X: {
7723 priority: 10,
7724 parse: function (string, token, _match, _options) {
7725 switch (token) {
7726 case 'X':
7727 return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);
7728
7729 case 'XX':
7730 return parseTimezonePattern(timezonePatterns.basic, string);
7731
7732 case 'XXXX':
7733 return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);
7734
7735 case 'XXXXX':
7736 return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);
7737
7738 case 'XXX':
7739 default:
7740 return parseTimezonePattern(timezonePatterns.extended, string);
7741 }
7742 },
7743 set: function (date, flags, value, _options) {
7744 if (flags.timestampIsSet) {
7745 return date;
7746 }
7747
7748 return new Date(date.getTime() - value);
7749 },
7750 incompatibleTokens: ['t', 'T', 'x']
7751 },
7752 // Timezone (ISO-8601)
7753 x: {
7754 priority: 10,
7755 parse: function (string, token, _match, _options) {
7756 switch (token) {
7757 case 'x':
7758 return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);
7759
7760 case 'xx':
7761 return parseTimezonePattern(timezonePatterns.basic, string);
7762
7763 case 'xxxx':
7764 return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);
7765
7766 case 'xxxxx':
7767 return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);
7768
7769 case 'xxx':
7770 default:
7771 return parseTimezonePattern(timezonePatterns.extended, string);
7772 }
7773 },
7774 set: function (date, flags, value, _options) {
7775 if (flags.timestampIsSet) {
7776 return date;
7777 }
7778
7779 return new Date(date.getTime() - value);
7780 },
7781 incompatibleTokens: ['t', 'T', 'X']
7782 },
7783 // Seconds timestamp
7784 t: {
7785 priority: 40,
7786 parse: function (string, _token, _match, _options) {
7787 return parseAnyDigitsSigned(string);
7788 },
7789 set: function (_date, _flags, value, _options) {
7790 return [new Date(value * 1000), {
7791 timestampIsSet: true
7792 }];
7793 },
7794 incompatibleTokens: '*'
7795 },
7796 // Milliseconds timestamp
7797 T: {
7798 priority: 20,
7799 parse: function (string, _token, _match, _options) {
7800 return parseAnyDigitsSigned(string);
7801 },
7802 set: function (_date, _flags, value, _options) {
7803 return [new Date(value), {
7804 timestampIsSet: true
7805 }];
7806 },
7807 incompatibleTokens: '*'
7808 }
7809 };
7810
7811 var TIMEZONE_UNIT_PRIORITY = 10; // This RegExp consists of three parts separated by `|`:
7812 // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
7813 // (one of the certain letters followed by `o`)
7814 // - (\w)\1* matches any sequences of the same letter
7815 // - '' matches two quote characters in a row
7816 // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
7817 // except a single quote symbol, which ends the sequence.
7818 // Two quote characters do not end the sequence.
7819 // If there is no matching single quote
7820 // then the sequence will continue until the end of the string.
7821 // - . matches any single character unmatched by previous parts of the RegExps
7822
7823 var formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
7824 // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
7825
7826 var longFormattingTokensRegExp$1 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
7827 var escapedStringRegExp$1 = /^'([^]*?)'?$/;
7828 var doubleQuoteRegExp$1 = /''/g;
7829 var notWhitespaceRegExp = /\S/;
7830 var unescapedLatinCharacterRegExp$1 = /[a-zA-Z]/;
7831 /**
7832 * @name parse
7833 * @category Common Helpers
7834 * @summary Parse the date.
7835 *
7836 * @description
7837 * Return the date parsed from string using the given format string.
7838 *
7839 * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
7840 * > See: https://git.io/fxCyr
7841 *
7842 * The characters in the format string wrapped between two single quotes characters (') are escaped.
7843 * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
7844 *
7845 * Format of the format string is based on Unicode Technical Standard #35:
7846 * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
7847 * with a few additions (see note 5 below the table).
7848 *
7849 * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited
7850 * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:
7851 *
7852 * ```javascript
7853 * parse('23 AM', 'HH a', new Date())
7854 * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time
7855 * ```
7856 *
7857 * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true
7858 *
7859 * Accepted format string patterns:
7860 * | Unit |Prior| Pattern | Result examples | Notes |
7861 * |---------------------------------|-----|---------|-----------------------------------|-------|
7862 * | Era | 140 | G..GGG | AD, BC | |
7863 * | | | GGGG | Anno Domini, Before Christ | 2 |
7864 * | | | GGGGG | A, B | |
7865 * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |
7866 * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |
7867 * | | | yy | 44, 01, 00, 17 | 4 |
7868 * | | | yyy | 044, 001, 123, 999 | 4 |
7869 * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |
7870 * | | | yyyyy | ... | 2,4 |
7871 * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |
7872 * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |
7873 * | | | YY | 44, 01, 00, 17 | 4,6 |
7874 * | | | YYY | 044, 001, 123, 999 | 4 |
7875 * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |
7876 * | | | YYYYY | ... | 2,4 |
7877 * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |
7878 * | | | RR | -43, 01, 00, 17 | 4,5 |
7879 * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |
7880 * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |
7881 * | | | RRRRR | ... | 2,4,5 |
7882 * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |
7883 * | | | uu | -43, 01, 99, -99 | 4 |
7884 * | | | uuu | -043, 001, 123, 999, -999 | 4 |
7885 * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |
7886 * | | | uuuuu | ... | 2,4 |
7887 * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |
7888 * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |
7889 * | | | QQ | 01, 02, 03, 04 | |
7890 * | | | QQQ | Q1, Q2, Q3, Q4 | |
7891 * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
7892 * | | | QQQQQ | 1, 2, 3, 4 | 4 |
7893 * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |
7894 * | | | qo | 1st, 2nd, 3rd, 4th | 5 |
7895 * | | | qq | 01, 02, 03, 04 | |
7896 * | | | qqq | Q1, Q2, Q3, Q4 | |
7897 * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
7898 * | | | qqqqq | 1, 2, 3, 4 | 3 |
7899 * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |
7900 * | | | Mo | 1st, 2nd, ..., 12th | 5 |
7901 * | | | MM | 01, 02, ..., 12 | |
7902 * | | | MMM | Jan, Feb, ..., Dec | |
7903 * | | | MMMM | January, February, ..., December | 2 |
7904 * | | | MMMMM | J, F, ..., D | |
7905 * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |
7906 * | | | Lo | 1st, 2nd, ..., 12th | 5 |
7907 * | | | LL | 01, 02, ..., 12 | |
7908 * | | | LLL | Jan, Feb, ..., Dec | |
7909 * | | | LLLL | January, February, ..., December | 2 |
7910 * | | | LLLLL | J, F, ..., D | |
7911 * | Local week of year | 100 | w | 1, 2, ..., 53 | |
7912 * | | | wo | 1st, 2nd, ..., 53th | 5 |
7913 * | | | ww | 01, 02, ..., 53 | |
7914 * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |
7915 * | | | Io | 1st, 2nd, ..., 53th | 5 |
7916 * | | | II | 01, 02, ..., 53 | 5 |
7917 * | Day of month | 90 | d | 1, 2, ..., 31 | |
7918 * | | | do | 1st, 2nd, ..., 31st | 5 |
7919 * | | | dd | 01, 02, ..., 31 | |
7920 * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |
7921 * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |
7922 * | | | DD | 01, 02, ..., 365, 366 | 7 |
7923 * | | | DDD | 001, 002, ..., 365, 366 | |
7924 * | | | DDDD | ... | 2 |
7925 * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |
7926 * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
7927 * | | | EEEEE | M, T, W, T, F, S, S | |
7928 * | | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
7929 * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |
7930 * | | | io | 1st, 2nd, ..., 7th | 5 |
7931 * | | | ii | 01, 02, ..., 07 | 5 |
7932 * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |
7933 * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |
7934 * | | | iiiii | M, T, W, T, F, S, S | 5 |
7935 * | | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 5 |
7936 * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |
7937 * | | | eo | 2nd, 3rd, ..., 1st | 5 |
7938 * | | | ee | 02, 03, ..., 01 | |
7939 * | | | eee | Mon, Tue, Wed, ..., Sun | |
7940 * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |
7941 * | | | eeeee | M, T, W, T, F, S, S | |
7942 * | | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
7943 * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |
7944 * | | | co | 2nd, 3rd, ..., 1st | 5 |
7945 * | | | cc | 02, 03, ..., 01 | |
7946 * | | | ccc | Mon, Tue, Wed, ..., Sun | |
7947 * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |
7948 * | | | ccccc | M, T, W, T, F, S, S | |
7949 * | | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
7950 * | AM, PM | 80 | a..aaa | AM, PM | |
7951 * | | | aaaa | a.m., p.m. | 2 |
7952 * | | | aaaaa | a, p | |
7953 * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |
7954 * | | | bbbb | a.m., p.m., noon, midnight | 2 |
7955 * | | | bbbbb | a, p, n, mi | |
7956 * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |
7957 * | | | BBBB | at night, in the morning, ... | 2 |
7958 * | | | BBBBB | at night, in the morning, ... | |
7959 * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |
7960 * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |
7961 * | | | hh | 01, 02, ..., 11, 12 | |
7962 * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |
7963 * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |
7964 * | | | HH | 00, 01, 02, ..., 23 | |
7965 * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |
7966 * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |
7967 * | | | KK | 01, 02, ..., 11, 00 | |
7968 * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |
7969 * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |
7970 * | | | kk | 24, 01, 02, ..., 23 | |
7971 * | Minute | 60 | m | 0, 1, ..., 59 | |
7972 * | | | mo | 0th, 1st, ..., 59th | 5 |
7973 * | | | mm | 00, 01, ..., 59 | |
7974 * | Second | 50 | s | 0, 1, ..., 59 | |
7975 * | | | so | 0th, 1st, ..., 59th | 5 |
7976 * | | | ss | 00, 01, ..., 59 | |
7977 * | Seconds timestamp | 40 | t | 512969520 | |
7978 * | | | tt | ... | 2 |
7979 * | Fraction of second | 30 | S | 0, 1, ..., 9 | |
7980 * | | | SS | 00, 01, ..., 99 | |
7981 * | | | SSS | 000, 0001, ..., 999 | |
7982 * | | | SSSS | ... | 2 |
7983 * | Milliseconds timestamp | 20 | T | 512969520900 | |
7984 * | | | TT | ... | 2 |
7985 * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |
7986 * | | | XX | -0800, +0530, Z | |
7987 * | | | XXX | -08:00, +05:30, Z | |
7988 * | | | XXXX | -0800, +0530, Z, +123456 | 2 |
7989 * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
7990 * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |
7991 * | | | xx | -0800, +0530, +0000 | |
7992 * | | | xxx | -08:00, +05:30, +00:00 | 2 |
7993 * | | | xxxx | -0800, +0530, +0000, +123456 | |
7994 * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
7995 * | Long localized date | NA | P | 05/29/1453 | 5,8 |
7996 * | | | PP | May 29, 1453 | |
7997 * | | | PPP | May 29th, 1453 | |
7998 * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |
7999 * | Long localized time | NA | p | 12:00 AM | 5,8 |
8000 * | | | pp | 12:00:00 AM | |
8001 * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |
8002 * | | | PPpp | May 29, 1453, 12:00:00 AM | |
8003 * | | | PPPpp | May 29th, 1453 at ... | |
8004 * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |
8005 * Notes:
8006 * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
8007 * are the same as "stand-alone" units, but are different in some languages.
8008 * "Formatting" units are declined according to the rules of the language
8009 * in the context of a date. "Stand-alone" units are always nominative singular.
8010 * In `format` function, they will produce different result:
8011 *
8012 * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
8013 *
8014 * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
8015 *
8016 * `parse` will try to match both formatting and stand-alone units interchangably.
8017 *
8018 * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
8019 * the single quote characters (see below).
8020 * If the sequence is longer than listed in table:
8021 * - for numerical units (`yyyyyyyy`) `parse` will try to match a number
8022 * as wide as the sequence
8023 * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.
8024 * These variations are marked with "2" in the last column of the table.
8025 *
8026 * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
8027 * These tokens represent the shortest form of the quarter.
8028 *
8029 * 4. The main difference between `y` and `u` patterns are B.C. years:
8030 *
8031 * | Year | `y` | `u` |
8032 * |------|-----|-----|
8033 * | AC 1 | 1 | 1 |
8034 * | BC 1 | 1 | 0 |
8035 * | BC 2 | 2 | -1 |
8036 *
8037 * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:
8038 *
8039 * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`
8040 *
8041 * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`
8042 *
8043 * while `uu` will just assign the year as is:
8044 *
8045 * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`
8046 *
8047 * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`
8048 *
8049 * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
8050 * except local week-numbering years are dependent on `options.weekStartsOn`
8051 * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}
8052 * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).
8053 *
8054 * 5. These patterns are not in the Unicode Technical Standard #35:
8055 * - `i`: ISO day of week
8056 * - `I`: ISO week of year
8057 * - `R`: ISO week-numbering year
8058 * - `o`: ordinal number modifier
8059 * - `P`: long localized date
8060 * - `p`: long localized time
8061 *
8062 * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
8063 * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
8064 *
8065 * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
8066 * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
8067 *
8068 * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
8069 * on the given locale.
8070 *
8071 * using `en-US` locale: `P` => `MM/dd/yyyy`
8072 * using `en-US` locale: `p` => `hh:mm a`
8073 * using `pt-BR` locale: `P` => `dd/MM/yyyy`
8074 * using `pt-BR` locale: `p` => `HH:mm`
8075 *
8076 * Values will be assigned to the date in the descending order of its unit's priority.
8077 * Units of an equal priority overwrite each other in the order of appearance.
8078 *
8079 * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
8080 * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.
8081 *
8082 * `referenceDate` must be passed for correct work of the function.
8083 * If you're not sure which `referenceDate` to supply, create a new instance of Date:
8084 * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`
8085 * In this case parsing will be done in the context of the current date.
8086 * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,
8087 * then `Invalid Date` will be returned.
8088 *
8089 * The result may vary by locale.
8090 *
8091 * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.
8092 *
8093 * If parsing failed, `Invalid Date` will be returned.
8094 * Invalid Date is a Date, whose time value is NaN.
8095 * Time value of Date: http://es5.github.io/#x15.9.1.1
8096 *
8097 * ### v2.0.0 breaking changes:
8098 *
8099 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
8100 *
8101 * - Old `parse` was renamed to `toDate`.
8102 * Now `parse` is a new function which parses a string using a provided format.
8103 *
8104 * ```javascript
8105 * // Before v2.0.0
8106 * parse('2016-01-01')
8107 *
8108 * // v2.0.0 onward (toDate no longer accepts a string)
8109 * toDate(1392098430000) // Unix to timestamp
8110 * toDate(new Date(2014, 1, 11, 11, 30, 30)) // Cloning the date
8111 * parse('2016-01-01', 'yyyy-MM-dd', new Date())
8112 * ```
8113 *
8114 * @param {String} dateString - the string to parse
8115 * @param {String} formatString - the string of tokens
8116 * @param {Date|Number} referenceDate - defines values missing from the parsed dateString
8117 * @param {Object} [options] - an object with options.
8118 * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
8119 * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
8120 * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year
8121 * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
8122 * see: https://git.io/fxCyr
8123 * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
8124 * see: https://git.io/fxCyr
8125 * @returns {Date} the parsed date
8126 * @throws {TypeError} 3 arguments required
8127 * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
8128 * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
8129 * @throws {RangeError} `options.locale` must contain `match` property
8130 * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
8131 * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
8132 * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
8133 * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
8134 * @throws {RangeError} format string contains an unescaped latin alphabet character
8135 *
8136 * @example
8137 * // Parse 11 February 2014 from middle-endian format:
8138 * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
8139 * //=> Tue Feb 11 2014 00:00:00
8140 *
8141 * @example
8142 * // Parse 28th of February in Esperanto locale in the context of 2010 year:
8143 * import eo from 'date-fns/locale/eo'
8144 * var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
8145 * locale: eo
8146 * })
8147 * //=> Sun Feb 28 2010 00:00:00
8148 */
8149
8150 function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOptions) {
8151 requiredArgs(3, arguments);
8152 var dateString = String(dirtyDateString);
8153 var formatString = String(dirtyFormatString);
8154 var options = dirtyOptions || {};
8155 var locale$1 = options.locale || locale;
8156
8157 if (!locale$1.match) {
8158 throw new RangeError('locale must contain match property');
8159 }
8160
8161 var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
8162 var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
8163 var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
8164
8165 if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
8166 throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
8167 }
8168
8169 var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
8170 var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
8171 var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
8172
8173 if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
8174 throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
8175 }
8176
8177 if (formatString === '') {
8178 if (dateString === '') {
8179 return toDate(dirtyReferenceDate);
8180 } else {
8181 return new Date(NaN);
8182 }
8183 }
8184
8185 var subFnOptions = {
8186 firstWeekContainsDate: firstWeekContainsDate,
8187 weekStartsOn: weekStartsOn,
8188 locale: locale$1 // If timezone isn't specified, it will be set to the system timezone
8189
8190 };
8191 var setters = [{
8192 priority: TIMEZONE_UNIT_PRIORITY,
8193 subPriority: -1,
8194 set: dateToSystemTimezone,
8195 index: 0
8196 }];
8197 var i;
8198 var tokens = formatString.match(longFormattingTokensRegExp$1).map(function (substring) {
8199 var firstCharacter = substring[0];
8200
8201 if (firstCharacter === 'p' || firstCharacter === 'P') {
8202 var longFormatter = longFormatters[firstCharacter];
8203 return longFormatter(substring, locale$1.formatLong, subFnOptions);
8204 }
8205
8206 return substring;
8207 }).join('').match(formattingTokensRegExp$1);
8208 var usedTokens = [];
8209
8210 for (i = 0; i < tokens.length; i++) {
8211 var token = tokens[i];
8212
8213 if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) {
8214 throwProtectedError(token, formatString, dirtyDateString);
8215 }
8216
8217 if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
8218 throwProtectedError(token, formatString, dirtyDateString);
8219 }
8220
8221 var firstCharacter = token[0];
8222 var parser = parsers[firstCharacter];
8223
8224 if (parser) {
8225 var incompatibleTokens = parser.incompatibleTokens;
8226
8227 if (Array.isArray(incompatibleTokens)) {
8228 var incompatibleToken = void 0;
8229
8230 for (var _i = 0; _i < usedTokens.length; _i++) {
8231 var usedToken = usedTokens[_i].token;
8232
8233 if (incompatibleTokens.indexOf(usedToken) !== -1 || usedToken === firstCharacter) {
8234 incompatibleToken = usedTokens[_i];
8235 break;
8236 }
8237 }
8238
8239 if (incompatibleToken) {
8240 throw new RangeError("The format string mustn't contain `".concat(incompatibleToken.fullToken, "` and `").concat(token, "` at the same time"));
8241 }
8242 } else if (parser.incompatibleTokens === '*' && usedTokens.length) {
8243 throw new RangeError("The format string mustn't contain `".concat(token, "` and any other token at the same time"));
8244 }
8245
8246 usedTokens.push({
8247 token: firstCharacter,
8248 fullToken: token
8249 });
8250 var parseResult = parser.parse(dateString, token, locale$1.match, subFnOptions);
8251
8252 if (!parseResult) {
8253 return new Date(NaN);
8254 }
8255
8256 setters.push({
8257 priority: parser.priority,
8258 subPriority: parser.subPriority || 0,
8259 set: parser.set,
8260 validate: parser.validate,
8261 value: parseResult.value,
8262 index: setters.length
8263 });
8264 dateString = parseResult.rest;
8265 } else {
8266 if (firstCharacter.match(unescapedLatinCharacterRegExp$1)) {
8267 throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
8268 } // Replace two single quote characters with one single quote character
8269
8270
8271 if (token === "''") {
8272 token = "'";
8273 } else if (firstCharacter === "'") {
8274 token = cleanEscapedString$1(token);
8275 } // Cut token from string, or, if string doesn't match the token, return Invalid Date
8276
8277
8278 if (dateString.indexOf(token) === 0) {
8279 dateString = dateString.slice(token.length);
8280 } else {
8281 return new Date(NaN);
8282 }
8283 }
8284 } // Check if the remaining input contains something other than whitespace
8285
8286
8287 if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {
8288 return new Date(NaN);
8289 }
8290
8291 var uniquePrioritySetters = setters.map(function (setter) {
8292 return setter.priority;
8293 }).sort(function (a, b) {
8294 return b - a;
8295 }).filter(function (priority, index, array) {
8296 return array.indexOf(priority) === index;
8297 }).map(function (priority) {
8298 return setters.filter(function (setter) {
8299 return setter.priority === priority;
8300 }).sort(function (a, b) {
8301 return b.subPriority - a.subPriority;
8302 });
8303 }).map(function (setterArray) {
8304 return setterArray[0];
8305 });
8306 var date = toDate(dirtyReferenceDate);
8307
8308 if (isNaN(date)) {
8309 return new Date(NaN);
8310 } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
8311 // This ensures that when UTC functions will be implemented, locales will be compatible with them.
8312 // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37
8313
8314
8315 var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));
8316 var flags = {};
8317
8318 for (i = 0; i < uniquePrioritySetters.length; i++) {
8319 var setter = uniquePrioritySetters[i];
8320
8321 if (setter.validate && !setter.validate(utcDate, setter.value, subFnOptions)) {
8322 return new Date(NaN);
8323 }
8324
8325 var result = setter.set(utcDate, flags, setter.value, subFnOptions); // Result is tuple (date, flags)
8326
8327 if (result[0]) {
8328 utcDate = result[0];
8329 assign(flags, result[1]); // Result is date
8330 } else {
8331 utcDate = result;
8332 }
8333 }
8334
8335 return utcDate;
8336 }
8337
8338 function dateToSystemTimezone(date, flags) {
8339 if (flags.timestampIsSet) {
8340 return date;
8341 }
8342
8343 var convertedDate = new Date(0);
8344 convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
8345 convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
8346 return convertedDate;
8347 }
8348
8349 function cleanEscapedString$1(input) {
8350 return input.match(escapedStringRegExp$1)[1].replace(doubleQuoteRegExp$1, "'");
8351 }
8352
8353 var date = Object.assign({}, defaultType);
8354 date.isRight = true;
8355
8356 date.compare = function (x, y, column) {
8357 function cook(d) {
8358 if (column && column.dateInputFormat) {
8359 return parse("".concat(d), "".concat(column.dateInputFormat), new Date());
8360 }
8361
8362 return d;
8363 }
8364
8365 x = cook(x);
8366 y = cook(y);
8367
8368 if (!isValid(x)) {
8369 return -1;
8370 }
8371
8372 if (!isValid(y)) {
8373 return 1;
8374 }
8375
8376 return compareAsc(x, y);
8377 };
8378
8379 date.format = function (v, column) {
8380 if (v === undefined || v === null) return ''; // convert to date
8381
8382 var date = parse(v, column.dateInputFormat, new Date());
8383
8384 if (isValid(date)) {
8385 return format(date, column.dateOutputFormat);
8386 }
8387
8388 console.error("Not a valid date: \"".concat(v, "\""));
8389 return null;
8390 };
8391
8392 var date$1 = /*#__PURE__*/Object.freeze({
8393 __proto__: null,
8394 'default': date
8395 });
8396
8397 var number = Object.assign({}, defaultType);
8398 number.isRight = true;
8399
8400 number.filterPredicate = function (rowval, filter) {
8401 return number.compare(rowval, filter) === 0;
8402 };
8403
8404 number.compare = function (x, y) {
8405 function cook(d) {
8406 // if d is null or undefined we give it the smallest
8407 // possible value
8408 if (d === undefined || d === null) return -Infinity;
8409 return d.indexOf('.') >= 0 ? parseFloat(d) : parseInt(d, 10);
8410 }
8411
8412 x = typeof x === 'number' ? x : cook(x);
8413 y = typeof y === 'number' ? y : cook(y);
8414 if (x < y) return -1;
8415 if (x > y) return 1;
8416 return 0;
8417 };
8418
8419 var number$1 = /*#__PURE__*/Object.freeze({
8420 __proto__: null,
8421 'default': number
8422 });
8423
8424 var decimal = Object.assign({}, number);
8425
8426 decimal.format = function (v) {
8427 if (v === undefined || v === null) return '';
8428 return parseFloat(Math.round(v * 100) / 100).toFixed(2);
8429 };
8430
8431 var decimal$1 = /*#__PURE__*/Object.freeze({
8432 __proto__: null,
8433 'default': decimal
8434 });
8435
8436 var percentage = Object.assign({}, number);
8437
8438 percentage.format = function (v) {
8439 if (v === undefined || v === null) return '';
8440 return "".concat(parseFloat(v * 100).toFixed(2), "%");
8441 };
8442
8443 var percentage$1 = /*#__PURE__*/Object.freeze({
8444 __proto__: null,
8445 'default': percentage
8446 });
8447
8448 var _boolean = Object.assign({}, defaultType);
8449
8450 _boolean.isRight = true;
8451
8452 _boolean.filterPredicate = function (rowval, filter) {
8453 return _boolean.compare(rowval, filter) === 0;
8454 };
8455
8456 _boolean.compare = function (x, y) {
8457 function cook(d) {
8458 if (typeof d === 'boolean') return d ? 1 : 0;
8459 if (typeof d === 'string') return d === 'true' ? 1 : 0;
8460 return -Infinity;
8461 }
8462
8463 x = cook(x);
8464 y = cook(y);
8465 if (x < y) return -1;
8466 if (x > y) return 1;
8467 return 0;
8468 };
8469
8470 var _boolean$1 = /*#__PURE__*/Object.freeze({
8471 __proto__: null,
8472 'default': _boolean
8473 });
8474
8475 var index = {
8476 date: date$1,
8477 decimal: decimal$1,
8478 number: number$1,
8479 percentage: percentage$1,
8480 "boolean": _boolean$1
8481 };
8482
8483 var dataTypes = {};
8484 var coreDataTypes = index;
8485 Object.keys(coreDataTypes).forEach(function (key) {
8486 var compName = key.replace(/^\.\//, '').replace(/\.js/, '');
8487 dataTypes[compName] = coreDataTypes[key]["default"];
8488 });
8489 var script$6 = {
8490 name: 'vue-good-table',
8491 props: {
8492 isLoading: {
8493 "default": null,
8494 type: Boolean
8495 },
8496 maxHeight: {
8497 "default": null,
8498 type: String
8499 },
8500 fixedHeader: Boolean,
8501 theme: {
8502 "default": ''
8503 },
8504 mode: {
8505 "default": 'local'
8506 },
8507 // could be remote
8508 totalRows: {},
8509 // required if mode = 'remote'
8510 styleClass: {
8511 "default": 'vgt-table bordered'
8512 },
8513 columns: {},
8514 rows: {},
8515 lineNumbers: Boolean,
8516 responsive: {
8517 "default": true,
8518 type: Boolean
8519 },
8520 rtl: Boolean,
8521 rowStyleClass: {
8522 "default": null,
8523 type: [Function, String]
8524 },
8525 compactMode: Boolean,
8526 groupOptions: {
8527 "default": function _default() {
8528 return {
8529 enabled: false,
8530 collapsable: false,
8531 rowKey: null
8532 };
8533 }
8534 },
8535 selectOptions: {
8536 "default": function _default() {
8537 return {
8538 enabled: false,
8539 selectionInfoClass: '',
8540 selectionText: 'rows selected',
8541 clearSelectionText: 'clear',
8542 disableSelectInfo: false,
8543 selectAllByGroup: false
8544 };
8545 }
8546 },
8547 // sort
8548 sortOptions: {
8549 "default": function _default() {
8550 return {
8551 enabled: true,
8552 initialSortBy: {}
8553 };
8554 }
8555 },
8556 // pagination
8557 paginationOptions: {
8558 "default": function _default() {
8559 var _ref;
8560
8561 return _ref = {
8562 enabled: false,
8563 position: 'bottom',
8564 perPage: 10,
8565 perPageDropdown: null,
8566 perPageDropdownEnabled: true
8567 }, _defineProperty(_ref, "position", 'bottom'), _defineProperty(_ref, "dropdownAllowAll", true), _defineProperty(_ref, "mode", 'records'), _defineProperty(_ref, "infoFn", null), _ref;
8568 }
8569 },
8570 searchOptions: {
8571 "default": function _default() {
8572 return {
8573 enabled: false,
8574 trigger: null,
8575 externalQuery: null,
8576 searchFn: null,
8577 placeholder: 'Search Table'
8578 };
8579 }
8580 }
8581 },
8582 data: function data() {
8583 return {
8584 // loading state for remote mode
8585 tableLoading: false,
8586 // text options
8587 nextText: 'Next',
8588 prevText: 'Previous',
8589 rowsPerPageText: 'Rows per page',
8590 ofText: 'of',
8591 allText: 'All',
8592 pageText: 'page',
8593 // internal select options
8594 selectable: false,
8595 selectOnCheckboxOnly: false,
8596 selectAllByPage: true,
8597 disableSelectInfo: false,
8598 selectionInfoClass: '',
8599 selectionText: 'rows selected',
8600 clearSelectionText: 'clear',
8601 // keys for rows that are currently expanded
8602 maintainExpanded: true,
8603 expandedRowKeys: new Set(),
8604 // internal sort options
8605 sortable: true,
8606 defaultSortBy: null,
8607 // internal search options
8608 searchEnabled: false,
8609 searchTrigger: null,
8610 externalSearchQuery: null,
8611 searchFn: null,
8612 searchPlaceholder: 'Search Table',
8613 searchSkipDiacritics: false,
8614 // internal pagination options
8615 perPage: null,
8616 paginate: false,
8617 paginateOnTop: false,
8618 paginateOnBottom: true,
8619 customRowsPerPageDropdown: [],
8620 paginateDropdownAllowAll: true,
8621 paginationMode: 'records',
8622 paginationInfoFn: null,
8623 currentPage: 1,
8624 currentPerPage: 10,
8625 sorts: [],
8626 globalSearchTerm: '',
8627 filteredRows: [],
8628 columnFilters: {},
8629 forceSearch: false,
8630 sortChanged: false,
8631 dataTypes: dataTypes || {}
8632 };
8633 },
8634 watch: {
8635 rows: {
8636 handler: function handler() {
8637 this.$emit('update:isLoading', false);
8638 this.filterRows(this.columnFilters, false);
8639 },
8640 deep: true,
8641 immediate: true
8642 },
8643 selectOptions: {
8644 handler: function handler() {
8645 this.initializeSelect();
8646 },
8647 deep: true,
8648 immediate: true
8649 },
8650 paginationOptions: {
8651 handler: function handler(newValue, oldValue) {
8652 if (!lodash_isequal(newValue, oldValue)) {
8653 this.initializePagination();
8654 }
8655 },
8656 deep: true,
8657 immediate: true
8658 },
8659 searchOptions: {
8660 handler: function handler() {
8661 if (this.searchOptions.externalQuery !== undefined && this.searchOptions.externalQuery !== this.searchTerm) {
8662 //* we need to set searchTerm to externalQuery first.
8663 this.externalSearchQuery = this.searchOptions.externalQuery;
8664 this.handleSearch();
8665 }
8666
8667 this.initializeSearch();
8668 },
8669 deep: true,
8670 immediate: true
8671 },
8672 sortOptions: {
8673 handler: function handler(newValue, oldValue) {
8674 if (!lodash_isequal(newValue, oldValue)) {
8675 this.initializeSort();
8676 }
8677 },
8678 deep: true
8679 },
8680 selectedRows: function selectedRows(newValue, oldValue) {
8681 if (!lodash_isequal(newValue, oldValue)) {
8682 this.$emit('on-selected-rows-change', {
8683 selectedRows: this.selectedRows
8684 });
8685 }
8686 }
8687 },
8688 computed: {
8689 tableStyles: function tableStyles() {
8690 if (this.compactMode) return this.tableStyleClasses + 'vgt-compact';else return this.tableStyleClasses;
8691 },
8692 hasFooterSlot: function hasFooterSlot() {
8693 return !!this.$slots['table-actions-bottom'];
8694 },
8695 wrapperStyles: function wrapperStyles() {
8696 return {
8697 overflow: 'scroll-y',
8698 maxHeight: this.maxHeight ? this.maxHeight : 'auto'
8699 };
8700 },
8701 rowKeyField: function rowKeyField() {
8702 return this.groupOptions.rowKey || 'vgt_header_id';
8703 },
8704 hasHeaderRowTemplate: function hasHeaderRowTemplate() {
8705 return !!this.$slots['table-header-row'] || !!this.$scopedSlots['table-header-row'];
8706 },
8707 showEmptySlot: function showEmptySlot() {
8708 if (!this.paginated.length) return true;
8709
8710 if (this.paginated[0].label === 'no groups' && !this.paginated[0].children.length) {
8711 return true;
8712 }
8713
8714 return false;
8715 },
8716 allSelected: function allSelected() {
8717 return this.selectedRowCount > 0 && (this.selectAllByPage && this.selectedPageRowsCount === this.totalPageRowCount || !this.selectAllByPage && this.selectedRowCount === this.totalRowCount);
8718 },
8719 allSelectedIndeterminate: function allSelectedIndeterminate() {
8720 return !this.allSelected && (this.selectAllByPage && this.selectedPageRowsCount > 0 || !this.selectAllByPage && this.selectedRowCount > 0);
8721 },
8722 selectionInfo: function selectionInfo() {
8723 return "".concat(this.selectedRowCount, " ").concat(this.selectionText);
8724 },
8725 selectedRowCount: function selectedRowCount() {
8726 return this.selectedRows.length;
8727 },
8728 selectedPageRowsCount: function selectedPageRowsCount() {
8729 return this.selectedPageRows.length;
8730 },
8731 selectedPageRows: function selectedPageRows() {
8732 var selectedRows = [];
8733 this.paginated.forEach(function (headerRow) {
8734 headerRow.children.forEach(function (row) {
8735 if (row.vgtSelected) {
8736 selectedRows.push(row);
8737 }
8738 });
8739 });
8740 return selectedRows;
8741 },
8742 selectedRows: function selectedRows() {
8743 var selectedRows = [];
8744 this.processedRows.forEach(function (headerRow) {
8745 headerRow.children.forEach(function (row) {
8746 if (row.vgtSelected) {
8747 selectedRows.push(row);
8748 }
8749 });
8750 });
8751 return selectedRows.sort(function (r1, r2) {
8752 return r1.originalIndex - r2.originalIndex;
8753 });
8754 },
8755 fullColspan: function fullColspan() {
8756 var fullColspan = 0;
8757
8758 for (var i = 0; i < this.columns.length; i += 1) {
8759 if (!this.columns[i].hidden) {
8760 fullColspan += 1;
8761 }
8762 }
8763
8764 if (this.lineNumbers) fullColspan++;
8765 if (this.selectable) fullColspan++;
8766 return fullColspan;
8767 },
8768 groupHeaderOnTop: function groupHeaderOnTop() {
8769 if (this.groupOptions && this.groupOptions.enabled && this.groupOptions.headerPosition && this.groupOptions.headerPosition === 'bottom') {
8770 return false;
8771 }
8772
8773 if (this.groupOptions && this.groupOptions.enabled) return true; // will only get here if groupOptions is false
8774
8775 return false;
8776 },
8777 groupHeaderOnBottom: function groupHeaderOnBottom() {
8778 if (this.groupOptions && this.groupOptions.enabled && this.groupOptions.headerPosition && this.groupOptions.headerPosition === 'bottom') {
8779 return true;
8780 }
8781
8782 return false;
8783 },
8784 totalRowCount: function totalRowCount() {
8785 var total = this.processedRows.reduce(function (total, headerRow) {
8786 var childrenCount = headerRow.children ? headerRow.children.length : 0;
8787 return total + childrenCount;
8788 }, 0);
8789 return total;
8790 },
8791 totalPageRowCount: function totalPageRowCount() {
8792 var total = this.paginated.reduce(function (total, headerRow) {
8793 var childrenCount = headerRow.children ? headerRow.children.length : 0;
8794 return total + childrenCount;
8795 }, 0);
8796 return total;
8797 },
8798 wrapStyleClasses: function wrapStyleClasses() {
8799 var classes = 'vgt-wrap';
8800 if (this.rtl) classes += ' rtl';
8801 classes += " ".concat(this.theme);
8802 return classes;
8803 },
8804 tableStyleClasses: function tableStyleClasses() {
8805 var classes = this.styleClass;
8806 classes += " ".concat(this.theme);
8807 return classes;
8808 },
8809 searchTerm: function searchTerm() {
8810 return this.externalSearchQuery != null ? this.externalSearchQuery : this.globalSearchTerm;
8811 },
8812 //
8813 globalSearchAllowed: function globalSearchAllowed() {
8814 if (this.searchEnabled && !!this.globalSearchTerm && this.searchTrigger !== 'enter') {
8815 return true;
8816 }
8817
8818 if (this.externalSearchQuery != null && this.searchTrigger !== 'enter') {
8819 return true;
8820 }
8821
8822 if (this.forceSearch) {
8823 this.forceSearch = false;
8824 return true;
8825 }
8826
8827 return false;
8828 },
8829 // this is done everytime sortColumn
8830 // or sort type changes
8831 //----------------------------------------
8832 processedRows: function processedRows() {
8833 var _this = this;
8834
8835 // we only process rows when mode is local
8836 var computedRows = this.filteredRows;
8837
8838 if (this.mode === 'remote') {
8839 return computedRows;
8840 } // take care of the global filter here also
8841
8842
8843 if (this.globalSearchAllowed) {
8844 // here also we need to de-construct and then
8845 // re-construct the rows.
8846 var allRows = [];
8847 this.filteredRows.forEach(function (headerRow) {
8848 allRows.push.apply(allRows, _toConsumableArray(headerRow.children));
8849 });
8850 var filteredRows = [];
8851 allRows.forEach(function (row) {
8852 _this.columns.forEach(function (col) {
8853 // if col does not have search disabled,
8854 if (!col.globalSearchDisabled) {
8855 // if a search function is provided,
8856 // use that for searching, otherwise,
8857 // use the default search behavior
8858 if (_this.searchFn) {
8859 var foundMatch = _this.searchFn(row, col, _this.collectFormatted(row, col), _this.searchTerm);
8860
8861 if (foundMatch) {
8862 filteredRows.push(row);
8863 return false; // break the loop
8864 }
8865 } else {
8866 // comparison
8867 var matched = defaultType.filterPredicate(_this.collectFormatted(row, col), _this.searchTerm, _this.searchSkipDiacritics);
8868
8869 if (matched) {
8870 filteredRows.push(row);
8871 return false; // break loop
8872 }
8873 }
8874 }
8875 });
8876 }); // this is where we emit on search
8877
8878 this.$emit('on-search', {
8879 searchTerm: this.searchTerm,
8880 rowCount: filteredRows.length
8881 }); // here we need to reconstruct the nested structure
8882 // of rows
8883
8884 computedRows = [];
8885 this.filteredRows.forEach(function (headerRow) {
8886 var i = headerRow.vgt_header_id;
8887 var children = filteredRows.filter(function (r) {
8888 return r.vgt_id === i;
8889 });
8890
8891 if (children.length) {
8892 var newHeaderRow = JSON.parse(JSON.stringify(headerRow));
8893 newHeaderRow.children = children;
8894 computedRows.push(newHeaderRow);
8895 }
8896 });
8897 }
8898
8899 if (this.sorts.length) {
8900 //* we need to sort
8901 computedRows.forEach(function (cRows) {
8902 cRows.children.sort(function (xRow, yRow) {
8903 //* we need to get column for each sort
8904 var sortValue;
8905
8906 for (var i = 0; i < _this.sorts.length; i += 1) {
8907 var column = _this.getColumnForField(_this.sorts[i].field);
8908
8909 var xvalue = _this.collect(xRow, _this.sorts[i].field);
8910
8911 var yvalue = _this.collect(yRow, _this.sorts[i].field); //* if a custom sort function has been provided we use that
8912
8913
8914 var sortFn = column.sortFn;
8915
8916 if (sortFn && typeof sortFn === 'function') {
8917 sortValue = sortValue || sortFn(xvalue, yvalue, column, xRow, yRow) * (_this.sorts[i].type === 'desc' ? -1 : 1);
8918 } else {
8919 //* else we use our own sort
8920 sortValue = sortValue || column.typeDef.compare(xvalue, yvalue, column) * (_this.sorts[i].type === 'desc' ? -1 : 1);
8921 }
8922 }
8923
8924 return sortValue;
8925 });
8926 });
8927 } // if the filtering is event based, we need to maintain filter
8928 // rows
8929
8930
8931 if (this.searchTrigger === 'enter') {
8932 this.filteredRows = computedRows;
8933 }
8934
8935 return computedRows;
8936 },
8937 paginated: function paginated() {
8938 var _this2 = this;
8939
8940 if (!this.processedRows.length) return [];
8941
8942 if (this.mode === 'remote') {
8943 return this.processedRows;
8944 } //* flatten the rows for paging.
8945
8946
8947 var paginatedRows = [];
8948 this.processedRows.forEach(function (childRows) {
8949 var _paginatedRows;
8950
8951 //* only add headers when group options are enabled.
8952 if (_this2.groupOptions.enabled) {
8953 paginatedRows.push(childRows);
8954 }
8955
8956 (_paginatedRows = paginatedRows).push.apply(_paginatedRows, _toConsumableArray(childRows.children));
8957 });
8958
8959 if (this.paginate) {
8960 var pageStart = (this.currentPage - 1) * this.currentPerPage; // in case of filtering we might be on a page that is
8961 // not relevant anymore
8962 // also, if setting to all, current page will not be valid
8963
8964 if (pageStart >= paginatedRows.length || this.currentPerPage === -1) {
8965 this.currentPage = 1;
8966 pageStart = 0;
8967 } // calculate page end now
8968
8969
8970 var pageEnd = paginatedRows.length + 1; // if the setting is set to 'all'
8971
8972 if (this.currentPerPage !== -1) {
8973 pageEnd = this.currentPage * this.currentPerPage;
8974 }
8975
8976 paginatedRows = paginatedRows.slice(pageStart, pageEnd);
8977 } // reconstruct paginated rows here
8978
8979
8980 var reconstructedRows = [];
8981 paginatedRows.forEach(function (flatRow) {
8982 //* header row?
8983 if (flatRow.vgt_header_id !== undefined) {
8984 _this2.handleExpanded(flatRow);
8985
8986 var newHeaderRow = JSON.parse(JSON.stringify(flatRow));
8987 newHeaderRow.children = [];
8988 reconstructedRows.push(newHeaderRow);
8989 } else {
8990 //* child row
8991 var hRow = reconstructedRows.find(function (r) {
8992 return r.vgt_header_id === flatRow.vgt_id;
8993 });
8994
8995 if (!hRow) {
8996 hRow = _this2.processedRows.find(function (r) {
8997 return r.vgt_header_id === flatRow.vgt_id;
8998 });
8999
9000 if (hRow) {
9001 hRow = JSON.parse(JSON.stringify(hRow));
9002 hRow.children = [];
9003 reconstructedRows.push(hRow);
9004 }
9005 }
9006
9007 hRow.children.push(flatRow);
9008 }
9009 });
9010 return reconstructedRows;
9011 },
9012 originalRows: function originalRows() {
9013 var rows = JSON.parse(JSON.stringify(this.rows));
9014 var nestedRows = [];
9015
9016 if (!this.groupOptions.enabled) {
9017 nestedRows = this.handleGrouped([{
9018 label: 'no groups',
9019 children: rows
9020 }]);
9021 } else {
9022 nestedRows = this.handleGrouped(rows);
9023 } // we need to preserve the original index of
9024 // rows so lets do that
9025
9026
9027 var index = 0;
9028 nestedRows.forEach(function (headerRow) {
9029 headerRow.children.forEach(function (row) {
9030 row.originalIndex = index++;
9031 });
9032 });
9033 return nestedRows;
9034 },
9035 typedColumns: function typedColumns() {
9036 var columns = this.columns;
9037
9038 for (var i = 0; i < this.columns.length; i++) {
9039 var column = columns[i];
9040 column.typeDef = this.dataTypes[column.type] || defaultType;
9041 }
9042
9043 return columns;
9044 },
9045 hasRowClickListener: function hasRowClickListener() {
9046 return this.$listeners && this.$listeners['on-row-click'];
9047 }
9048 },
9049 methods: {
9050 //* we need to check for expanded row state here
9051 //* to maintain it when sorting/filtering
9052 handleExpanded: function handleExpanded(headerRow) {
9053 if (this.maintainExpanded && this.expandedRowKeys.has(headerRow[this.rowKeyField])) {
9054 this.$set(headerRow, 'vgtIsExpanded', true);
9055 } else {
9056 this.$set(headerRow, 'vgtIsExpanded', false);
9057 }
9058 },
9059 toggleExpand: function toggleExpand(id) {
9060 var _this3 = this;
9061
9062 var headerRow = this.filteredRows.find(function (r) {
9063 return r[_this3.rowKeyField] === id;
9064 });
9065
9066 if (headerRow) {
9067 this.$set(headerRow, 'vgtIsExpanded', !headerRow.vgtIsExpanded);
9068 }
9069
9070 if (this.maintainExpanded && headerRow.vgtIsExpanded) {
9071 this.expandedRowKeys.add(headerRow[this.rowKeyField]);
9072 } else {
9073 this.expandedRowKeys["delete"](headerRow[this.rowKeyField]);
9074 }
9075 },
9076 expandAll: function expandAll() {
9077 var _this4 = this;
9078
9079 this.filteredRows.forEach(function (row) {
9080 _this4.$set(row, 'vgtIsExpanded', true);
9081
9082 if (_this4.maintainExpanded) {
9083 _this4.expandedRowKeys.add(row[_this4.rowKeyField]);
9084 }
9085 });
9086 },
9087 collapseAll: function collapseAll() {
9088 var _this5 = this;
9089
9090 this.filteredRows.forEach(function (row) {
9091 _this5.$set(row, 'vgtIsExpanded', false);
9092
9093 _this5.expandedRowKeys.clear();
9094 });
9095 },
9096 getColumnForField: function getColumnForField(field) {
9097 for (var i = 0; i < this.typedColumns.length; i += 1) {
9098 if (this.typedColumns[i].field === field) return this.typedColumns[i];
9099 }
9100 },
9101 handleSearch: function handleSearch() {
9102 this.resetTable(); // for remote mode, we need to emit on-search
9103
9104 if (this.mode === 'remote') {
9105 this.$emit('on-search', {
9106 searchTerm: this.searchTerm
9107 });
9108 }
9109 },
9110 reset: function reset() {
9111 this.initializeSort();
9112 this.changePage(1);
9113 this.$refs['table-header-primary'].reset(true);
9114
9115 if (this.$refs['table-header-secondary']) {
9116 this.$refs['table-header-secondary'].reset(true);
9117 }
9118 },
9119 emitSelectedRows: function emitSelectedRows() {
9120 this.$emit('on-select-all', {
9121 selected: this.selectedRowCount === this.totalRowCount,
9122 selectedRows: this.selectedRows
9123 });
9124 },
9125 unselectAllInternal: function unselectAllInternal(forceAll) {
9126 var _this6 = this;
9127
9128 var rows = this.selectAllByPage && !forceAll ? this.paginated : this.filteredRows;
9129 rows.forEach(function (headerRow, i) {
9130 headerRow.children.forEach(function (row, j) {
9131 _this6.$set(row, 'vgtSelected', false);
9132 });
9133 });
9134 this.emitSelectedRows();
9135 },
9136 toggleSelectAll: function toggleSelectAll() {
9137 var _this7 = this;
9138
9139 if (this.allSelected) {
9140 this.unselectAllInternal();
9141 return;
9142 }
9143
9144 var rows = this.selectAllByPage ? this.paginated : this.filteredRows;
9145 rows.forEach(function (headerRow) {
9146 headerRow.children.forEach(function (row) {
9147 _this7.$set(row, 'vgtSelected', true);
9148 });
9149 });
9150 this.emitSelectedRows();
9151 },
9152 toggleSelectGroup: function toggleSelectGroup(event, headerRow) {
9153 var _this8 = this;
9154
9155 headerRow.children.forEach(function (row) {
9156 _this8.$set(row, 'vgtSelected', event.checked);
9157 });
9158 },
9159 changePage: function changePage(value) {
9160 var enabled = this.paginate;
9161 var _this$$refs = this.$refs,
9162 paginationBottom = _this$$refs.paginationBottom,
9163 paginationTop = _this$$refs.paginationTop;
9164
9165 if (enabled) {
9166 if (this.paginateOnTop && paginationTop) {
9167 paginationTop.currentPage = value;
9168 }
9169
9170 if (this.paginateOnBottom && paginationBottom) {
9171 paginationBottom.currentPage = value;
9172 } // we also need to set the currentPage
9173 // for table.
9174
9175
9176 this.currentPage = value;
9177 }
9178 },
9179 pageChangedEvent: function pageChangedEvent() {
9180 return {
9181 currentPage: this.currentPage,
9182 currentPerPage: this.currentPerPage,
9183 total: Math.floor(this.totalRowCount / this.currentPerPage)
9184 };
9185 },
9186 pageChanged: function pageChanged(pagination) {
9187 this.currentPage = pagination.currentPage;
9188 var pageChangedEvent = this.pageChangedEvent();
9189 pageChangedEvent.prevPage = pagination.prevPage;
9190 this.$emit('on-page-change', pageChangedEvent);
9191
9192 if (this.mode === 'remote') {
9193 this.$emit('update:isLoading', true);
9194 }
9195 },
9196 perPageChanged: function perPageChanged(pagination) {
9197 this.currentPerPage = pagination.currentPerPage; // ensure that both sides of pagination are in agreement
9198 // this fixes changes during position = 'both'
9199
9200 var paginationPosition = this.paginationOptions.position;
9201
9202 if (this.$refs.paginationTop && (paginationPosition === 'top' || paginationPosition === 'both')) {
9203 this.$refs.paginationTop.currentPerPage = this.currentPerPage;
9204 }
9205
9206 if (this.$refs.paginationBottom && (paginationPosition === 'bottom' || paginationPosition === 'both')) {
9207 this.$refs.paginationBottom.currentPerPage = this.currentPerPage;
9208 } //* update perPage also
9209
9210
9211 var perPageChangedEvent = this.pageChangedEvent();
9212 this.$emit('on-per-page-change', perPageChangedEvent);
9213
9214 if (this.mode === 'remote') {
9215 this.$emit('update:isLoading', true);
9216 }
9217 },
9218 changeSort: function changeSort(sorts) {
9219 this.sorts = sorts;
9220 this.$emit('on-sort-change', sorts); // every time we change sort we need to reset to page 1
9221
9222 this.changePage(1); // if the mode is remote, we don't need to do anything
9223 // after this. just set table loading to true
9224
9225 if (this.mode === 'remote') {
9226 this.$emit('update:isLoading', true);
9227 return;
9228 }
9229
9230 this.sortChanged = true;
9231 },
9232 // checkbox click should always do the following
9233 onCheckboxClicked: function onCheckboxClicked(row, index, event) {
9234 this.$set(row, 'vgtSelected', !row.vgtSelected);
9235 this.$emit('on-row-click', {
9236 row: row,
9237 pageIndex: index,
9238 selected: !!row.vgtSelected,
9239 event: event
9240 });
9241 },
9242 onRowDoubleClicked: function onRowDoubleClicked(row, index, event) {
9243 this.$emit('on-row-dblclick', {
9244 row: row,
9245 pageIndex: index,
9246 selected: !!row.vgtSelected,
9247 event: event
9248 });
9249 },
9250 onRowClicked: function onRowClicked(row, index, event) {
9251 if (this.selectable && !this.selectOnCheckboxOnly) {
9252 this.$set(row, 'vgtSelected', !row.vgtSelected);
9253 }
9254
9255 this.$emit('on-row-click', {
9256 row: row,
9257 pageIndex: index,
9258 selected: !!row.vgtSelected,
9259 event: event
9260 });
9261 },
9262 onRowAuxClicked: function onRowAuxClicked(row, index, event) {
9263 this.$emit('on-row-aux-click', {
9264 row: row,
9265 pageIndex: index,
9266 selected: !!row.vgtSelected,
9267 event: event
9268 });
9269 },
9270 onCellClicked: function onCellClicked(row, column, rowIndex, event) {
9271 this.$emit('on-cell-click', {
9272 row: row,
9273 column: column,
9274 rowIndex: rowIndex,
9275 event: event
9276 });
9277 },
9278 onMouseenter: function onMouseenter(row, index) {
9279 this.$emit('on-row-mouseenter', {
9280 row: row,
9281 pageIndex: index
9282 });
9283 },
9284 onMouseleave: function onMouseleave(row, index) {
9285 this.$emit('on-row-mouseleave', {
9286 row: row,
9287 pageIndex: index
9288 });
9289 },
9290 searchTableOnEnter: function searchTableOnEnter() {
9291 if (this.searchTrigger === 'enter') {
9292 this.handleSearch(); // we reset the filteredRows here because
9293 // we want to search across everything.
9294
9295 this.filteredRows = JSON.parse(JSON.stringify(this.originalRows));
9296 this.forceSearch = true;
9297 this.sortChanged = true;
9298 }
9299 },
9300 searchTableOnKeyUp: function searchTableOnKeyUp() {
9301 if (this.searchTrigger !== 'enter') {
9302 this.handleSearch();
9303 }
9304 },
9305 resetTable: function resetTable() {
9306 this.unselectAllInternal(true); // every time we searchTable
9307
9308 this.changePage(1);
9309 },
9310 // field can be:
9311 // 1. function (passed as a string using function.name. For example: 'bound myFunction')
9312 // 2. regular property - ex: 'prop'
9313 // 3. nested property path - ex: 'nested.prop'
9314 collect: function collect(obj, field) {
9315 // utility function to get nested property
9316 function dig(obj, selector) {
9317 var result = obj;
9318 var splitter = selector.split('.');
9319
9320 for (var i = 0; i < splitter.length; i++) {
9321 if (typeof result === 'undefined' || result === null) {
9322 return undefined;
9323 }
9324
9325 result = result[splitter[i]];
9326 }
9327
9328 return result;
9329 }
9330
9331 if (typeof field === 'function') return field(obj);
9332 if (typeof field === 'string') return dig(obj, field);
9333 return undefined;
9334 },
9335 collectFormatted: function collectFormatted(obj, column) {
9336 var headerRow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9337 var value;
9338
9339 if (headerRow && column.headerField) {
9340 value = this.collect(obj, column.headerField);
9341 } else {
9342 value = this.collect(obj, column.field);
9343 }
9344
9345 if (value === undefined) return ''; // if user has supplied custom formatter,
9346 // use that here
9347
9348 if (column.formatFn && typeof column.formatFn === 'function') {
9349 return column.formatFn(value, obj);
9350 } // lets format the resultant data
9351
9352
9353 var type = column.typeDef; // this will only happen if we try to collect formatted
9354 // before types have been initialized. for example: on
9355 // load when external query is specified.
9356
9357 if (!type) {
9358 type = this.dataTypes[column.type] || defaultType;
9359 }
9360
9361 var result = type.format(value, column); // we must have some values in compact mode
9362
9363 if (this.compactMode && (result == '' || result == null)) return '-';
9364 return result;
9365 },
9366 formattedRow: function formattedRow(row) {
9367 var isHeaderRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9368 var formattedRow = {};
9369
9370 for (var i = 0; i < this.typedColumns.length; i++) {
9371 var col = this.typedColumns[i]; // what happens if field is
9372
9373 if (col.field) {
9374 formattedRow[col.field] = this.collectFormatted(row, col, isHeaderRow);
9375 }
9376 }
9377
9378 return formattedRow;
9379 },
9380 // Get classes for the given column index & element.
9381 getClasses: function getClasses(index, element, row) {
9382 var _this$typedColumns$in = this.typedColumns[index],
9383 typeDef = _this$typedColumns$in.typeDef,
9384 custom = _this$typedColumns$in["".concat(element, "Class")];
9385
9386 var isRight = typeDef.isRight;
9387 if (this.rtl) isRight = true;
9388 var classes = {
9389 'vgt-right-align': isRight,
9390 'vgt-left-align': !isRight
9391 }; // for td we need to check if value is
9392 // a function.
9393
9394 if (typeof custom === 'function') {
9395 classes[custom(row)] = true;
9396 } else if (typeof custom === 'string') {
9397 classes[custom] = true;
9398 }
9399
9400 return classes;
9401 },
9402 // method to filter rows
9403 filterRows: function filterRows(columnFilters) {
9404 var _this9 = this;
9405
9406 var fromFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9407 // if (!this.rows.length) return;
9408 // this is invoked either as a result of changing filters
9409 // or as a result of modifying rows.
9410 this.columnFilters = columnFilters;
9411 var computedRows = JSON.parse(JSON.stringify(this.originalRows)); // do we have a filter to care about?
9412 // if not we don't need to do anything
9413
9414 if (this.columnFilters && Object.keys(this.columnFilters).length) {
9415 var _ret = function () {
9416 // every time we filter rows, we need to set current page
9417 // to 1
9418 // if the mode is remote, we only need to reset, if this is
9419 // being called from filter, not when rows are changing
9420 if (_this9.mode !== 'remote' || fromFilter) {
9421 _this9.changePage(1);
9422 } // we need to emit an event and that's that.
9423 // but this only needs to be invoked if filter is changing
9424 // not when row object is modified.
9425
9426
9427 if (fromFilter) {
9428 _this9.$emit('on-column-filter', {
9429 columnFilters: _this9.columnFilters
9430 });
9431 } // if mode is remote, we don't do any filtering here.
9432
9433
9434 if (_this9.mode === 'remote') {
9435 if (fromFilter) {
9436 _this9.$emit('update:isLoading', true);
9437 } else {
9438 // if remote filtering has already been taken care of.
9439 _this9.filteredRows = computedRows;
9440 }
9441
9442 return {
9443 v: void 0
9444 };
9445 }
9446
9447 var fieldKey = function fieldKey(field) {
9448 if (typeof field === 'function' && field.name) {
9449 return field.name;
9450 }
9451
9452 return field;
9453 };
9454
9455 var _loop = function _loop(i) {
9456 var col = _this9.typedColumns[i];
9457
9458 if (_this9.columnFilters[fieldKey(col.field)]) {
9459 computedRows.forEach(function (headerRow) {
9460 var newChildren = headerRow.children.filter(function (row) {
9461 // If column has a custom filter, use that.
9462 if (col.filterOptions && typeof col.filterOptions.filterFn === 'function') {
9463 return col.filterOptions.filterFn(_this9.collect(row, col.field), _this9.columnFilters[fieldKey(col.field)]);
9464 } // Otherwise Use default filters
9465
9466
9467 var typeDef = col.typeDef;
9468 return typeDef.filterPredicate(_this9.collect(row, col.field), _this9.columnFilters[fieldKey(col.field)], false, col.filterOptions && _typeof(col.filterOptions.filterDropdownItems) === 'object');
9469 }); // should we remove the header?
9470
9471 headerRow.children = newChildren;
9472 });
9473 }
9474 };
9475
9476 for (var i = 0; i < _this9.typedColumns.length; i++) {
9477 _loop(i);
9478 }
9479 }();
9480
9481 if (_typeof(_ret) === "object") return _ret.v;
9482 }
9483
9484 this.filteredRows = computedRows;
9485 },
9486 getCurrentIndex: function getCurrentIndex(rowId) {
9487 var index = 0;
9488 var found = false;
9489
9490 for (var i = 0; i < this.paginated.length; i += 1) {
9491 var headerRow = this.paginated[i];
9492 var children = headerRow.children;
9493
9494 if (children && children.length) {
9495 for (var j = 0; j < children.length; j += 1) {
9496 var c = children[j];
9497
9498 if (c.originalIndex === rowId) {
9499 found = true;
9500 break;
9501 }
9502
9503 index += 1;
9504 }
9505 }
9506
9507 if (found) break;
9508 }
9509
9510 return (this.currentPage - 1) * this.currentPerPage + index + 1;
9511 },
9512 getRowStyleClass: function getRowStyleClass(row) {
9513 var classes = '';
9514 if (this.hasRowClickListener) classes += 'clickable';
9515 var rowStyleClasses;
9516
9517 if (typeof this.rowStyleClass === 'function') {
9518 rowStyleClasses = this.rowStyleClass(row);
9519 } else {
9520 rowStyleClasses = this.rowStyleClass;
9521 }
9522
9523 if (rowStyleClasses) {
9524 classes += " ".concat(rowStyleClasses);
9525 }
9526
9527 return classes;
9528 },
9529 handleGrouped: function handleGrouped(originalRows) {
9530 var _this10 = this;
9531
9532 originalRows.forEach(function (headerRow, i) {
9533 headerRow.vgt_header_id = i;
9534
9535 if (_this10.groupOptions.maintainExpanded && _this10.expandedRowKeys.has(headerRow[_this10.groupOptions.rowKey])) {
9536 _this10.$set(headerRow, 'vgtIsExpanded', true);
9537 }
9538
9539 headerRow.children.forEach(function (childRow) {
9540 childRow.vgt_id = i;
9541 });
9542 });
9543 return originalRows;
9544 },
9545 initializePagination: function initializePagination() {
9546 var _this11 = this;
9547
9548 var _this$paginationOptio = this.paginationOptions,
9549 enabled = _this$paginationOptio.enabled,
9550 perPage = _this$paginationOptio.perPage,
9551 position = _this$paginationOptio.position,
9552 perPageDropdown = _this$paginationOptio.perPageDropdown,
9553 perPageDropdownEnabled = _this$paginationOptio.perPageDropdownEnabled,
9554 dropdownAllowAll = _this$paginationOptio.dropdownAllowAll,
9555 nextLabel = _this$paginationOptio.nextLabel,
9556 prevLabel = _this$paginationOptio.prevLabel,
9557 rowsPerPageLabel = _this$paginationOptio.rowsPerPageLabel,
9558 ofLabel = _this$paginationOptio.ofLabel,
9559 pageLabel = _this$paginationOptio.pageLabel,
9560 allLabel = _this$paginationOptio.allLabel,
9561 setCurrentPage = _this$paginationOptio.setCurrentPage,
9562 mode = _this$paginationOptio.mode,
9563 infoFn = _this$paginationOptio.infoFn;
9564
9565 if (typeof enabled === 'boolean') {
9566 this.paginate = enabled;
9567 }
9568
9569 if (typeof perPage === 'number') {
9570 this.perPage = perPage;
9571 }
9572
9573 if (position === 'top') {
9574 this.paginateOnTop = true; // default is false
9575
9576 this.paginateOnBottom = false; // default is true
9577 } else if (position === 'both') {
9578 this.paginateOnTop = true;
9579 this.paginateOnBottom = true;
9580 }
9581
9582 if (Array.isArray(perPageDropdown) && perPageDropdown.length) {
9583 this.customRowsPerPageDropdown = perPageDropdown;
9584
9585 if (!this.perPage) {
9586 var _perPageDropdown = _slicedToArray(perPageDropdown, 1);
9587
9588 this.perPage = _perPageDropdown[0];
9589 }
9590 }
9591
9592 if (typeof perPageDropdownEnabled === 'boolean') {
9593 this.perPageDropdownEnabled = perPageDropdownEnabled;
9594 }
9595
9596 if (typeof dropdownAllowAll === 'boolean') {
9597 this.paginateDropdownAllowAll = dropdownAllowAll;
9598 }
9599
9600 if (typeof mode === 'string') {
9601 this.paginationMode = mode;
9602 }
9603
9604 if (typeof nextLabel === 'string') {
9605 this.nextText = nextLabel;
9606 }
9607
9608 if (typeof prevLabel === 'string') {
9609 this.prevText = prevLabel;
9610 }
9611
9612 if (typeof rowsPerPageLabel === 'string') {
9613 this.rowsPerPageText = rowsPerPageLabel;
9614 }
9615
9616 if (typeof ofLabel === 'string') {
9617 this.ofText = ofLabel;
9618 }
9619
9620 if (typeof pageLabel === 'string') {
9621 this.pageText = pageLabel;
9622 }
9623
9624 if (typeof allLabel === 'string') {
9625 this.allText = allLabel;
9626 }
9627
9628 if (typeof setCurrentPage === 'number') {
9629 setTimeout(function () {
9630 _this11.changePage(setCurrentPage);
9631 }, 500);
9632 }
9633
9634 if (typeof infoFn === 'function') {
9635 this.paginationInfoFn = infoFn;
9636 }
9637 },
9638 initializeSearch: function initializeSearch() {
9639 var _this$searchOptions = this.searchOptions,
9640 enabled = _this$searchOptions.enabled,
9641 trigger = _this$searchOptions.trigger,
9642 externalQuery = _this$searchOptions.externalQuery,
9643 searchFn = _this$searchOptions.searchFn,
9644 placeholder = _this$searchOptions.placeholder,
9645 skipDiacritics = _this$searchOptions.skipDiacritics;
9646
9647 if (typeof enabled === 'boolean') {
9648 this.searchEnabled = enabled;
9649 }
9650
9651 if (trigger === 'enter') {
9652 this.searchTrigger = trigger;
9653 }
9654
9655 if (typeof externalQuery === 'string') {
9656 this.externalSearchQuery = externalQuery;
9657 }
9658
9659 if (typeof searchFn === 'function') {
9660 this.searchFn = searchFn;
9661 }
9662
9663 if (typeof placeholder === 'string') {
9664 this.searchPlaceholder = placeholder;
9665 }
9666
9667 if (typeof skipDiacritics === 'boolean') {
9668 this.searchSkipDiacritics = skipDiacritics;
9669 }
9670 },
9671 initializeSort: function initializeSort() {
9672 var _this$sortOptions = this.sortOptions,
9673 enabled = _this$sortOptions.enabled,
9674 initialSortBy = _this$sortOptions.initialSortBy;
9675
9676 if (typeof enabled === 'boolean') {
9677 this.sortable = enabled;
9678 } //* initialSortBy can be an array or an object
9679
9680
9681 if (_typeof(initialSortBy) === 'object') {
9682 var ref = this.fixedHeader ? this.$refs['table-header-secondary'] : this.$refs['table-header-primary'];
9683
9684 if (Array.isArray(initialSortBy)) {
9685 ref.setInitialSort(initialSortBy);
9686 } else {
9687 var hasField = Object.prototype.hasOwnProperty.call(initialSortBy, 'field');
9688 if (hasField) ref.setInitialSort([initialSortBy]);
9689 }
9690 }
9691 },
9692 initializeSelect: function initializeSelect() {
9693 var _this$selectOptions = this.selectOptions,
9694 enabled = _this$selectOptions.enabled,
9695 selectionInfoClass = _this$selectOptions.selectionInfoClass,
9696 selectionText = _this$selectOptions.selectionText,
9697 clearSelectionText = _this$selectOptions.clearSelectionText,
9698 selectOnCheckboxOnly = _this$selectOptions.selectOnCheckboxOnly,
9699 selectAllByPage = _this$selectOptions.selectAllByPage,
9700 disableSelectInfo = _this$selectOptions.disableSelectInfo,
9701 selectAllByGroup = _this$selectOptions.selectAllByGroup;
9702
9703 if (typeof enabled === 'boolean') {
9704 this.selectable = enabled;
9705 }
9706
9707 if (typeof selectOnCheckboxOnly === 'boolean') {
9708 this.selectOnCheckboxOnly = selectOnCheckboxOnly;
9709 }
9710
9711 if (typeof selectAllByPage === 'boolean') {
9712 this.selectAllByPage = selectAllByPage;
9713 }
9714
9715 if (typeof selectAllByGroup === 'boolean') {
9716 this.selectAllByGroup = selectAllByGroup;
9717 }
9718
9719 if (typeof disableSelectInfo === 'boolean') {
9720 this.disableSelectInfo = disableSelectInfo;
9721 }
9722
9723 if (typeof selectionInfoClass === 'string') {
9724 this.selectionInfoClass = selectionInfoClass;
9725 }
9726
9727 if (typeof selectionText === 'string') {
9728 this.selectionText = selectionText;
9729 }
9730
9731 if (typeof clearSelectionText === 'string') {
9732 this.clearSelectionText = clearSelectionText;
9733 }
9734 }
9735 },
9736 mounted: function mounted() {
9737 if (this.perPage) {
9738 this.currentPerPage = this.perPage;
9739 }
9740
9741 this.initializeSort();
9742 },
9743 components: {
9744 'vgt-pagination': __vue_component__$1,
9745 'vgt-global-search': __vue_component__$2,
9746 'vgt-header-row': __vue_component__$5,
9747 'vgt-table-header': __vue_component__$4
9748 }
9749 };
9750
9751 /* script */
9752 var __vue_script__$6 = script$6;
9753 /* template */
9754
9755 var __vue_render__$6 = function __vue_render__() {
9756 var _vm = this;
9757
9758 var _h = _vm.$createElement;
9759
9760 var _c = _vm._self._c || _h;
9761
9762 return _c('div', {
9763 "class": _vm.wrapStyleClasses
9764 }, [_vm.isLoading ? _c('div', {
9765 staticClass: "vgt-loading vgt-center-align"
9766 }, [_vm._t("loadingContent", [_c('span', {
9767 staticClass: "vgt-loading__content"
9768 }, [_vm._v("\n Loading...\n ")])])], 2) : _vm._e(), _vm._v(" "), _c('div', {
9769 staticClass: "vgt-inner-wrap",
9770 "class": {
9771 'is-loading': _vm.isLoading
9772 }
9773 }, [_vm.paginate && _vm.paginateOnTop ? _vm._t("pagination-top", [_c('vgt-pagination', {
9774 ref: "paginationTop",
9775 attrs: {
9776 "perPage": _vm.perPage,
9777 "rtl": _vm.rtl,
9778 "total": _vm.totalRows || _vm.totalRowCount,
9779 "mode": _vm.paginationMode,
9780 "nextText": _vm.nextText,
9781 "prevText": _vm.prevText,
9782 "rowsPerPageText": _vm.rowsPerPageText,
9783 "perPageDropdownEnabled": _vm.paginationOptions.perPageDropdownEnabled,
9784 "customRowsPerPageDropdown": _vm.customRowsPerPageDropdown,
9785 "paginateDropdownAllowAll": _vm.paginateDropdownAllowAll,
9786 "ofText": _vm.ofText,
9787 "pageText": _vm.pageText,
9788 "allText": _vm.allText,
9789 "info-fn": _vm.paginationInfoFn
9790 },
9791 on: {
9792 "page-changed": _vm.pageChanged,
9793 "per-page-changed": _vm.perPageChanged
9794 }
9795 })], {
9796 "pageChanged": _vm.pageChanged,
9797 "perPageChanged": _vm.perPageChanged,
9798 "total": _vm.totalRows || _vm.totalRowCount
9799 }) : _vm._e(), _vm._v(" "), _c('vgt-global-search', {
9800 attrs: {
9801 "search-enabled": _vm.searchEnabled && _vm.externalSearchQuery == null,
9802 "global-search-placeholder": _vm.searchPlaceholder
9803 },
9804 on: {
9805 "on-keyup": _vm.searchTableOnKeyUp,
9806 "on-enter": _vm.searchTableOnEnter
9807 },
9808 model: {
9809 value: _vm.globalSearchTerm,
9810 callback: function callback($$v) {
9811 _vm.globalSearchTerm = $$v;
9812 },
9813 expression: "globalSearchTerm"
9814 }
9815 }, [_c('template', {
9816 slot: "internal-table-actions"
9817 }, [_vm._t("table-actions")], 2)], 2), _vm._v(" "), _vm.selectedRowCount && !_vm.disableSelectInfo ? _c('div', {
9818 staticClass: "vgt-selection-info-row clearfix",
9819 "class": _vm.selectionInfoClass
9820 }, [_vm._v("\n " + _vm._s(_vm.selectionInfo) + "\n "), _c('a', {
9821 attrs: {
9822 "href": ""
9823 },
9824 on: {
9825 "click": function click($event) {
9826 $event.preventDefault();
9827 return _vm.unselectAllInternal(true);
9828 }
9829 }
9830 }, [_vm._v("\n " + _vm._s(_vm.clearSelectionText) + "\n ")]), _vm._v(" "), _c('div', {
9831 staticClass: "vgt-selection-info-row__actions vgt-pull-right"
9832 }, [_vm._t("selected-row-actions")], 2)]) : _vm._e(), _vm._v(" "), _c('div', {
9833 staticClass: "vgt-fixed-header"
9834 }, [_vm.fixedHeader ? _c('table', {
9835 "class": _vm.tableStyleClasses,
9836 attrs: {
9837 "id": "vgt-table"
9838 }
9839 }, [_c('colgroup', _vm._l(_vm.columns, function (column, index) {
9840 return _c('col', {
9841 key: index,
9842 attrs: {
9843 "id": "col-" + index
9844 }
9845 });
9846 }), 0), _vm._v(" "), _c("vgt-table-header", {
9847 ref: "table-header-secondary",
9848 tag: "thead",
9849 attrs: {
9850 "columns": _vm.columns,
9851 "line-numbers": _vm.lineNumbers,
9852 "selectable": _vm.selectable,
9853 "all-selected": _vm.allSelected,
9854 "all-selected-indeterminate": _vm.allSelectedIndeterminate,
9855 "mode": _vm.mode,
9856 "sortable": _vm.sortable,
9857 "typed-columns": _vm.typedColumns,
9858 "getClasses": _vm.getClasses,
9859 "searchEnabled": _vm.searchEnabled,
9860 "paginated": _vm.paginated,
9861 "table-ref": _vm.$refs.table
9862 },
9863 on: {
9864 "on-toggle-select-all": _vm.toggleSelectAll,
9865 "on-sort-change": _vm.changeSort,
9866 "filter-changed": _vm.filterRows
9867 },
9868 scopedSlots: _vm._u([{
9869 key: "table-column",
9870 fn: function fn(props) {
9871 return [_vm._t("table-column", [_c('span', [_vm._v(_vm._s(props.column.label))])], {
9872 "column": props.column
9873 })];
9874 }
9875 }, {
9876 key: "column-filter",
9877 fn: function fn(props) {
9878 return [_vm._t("column-filter", null, {
9879 "column": props.column,
9880 "updateFilters": props.updateFilters
9881 })];
9882 }
9883 }], null, true)
9884 })], 1) : _vm._e()]), _vm._v(" "), _c('div', {
9885 "class": {
9886 'vgt-responsive': _vm.responsive
9887 },
9888 style: _vm.wrapperStyles
9889 }, [_c('table', {
9890 ref: "table",
9891 "class": _vm.tableStyles,
9892 attrs: {
9893 "id": "vgt-table"
9894 }
9895 }, [_c('colgroup', _vm._l(_vm.columns, function (column, index) {
9896 return _c('col', {
9897 key: index,
9898 attrs: {
9899 "id": "col-" + index
9900 }
9901 });
9902 }), 0), _vm._v(" "), _c("vgt-table-header", {
9903 ref: "table-header-primary",
9904 tag: "thead",
9905 attrs: {
9906 "columns": _vm.columns,
9907 "line-numbers": _vm.lineNumbers,
9908 "selectable": _vm.selectable,
9909 "all-selected": _vm.allSelected,
9910 "all-selected-indeterminate": _vm.allSelectedIndeterminate,
9911 "mode": _vm.mode,
9912 "sortable": _vm.sortable,
9913 "typed-columns": _vm.typedColumns,
9914 "getClasses": _vm.getClasses,
9915 "searchEnabled": _vm.searchEnabled
9916 },
9917 on: {
9918 "on-toggle-select-all": _vm.toggleSelectAll,
9919 "on-sort-change": _vm.changeSort,
9920 "filter-changed": _vm.filterRows
9921 },
9922 scopedSlots: _vm._u([{
9923 key: "table-column",
9924 fn: function fn(props) {
9925 return [_vm._t("table-column", [_c('span', [_vm._v(_vm._s(props.column.label))])], {
9926 "column": props.column
9927 })];
9928 }
9929 }, {
9930 key: "column-filter",
9931 fn: function fn(props) {
9932 return [_vm._t("column-filter", null, {
9933 "column": props.column,
9934 "updateFilters": props.updateFilters
9935 })];
9936 }
9937 }], null, true)
9938 }), _vm._v(" "), _vm._l(_vm.paginated, function (headerRow, hIndex) {
9939 return _c('tbody', {
9940 key: hIndex
9941 }, [_vm.groupHeaderOnTop ? _c('vgt-header-row', {
9942 "class": _vm.getRowStyleClass(headerRow),
9943 attrs: {
9944 "header-row": headerRow,
9945 "columns": _vm.columns,
9946 "line-numbers": _vm.lineNumbers,
9947 "selectable": _vm.selectable,
9948 "select-all-by-group": _vm.selectAllByGroup,
9949 "collapsable": _vm.groupOptions.collapsable,
9950 "collect-formatted": _vm.collectFormatted,
9951 "formatted-row": _vm.formattedRow,
9952 "get-classes": _vm.getClasses,
9953 "full-colspan": _vm.fullColspan,
9954 "groupIndex": hIndex
9955 },
9956 on: {
9957 "vgtExpand": function vgtExpand($event) {
9958 return _vm.toggleExpand(headerRow[_vm.rowKeyField]);
9959 },
9960 "on-select-group-change": function onSelectGroupChange($event) {
9961 return _vm.toggleSelectGroup($event, headerRow);
9962 }
9963 },
9964 scopedSlots: _vm._u([{
9965 key: "table-header-row",
9966 fn: function fn(props) {
9967 return _vm.hasHeaderRowTemplate ? [_vm._t("table-header-row", null, {
9968 "column": props.column,
9969 "formattedRow": props.formattedRow,
9970 "row": props.row
9971 })] : undefined;
9972 }
9973 }], null, true)
9974 }) : _vm._e(), _vm._v(" "), _vm._l(headerRow.children, function (row, index) {
9975 return (_vm.groupOptions.collapsable ? headerRow.vgtIsExpanded : true) ? _c('tr', {
9976 key: row.originalIndex,
9977 "class": _vm.getRowStyleClass(row),
9978 on: {
9979 "mouseenter": function mouseenter($event) {
9980 return _vm.onMouseenter(row, index);
9981 },
9982 "mouseleave": function mouseleave($event) {
9983 return _vm.onMouseleave(row, index);
9984 },
9985 "dblclick": function dblclick($event) {
9986 return _vm.onRowDoubleClicked(row, index, $event);
9987 },
9988 "click": function click($event) {
9989 return _vm.onRowClicked(row, index, $event);
9990 },
9991 "auxclick": function auxclick($event) {
9992 return _vm.onRowAuxClicked(row, index, $event);
9993 }
9994 }
9995 }, [_vm.lineNumbers ? _c('th', {
9996 staticClass: "line-numbers"
9997 }, [_vm._v("\n " + _vm._s(_vm.getCurrentIndex(row.originalIndex)) + "\n ")]) : _vm._e(), _vm._v(" "), _vm.selectable ? _c('th', {
9998 staticClass: "vgt-checkbox-col",
9999 on: {
10000 "click": function click($event) {
10001 $event.stopPropagation();
10002 return _vm.onCheckboxClicked(row, index, $event);
10003 }
10004 }
10005 }, [_c('input', {
10006 attrs: {
10007 "type": "checkbox",
10008 "disabled": row.vgtDisabled
10009 },
10010 domProps: {
10011 "checked": row.vgtSelected
10012 }
10013 })]) : _vm._e(), _vm._v(" "), _vm._l(_vm.columns, function (column, i) {
10014 return !column.hidden && column.field ? _c('td', {
10015 key: i,
10016 "class": _vm.getClasses(i, 'td', row),
10017 attrs: {
10018 "data-label": _vm.compactMode ? column.label : undefined
10019 },
10020 on: {
10021 "click": function click($event) {
10022 return _vm.onCellClicked(row, column, index, $event);
10023 }
10024 }
10025 }, [_vm._t("table-row", [!column.html ? _c('span', [_vm._v("\n " + _vm._s(_vm.collectFormatted(row, column)) + "\n ")]) : _c('span', {
10026 domProps: {
10027 "innerHTML": _vm._s(_vm.collect(row, column.field))
10028 }
10029 })], {
10030 "row": row,
10031 "column": column,
10032 "formattedRow": _vm.formattedRow(row),
10033 "index": index
10034 })], 2) : _vm._e();
10035 })], 2) : _vm._e();
10036 }), _vm._v(" "), _vm.groupHeaderOnBottom ? _c('vgt-header-row', {
10037 attrs: {
10038 "header-row": headerRow,
10039 "columns": _vm.columns,
10040 "line-numbers": _vm.lineNumbers,
10041 "selectable": _vm.selectable,
10042 "select-all-by-group": _vm.selectAllByGroup,
10043 "collect-formatted": _vm.collectFormatted,
10044 "formatted-row": _vm.formattedRow,
10045 "get-classes": _vm.getClasses,
10046 "full-colspan": _vm.fullColspan,
10047 "groupIndex": _vm.index
10048 },
10049 on: {
10050 "on-select-group-change": function onSelectGroupChange($event) {
10051 return _vm.toggleSelectGroup($event, headerRow);
10052 }
10053 },
10054 scopedSlots: _vm._u([{
10055 key: "table-header-row",
10056 fn: function fn(props) {
10057 return _vm.hasHeaderRowTemplate ? [_vm._t("table-header-row", null, {
10058 "column": props.column,
10059 "formattedRow": props.formattedRow,
10060 "row": props.row
10061 })] : undefined;
10062 }
10063 }], null, true)
10064 }) : _vm._e()], 2);
10065 }), _vm._v(" "), _vm.showEmptySlot ? _c('tbody', [_c('tr', [_c('td', {
10066 attrs: {
10067 "colspan": _vm.fullColspan
10068 }
10069 }, [_vm._t("emptystate", [_c('div', {
10070 staticClass: "vgt-center-align vgt-text-disabled"
10071 }, [_vm._v("\n No data for table\n ")])])], 2)])]) : _vm._e()], 2)]), _vm._v(" "), _vm.hasFooterSlot ? _c('div', {
10072 staticClass: "vgt-wrap__actions-footer"
10073 }, [_vm._t("table-actions-bottom")], 2) : _vm._e(), _vm._v(" "), _vm.paginate && _vm.paginateOnBottom ? _vm._t("pagination-bottom", [_c('vgt-pagination', {
10074 ref: "paginationBottom",
10075 attrs: {
10076 "perPage": _vm.perPage,
10077 "rtl": _vm.rtl,
10078 "total": _vm.totalRows || _vm.totalRowCount,
10079 "mode": _vm.paginationMode,
10080 "nextText": _vm.nextText,
10081 "prevText": _vm.prevText,
10082 "rowsPerPageText": _vm.rowsPerPageText,
10083 "perPageDropdownEnabled": _vm.paginationOptions.perPageDropdownEnabled,
10084 "customRowsPerPageDropdown": _vm.customRowsPerPageDropdown,
10085 "paginateDropdownAllowAll": _vm.paginateDropdownAllowAll,
10086 "ofText": _vm.ofText,
10087 "pageText": _vm.pageText,
10088 "allText": _vm.allText,
10089 "info-fn": _vm.paginationInfoFn
10090 },
10091 on: {
10092 "page-changed": _vm.pageChanged,
10093 "per-page-changed": _vm.perPageChanged
10094 }
10095 })], {
10096 "pageChanged": _vm.pageChanged,
10097 "perPageChanged": _vm.perPageChanged,
10098 "total": _vm.totalRows || _vm.totalRowCount
10099 }) : _vm._e()], 2)]);
10100 };
10101
10102 var __vue_staticRenderFns__$6 = [];
10103 /* style */
10104
10105 var __vue_inject_styles__$6 = undefined;
10106 /* scoped */
10107
10108 var __vue_scope_id__$6 = undefined;
10109 /* module identifier */
10110
10111 var __vue_module_identifier__$6 = undefined;
10112 /* functional template */
10113
10114 var __vue_is_functional_template__$6 = false;
10115 /* style inject */
10116
10117 /* style inject SSR */
10118
10119 /* style inject shadow dom */
10120
10121 var __vue_component__$6 = /*#__PURE__*/normalizeComponent({
10122 render: __vue_render__$6,
10123 staticRenderFns: __vue_staticRenderFns__$6
10124 }, __vue_inject_styles__$6, __vue_script__$6, __vue_scope_id__$6, __vue_is_functional_template__$6, __vue_module_identifier__$6, false, undefined, undefined, undefined);
10125
10126 var VueGoodTablePlugin = {
10127 install: function install(Vue, options) {
10128 Vue.component(__vue_component__$6.name, __vue_component__$6);
10129 }
10130 }; // Automatic installation if Vue has been added to the global scope.
10131
10132 if (typeof window !== 'undefined' && window.Vue) {
10133 window.Vue.use(VueGoodTablePlugin);
10134 }
10135
10136 exports.VueGoodTable = __vue_component__$6;
10137 exports.default = VueGoodTablePlugin;
10138
10139 Object.defineProperty(exports, '__esModule', { value: true });
10140
10141})));