UNPKG

104 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global = global || self, factory(global.jQuery));
5}(this, (function ($) { 'use strict';
6
7 $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
8
9 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
11 function createCommonjsModule(fn, module) {
12 return module = { exports: {} }, fn(module, module.exports), module.exports;
13 }
14
15 var check = function (it) {
16 return it && it.Math == Math && it;
17 };
18
19 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
20 var global_1 =
21 // eslint-disable-next-line no-undef
22 check(typeof globalThis == 'object' && globalThis) ||
23 check(typeof window == 'object' && window) ||
24 check(typeof self == 'object' && self) ||
25 check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
26 // eslint-disable-next-line no-new-func
27 Function('return this')();
28
29 var fails = function (exec) {
30 try {
31 return !!exec();
32 } catch (error) {
33 return true;
34 }
35 };
36
37 // Thank's IE8 for his funny defineProperty
38 var descriptors = !fails(function () {
39 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
40 });
41
42 var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
43 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
44
45 // Nashorn ~ JDK8 bug
46 var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
47
48 // `Object.prototype.propertyIsEnumerable` method implementation
49 // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
50 var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
51 var descriptor = getOwnPropertyDescriptor(this, V);
52 return !!descriptor && descriptor.enumerable;
53 } : nativePropertyIsEnumerable;
54
55 var objectPropertyIsEnumerable = {
56 f: f
57 };
58
59 var createPropertyDescriptor = function (bitmap, value) {
60 return {
61 enumerable: !(bitmap & 1),
62 configurable: !(bitmap & 2),
63 writable: !(bitmap & 4),
64 value: value
65 };
66 };
67
68 var toString = {}.toString;
69
70 var classofRaw = function (it) {
71 return toString.call(it).slice(8, -1);
72 };
73
74 var split = ''.split;
75
76 // fallback for non-array-like ES3 and non-enumerable old V8 strings
77 var indexedObject = fails(function () {
78 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
79 // eslint-disable-next-line no-prototype-builtins
80 return !Object('z').propertyIsEnumerable(0);
81 }) ? function (it) {
82 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
83 } : Object;
84
85 // `RequireObjectCoercible` abstract operation
86 // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
87 var requireObjectCoercible = function (it) {
88 if (it == undefined) throw TypeError("Can't call method on " + it);
89 return it;
90 };
91
92 // toObject with fallback for non-array-like ES3 strings
93
94
95
96 var toIndexedObject = function (it) {
97 return indexedObject(requireObjectCoercible(it));
98 };
99
100 var isObject = function (it) {
101 return typeof it === 'object' ? it !== null : typeof it === 'function';
102 };
103
104 // `ToPrimitive` abstract operation
105 // https://tc39.github.io/ecma262/#sec-toprimitive
106 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
107 // and the second argument - flag - preferred type is a string
108 var toPrimitive = function (input, PREFERRED_STRING) {
109 if (!isObject(input)) return input;
110 var fn, val;
111 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
112 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
113 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
114 throw TypeError("Can't convert object to primitive value");
115 };
116
117 var hasOwnProperty = {}.hasOwnProperty;
118
119 var has = function (it, key) {
120 return hasOwnProperty.call(it, key);
121 };
122
123 var document$1 = global_1.document;
124 // typeof document.createElement is 'object' in old IE
125 var EXISTS = isObject(document$1) && isObject(document$1.createElement);
126
127 var documentCreateElement = function (it) {
128 return EXISTS ? document$1.createElement(it) : {};
129 };
130
131 // Thank's IE8 for his funny defineProperty
132 var ie8DomDefine = !descriptors && !fails(function () {
133 return Object.defineProperty(documentCreateElement('div'), 'a', {
134 get: function () { return 7; }
135 }).a != 7;
136 });
137
138 var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
139
140 // `Object.getOwnPropertyDescriptor` method
141 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
142 var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
143 O = toIndexedObject(O);
144 P = toPrimitive(P, true);
145 if (ie8DomDefine) try {
146 return nativeGetOwnPropertyDescriptor(O, P);
147 } catch (error) { /* empty */ }
148 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
149 };
150
151 var objectGetOwnPropertyDescriptor = {
152 f: f$1
153 };
154
155 var anObject = function (it) {
156 if (!isObject(it)) {
157 throw TypeError(String(it) + ' is not an object');
158 } return it;
159 };
160
161 var nativeDefineProperty = Object.defineProperty;
162
163 // `Object.defineProperty` method
164 // https://tc39.github.io/ecma262/#sec-object.defineproperty
165 var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
166 anObject(O);
167 P = toPrimitive(P, true);
168 anObject(Attributes);
169 if (ie8DomDefine) try {
170 return nativeDefineProperty(O, P, Attributes);
171 } catch (error) { /* empty */ }
172 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
173 if ('value' in Attributes) O[P] = Attributes.value;
174 return O;
175 };
176
177 var objectDefineProperty = {
178 f: f$2
179 };
180
181 var createNonEnumerableProperty = descriptors ? function (object, key, value) {
182 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
183 } : function (object, key, value) {
184 object[key] = value;
185 return object;
186 };
187
188 var setGlobal = function (key, value) {
189 try {
190 createNonEnumerableProperty(global_1, key, value);
191 } catch (error) {
192 global_1[key] = value;
193 } return value;
194 };
195
196 var SHARED = '__core-js_shared__';
197 var store = global_1[SHARED] || setGlobal(SHARED, {});
198
199 var sharedStore = store;
200
201 var functionToString = Function.toString;
202
203 // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
204 if (typeof sharedStore.inspectSource != 'function') {
205 sharedStore.inspectSource = function (it) {
206 return functionToString.call(it);
207 };
208 }
209
210 var inspectSource = sharedStore.inspectSource;
211
212 var WeakMap = global_1.WeakMap;
213
214 var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
215
216 var shared = createCommonjsModule(function (module) {
217 (module.exports = function (key, value) {
218 return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
219 })('versions', []).push({
220 version: '3.6.0',
221 mode: 'global',
222 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
223 });
224 });
225
226 var id = 0;
227 var postfix = Math.random();
228
229 var uid = function (key) {
230 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
231 };
232
233 var keys = shared('keys');
234
235 var sharedKey = function (key) {
236 return keys[key] || (keys[key] = uid(key));
237 };
238
239 var hiddenKeys = {};
240
241 var WeakMap$1 = global_1.WeakMap;
242 var set, get, has$1;
243
244 var enforce = function (it) {
245 return has$1(it) ? get(it) : set(it, {});
246 };
247
248 var getterFor = function (TYPE) {
249 return function (it) {
250 var state;
251 if (!isObject(it) || (state = get(it)).type !== TYPE) {
252 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
253 } return state;
254 };
255 };
256
257 if (nativeWeakMap) {
258 var store$1 = new WeakMap$1();
259 var wmget = store$1.get;
260 var wmhas = store$1.has;
261 var wmset = store$1.set;
262 set = function (it, metadata) {
263 wmset.call(store$1, it, metadata);
264 return metadata;
265 };
266 get = function (it) {
267 return wmget.call(store$1, it) || {};
268 };
269 has$1 = function (it) {
270 return wmhas.call(store$1, it);
271 };
272 } else {
273 var STATE = sharedKey('state');
274 hiddenKeys[STATE] = true;
275 set = function (it, metadata) {
276 createNonEnumerableProperty(it, STATE, metadata);
277 return metadata;
278 };
279 get = function (it) {
280 return has(it, STATE) ? it[STATE] : {};
281 };
282 has$1 = function (it) {
283 return has(it, STATE);
284 };
285 }
286
287 var internalState = {
288 set: set,
289 get: get,
290 has: has$1,
291 enforce: enforce,
292 getterFor: getterFor
293 };
294
295 var redefine = createCommonjsModule(function (module) {
296 var getInternalState = internalState.get;
297 var enforceInternalState = internalState.enforce;
298 var TEMPLATE = String(String).split('String');
299
300 (module.exports = function (O, key, value, options) {
301 var unsafe = options ? !!options.unsafe : false;
302 var simple = options ? !!options.enumerable : false;
303 var noTargetGet = options ? !!options.noTargetGet : false;
304 if (typeof value == 'function') {
305 if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
306 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
307 }
308 if (O === global_1) {
309 if (simple) O[key] = value;
310 else setGlobal(key, value);
311 return;
312 } else if (!unsafe) {
313 delete O[key];
314 } else if (!noTargetGet && O[key]) {
315 simple = true;
316 }
317 if (simple) O[key] = value;
318 else createNonEnumerableProperty(O, key, value);
319 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
320 })(Function.prototype, 'toString', function toString() {
321 return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
322 });
323 });
324
325 var path = global_1;
326
327 var aFunction = function (variable) {
328 return typeof variable == 'function' ? variable : undefined;
329 };
330
331 var getBuiltIn = function (namespace, method) {
332 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
333 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
334 };
335
336 var ceil = Math.ceil;
337 var floor = Math.floor;
338
339 // `ToInteger` abstract operation
340 // https://tc39.github.io/ecma262/#sec-tointeger
341 var toInteger = function (argument) {
342 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
343 };
344
345 var min = Math.min;
346
347 // `ToLength` abstract operation
348 // https://tc39.github.io/ecma262/#sec-tolength
349 var toLength = function (argument) {
350 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
351 };
352
353 var max = Math.max;
354 var min$1 = Math.min;
355
356 // Helper for a popular repeating case of the spec:
357 // Let integer be ? ToInteger(index).
358 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
359 var toAbsoluteIndex = function (index, length) {
360 var integer = toInteger(index);
361 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
362 };
363
364 // `Array.prototype.{ indexOf, includes }` methods implementation
365 var createMethod = function (IS_INCLUDES) {
366 return function ($this, el, fromIndex) {
367 var O = toIndexedObject($this);
368 var length = toLength(O.length);
369 var index = toAbsoluteIndex(fromIndex, length);
370 var value;
371 // Array#includes uses SameValueZero equality algorithm
372 // eslint-disable-next-line no-self-compare
373 if (IS_INCLUDES && el != el) while (length > index) {
374 value = O[index++];
375 // eslint-disable-next-line no-self-compare
376 if (value != value) return true;
377 // Array#indexOf ignores holes, Array#includes - not
378 } else for (;length > index; index++) {
379 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
380 } return !IS_INCLUDES && -1;
381 };
382 };
383
384 var arrayIncludes = {
385 // `Array.prototype.includes` method
386 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
387 includes: createMethod(true),
388 // `Array.prototype.indexOf` method
389 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
390 indexOf: createMethod(false)
391 };
392
393 var indexOf = arrayIncludes.indexOf;
394
395
396 var objectKeysInternal = function (object, names) {
397 var O = toIndexedObject(object);
398 var i = 0;
399 var result = [];
400 var key;
401 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
402 // Don't enum bug & hidden keys
403 while (names.length > i) if (has(O, key = names[i++])) {
404 ~indexOf(result, key) || result.push(key);
405 }
406 return result;
407 };
408
409 // IE8- don't enum bug keys
410 var enumBugKeys = [
411 'constructor',
412 'hasOwnProperty',
413 'isPrototypeOf',
414 'propertyIsEnumerable',
415 'toLocaleString',
416 'toString',
417 'valueOf'
418 ];
419
420 var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
421
422 // `Object.getOwnPropertyNames` method
423 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
424 var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
425 return objectKeysInternal(O, hiddenKeys$1);
426 };
427
428 var objectGetOwnPropertyNames = {
429 f: f$3
430 };
431
432 var f$4 = Object.getOwnPropertySymbols;
433
434 var objectGetOwnPropertySymbols = {
435 f: f$4
436 };
437
438 // all object keys, includes non-enumerable and symbols
439 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
440 var keys = objectGetOwnPropertyNames.f(anObject(it));
441 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
442 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
443 };
444
445 var copyConstructorProperties = function (target, source) {
446 var keys = ownKeys(source);
447 var defineProperty = objectDefineProperty.f;
448 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
449 for (var i = 0; i < keys.length; i++) {
450 var key = keys[i];
451 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
452 }
453 };
454
455 var replacement = /#|\.prototype\./;
456
457 var isForced = function (feature, detection) {
458 var value = data[normalize(feature)];
459 return value == POLYFILL ? true
460 : value == NATIVE ? false
461 : typeof detection == 'function' ? fails(detection)
462 : !!detection;
463 };
464
465 var normalize = isForced.normalize = function (string) {
466 return String(string).replace(replacement, '.').toLowerCase();
467 };
468
469 var data = isForced.data = {};
470 var NATIVE = isForced.NATIVE = 'N';
471 var POLYFILL = isForced.POLYFILL = 'P';
472
473 var isForced_1 = isForced;
474
475 var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
476
477
478
479
480
481
482 /*
483 options.target - name of the target object
484 options.global - target is the global object
485 options.stat - export as static methods of target
486 options.proto - export as prototype methods of target
487 options.real - real prototype method for the `pure` version
488 options.forced - export even if the native feature is available
489 options.bind - bind methods to the target, required for the `pure` version
490 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
491 options.unsafe - use the simple assignment of property instead of delete + defineProperty
492 options.sham - add a flag to not completely full polyfills
493 options.enumerable - export as enumerable property
494 options.noTargetGet - prevent calling a getter on target
495 */
496 var _export = function (options, source) {
497 var TARGET = options.target;
498 var GLOBAL = options.global;
499 var STATIC = options.stat;
500 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
501 if (GLOBAL) {
502 target = global_1;
503 } else if (STATIC) {
504 target = global_1[TARGET] || setGlobal(TARGET, {});
505 } else {
506 target = (global_1[TARGET] || {}).prototype;
507 }
508 if (target) for (key in source) {
509 sourceProperty = source[key];
510 if (options.noTargetGet) {
511 descriptor = getOwnPropertyDescriptor$1(target, key);
512 targetProperty = descriptor && descriptor.value;
513 } else targetProperty = target[key];
514 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
515 // contained in target
516 if (!FORCED && targetProperty !== undefined) {
517 if (typeof sourceProperty === typeof targetProperty) continue;
518 copyConstructorProperties(sourceProperty, targetProperty);
519 }
520 // add a flag to not completely full polyfills
521 if (options.sham || (targetProperty && targetProperty.sham)) {
522 createNonEnumerableProperty(sourceProperty, 'sham', true);
523 }
524 // extend global
525 redefine(target, key, sourceProperty, options);
526 }
527 };
528
529 // `IsArray` abstract operation
530 // https://tc39.github.io/ecma262/#sec-isarray
531 var isArray = Array.isArray || function isArray(arg) {
532 return classofRaw(arg) == 'Array';
533 };
534
535 // `ToObject` abstract operation
536 // https://tc39.github.io/ecma262/#sec-toobject
537 var toObject = function (argument) {
538 return Object(requireObjectCoercible(argument));
539 };
540
541 var createProperty = function (object, key, value) {
542 var propertyKey = toPrimitive(key);
543 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
544 else object[propertyKey] = value;
545 };
546
547 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
548 // Chrome 38 Symbol has incorrect toString conversion
549 // eslint-disable-next-line no-undef
550 return !String(Symbol());
551 });
552
553 var useSymbolAsUid = nativeSymbol
554 // eslint-disable-next-line no-undef
555 && !Symbol.sham
556 // eslint-disable-next-line no-undef
557 && typeof Symbol() == 'symbol';
558
559 var WellKnownSymbolsStore = shared('wks');
560 var Symbol$1 = global_1.Symbol;
561 var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : uid;
562
563 var wellKnownSymbol = function (name) {
564 if (!has(WellKnownSymbolsStore, name)) {
565 if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
566 else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
567 } return WellKnownSymbolsStore[name];
568 };
569
570 var SPECIES = wellKnownSymbol('species');
571
572 // `ArraySpeciesCreate` abstract operation
573 // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
574 var arraySpeciesCreate = function (originalArray, length) {
575 var C;
576 if (isArray(originalArray)) {
577 C = originalArray.constructor;
578 // cross-realm fallback
579 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
580 else if (isObject(C)) {
581 C = C[SPECIES];
582 if (C === null) C = undefined;
583 }
584 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
585 };
586
587 var userAgent = getBuiltIn('navigator', 'userAgent') || '';
588
589 var process = global_1.process;
590 var versions = process && process.versions;
591 var v8 = versions && versions.v8;
592 var match, version;
593
594 if (v8) {
595 match = v8.split('.');
596 version = match[0] + match[1];
597 } else if (userAgent) {
598 match = userAgent.match(/Edge\/(\d+)/);
599 if (!match || match[1] >= 74) {
600 match = userAgent.match(/Chrome\/(\d+)/);
601 if (match) version = match[1];
602 }
603 }
604
605 var v8Version = version && +version;
606
607 var SPECIES$1 = wellKnownSymbol('species');
608
609 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
610 // We can't use this feature detection in V8 since it causes
611 // deoptimization and serious performance degradation
612 // https://github.com/zloirock/core-js/issues/677
613 return v8Version >= 51 || !fails(function () {
614 var array = [];
615 var constructor = array.constructor = {};
616 constructor[SPECIES$1] = function () {
617 return { foo: 1 };
618 };
619 return array[METHOD_NAME](Boolean).foo !== 1;
620 });
621 };
622
623 var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
624 var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
625 var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
626
627 // We can't use this feature detection in V8 since it causes
628 // deoptimization and serious performance degradation
629 // https://github.com/zloirock/core-js/issues/679
630 var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
631 var array = [];
632 array[IS_CONCAT_SPREADABLE] = false;
633 return array.concat()[0] !== array;
634 });
635
636 var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
637
638 var isConcatSpreadable = function (O) {
639 if (!isObject(O)) return false;
640 var spreadable = O[IS_CONCAT_SPREADABLE];
641 return spreadable !== undefined ? !!spreadable : isArray(O);
642 };
643
644 var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
645
646 // `Array.prototype.concat` method
647 // https://tc39.github.io/ecma262/#sec-array.prototype.concat
648 // with adding support of @@isConcatSpreadable and @@species
649 _export({ target: 'Array', proto: true, forced: FORCED }, {
650 concat: function concat(arg) { // eslint-disable-line no-unused-vars
651 var O = toObject(this);
652 var A = arraySpeciesCreate(O, 0);
653 var n = 0;
654 var i, k, length, len, E;
655 for (i = -1, length = arguments.length; i < length; i++) {
656 E = i === -1 ? O : arguments[i];
657 if (isConcatSpreadable(E)) {
658 len = toLength(E.length);
659 if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
660 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
661 } else {
662 if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
663 createProperty(A, n++, E);
664 }
665 }
666 A.length = n;
667 return A;
668 }
669 });
670
671 var aFunction$1 = function (it) {
672 if (typeof it != 'function') {
673 throw TypeError(String(it) + ' is not a function');
674 } return it;
675 };
676
677 // optional / simple context binding
678 var bindContext = function (fn, that, length) {
679 aFunction$1(fn);
680 if (that === undefined) return fn;
681 switch (length) {
682 case 0: return function () {
683 return fn.call(that);
684 };
685 case 1: return function (a) {
686 return fn.call(that, a);
687 };
688 case 2: return function (a, b) {
689 return fn.call(that, a, b);
690 };
691 case 3: return function (a, b, c) {
692 return fn.call(that, a, b, c);
693 };
694 }
695 return function (/* ...args */) {
696 return fn.apply(that, arguments);
697 };
698 };
699
700 var push = [].push;
701
702 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
703 var createMethod$1 = function (TYPE) {
704 var IS_MAP = TYPE == 1;
705 var IS_FILTER = TYPE == 2;
706 var IS_SOME = TYPE == 3;
707 var IS_EVERY = TYPE == 4;
708 var IS_FIND_INDEX = TYPE == 6;
709 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
710 return function ($this, callbackfn, that, specificCreate) {
711 var O = toObject($this);
712 var self = indexedObject(O);
713 var boundFunction = bindContext(callbackfn, that, 3);
714 var length = toLength(self.length);
715 var index = 0;
716 var create = specificCreate || arraySpeciesCreate;
717 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
718 var value, result;
719 for (;length > index; index++) if (NO_HOLES || index in self) {
720 value = self[index];
721 result = boundFunction(value, index, O);
722 if (TYPE) {
723 if (IS_MAP) target[index] = result; // map
724 else if (result) switch (TYPE) {
725 case 3: return true; // some
726 case 5: return value; // find
727 case 6: return index; // findIndex
728 case 2: push.call(target, value); // filter
729 } else if (IS_EVERY) return false; // every
730 }
731 }
732 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
733 };
734 };
735
736 var arrayIteration = {
737 // `Array.prototype.forEach` method
738 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
739 forEach: createMethod$1(0),
740 // `Array.prototype.map` method
741 // https://tc39.github.io/ecma262/#sec-array.prototype.map
742 map: createMethod$1(1),
743 // `Array.prototype.filter` method
744 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
745 filter: createMethod$1(2),
746 // `Array.prototype.some` method
747 // https://tc39.github.io/ecma262/#sec-array.prototype.some
748 some: createMethod$1(3),
749 // `Array.prototype.every` method
750 // https://tc39.github.io/ecma262/#sec-array.prototype.every
751 every: createMethod$1(4),
752 // `Array.prototype.find` method
753 // https://tc39.github.io/ecma262/#sec-array.prototype.find
754 find: createMethod$1(5),
755 // `Array.prototype.findIndex` method
756 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
757 findIndex: createMethod$1(6)
758 };
759
760 var $filter = arrayIteration.filter;
761
762
763
764 var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
765 // Edge 14- issue
766 var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () {
767 [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; });
768 });
769
770 // `Array.prototype.filter` method
771 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
772 // with adding support of @@species
773 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
774 filter: function filter(callbackfn /* , thisArg */) {
775 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
776 }
777 });
778
779 // `Object.keys` method
780 // https://tc39.github.io/ecma262/#sec-object.keys
781 var objectKeys = Object.keys || function keys(O) {
782 return objectKeysInternal(O, enumBugKeys);
783 };
784
785 // `Object.defineProperties` method
786 // https://tc39.github.io/ecma262/#sec-object.defineproperties
787 var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
788 anObject(O);
789 var keys = objectKeys(Properties);
790 var length = keys.length;
791 var index = 0;
792 var key;
793 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
794 return O;
795 };
796
797 var html = getBuiltIn('document', 'documentElement');
798
799 var GT = '>';
800 var LT = '<';
801 var PROTOTYPE = 'prototype';
802 var SCRIPT = 'script';
803 var IE_PROTO = sharedKey('IE_PROTO');
804
805 var EmptyConstructor = function () { /* empty */ };
806
807 var scriptTag = function (content) {
808 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
809 };
810
811 // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
812 var NullProtoObjectViaActiveX = function (activeXDocument) {
813 activeXDocument.write(scriptTag(''));
814 activeXDocument.close();
815 var temp = activeXDocument.parentWindow.Object;
816 activeXDocument = null; // avoid memory leak
817 return temp;
818 };
819
820 // Create object with fake `null` prototype: use iframe Object with cleared prototype
821 var NullProtoObjectViaIFrame = function () {
822 // Thrash, waste and sodomy: IE GC bug
823 var iframe = documentCreateElement('iframe');
824 var JS = 'java' + SCRIPT + ':';
825 var iframeDocument;
826 iframe.style.display = 'none';
827 html.appendChild(iframe);
828 // https://github.com/zloirock/core-js/issues/475
829 iframe.src = String(JS);
830 iframeDocument = iframe.contentWindow.document;
831 iframeDocument.open();
832 iframeDocument.write(scriptTag('document.F=Object'));
833 iframeDocument.close();
834 return iframeDocument.F;
835 };
836
837 // Check for document.domain and active x support
838 // No need to use active x approach when document.domain is not set
839 // see https://github.com/es-shims/es5-shim/issues/150
840 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
841 // avoid IE GC bug
842 var activeXDocument;
843 var NullProtoObject = function () {
844 try {
845 /* global ActiveXObject */
846 activeXDocument = document.domain && new ActiveXObject('htmlfile');
847 } catch (error) { /* ignore */ }
848 NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
849 var length = enumBugKeys.length;
850 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
851 return NullProtoObject();
852 };
853
854 hiddenKeys[IE_PROTO] = true;
855
856 // `Object.create` method
857 // https://tc39.github.io/ecma262/#sec-object.create
858 var objectCreate = Object.create || function create(O, Properties) {
859 var result;
860 if (O !== null) {
861 EmptyConstructor[PROTOTYPE] = anObject(O);
862 result = new EmptyConstructor();
863 EmptyConstructor[PROTOTYPE] = null;
864 // add "__proto__" for Object.getPrototypeOf polyfill
865 result[IE_PROTO] = O;
866 } else result = NullProtoObject();
867 return Properties === undefined ? result : objectDefineProperties(result, Properties);
868 };
869
870 var UNSCOPABLES = wellKnownSymbol('unscopables');
871 var ArrayPrototype = Array.prototype;
872
873 // Array.prototype[@@unscopables]
874 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
875 if (ArrayPrototype[UNSCOPABLES] == undefined) {
876 objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
877 configurable: true,
878 value: objectCreate(null)
879 });
880 }
881
882 // add a key to Array.prototype[@@unscopables]
883 var addToUnscopables = function (key) {
884 ArrayPrototype[UNSCOPABLES][key] = true;
885 };
886
887 var $find = arrayIteration.find;
888
889
890 var FIND = 'find';
891 var SKIPS_HOLES = true;
892
893 // Shouldn't skip holes
894 if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
895
896 // `Array.prototype.find` method
897 // https://tc39.github.io/ecma262/#sec-array.prototype.find
898 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
899 find: function find(callbackfn /* , that = undefined */) {
900 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
901 }
902 });
903
904 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
905 addToUnscopables(FIND);
906
907 var $includes = arrayIncludes.includes;
908
909
910 // `Array.prototype.includes` method
911 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
912 _export({ target: 'Array', proto: true }, {
913 includes: function includes(el /* , fromIndex = 0 */) {
914 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
915 }
916 });
917
918 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
919 addToUnscopables('includes');
920
921 var sloppyArrayMethod = function (METHOD_NAME, argument) {
922 var method = [][METHOD_NAME];
923 return !method || !fails(function () {
924 // eslint-disable-next-line no-useless-call,no-throw-literal
925 method.call(null, argument || function () { throw 1; }, 1);
926 });
927 };
928
929 var $indexOf = arrayIncludes.indexOf;
930
931
932 var nativeIndexOf = [].indexOf;
933
934 var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
935 var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
936
937 // `Array.prototype.indexOf` method
938 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
939 _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
940 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
941 return NEGATIVE_ZERO
942 // convert -0 to +0
943 ? nativeIndexOf.apply(this, arguments) || 0
944 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
945 }
946 });
947
948 var nativeAssign = Object.assign;
949 var defineProperty = Object.defineProperty;
950
951 // `Object.assign` method
952 // https://tc39.github.io/ecma262/#sec-object.assign
953 var objectAssign = !nativeAssign || fails(function () {
954 // should have correct order of operations (Edge bug)
955 if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
956 enumerable: true,
957 get: function () {
958 defineProperty(this, 'b', {
959 value: 3,
960 enumerable: false
961 });
962 }
963 }), { b: 2 })).b !== 1) return true;
964 // should work with symbols and should have deterministic property order (V8 bug)
965 var A = {};
966 var B = {};
967 // eslint-disable-next-line no-undef
968 var symbol = Symbol();
969 var alphabet = 'abcdefghijklmnopqrst';
970 A[symbol] = 7;
971 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
972 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
973 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
974 var T = toObject(target);
975 var argumentsLength = arguments.length;
976 var index = 1;
977 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
978 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
979 while (argumentsLength > index) {
980 var S = indexedObject(arguments[index++]);
981 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
982 var length = keys.length;
983 var j = 0;
984 var key;
985 while (length > j) {
986 key = keys[j++];
987 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
988 }
989 } return T;
990 } : nativeAssign;
991
992 // `Object.assign` method
993 // https://tc39.github.io/ecma262/#sec-object.assign
994 _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
995 assign: objectAssign
996 });
997
998 var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
999
1000 // `Object.keys` method
1001 // https://tc39.github.io/ecma262/#sec-object.keys
1002 _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
1003 keys: function keys(it) {
1004 return objectKeys(toObject(it));
1005 }
1006 });
1007
1008 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1009 var test = {};
1010
1011 test[TO_STRING_TAG] = 'z';
1012
1013 var toStringTagSupport = String(test) === '[object z]';
1014
1015 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1016 // ES3 wrong here
1017 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1018
1019 // fallback for IE11 Script Access Denied error
1020 var tryGet = function (it, key) {
1021 try {
1022 return it[key];
1023 } catch (error) { /* empty */ }
1024 };
1025
1026 // getting tag from ES6+ `Object.prototype.toString`
1027 var classof = toStringTagSupport ? classofRaw : function (it) {
1028 var O, tag, result;
1029 return it === undefined ? 'Undefined' : it === null ? 'Null'
1030 // @@toStringTag case
1031 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
1032 // builtinTag case
1033 : CORRECT_ARGUMENTS ? classofRaw(O)
1034 // ES3 arguments fallback
1035 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1036 };
1037
1038 // `Object.prototype.toString` method implementation
1039 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1040 var objectToString = toStringTagSupport ? {}.toString : function toString() {
1041 return '[object ' + classof(this) + ']';
1042 };
1043
1044 // `Object.prototype.toString` method
1045 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1046 if (!toStringTagSupport) {
1047 redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
1048 }
1049
1050 // a string of all valid unicode whitespaces
1051 // eslint-disable-next-line max-len
1052 var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1053
1054 var whitespace = '[' + whitespaces + ']';
1055 var ltrim = RegExp('^' + whitespace + whitespace + '*');
1056 var rtrim = RegExp(whitespace + whitespace + '*$');
1057
1058 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1059 var createMethod$2 = function (TYPE) {
1060 return function ($this) {
1061 var string = String(requireObjectCoercible($this));
1062 if (TYPE & 1) string = string.replace(ltrim, '');
1063 if (TYPE & 2) string = string.replace(rtrim, '');
1064 return string;
1065 };
1066 };
1067
1068 var stringTrim = {
1069 // `String.prototype.{ trimLeft, trimStart }` methods
1070 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1071 start: createMethod$2(1),
1072 // `String.prototype.{ trimRight, trimEnd }` methods
1073 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1074 end: createMethod$2(2),
1075 // `String.prototype.trim` method
1076 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1077 trim: createMethod$2(3)
1078 };
1079
1080 var trim = stringTrim.trim;
1081
1082
1083 var nativeParseInt = global_1.parseInt;
1084 var hex = /^[+-]?0[Xx]/;
1085 var FORCED$1 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
1086
1087 // `parseInt` method
1088 // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1089 var _parseInt = FORCED$1 ? function parseInt(string, radix) {
1090 var S = trim(String(string));
1091 return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
1092 } : nativeParseInt;
1093
1094 // `parseInt` method
1095 // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1096 _export({ global: true, forced: parseInt != _parseInt }, {
1097 parseInt: _parseInt
1098 });
1099
1100 // `RegExp.prototype.flags` getter implementation
1101 // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
1102 var regexpFlags = function () {
1103 var that = anObject(this);
1104 var result = '';
1105 if (that.global) result += 'g';
1106 if (that.ignoreCase) result += 'i';
1107 if (that.multiline) result += 'm';
1108 if (that.dotAll) result += 's';
1109 if (that.unicode) result += 'u';
1110 if (that.sticky) result += 'y';
1111 return result;
1112 };
1113
1114 // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
1115 // so we use an intermediate function.
1116 function RE(s, f) {
1117 return RegExp(s, f);
1118 }
1119
1120 var UNSUPPORTED_Y = fails(function () {
1121 // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1122 var re = RE('a', 'y');
1123 re.lastIndex = 2;
1124 return re.exec('abcd') != null;
1125 });
1126
1127 var BROKEN_CARET = fails(function () {
1128 // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1129 var re = RE('^r', 'gy');
1130 re.lastIndex = 2;
1131 return re.exec('str') != null;
1132 });
1133
1134 var regexpStickyHelpers = {
1135 UNSUPPORTED_Y: UNSUPPORTED_Y,
1136 BROKEN_CARET: BROKEN_CARET
1137 };
1138
1139 var nativeExec = RegExp.prototype.exec;
1140 // This always refers to the native implementation, because the
1141 // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
1142 // which loads this file before patching the method.
1143 var nativeReplace = String.prototype.replace;
1144
1145 var patchedExec = nativeExec;
1146
1147 var UPDATES_LAST_INDEX_WRONG = (function () {
1148 var re1 = /a/;
1149 var re2 = /b*/g;
1150 nativeExec.call(re1, 'a');
1151 nativeExec.call(re2, 'a');
1152 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1153 })();
1154
1155 var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
1156
1157 // nonparticipating capturing group, copied from es5-shim's String#split patch.
1158 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1159
1160 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
1161
1162 if (PATCH) {
1163 patchedExec = function exec(str) {
1164 var re = this;
1165 var lastIndex, reCopy, match, i;
1166 var sticky = UNSUPPORTED_Y$1 && re.sticky;
1167 var flags = regexpFlags.call(re);
1168 var source = re.source;
1169 var charsAdded = 0;
1170 var strCopy = str;
1171
1172 if (sticky) {
1173 flags = flags.replace('y', '');
1174 if (flags.indexOf('g') === -1) {
1175 flags += 'g';
1176 }
1177
1178 strCopy = String(str).slice(re.lastIndex);
1179 // Support anchored sticky behavior.
1180 if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
1181 source = '(?: ' + source + ')';
1182 strCopy = ' ' + strCopy;
1183 charsAdded++;
1184 }
1185 // ^(? + rx + ) is needed, in combination with some str slicing, to
1186 // simulate the 'y' flag.
1187 reCopy = new RegExp('^(?:' + source + ')', flags);
1188 }
1189
1190 if (NPCG_INCLUDED) {
1191 reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1192 }
1193 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1194
1195 match = nativeExec.call(sticky ? reCopy : re, strCopy);
1196
1197 if (sticky) {
1198 if (match) {
1199 match.input = match.input.slice(charsAdded);
1200 match[0] = match[0].slice(charsAdded);
1201 match.index = re.lastIndex;
1202 re.lastIndex += match[0].length;
1203 } else re.lastIndex = 0;
1204 } else if (UPDATES_LAST_INDEX_WRONG && match) {
1205 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1206 }
1207 if (NPCG_INCLUDED && match && match.length > 1) {
1208 // Fix browsers whose `exec` methods don't consistently return `undefined`
1209 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1210 nativeReplace.call(match[0], reCopy, function () {
1211 for (i = 1; i < arguments.length - 2; i++) {
1212 if (arguments[i] === undefined) match[i] = undefined;
1213 }
1214 });
1215 }
1216
1217 return match;
1218 };
1219 }
1220
1221 var regexpExec = patchedExec;
1222
1223 _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
1224 exec: regexpExec
1225 });
1226
1227 var TO_STRING = 'toString';
1228 var RegExpPrototype = RegExp.prototype;
1229 var nativeToString = RegExpPrototype[TO_STRING];
1230
1231 var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
1232 // FF44- RegExp#toString has a wrong name
1233 var INCORRECT_NAME = nativeToString.name != TO_STRING;
1234
1235 // `RegExp.prototype.toString` method
1236 // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
1237 if (NOT_GENERIC || INCORRECT_NAME) {
1238 redefine(RegExp.prototype, TO_STRING, function toString() {
1239 var R = anObject(this);
1240 var p = String(R.source);
1241 var rf = R.flags;
1242 var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
1243 return '/' + p + '/' + f;
1244 }, { unsafe: true });
1245 }
1246
1247 var MATCH = wellKnownSymbol('match');
1248
1249 // `IsRegExp` abstract operation
1250 // https://tc39.github.io/ecma262/#sec-isregexp
1251 var isRegexp = function (it) {
1252 var isRegExp;
1253 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1254 };
1255
1256 var notARegexp = function (it) {
1257 if (isRegexp(it)) {
1258 throw TypeError("The method doesn't accept regular expressions");
1259 } return it;
1260 };
1261
1262 var MATCH$1 = wellKnownSymbol('match');
1263
1264 var correctIsRegexpLogic = function (METHOD_NAME) {
1265 var regexp = /./;
1266 try {
1267 '/./'[METHOD_NAME](regexp);
1268 } catch (e) {
1269 try {
1270 regexp[MATCH$1] = false;
1271 return '/./'[METHOD_NAME](regexp);
1272 } catch (f) { /* empty */ }
1273 } return false;
1274 };
1275
1276 // `String.prototype.includes` method
1277 // https://tc39.github.io/ecma262/#sec-string.prototype.includes
1278 _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
1279 includes: function includes(searchString /* , position = 0 */) {
1280 return !!~String(requireObjectCoercible(this))
1281 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
1282 }
1283 });
1284
1285 var non = '\u200B\u0085\u180E';
1286
1287 // check that a method works with the correct list
1288 // of whitespaces and has a correct name
1289 var forcedStringTrimMethod = function (METHOD_NAME) {
1290 return fails(function () {
1291 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
1292 });
1293 };
1294
1295 var $trim = stringTrim.trim;
1296
1297
1298 // `String.prototype.trim` method
1299 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1300 _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1301 trim: function trim() {
1302 return $trim(this);
1303 }
1304 });
1305
1306 // iterable DOM collections
1307 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1308 var domIterables = {
1309 CSSRuleList: 0,
1310 CSSStyleDeclaration: 0,
1311 CSSValueList: 0,
1312 ClientRectList: 0,
1313 DOMRectList: 0,
1314 DOMStringList: 0,
1315 DOMTokenList: 1,
1316 DataTransferItemList: 0,
1317 FileList: 0,
1318 HTMLAllCollection: 0,
1319 HTMLCollection: 0,
1320 HTMLFormElement: 0,
1321 HTMLSelectElement: 0,
1322 MediaList: 0,
1323 MimeTypeArray: 0,
1324 NamedNodeMap: 0,
1325 NodeList: 1,
1326 PaintRequestList: 0,
1327 Plugin: 0,
1328 PluginArray: 0,
1329 SVGLengthList: 0,
1330 SVGNumberList: 0,
1331 SVGPathSegList: 0,
1332 SVGPointList: 0,
1333 SVGStringList: 0,
1334 SVGTransformList: 0,
1335 SourceBufferList: 0,
1336 StyleSheetList: 0,
1337 TextTrackCueList: 0,
1338 TextTrackList: 0,
1339 TouchList: 0
1340 };
1341
1342 var $forEach = arrayIteration.forEach;
1343
1344
1345 // `Array.prototype.forEach` method implementation
1346 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1347 var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
1348 return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1349 } : [].forEach;
1350
1351 for (var COLLECTION_NAME in domIterables) {
1352 var Collection = global_1[COLLECTION_NAME];
1353 var CollectionPrototype = Collection && Collection.prototype;
1354 // some Chrome versions have non-configurable methods on DOMTokenList
1355 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
1356 createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
1357 } catch (error) {
1358 CollectionPrototype.forEach = arrayForEach;
1359 }
1360 }
1361
1362 function _typeof(obj) {
1363 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1364 _typeof = function (obj) {
1365 return typeof obj;
1366 };
1367 } else {
1368 _typeof = function (obj) {
1369 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1370 };
1371 }
1372
1373 return _typeof(obj);
1374 }
1375
1376 function _classCallCheck(instance, Constructor) {
1377 if (!(instance instanceof Constructor)) {
1378 throw new TypeError("Cannot call a class as a function");
1379 }
1380 }
1381
1382 function _defineProperties(target, props) {
1383 for (var i = 0; i < props.length; i++) {
1384 var descriptor = props[i];
1385 descriptor.enumerable = descriptor.enumerable || false;
1386 descriptor.configurable = true;
1387 if ("value" in descriptor) descriptor.writable = true;
1388 Object.defineProperty(target, descriptor.key, descriptor);
1389 }
1390 }
1391
1392 function _createClass(Constructor, protoProps, staticProps) {
1393 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1394 if (staticProps) _defineProperties(Constructor, staticProps);
1395 return Constructor;
1396 }
1397
1398 function _inherits(subClass, superClass) {
1399 if (typeof superClass !== "function" && superClass !== null) {
1400 throw new TypeError("Super expression must either be null or a function");
1401 }
1402
1403 subClass.prototype = Object.create(superClass && superClass.prototype, {
1404 constructor: {
1405 value: subClass,
1406 writable: true,
1407 configurable: true
1408 }
1409 });
1410 if (superClass) _setPrototypeOf(subClass, superClass);
1411 }
1412
1413 function _getPrototypeOf(o) {
1414 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
1415 return o.__proto__ || Object.getPrototypeOf(o);
1416 };
1417 return _getPrototypeOf(o);
1418 }
1419
1420 function _setPrototypeOf(o, p) {
1421 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1422 o.__proto__ = p;
1423 return o;
1424 };
1425
1426 return _setPrototypeOf(o, p);
1427 }
1428
1429 function _assertThisInitialized(self) {
1430 if (self === void 0) {
1431 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1432 }
1433
1434 return self;
1435 }
1436
1437 function _possibleConstructorReturn(self, call) {
1438 if (call && (typeof call === "object" || typeof call === "function")) {
1439 return call;
1440 }
1441
1442 return _assertThisInitialized(self);
1443 }
1444
1445 function _superPropBase(object, property) {
1446 while (!Object.prototype.hasOwnProperty.call(object, property)) {
1447 object = _getPrototypeOf(object);
1448 if (object === null) break;
1449 }
1450
1451 return object;
1452 }
1453
1454 function _get(target, property, receiver) {
1455 if (typeof Reflect !== "undefined" && Reflect.get) {
1456 _get = Reflect.get;
1457 } else {
1458 _get = function _get(target, property, receiver) {
1459 var base = _superPropBase(target, property);
1460
1461 if (!base) return;
1462 var desc = Object.getOwnPropertyDescriptor(base, property);
1463
1464 if (desc.get) {
1465 return desc.get.call(receiver);
1466 }
1467
1468 return desc.value;
1469 };
1470 }
1471
1472 return _get(target, property, receiver || target);
1473 }
1474
1475 function _toConsumableArray(arr) {
1476 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
1477 }
1478
1479 function _arrayWithoutHoles(arr) {
1480 if (Array.isArray(arr)) {
1481 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1482
1483 return arr2;
1484 }
1485 }
1486
1487 function _iterableToArray(iter) {
1488 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
1489 }
1490
1491 function _nonIterableSpread() {
1492 throw new TypeError("Invalid attempt to spread non-iterable instance");
1493 }
1494
1495 var nativeJoin = [].join;
1496
1497 var ES3_STRINGS = indexedObject != Object;
1498 var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
1499
1500 // `Array.prototype.join` method
1501 // https://tc39.github.io/ecma262/#sec-array.prototype.join
1502 _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
1503 join: function join(separator) {
1504 return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
1505 }
1506 });
1507
1508 var test$1 = [];
1509 var nativeSort = test$1.sort;
1510
1511 // IE8-
1512 var FAILS_ON_UNDEFINED = fails(function () {
1513 test$1.sort(undefined);
1514 });
1515 // V8 bug
1516 var FAILS_ON_NULL = fails(function () {
1517 test$1.sort(null);
1518 });
1519 // Old WebKit
1520 var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
1521
1522 var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
1523
1524 // `Array.prototype.sort` method
1525 // https://tc39.github.io/ecma262/#sec-array.prototype.sort
1526 _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
1527 sort: function sort(comparefn) {
1528 return comparefn === undefined
1529 ? nativeSort.call(toObject(this))
1530 : nativeSort.call(toObject(this), aFunction$1(comparefn));
1531 }
1532 });
1533
1534 var SPECIES$2 = wellKnownSymbol('species');
1535
1536 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
1537 // #replace needs built-in support for named groups.
1538 // #match works fine because it just return the exec results, even if it has
1539 // a "grops" property.
1540 var re = /./;
1541 re.exec = function () {
1542 var result = [];
1543 result.groups = { a: '7' };
1544 return result;
1545 };
1546 return ''.replace(re, '$<a>') !== '7';
1547 });
1548
1549 // IE <= 11 replaces $0 with the whole match, as if it was $&
1550 // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
1551 var REPLACE_KEEPS_$0 = (function () {
1552 return 'a'.replace(/./, '$0') === '$0';
1553 })();
1554
1555 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1556 // Weex JS has frozen built-in prototypes, so use try / catch wrapper
1557 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
1558 var re = /(?:)/;
1559 var originalExec = re.exec;
1560 re.exec = function () { return originalExec.apply(this, arguments); };
1561 var result = 'ab'.split(re);
1562 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
1563 });
1564
1565 var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
1566 var SYMBOL = wellKnownSymbol(KEY);
1567
1568 var DELEGATES_TO_SYMBOL = !fails(function () {
1569 // String methods call symbol-named RegEp methods
1570 var O = {};
1571 O[SYMBOL] = function () { return 7; };
1572 return ''[KEY](O) != 7;
1573 });
1574
1575 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
1576 // Symbol-named RegExp methods call .exec
1577 var execCalled = false;
1578 var re = /a/;
1579
1580 if (KEY === 'split') {
1581 // We can't use real regex here since it causes deoptimization
1582 // and serious performance degradation in V8
1583 // https://github.com/zloirock/core-js/issues/306
1584 re = {};
1585 // RegExp[@@split] doesn't call the regex's exec method, but first creates
1586 // a new one. We need to return the patched regex when creating the new one.
1587 re.constructor = {};
1588 re.constructor[SPECIES$2] = function () { return re; };
1589 re.flags = '';
1590 re[SYMBOL] = /./[SYMBOL];
1591 }
1592
1593 re.exec = function () { execCalled = true; return null; };
1594
1595 re[SYMBOL]('');
1596 return !execCalled;
1597 });
1598
1599 if (
1600 !DELEGATES_TO_SYMBOL ||
1601 !DELEGATES_TO_EXEC ||
1602 (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
1603 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
1604 ) {
1605 var nativeRegExpMethod = /./[SYMBOL];
1606 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
1607 if (regexp.exec === regexpExec) {
1608 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
1609 // The native String method already delegates to @@method (this
1610 // polyfilled function), leasing to infinite recursion.
1611 // We avoid it by directly calling the native @@method method.
1612 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
1613 }
1614 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
1615 }
1616 return { done: false };
1617 }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
1618 var stringMethod = methods[0];
1619 var regexMethod = methods[1];
1620
1621 redefine(String.prototype, KEY, stringMethod);
1622 redefine(RegExp.prototype, SYMBOL, length == 2
1623 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
1624 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
1625 ? function (string, arg) { return regexMethod.call(string, this, arg); }
1626 // 21.2.5.6 RegExp.prototype[@@match](string)
1627 // 21.2.5.9 RegExp.prototype[@@search](string)
1628 : function (string) { return regexMethod.call(string, this); }
1629 );
1630 }
1631
1632 if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
1633 };
1634
1635 // `String.prototype.{ codePointAt, at }` methods implementation
1636 var createMethod$3 = function (CONVERT_TO_STRING) {
1637 return function ($this, pos) {
1638 var S = String(requireObjectCoercible($this));
1639 var position = toInteger(pos);
1640 var size = S.length;
1641 var first, second;
1642 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1643 first = S.charCodeAt(position);
1644 return first < 0xD800 || first > 0xDBFF || position + 1 === size
1645 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
1646 ? CONVERT_TO_STRING ? S.charAt(position) : first
1647 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1648 };
1649 };
1650
1651 var stringMultibyte = {
1652 // `String.prototype.codePointAt` method
1653 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1654 codeAt: createMethod$3(false),
1655 // `String.prototype.at` method
1656 // https://github.com/mathiasbynens/String.prototype.at
1657 charAt: createMethod$3(true)
1658 };
1659
1660 var charAt = stringMultibyte.charAt;
1661
1662 // `AdvanceStringIndex` abstract operation
1663 // https://tc39.github.io/ecma262/#sec-advancestringindex
1664 var advanceStringIndex = function (S, index, unicode) {
1665 return index + (unicode ? charAt(S, index).length : 1);
1666 };
1667
1668 // `RegExpExec` abstract operation
1669 // https://tc39.github.io/ecma262/#sec-regexpexec
1670 var regexpExecAbstract = function (R, S) {
1671 var exec = R.exec;
1672 if (typeof exec === 'function') {
1673 var result = exec.call(R, S);
1674 if (typeof result !== 'object') {
1675 throw TypeError('RegExp exec method returned something other than an Object or null');
1676 }
1677 return result;
1678 }
1679
1680 if (classofRaw(R) !== 'RegExp') {
1681 throw TypeError('RegExp#exec called on incompatible receiver');
1682 }
1683
1684 return regexpExec.call(R, S);
1685 };
1686
1687 // @@match logic
1688 fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
1689 return [
1690 // `String.prototype.match` method
1691 // https://tc39.github.io/ecma262/#sec-string.prototype.match
1692 function match(regexp) {
1693 var O = requireObjectCoercible(this);
1694 var matcher = regexp == undefined ? undefined : regexp[MATCH];
1695 return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
1696 },
1697 // `RegExp.prototype[@@match]` method
1698 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
1699 function (regexp) {
1700 var res = maybeCallNative(nativeMatch, regexp, this);
1701 if (res.done) return res.value;
1702
1703 var rx = anObject(regexp);
1704 var S = String(this);
1705
1706 if (!rx.global) return regexpExecAbstract(rx, S);
1707
1708 var fullUnicode = rx.unicode;
1709 rx.lastIndex = 0;
1710 var A = [];
1711 var n = 0;
1712 var result;
1713 while ((result = regexpExecAbstract(rx, S)) !== null) {
1714 var matchStr = String(result[0]);
1715 A[n] = matchStr;
1716 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1717 n++;
1718 }
1719 return n === 0 ? null : A;
1720 }
1721 ];
1722 });
1723
1724 var max$1 = Math.max;
1725 var min$2 = Math.min;
1726 var floor$1 = Math.floor;
1727 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
1728 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
1729
1730 var maybeToString = function (it) {
1731 return it === undefined ? it : String(it);
1732 };
1733
1734 // @@replace logic
1735 fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
1736 return [
1737 // `String.prototype.replace` method
1738 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
1739 function replace(searchValue, replaceValue) {
1740 var O = requireObjectCoercible(this);
1741 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
1742 return replacer !== undefined
1743 ? replacer.call(searchValue, O, replaceValue)
1744 : nativeReplace.call(String(O), searchValue, replaceValue);
1745 },
1746 // `RegExp.prototype[@@replace]` method
1747 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
1748 function (regexp, replaceValue) {
1749 if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
1750 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
1751 if (res.done) return res.value;
1752 }
1753
1754 var rx = anObject(regexp);
1755 var S = String(this);
1756
1757 var functionalReplace = typeof replaceValue === 'function';
1758 if (!functionalReplace) replaceValue = String(replaceValue);
1759
1760 var global = rx.global;
1761 if (global) {
1762 var fullUnicode = rx.unicode;
1763 rx.lastIndex = 0;
1764 }
1765 var results = [];
1766 while (true) {
1767 var result = regexpExecAbstract(rx, S);
1768 if (result === null) break;
1769
1770 results.push(result);
1771 if (!global) break;
1772
1773 var matchStr = String(result[0]);
1774 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1775 }
1776
1777 var accumulatedResult = '';
1778 var nextSourcePosition = 0;
1779 for (var i = 0; i < results.length; i++) {
1780 result = results[i];
1781
1782 var matched = String(result[0]);
1783 var position = max$1(min$2(toInteger(result.index), S.length), 0);
1784 var captures = [];
1785 // NOTE: This is equivalent to
1786 // captures = result.slice(1).map(maybeToString)
1787 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
1788 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
1789 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
1790 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
1791 var namedCaptures = result.groups;
1792 if (functionalReplace) {
1793 var replacerArgs = [matched].concat(captures, position, S);
1794 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
1795 var replacement = String(replaceValue.apply(undefined, replacerArgs));
1796 } else {
1797 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
1798 }
1799 if (position >= nextSourcePosition) {
1800 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
1801 nextSourcePosition = position + matched.length;
1802 }
1803 }
1804 return accumulatedResult + S.slice(nextSourcePosition);
1805 }
1806 ];
1807
1808 // https://tc39.github.io/ecma262/#sec-getsubstitution
1809 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
1810 var tailPos = position + matched.length;
1811 var m = captures.length;
1812 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
1813 if (namedCaptures !== undefined) {
1814 namedCaptures = toObject(namedCaptures);
1815 symbols = SUBSTITUTION_SYMBOLS;
1816 }
1817 return nativeReplace.call(replacement, symbols, function (match, ch) {
1818 var capture;
1819 switch (ch.charAt(0)) {
1820 case '$': return '$';
1821 case '&': return matched;
1822 case '`': return str.slice(0, position);
1823 case "'": return str.slice(tailPos);
1824 case '<':
1825 capture = namedCaptures[ch.slice(1, -1)];
1826 break;
1827 default: // \d\d?
1828 var n = +ch;
1829 if (n === 0) return match;
1830 if (n > m) {
1831 var f = floor$1(n / 10);
1832 if (f === 0) return match;
1833 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
1834 return match;
1835 }
1836 capture = captures[n - 1];
1837 }
1838 return capture === undefined ? '' : capture;
1839 });
1840 }
1841 });
1842
1843 var SPECIES$3 = wellKnownSymbol('species');
1844
1845 // `SpeciesConstructor` abstract operation
1846 // https://tc39.github.io/ecma262/#sec-speciesconstructor
1847 var speciesConstructor = function (O, defaultConstructor) {
1848 var C = anObject(O).constructor;
1849 var S;
1850 return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction$1(S);
1851 };
1852
1853 var arrayPush = [].push;
1854 var min$3 = Math.min;
1855 var MAX_UINT32 = 0xFFFFFFFF;
1856
1857 // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
1858 var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
1859
1860 // @@split logic
1861 fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
1862 var internalSplit;
1863 if (
1864 'abbc'.split(/(b)*/)[1] == 'c' ||
1865 'test'.split(/(?:)/, -1).length != 4 ||
1866 'ab'.split(/(?:ab)*/).length != 2 ||
1867 '.'.split(/(.?)(.?)/).length != 4 ||
1868 '.'.split(/()()/).length > 1 ||
1869 ''.split(/.?/).length
1870 ) {
1871 // based on es5-shim implementation, need to rework it
1872 internalSplit = function (separator, limit) {
1873 var string = String(requireObjectCoercible(this));
1874 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1875 if (lim === 0) return [];
1876 if (separator === undefined) return [string];
1877 // If `separator` is not a regex, use native split
1878 if (!isRegexp(separator)) {
1879 return nativeSplit.call(string, separator, lim);
1880 }
1881 var output = [];
1882 var flags = (separator.ignoreCase ? 'i' : '') +
1883 (separator.multiline ? 'm' : '') +
1884 (separator.unicode ? 'u' : '') +
1885 (separator.sticky ? 'y' : '');
1886 var lastLastIndex = 0;
1887 // Make `global` and avoid `lastIndex` issues by working with a copy
1888 var separatorCopy = new RegExp(separator.source, flags + 'g');
1889 var match, lastIndex, lastLength;
1890 while (match = regexpExec.call(separatorCopy, string)) {
1891 lastIndex = separatorCopy.lastIndex;
1892 if (lastIndex > lastLastIndex) {
1893 output.push(string.slice(lastLastIndex, match.index));
1894 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
1895 lastLength = match[0].length;
1896 lastLastIndex = lastIndex;
1897 if (output.length >= lim) break;
1898 }
1899 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
1900 }
1901 if (lastLastIndex === string.length) {
1902 if (lastLength || !separatorCopy.test('')) output.push('');
1903 } else output.push(string.slice(lastLastIndex));
1904 return output.length > lim ? output.slice(0, lim) : output;
1905 };
1906 // Chakra, V8
1907 } else if ('0'.split(undefined, 0).length) {
1908 internalSplit = function (separator, limit) {
1909 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
1910 };
1911 } else internalSplit = nativeSplit;
1912
1913 return [
1914 // `String.prototype.split` method
1915 // https://tc39.github.io/ecma262/#sec-string.prototype.split
1916 function split(separator, limit) {
1917 var O = requireObjectCoercible(this);
1918 var splitter = separator == undefined ? undefined : separator[SPLIT];
1919 return splitter !== undefined
1920 ? splitter.call(separator, O, limit)
1921 : internalSplit.call(String(O), separator, limit);
1922 },
1923 // `RegExp.prototype[@@split]` method
1924 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
1925 //
1926 // NOTE: This cannot be properly polyfilled in engines that don't support
1927 // the 'y' flag.
1928 function (regexp, limit) {
1929 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
1930 if (res.done) return res.value;
1931
1932 var rx = anObject(regexp);
1933 var S = String(this);
1934 var C = speciesConstructor(rx, RegExp);
1935
1936 var unicodeMatching = rx.unicode;
1937 var flags = (rx.ignoreCase ? 'i' : '') +
1938 (rx.multiline ? 'm' : '') +
1939 (rx.unicode ? 'u' : '') +
1940 (SUPPORTS_Y ? 'y' : 'g');
1941
1942 // ^(? + rx + ) is needed, in combination with some S slicing, to
1943 // simulate the 'y' flag.
1944 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
1945 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1946 if (lim === 0) return [];
1947 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
1948 var p = 0;
1949 var q = 0;
1950 var A = [];
1951 while (q < S.length) {
1952 splitter.lastIndex = SUPPORTS_Y ? q : 0;
1953 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
1954 var e;
1955 if (
1956 z === null ||
1957 (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
1958 ) {
1959 q = advanceStringIndex(S, q, unicodeMatching);
1960 } else {
1961 A.push(S.slice(p, q));
1962 if (A.length === lim) return A;
1963 for (var i = 1; i <= z.length - 1; i++) {
1964 A.push(z[i]);
1965 if (A.length === lim) return A;
1966 }
1967 q = p = e;
1968 }
1969 }
1970 A.push(S.slice(p));
1971 return A;
1972 }
1973 ];
1974 }, !SUPPORTS_Y);
1975
1976 var Utils = $.fn.bootstrapTable.utils;
1977 var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
1978 function getOptionsFromSelectControl(selectControl) {
1979 return selectControl.get(selectControl.length - 1).options;
1980 }
1981 function getControlContainer(that) {
1982 if (that.options.filterControlContainer) {
1983 return $("".concat(that.options.filterControlContainer));
1984 }
1985
1986 return that.$header;
1987 }
1988 function getSearchControls(that) {
1989 return getControlContainer(that).find(searchControls);
1990 }
1991 function hideUnusedSelectOptions(selectControl, uniqueValues) {
1992 var options = getOptionsFromSelectControl(selectControl);
1993
1994 for (var i = 0; i < options.length; i++) {
1995 if (options[i].value !== '') {
1996 if (!uniqueValues.hasOwnProperty(options[i].value)) {
1997 selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
1998 } else {
1999 selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
2000 }
2001 }
2002 }
2003 }
2004 function existOptionInSelectControl(selectControl, value) {
2005 var options = getOptionsFromSelectControl(selectControl);
2006
2007 for (var i = 0; i < options.length; i++) {
2008 if (options[i].value === Utils.unescapeHTML(value.toString())) {
2009 // The value is not valid to add
2010 return true;
2011 }
2012 } // If we get here, the value is valid to add
2013
2014
2015 return false;
2016 }
2017 function addOptionToSelectControl(selectControl, _value, text, selected) {
2018 var value = _value === undefined || _value === null ? '' : _value.toString().trim();
2019 var $selectControl = $(selectControl.get(selectControl.length - 1));
2020
2021 if (!existOptionInSelectControl(selectControl, value)) {
2022 var option = $("<option value=\"".concat(value, "\">").concat(text, "</option>"));
2023
2024 if (value === selected) {
2025 option.attr('selected', true);
2026 }
2027
2028 $selectControl.append(option);
2029 }
2030 }
2031 function sortSelectControl(selectControl, orderBy) {
2032 var $selectControl = $(selectControl.get(selectControl.length - 1));
2033 var $opts = $selectControl.find('option:gt(0)');
2034
2035 if (orderBy !== 'server') {
2036 $opts.sort(function (a, b) {
2037 return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
2038 });
2039 }
2040
2041 $selectControl.find('option:gt(0)').remove();
2042 $selectControl.append($opts);
2043 }
2044 function fixHeaderCSS(_ref) {
2045 var $tableHeader = _ref.$tableHeader;
2046 $tableHeader.css('height', '89px');
2047 }
2048 function getElementClass($element) {
2049 return $element.attr('class').replace('form-control', '').replace('focus-temp', '').replace('search-input', '').trim();
2050 }
2051 function getCursorPosition(el) {
2052 if (Utils.isIEBrowser()) {
2053 if ($(el).is('input[type=text]')) {
2054 var pos = 0;
2055
2056 if ('selectionStart' in el) {
2057 pos = el.selectionStart;
2058 } else if ('selection' in document) {
2059 el.focus();
2060 var Sel = document.selection.createRange();
2061 var SelLength = document.selection.createRange().text.length;
2062 Sel.moveStart('character', -el.value.length);
2063 pos = Sel.text.length - SelLength;
2064 }
2065
2066 return pos;
2067 }
2068
2069 return -1;
2070 }
2071
2072 return -1;
2073 }
2074 function setCursorPosition(el) {
2075 $(el).val(el.value);
2076 }
2077 function copyValues(that) {
2078 var searchControls = getSearchControls(that);
2079 that.options.valuesFilterControl = [];
2080 searchControls.each(function () {
2081 var $field = $(this);
2082
2083 if (that.options.height) {
2084 var fieldClass = getElementClass($field);
2085 $field = $(".fixed-table-header .".concat(fieldClass));
2086 }
2087
2088 that.options.valuesFilterControl.push({
2089 field: $field.closest('[data-field]').data('field'),
2090 value: $field.val(),
2091 position: getCursorPosition($field.get(0)),
2092 hasFocus: $field.is(':focus')
2093 });
2094 });
2095 }
2096 function setValues(that) {
2097 var field = null;
2098 var result = [];
2099 var searchControls = getSearchControls(that);
2100
2101 if (that.options.valuesFilterControl.length > 0) {
2102 // Callback to apply after settings fields values
2103 var fieldToFocusCallback = null;
2104 searchControls.each(function (i, el) {
2105 var $this = $(el);
2106 field = $this.closest('[data-field]').data('field');
2107 result = that.options.valuesFilterControl.filter(function (valueObj) {
2108 return valueObj.field === field;
2109 });
2110
2111 if (result.length > 0) {
2112 if ($this.is('[type=radio]')) {
2113 return;
2114 }
2115
2116 $this.val(result[0].value);
2117
2118 if (result[0].hasFocus && result[0].value !== '') {
2119 // set callback if the field had the focus.
2120 fieldToFocusCallback = function (fieldToFocus, carretPosition) {
2121 // Closure here to capture the field and cursor position
2122 var closedCallback = function closedCallback() {
2123 fieldToFocus.focus();
2124 setCursorPosition(fieldToFocus);
2125 };
2126
2127 return closedCallback;
2128 }($this.get(0), result[0].position);
2129 }
2130 }
2131 }); // Callback call.
2132
2133 if (fieldToFocusCallback !== null) {
2134 fieldToFocusCallback();
2135 }
2136 }
2137 }
2138 function collectBootstrapCookies() {
2139 var cookies = [];
2140 var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
2141 var foundLocalStorage = localStorage;
2142
2143 if (foundCookies) {
2144 $.each(foundCookies, function (i, _cookie) {
2145 var cookie = _cookie;
2146
2147 if (/./.test(cookie)) {
2148 cookie = cookie.split('.').pop();
2149 }
2150
2151 if ($.inArray(cookie, cookies) === -1) {
2152 cookies.push(cookie);
2153 }
2154 });
2155 }
2156
2157 if (foundLocalStorage) {
2158 for (var i = 0; i < foundLocalStorage.length; i++) {
2159 var cookie = foundLocalStorage.key(i);
2160
2161 if (/./.test(cookie)) {
2162 cookie = cookie.split('.').pop();
2163 }
2164
2165 if (!cookies.includes(cookie)) {
2166 cookies.push(cookie);
2167 }
2168 }
2169 }
2170
2171 return cookies;
2172 }
2173 function escapeID(id) {
2174 // eslint-disable-next-line no-useless-escape
2175 return String(id).replace(/([:.\[\],])/g, '\\$1');
2176 }
2177 function isColumnSearchableViaSelect(_ref2) {
2178 var filterControl = _ref2.filterControl,
2179 searchable = _ref2.searchable;
2180 return filterControl && filterControl.toLowerCase() === 'select' && searchable;
2181 }
2182 function isFilterDataNotGiven(_ref3) {
2183 var filterData = _ref3.filterData;
2184 return filterData === undefined || filterData.toLowerCase() === 'column';
2185 }
2186 function hasSelectControlElement(selectControl) {
2187 return selectControl && selectControl.length > 0;
2188 }
2189 function initFilterSelectControls(that) {
2190 var data = that.data;
2191 var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
2192 $.each(that.header.fields, function (j, field) {
2193 var column = that.columns[that.fieldsColumnsIndex[field]];
2194 var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
2195
2196 if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
2197 if (selectControl.get(selectControl.length - 1).options.length === 0) {
2198 // Added the default option
2199 addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
2200 }
2201
2202 var uniqueValues = {};
2203
2204 for (var i = 0; i < z; i++) {
2205 // Added a new value
2206 var fieldValue = data[i][field];
2207 var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
2208 var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
2209
2210 if (column.filterDataCollector) {
2211 formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
2212 }
2213
2214 if (column.searchFormatter) {
2215 fieldValue = formattedValue;
2216 }
2217
2218 uniqueValues[formattedValue] = fieldValue;
2219
2220 if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
2221 formattedValue.forEach(function (value) {
2222 addOptionToSelectControl(selectControl, value, value, column.filterDefault);
2223 });
2224 continue;
2225 } // eslint-disable-next-line guard-for-in
2226
2227
2228 for (var key in uniqueValues) {
2229 addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
2230 }
2231 }
2232
2233 sortSelectControl(selectControl, column.filterOrderBy);
2234
2235 if (that.options.hideUnusedSelectOptions) {
2236 hideUnusedSelectOptions(selectControl, uniqueValues);
2237 }
2238 }
2239 });
2240 }
2241 function getFilterDataMethod(objFilterDataMethod, searchTerm) {
2242 var keys = Object.keys(objFilterDataMethod);
2243
2244 for (var i = 0; i < keys.length; i++) {
2245 if (keys[i] === searchTerm) {
2246 return objFilterDataMethod[searchTerm];
2247 }
2248 }
2249
2250 return null;
2251 }
2252 function createControls(that, header) {
2253 var addedFilterControl = false;
2254 var html;
2255 $.each(that.columns, function (_, column) {
2256 html = [];
2257
2258 if (!column.visible) {
2259 return;
2260 }
2261
2262 if (!column.filterControl && !that.options.filterControlContainer) {
2263 html.push('<div class="no-filter-control"></div>');
2264 } else if (that.options.filterControlContainer) {
2265 var $filterControls = $(".bootstrap-table-filter-control-".concat(column.field));
2266 $.each($filterControls, function (_, filterControl) {
2267 var $filterControl = $(filterControl);
2268
2269 if (!$filterControl.is('[type=radio]')) {
2270 var placeholder = column.filterControlPlaceholder ? column.filterControlPlaceholder : '';
2271 $filterControl.attr('placeholder', placeholder).val(column.filterDefault);
2272 }
2273
2274 $filterControl.attr('data-field', column.field);
2275 });
2276 addedFilterControl = true;
2277 } else {
2278 var nameControl = column.filterControl.toLowerCase();
2279 html.push('<div class="filter-control">');
2280 addedFilterControl = true;
2281
2282 if (column.searchable && that.options.filterTemplate[nameControl]) {
2283 html.push(that.options.filterTemplate[nameControl](that, column.field, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
2284 }
2285 }
2286
2287 if (!column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
2288 if ($.isEmptyObject(that.filterColumnsPartial)) {
2289 that.filterColumnsPartial = {};
2290 }
2291
2292 that.filterColumnsPartial[column.field] = column.filterDefault;
2293 }
2294
2295 $.each(header.find('th'), function (i, th) {
2296 var $th = $(th);
2297
2298 if ($th.data('field') === column.field) {
2299 $th.find('.fht-cell').append(html.join(''));
2300 return false;
2301 }
2302 });
2303
2304 if (column.filterData && column.filterData.toLowerCase() !== 'column') {
2305 var filterDataType = getFilterDataMethod(
2306 /* eslint-disable no-use-before-define */
2307 filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
2308 var filterDataSource;
2309 var selectControl;
2310
2311 if (filterDataType) {
2312 filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
2313 selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
2314 addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
2315 filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
2316 } else {
2317 throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, obj, json, url, func.' + ' Use like this: var: {key: "value"}');
2318 }
2319 }
2320 });
2321
2322 if (addedFilterControl) {
2323 header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
2324 var currentTarget = _ref4.currentTarget,
2325 keyCode = _ref4.keyCode;
2326 syncControls(that); // Simulate enter key action from clear button
2327
2328 keyCode = obj ? obj.keyCode : keyCode;
2329
2330 if (that.options.searchOnEnterKey && keyCode !== 13) {
2331 return;
2332 }
2333
2334 if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
2335 return;
2336 }
2337
2338 var $currentTarget = $(currentTarget);
2339
2340 if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
2341 return;
2342 }
2343
2344 clearTimeout(currentTarget.timeoutId || 0);
2345 currentTarget.timeoutId = setTimeout(function () {
2346 that.onColumnSearch({
2347 currentTarget: currentTarget,
2348 keyCode: keyCode
2349 });
2350 }, that.options.searchTimeOut);
2351 });
2352 header.off('change', 'select:not(".ms-offscreen")').on('change', 'select:not(".ms-offscreen")', function (_ref5) {
2353 var currentTarget = _ref5.currentTarget,
2354 keyCode = _ref5.keyCode;
2355 syncControls(that);
2356 var $select = $(currentTarget);
2357 var value = $select.val();
2358
2359 if (value && value.length > 0 && value.trim()) {
2360 $select.find('option[selected]').removeAttr('selected');
2361 $select.find("option[value=\"".concat(value, "\"]")).attr('selected', true);
2362 } else {
2363 $select.find('option[selected]').removeAttr('selected');
2364 }
2365
2366 clearTimeout(currentTarget.timeoutId || 0);
2367 currentTarget.timeoutId = setTimeout(function () {
2368 that.onColumnSearch({
2369 currentTarget: currentTarget,
2370 keyCode: keyCode
2371 });
2372 }, that.options.searchTimeOut);
2373 });
2374 header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
2375 var currentTarget = _ref6.currentTarget,
2376 keyCode = _ref6.keyCode;
2377 var $input = $(currentTarget);
2378 var oldValue = $input.val();
2379
2380 if (oldValue === '') {
2381 return;
2382 }
2383
2384 setTimeout(function () {
2385 syncControls(that);
2386 var newValue = $input.val();
2387
2388 if (newValue === '') {
2389 clearTimeout(currentTarget.timeoutId || 0);
2390 currentTarget.timeoutId = setTimeout(function () {
2391 that.onColumnSearch({
2392 currentTarget: currentTarget,
2393 keyCode: keyCode
2394 });
2395 }, that.options.searchTimeOut);
2396 }
2397 }, 1);
2398 });
2399 header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
2400 var currentTarget = _ref7.currentTarget,
2401 keyCode = _ref7.keyCode;
2402 clearTimeout(currentTarget.timeoutId || 0);
2403 currentTarget.timeoutId = setTimeout(function () {
2404 syncControls(that);
2405 that.onColumnSearch({
2406 currentTarget: currentTarget,
2407 keyCode: keyCode
2408 });
2409 }, that.options.searchTimeOut);
2410 });
2411
2412 if (header.find('.date-filter-control').length > 0) {
2413 $.each(that.columns, function (i, _ref8) {
2414 var filterDefault = _ref8.filterDefault,
2415 filterControl = _ref8.filterControl,
2416 field = _ref8.field,
2417 filterDatepickerOptions = _ref8.filterDatepickerOptions;
2418
2419 if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
2420 var $datepicker = header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field));
2421 $datepicker.datepicker(filterDatepickerOptions);
2422
2423 if (filterDefault) {
2424 $datepicker.datepicker('setDate', filterDefault);
2425 }
2426
2427 $datepicker.on('changeDate', function (_ref9) {
2428 var currentTarget = _ref9.currentTarget,
2429 keyCode = _ref9.keyCode;
2430 clearTimeout(currentTarget.timeoutId || 0);
2431 currentTarget.timeoutId = setTimeout(function () {
2432 syncControls(that);
2433 that.onColumnSearch({
2434 currentTarget: currentTarget,
2435 keyCode: keyCode
2436 });
2437 }, that.options.searchTimeOut);
2438 });
2439 }
2440 });
2441 }
2442
2443 if (that.options.sidePagination !== 'server' && !that.options.height) {
2444 that.triggerSearch();
2445 }
2446
2447 if (!that.options.filterControlVisible) {
2448 header.find('.filter-control, .no-filter-control').hide();
2449 }
2450 } else {
2451 header.find('.filter-control, .no-filter-control').hide();
2452 }
2453
2454 that.trigger('created-controls');
2455 }
2456 function getDirectionOfSelectOptions(_alignment) {
2457 var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
2458
2459 switch (alignment) {
2460 case 'left':
2461 return 'ltr';
2462
2463 case 'right':
2464 return 'rtl';
2465
2466 case 'auto':
2467 return 'auto';
2468
2469 default:
2470 return 'ltr';
2471 }
2472 }
2473 function syncControls(that) {
2474 if (that.options.height) {
2475 var controlsTableHeader = that.$tableHeader.find(searchControls);
2476 that.$header.find(searchControls).each(function (_, control) {
2477 var $control = $(control);
2478 var controlClass = getElementClass($control);
2479 var foundControl = controlsTableHeader.filter(function (_, ele) {
2480 var eleClass = getElementClass($(ele));
2481 return controlClass === eleClass;
2482 });
2483
2484 if (foundControl.length === 0) {
2485 return;
2486 }
2487
2488 if ($control.is('select')) {
2489 $control.find('option:selected').removeAttr('selected');
2490 $control.find("option[value='".concat(foundControl.val(), "']")).attr('selected', true);
2491 } else {
2492 $control.val(foundControl.val());
2493 }
2494 });
2495 }
2496 }
2497 var filterDataMethods = {
2498 func: function func(filterDataSource, selectControl, filterOrderBy, selected) {
2499 var variableValues = window[filterDataSource].apply(); // eslint-disable-next-line guard-for-in
2500
2501 for (var key in variableValues) {
2502 addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2503 }
2504
2505 sortSelectControl(selectControl, filterOrderBy);
2506 },
2507 obj: function obj(filterDataSource, selectControl, filterOrderBy, selected) {
2508 var objectKeys = filterDataSource.split('.');
2509 var variableName = objectKeys.shift();
2510 var variableValues = window[variableName];
2511
2512 if (objectKeys.length > 0) {
2513 objectKeys.forEach(function (key) {
2514 variableValues = variableValues[key];
2515 });
2516 } // eslint-disable-next-line guard-for-in
2517
2518
2519 for (var key in variableValues) {
2520 addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2521 }
2522
2523 sortSelectControl(selectControl, filterOrderBy);
2524 },
2525 var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
2526 var variableValues = window[filterDataSource];
2527 var isArray = Array.isArray(variableValues);
2528
2529 for (var key in variableValues) {
2530 if (isArray) {
2531 addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected);
2532 } else {
2533 addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2534 }
2535 }
2536
2537 sortSelectControl(selectControl, filterOrderBy);
2538 },
2539 url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
2540 $.ajax({
2541 url: filterDataSource,
2542 dataType: 'json',
2543 success: function success(data) {
2544 // eslint-disable-next-line guard-for-in
2545 for (var key in data) {
2546 addOptionToSelectControl(selectControl, key, data[key], selected);
2547 }
2548
2549 sortSelectControl(selectControl, filterOrderBy);
2550 }
2551 });
2552 },
2553 json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
2554 var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
2555
2556 for (var key in variableValues) {
2557 addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2558 }
2559
2560 sortSelectControl(selectControl, filterOrderBy);
2561 }
2562 };
2563
2564 var Utils$1 = $.fn.bootstrapTable.utils;
2565 $.extend($.fn.bootstrapTable.defaults, {
2566 filterControl: false,
2567 filterControlVisible: true,
2568 // eslint-disable-next-line no-unused-vars
2569 onColumnSearch: function onColumnSearch(field, text) {
2570 return false;
2571 },
2572 onCreatedControls: function onCreatedControls() {
2573 return false;
2574 },
2575 alignmentSelectControlOptions: undefined,
2576 filterTemplate: {
2577 input: function input(that, field, placeholder, value) {
2578 return Utils$1.sprintf('<input type="search" class="form-control bootstrap-table-filter-control-%s search-input" style="width: 100%;" placeholder="%s" value="%s">', field, 'undefined' === typeof placeholder ? '' : placeholder, 'undefined' === typeof value ? '' : value);
2579 },
2580 select: function select(_ref, field) {
2581 var options = _ref.options;
2582 return Utils$1.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%;" dir="%s"></select>', field, getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
2583 },
2584 datepicker: function datepicker(that, field, value) {
2585 return Utils$1.sprintf('<input type="text" class="form-control date-filter-control bootstrap-table-filter-control-%s" style="width: 100%;" value="%s">', field, 'undefined' === typeof value ? '' : value);
2586 }
2587 },
2588 disableControlWhenSearch: false,
2589 searchOnEnterKey: false,
2590 showFilterControlSwitch: false,
2591 // internal variables
2592 valuesFilterControl: []
2593 });
2594 $.extend($.fn.bootstrapTable.columnDefaults, {
2595 filterControl: undefined,
2596 // input, select, datepicker
2597 filterDataCollector: undefined,
2598 filterData: undefined,
2599 filterDatepickerOptions: {},
2600 filterStrictSearch: false,
2601 filterStartsWithSearch: false,
2602 filterControlPlaceholder: '',
2603 filterDefault: '',
2604 filterOrderBy: 'asc' // asc || desc
2605
2606 });
2607 $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
2608 'column-search.bs.table': 'onColumnSearch',
2609 'created-controls.bs.table': 'onCreatedControls'
2610 });
2611 $.extend($.fn.bootstrapTable.defaults.icons, {
2612 clear: {
2613 bootstrap3: 'glyphicon-trash icon-clear'
2614 }[$.fn.bootstrapTable.theme] || 'fa-trash',
2615 filterControlSwitchHide: {
2616 bootstrap3: 'glyphicon-zoom-out icon-zoom-out',
2617 materialize: 'zoom_out'
2618 }[$.fn.bootstrapTable.theme] || 'fa-search-minus',
2619 filterControlSwitchShow: {
2620 bootstrap3: 'glyphicon-zoom-in icon-zoom-in',
2621 materialize: 'zoom_in'
2622 }[$.fn.bootstrapTable.theme] || 'fa-search-plus'
2623 });
2624 $.extend($.fn.bootstrapTable.locales, {
2625 formatFilterControlSwitch: function formatFilterControlSwitch() {
2626 return 'Hide/Show controls';
2627 },
2628 formatFilterControlSwitchHide: function formatFilterControlSwitchHide() {
2629 return 'Hide controls';
2630 },
2631 formatFilterControlSwitchShow: function formatFilterControlSwitchShow() {
2632 return 'Show controls';
2633 }
2634 });
2635 $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
2636 $.extend($.fn.bootstrapTable.defaults, {
2637 formatClearSearch: function formatClearSearch() {
2638 return 'Clear filters';
2639 }
2640 });
2641 $.fn.bootstrapTable.methods.push('triggerSearch');
2642 $.fn.bootstrapTable.methods.push('clearFilterControl');
2643 $.fn.bootstrapTable.methods.push('toggleFilterControl');
2644
2645 $.BootstrapTable =
2646 /*#__PURE__*/
2647 function (_$$BootstrapTable) {
2648 _inherits(_class, _$$BootstrapTable);
2649
2650 function _class() {
2651 _classCallCheck(this, _class);
2652
2653 return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
2654 }
2655
2656 _createClass(_class, [{
2657 key: "init",
2658 value: function init() {
2659 var _this = this;
2660
2661 // Make sure that the filterControl option is set
2662 if (this.options.filterControl) {
2663 // Make sure that the internal variables are set correctly
2664 this.options.valuesFilterControl = [];
2665 this.$el.on('reset-view.bs.table', function () {
2666 // Create controls on $tableHeader if the height is set
2667 if (!_this.options.height) {
2668 return;
2669 } // Avoid recreate the controls
2670
2671
2672 var $controlContainer = getControlContainer(_this);
2673
2674 if ($controlContainer.find('select').length > 0 || $controlContainer.find('input:not([type="checkbox"]):not([type="radio"])').length > 0) {
2675 return;
2676 }
2677
2678 createControls(_this, $controlContainer);
2679 }).on('post-header.bs.table', function () {
2680 setValues(_this);
2681 }).on('post-body.bs.table', function () {
2682 if (_this.options.height && !_this.options.filterControlContainer) {
2683 fixHeaderCSS(_this);
2684 }
2685
2686 _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
2687 }).on('column-switch.bs.table', function () {
2688 setValues(_this);
2689 }).on('load-success.bs.table', function () {
2690 _this.enableControls(true);
2691 }).on('load-error.bs.table', function () {
2692 _this.enableControls(true);
2693 });
2694 }
2695
2696 _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
2697 }
2698 }, {
2699 key: "initHeader",
2700 value: function initHeader() {
2701 _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
2702
2703 if (!this.options.filterControl || this.options.height) {
2704 return;
2705 }
2706
2707 createControls(this, getControlContainer(this));
2708 }
2709 }, {
2710 key: "initBody",
2711 value: function initBody() {
2712 _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
2713
2714 syncControls(this);
2715 initFilterSelectControls(this);
2716 }
2717 }, {
2718 key: "initSearch",
2719 value: function initSearch() {
2720 var _this2 = this;
2721
2722 var that = this;
2723 var fp = $.isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
2724
2725 _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
2726
2727 if (this.options.sidePagination === 'server' || fp === null) {
2728 return;
2729 } // Check partial column filter
2730
2731
2732 that.data = fp ? that.data.filter(function (item, i) {
2733 var itemIsExpected = [];
2734 var keys1 = Object.keys(item);
2735 var keys2 = Object.keys(fp);
2736 var keys = keys1.concat(keys2.filter(function (item) {
2737 return !keys1.includes(item);
2738 }));
2739 keys.forEach(function (key) {
2740 var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
2741 var fval = (fp[key] || '').toLowerCase();
2742 var value = Utils$1.unescapeHTML(Utils$1.getItemField(item, key, false));
2743 var tmpItemIsExpected;
2744
2745 if (fval === '') {
2746 tmpItemIsExpected = true;
2747 } else {
2748 // Fix #142: search use formatted data
2749 if (thisColumn && thisColumn.searchFormatter) {
2750 value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value);
2751 }
2752
2753 if ($.inArray(key, that.header.fields) !== -1) {
2754 if (value === undefined || value === null) {
2755 tmpItemIsExpected = false;
2756 } else if (_typeof(value) === 'object') {
2757 value.forEach(function (objectValue) {
2758 if (tmpItemIsExpected) {
2759 return;
2760 }
2761
2762 if (_this2.options.searchAccentNeutralise) {
2763 objectValue = Utils$1.normalizeAccent(objectValue);
2764 }
2765
2766 tmpItemIsExpected = that.isValueExpected(fval, objectValue, thisColumn, key);
2767 });
2768 } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
2769 if (_this2.options.searchAccentNeutralise) {
2770 value = Utils$1.normalizeAccent(value);
2771 }
2772
2773 tmpItemIsExpected = that.isValueExpected(fval, value, thisColumn, key);
2774 }
2775 }
2776 }
2777
2778 itemIsExpected.push(tmpItemIsExpected);
2779 });
2780 return !itemIsExpected.includes(false);
2781 }) : that.data;
2782 that.unsortedData = _toConsumableArray(that.data);
2783 }
2784 }, {
2785 key: "isValueExpected",
2786 value: function isValueExpected(searchValue, value, column, key) {
2787 var tmpItemIsExpected = false;
2788
2789 if (column.filterStrictSearch) {
2790 tmpItemIsExpected = value.toString().toLowerCase() === searchValue.toString().toLowerCase();
2791 } else if (column.filterStartsWithSearch) {
2792 tmpItemIsExpected = "".concat(value).toLowerCase().indexOf(searchValue) === 0;
2793 } else {
2794 tmpItemIsExpected = "".concat(value).toLowerCase().includes(searchValue);
2795 }
2796
2797 var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
2798 var matches = largerSmallerEqualsRegex.exec(searchValue);
2799
2800 if (matches) {
2801 var operator = matches[1] || "".concat(matches[5], "l");
2802 var comparisonValue = matches[2] || matches[3];
2803 var int = parseInt(value, 10);
2804 var comparisonInt = parseInt(comparisonValue, 10);
2805
2806 switch (operator) {
2807 case '>':
2808 case '<l':
2809 tmpItemIsExpected = int > comparisonInt;
2810 break;
2811
2812 case '<':
2813 case '>l':
2814 tmpItemIsExpected = int < comparisonInt;
2815 break;
2816
2817 case '<=':
2818 case '=<':
2819 case '>=l':
2820 case '=>l':
2821 tmpItemIsExpected = int <= comparisonInt;
2822 break;
2823
2824 case '>=':
2825 case '=>':
2826 case '<=l':
2827 case '=<l':
2828 tmpItemIsExpected = int >= comparisonInt;
2829 break;
2830 }
2831 }
2832
2833 if (column.filterCustomSearch) {
2834 var customSearchResult = Utils$1.calculateObjectValue(this, column.filterCustomSearch, [searchValue, value, key, this.options.data], true);
2835
2836 if (customSearchResult !== null) {
2837 tmpItemIsExpected = customSearchResult;
2838 }
2839 }
2840
2841 return tmpItemIsExpected;
2842 }
2843 }, {
2844 key: "initColumnSearch",
2845 value: function initColumnSearch(filterColumnsDefaults) {
2846 copyValues(this);
2847
2848 if (filterColumnsDefaults) {
2849 this.filterColumnsPartial = filterColumnsDefaults;
2850 this.updatePagination(); // eslint-disable-next-line guard-for-in
2851
2852 for (var filter in filterColumnsDefaults) {
2853 this.trigger('column-search', filter, filterColumnsDefaults[filter]);
2854 }
2855 }
2856 }
2857 }, {
2858 key: "onColumnSearch",
2859 value: function onColumnSearch(_ref2) {
2860 var currentTarget = _ref2.currentTarget,
2861 keyCode = _ref2.keyCode;
2862
2863 if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
2864 return;
2865 }
2866
2867 copyValues(this);
2868 var text = $.trim($(currentTarget).val());
2869 var $field = $(currentTarget).closest('[data-field]').data('field');
2870 this.trigger('column-search', $field, text);
2871
2872 if ($.isEmptyObject(this.filterColumnsPartial)) {
2873 this.filterColumnsPartial = {};
2874 }
2875
2876 if (text) {
2877 this.filterColumnsPartial[$field] = text;
2878 } else {
2879 delete this.filterColumnsPartial[$field];
2880 }
2881
2882 this.options.pageNumber = 1;
2883 this.enableControls(false);
2884 this.onSearch({
2885 currentTarget: currentTarget
2886 }, false);
2887 }
2888 }, {
2889 key: "initToolbar",
2890 value: function initToolbar() {
2891 this.showToolbar = this.showToolbar || this.options.showFilterControlSwitch;
2892 this.showSearchClearButton = this.options.filterControl && this.options.showSearchClearButton;
2893
2894 if (this.options.showFilterControlSwitch) {
2895 this.buttons = Object.assign(this.buttons, {
2896 filterControlSwitch: {
2897 text: this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow(),
2898 icon: this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow,
2899 event: this.toggleFilterControl,
2900 attributes: {
2901 'aria-label': this.options.formatFilterControlSwitch(),
2902 title: this.options.formatFilterControlSwitch()
2903 }
2904 }
2905 });
2906 }
2907
2908 _get(_getPrototypeOf(_class.prototype), "initToolbar", this).call(this);
2909 }
2910 }, {
2911 key: "resetSearch",
2912 value: function resetSearch(text) {
2913 if (this.options.filterControl && this.options.showSearchClearButton) {
2914 this.clearFilterControl();
2915 }
2916
2917 _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this, text);
2918 }
2919 }, {
2920 key: "clearFilterControl",
2921 value: function clearFilterControl() {
2922 if (this.options.filterControl) {
2923 var that = this;
2924 var cookies = collectBootstrapCookies();
2925 var table = this.$el.closest('table');
2926 var controls = getSearchControls(that);
2927 var search = Utils$1.getSearchInput(this);
2928 var hasValues = false;
2929 var timeoutId = 0;
2930 $.each(that.options.valuesFilterControl, function (i, item) {
2931 hasValues = hasValues ? true : item.value !== '';
2932 item.value = '';
2933 });
2934 $.each(that.options.filterControls, function (i, item) {
2935 item.text = '';
2936 });
2937 setValues(that); // clear cookies once the filters are clean
2938
2939 clearTimeout(timeoutId);
2940 timeoutId = setTimeout(function () {
2941 if (cookies && cookies.length > 0) {
2942 $.each(cookies, function (i, item) {
2943 if (that.deleteCookie !== undefined) {
2944 that.deleteCookie(item);
2945 }
2946 });
2947 }
2948 }, that.options.searchTimeOut); // If there is not any value in the controls exit this method
2949
2950 if (!hasValues) {
2951 return;
2952 } // Clear each type of filter if it exists.
2953 // Requires the body to reload each time a type of filter is found because we never know
2954 // which ones are going to be present.
2955
2956
2957 if (controls.length > 0) {
2958 this.filterColumnsPartial = {};
2959 $(controls[0]).trigger(controls[0].tagName === 'INPUT' ? 'keyup' : 'change', {
2960 keyCode: 13
2961 });
2962 } else {
2963 return;
2964 }
2965
2966 if (search.length > 0) {
2967 that.resetSearch();
2968 } // use the default sort order if it exists. do nothing if it does not
2969
2970
2971 if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
2972 var sorter = this.$header.find(Utils$1.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
2973
2974 if (sorter.length > 0) {
2975 that.onSort({
2976 type: 'keypress',
2977 currentTarget: sorter
2978 });
2979 $(sorter).find('.sortable').trigger('click');
2980 }
2981 }
2982 }
2983 }
2984 }, {
2985 key: "triggerSearch",
2986 value: function triggerSearch() {
2987 var searchControls = getSearchControls(this);
2988 searchControls.each(function () {
2989 var el = $(this);
2990
2991 if (el.is('select')) {
2992 el.change();
2993 } else {
2994 el.keyup();
2995 }
2996 });
2997 }
2998 }, {
2999 key: "enableControls",
3000 value: function enableControls(enable) {
3001 if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
3002 var searchControls = getSearchControls(this);
3003
3004 if (!enable) {
3005 searchControls.prop('disabled', 'disabled');
3006 } else {
3007 searchControls.removeProp('disabled');
3008 }
3009 }
3010 }
3011 }, {
3012 key: "toggleFilterControl",
3013 value: function toggleFilterControl() {
3014 this.options.filterControlVisible = !this.options.filterControlVisible;
3015 var $filterControls = getControlContainer(this).find('.filter-control, .no-filter-control');
3016
3017 if (this.options.filterControlVisible) {
3018 $filterControls.show();
3019 } else {
3020 $filterControls.hide();
3021 this.clearFilterControl();
3022 }
3023
3024 var icon = this.options.showButtonIcons ? this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow : '';
3025 var text = this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : '';
3026 this.$toolbar.find('>.columns').find('.filter-control-switch').html("".concat(Utils$1.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
3027 }
3028 }]);
3029
3030 return _class;
3031 }($.BootstrapTable);
3032
3033})));