UNPKG

241 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global = global || self, global.BootstrapTable = factory(global.jQuery));
5}(this, function ($) { 'use strict';
6
7 $ = $ && $.hasOwnProperty('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 O = 'object';
16 var check = function (it) {
17 return it && it.Math == Math && it;
18 };
19
20 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
21 var global_1 =
22 // eslint-disable-next-line no-undef
23 check(typeof globalThis == O && globalThis) ||
24 check(typeof window == O && window) ||
25 check(typeof self == O && self) ||
26 check(typeof commonjsGlobal == O && commonjsGlobal) ||
27 // eslint-disable-next-line no-new-func
28 Function('return this')();
29
30 var fails = function (exec) {
31 try {
32 return !!exec();
33 } catch (error) {
34 return true;
35 }
36 };
37
38 // Thank's IE8 for his funny defineProperty
39 var descriptors = !fails(function () {
40 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
41 });
42
43 var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
44 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
45
46 // Nashorn ~ JDK8 bug
47 var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
48
49 // `Object.prototype.propertyIsEnumerable` method implementation
50 // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
51 var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
52 var descriptor = getOwnPropertyDescriptor(this, V);
53 return !!descriptor && descriptor.enumerable;
54 } : nativePropertyIsEnumerable;
55
56 var objectPropertyIsEnumerable = {
57 f: f
58 };
59
60 var createPropertyDescriptor = function (bitmap, value) {
61 return {
62 enumerable: !(bitmap & 1),
63 configurable: !(bitmap & 2),
64 writable: !(bitmap & 4),
65 value: value
66 };
67 };
68
69 var toString = {}.toString;
70
71 var classofRaw = function (it) {
72 return toString.call(it).slice(8, -1);
73 };
74
75 var split = ''.split;
76
77 // fallback for non-array-like ES3 and non-enumerable old V8 strings
78 var indexedObject = fails(function () {
79 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
80 // eslint-disable-next-line no-prototype-builtins
81 return !Object('z').propertyIsEnumerable(0);
82 }) ? function (it) {
83 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
84 } : Object;
85
86 // `RequireObjectCoercible` abstract operation
87 // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
88 var requireObjectCoercible = function (it) {
89 if (it == undefined) throw TypeError("Can't call method on " + it);
90 return it;
91 };
92
93 // toObject with fallback for non-array-like ES3 strings
94
95
96
97 var toIndexedObject = function (it) {
98 return indexedObject(requireObjectCoercible(it));
99 };
100
101 var isObject = function (it) {
102 return typeof it === 'object' ? it !== null : typeof it === 'function';
103 };
104
105 // `ToPrimitive` abstract operation
106 // https://tc39.github.io/ecma262/#sec-toprimitive
107 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
108 // and the second argument - flag - preferred type is a string
109 var toPrimitive = function (input, PREFERRED_STRING) {
110 if (!isObject(input)) return input;
111 var fn, val;
112 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
113 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
114 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
115 throw TypeError("Can't convert object to primitive value");
116 };
117
118 var hasOwnProperty = {}.hasOwnProperty;
119
120 var has = function (it, key) {
121 return hasOwnProperty.call(it, key);
122 };
123
124 var document$1 = global_1.document;
125 // typeof document.createElement is 'object' in old IE
126 var EXISTS = isObject(document$1) && isObject(document$1.createElement);
127
128 var documentCreateElement = function (it) {
129 return EXISTS ? document$1.createElement(it) : {};
130 };
131
132 // Thank's IE8 for his funny defineProperty
133 var ie8DomDefine = !descriptors && !fails(function () {
134 return Object.defineProperty(documentCreateElement('div'), 'a', {
135 get: function () { return 7; }
136 }).a != 7;
137 });
138
139 var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
140
141 // `Object.getOwnPropertyDescriptor` method
142 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
143 var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
144 O = toIndexedObject(O);
145 P = toPrimitive(P, true);
146 if (ie8DomDefine) try {
147 return nativeGetOwnPropertyDescriptor(O, P);
148 } catch (error) { /* empty */ }
149 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
150 };
151
152 var objectGetOwnPropertyDescriptor = {
153 f: f$1
154 };
155
156 var anObject = function (it) {
157 if (!isObject(it)) {
158 throw TypeError(String(it) + ' is not an object');
159 } return it;
160 };
161
162 var nativeDefineProperty = Object.defineProperty;
163
164 // `Object.defineProperty` method
165 // https://tc39.github.io/ecma262/#sec-object.defineproperty
166 var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
167 anObject(O);
168 P = toPrimitive(P, true);
169 anObject(Attributes);
170 if (ie8DomDefine) try {
171 return nativeDefineProperty(O, P, Attributes);
172 } catch (error) { /* empty */ }
173 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
174 if ('value' in Attributes) O[P] = Attributes.value;
175 return O;
176 };
177
178 var objectDefineProperty = {
179 f: f$2
180 };
181
182 var hide = descriptors ? function (object, key, value) {
183 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
184 } : function (object, key, value) {
185 object[key] = value;
186 return object;
187 };
188
189 var setGlobal = function (key, value) {
190 try {
191 hide(global_1, key, value);
192 } catch (error) {
193 global_1[key] = value;
194 } return value;
195 };
196
197 var shared = createCommonjsModule(function (module) {
198 var SHARED = '__core-js_shared__';
199 var store = global_1[SHARED] || setGlobal(SHARED, {});
200
201 (module.exports = function (key, value) {
202 return store[key] || (store[key] = value !== undefined ? value : {});
203 })('versions', []).push({
204 version: '3.1.3',
205 mode: 'global',
206 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
207 });
208 });
209
210 var functionToString = shared('native-function-to-string', Function.toString);
211
212 var WeakMap = global_1.WeakMap;
213
214 var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
215
216 var id = 0;
217 var postfix = Math.random();
218
219 var uid = function (key) {
220 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
221 };
222
223 var keys = shared('keys');
224
225 var sharedKey = function (key) {
226 return keys[key] || (keys[key] = uid(key));
227 };
228
229 var hiddenKeys = {};
230
231 var WeakMap$1 = global_1.WeakMap;
232 var set, get, has$1;
233
234 var enforce = function (it) {
235 return has$1(it) ? get(it) : set(it, {});
236 };
237
238 var getterFor = function (TYPE) {
239 return function (it) {
240 var state;
241 if (!isObject(it) || (state = get(it)).type !== TYPE) {
242 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
243 } return state;
244 };
245 };
246
247 if (nativeWeakMap) {
248 var store = new WeakMap$1();
249 var wmget = store.get;
250 var wmhas = store.has;
251 var wmset = store.set;
252 set = function (it, metadata) {
253 wmset.call(store, it, metadata);
254 return metadata;
255 };
256 get = function (it) {
257 return wmget.call(store, it) || {};
258 };
259 has$1 = function (it) {
260 return wmhas.call(store, it);
261 };
262 } else {
263 var STATE = sharedKey('state');
264 hiddenKeys[STATE] = true;
265 set = function (it, metadata) {
266 hide(it, STATE, metadata);
267 return metadata;
268 };
269 get = function (it) {
270 return has(it, STATE) ? it[STATE] : {};
271 };
272 has$1 = function (it) {
273 return has(it, STATE);
274 };
275 }
276
277 var internalState = {
278 set: set,
279 get: get,
280 has: has$1,
281 enforce: enforce,
282 getterFor: getterFor
283 };
284
285 var redefine = createCommonjsModule(function (module) {
286 var getInternalState = internalState.get;
287 var enforceInternalState = internalState.enforce;
288 var TEMPLATE = String(functionToString).split('toString');
289
290 shared('inspectSource', function (it) {
291 return functionToString.call(it);
292 });
293
294 (module.exports = function (O, key, value, options) {
295 var unsafe = options ? !!options.unsafe : false;
296 var simple = options ? !!options.enumerable : false;
297 var noTargetGet = options ? !!options.noTargetGet : false;
298 if (typeof value == 'function') {
299 if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
300 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
301 }
302 if (O === global_1) {
303 if (simple) O[key] = value;
304 else setGlobal(key, value);
305 return;
306 } else if (!unsafe) {
307 delete O[key];
308 } else if (!noTargetGet && O[key]) {
309 simple = true;
310 }
311 if (simple) O[key] = value;
312 else hide(O, key, value);
313 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
314 })(Function.prototype, 'toString', function toString() {
315 return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
316 });
317 });
318
319 var path = global_1;
320
321 var aFunction = function (variable) {
322 return typeof variable == 'function' ? variable : undefined;
323 };
324
325 var getBuiltIn = function (namespace, method) {
326 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
327 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
328 };
329
330 var ceil = Math.ceil;
331 var floor = Math.floor;
332
333 // `ToInteger` abstract operation
334 // https://tc39.github.io/ecma262/#sec-tointeger
335 var toInteger = function (argument) {
336 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
337 };
338
339 var min = Math.min;
340
341 // `ToLength` abstract operation
342 // https://tc39.github.io/ecma262/#sec-tolength
343 var toLength = function (argument) {
344 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
345 };
346
347 var max = Math.max;
348 var min$1 = Math.min;
349
350 // Helper for a popular repeating case of the spec:
351 // Let integer be ? ToInteger(index).
352 // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
353 var toAbsoluteIndex = function (index, length) {
354 var integer = toInteger(index);
355 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
356 };
357
358 // `Array.prototype.{ indexOf, includes }` methods implementation
359 var createMethod = function (IS_INCLUDES) {
360 return function ($this, el, fromIndex) {
361 var O = toIndexedObject($this);
362 var length = toLength(O.length);
363 var index = toAbsoluteIndex(fromIndex, length);
364 var value;
365 // Array#includes uses SameValueZero equality algorithm
366 // eslint-disable-next-line no-self-compare
367 if (IS_INCLUDES && el != el) while (length > index) {
368 value = O[index++];
369 // eslint-disable-next-line no-self-compare
370 if (value != value) return true;
371 // Array#indexOf ignores holes, Array#includes - not
372 } else for (;length > index; index++) {
373 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
374 } return !IS_INCLUDES && -1;
375 };
376 };
377
378 var arrayIncludes = {
379 // `Array.prototype.includes` method
380 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
381 includes: createMethod(true),
382 // `Array.prototype.indexOf` method
383 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
384 indexOf: createMethod(false)
385 };
386
387 var indexOf = arrayIncludes.indexOf;
388
389
390 var objectKeysInternal = function (object, names) {
391 var O = toIndexedObject(object);
392 var i = 0;
393 var result = [];
394 var key;
395 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
396 // Don't enum bug & hidden keys
397 while (names.length > i) if (has(O, key = names[i++])) {
398 ~indexOf(result, key) || result.push(key);
399 }
400 return result;
401 };
402
403 // IE8- don't enum bug keys
404 var enumBugKeys = [
405 'constructor',
406 'hasOwnProperty',
407 'isPrototypeOf',
408 'propertyIsEnumerable',
409 'toLocaleString',
410 'toString',
411 'valueOf'
412 ];
413
414 var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
415
416 // `Object.getOwnPropertyNames` method
417 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
418 var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
419 return objectKeysInternal(O, hiddenKeys$1);
420 };
421
422 var objectGetOwnPropertyNames = {
423 f: f$3
424 };
425
426 var f$4 = Object.getOwnPropertySymbols;
427
428 var objectGetOwnPropertySymbols = {
429 f: f$4
430 };
431
432 // all object keys, includes non-enumerable and symbols
433 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
434 var keys = objectGetOwnPropertyNames.f(anObject(it));
435 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
436 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
437 };
438
439 var copyConstructorProperties = function (target, source) {
440 var keys = ownKeys(source);
441 var defineProperty = objectDefineProperty.f;
442 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
443 for (var i = 0; i < keys.length; i++) {
444 var key = keys[i];
445 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
446 }
447 };
448
449 var replacement = /#|\.prototype\./;
450
451 var isForced = function (feature, detection) {
452 var value = data[normalize(feature)];
453 return value == POLYFILL ? true
454 : value == NATIVE ? false
455 : typeof detection == 'function' ? fails(detection)
456 : !!detection;
457 };
458
459 var normalize = isForced.normalize = function (string) {
460 return String(string).replace(replacement, '.').toLowerCase();
461 };
462
463 var data = isForced.data = {};
464 var NATIVE = isForced.NATIVE = 'N';
465 var POLYFILL = isForced.POLYFILL = 'P';
466
467 var isForced_1 = isForced;
468
469 var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
470
471
472
473
474
475
476 /*
477 options.target - name of the target object
478 options.global - target is the global object
479 options.stat - export as static methods of target
480 options.proto - export as prototype methods of target
481 options.real - real prototype method for the `pure` version
482 options.forced - export even if the native feature is available
483 options.bind - bind methods to the target, required for the `pure` version
484 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
485 options.unsafe - use the simple assignment of property instead of delete + defineProperty
486 options.sham - add a flag to not completely full polyfills
487 options.enumerable - export as enumerable property
488 options.noTargetGet - prevent calling a getter on target
489 */
490 var _export = function (options, source) {
491 var TARGET = options.target;
492 var GLOBAL = options.global;
493 var STATIC = options.stat;
494 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
495 if (GLOBAL) {
496 target = global_1;
497 } else if (STATIC) {
498 target = global_1[TARGET] || setGlobal(TARGET, {});
499 } else {
500 target = (global_1[TARGET] || {}).prototype;
501 }
502 if (target) for (key in source) {
503 sourceProperty = source[key];
504 if (options.noTargetGet) {
505 descriptor = getOwnPropertyDescriptor$1(target, key);
506 targetProperty = descriptor && descriptor.value;
507 } else targetProperty = target[key];
508 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
509 // contained in target
510 if (!FORCED && targetProperty !== undefined) {
511 if (typeof sourceProperty === typeof targetProperty) continue;
512 copyConstructorProperties(sourceProperty, targetProperty);
513 }
514 // add a flag to not completely full polyfills
515 if (options.sham || (targetProperty && targetProperty.sham)) {
516 hide(sourceProperty, 'sham', true);
517 }
518 // extend global
519 redefine(target, key, sourceProperty, options);
520 }
521 };
522
523 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
524 // Chrome 38 Symbol has incorrect toString conversion
525 // eslint-disable-next-line no-undef
526 return !String(Symbol());
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 // `Object.keys` method
542 // https://tc39.github.io/ecma262/#sec-object.keys
543 var objectKeys = Object.keys || function keys(O) {
544 return objectKeysInternal(O, enumBugKeys);
545 };
546
547 // `Object.defineProperties` method
548 // https://tc39.github.io/ecma262/#sec-object.defineproperties
549 var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
550 anObject(O);
551 var keys = objectKeys(Properties);
552 var length = keys.length;
553 var index = 0;
554 var key;
555 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
556 return O;
557 };
558
559 var html = getBuiltIn('document', 'documentElement');
560
561 var IE_PROTO = sharedKey('IE_PROTO');
562
563 var PROTOTYPE = 'prototype';
564 var Empty = function () { /* empty */ };
565
566 // Create object with fake `null` prototype: use iframe Object with cleared prototype
567 var createDict = function () {
568 // Thrash, waste and sodomy: IE GC bug
569 var iframe = documentCreateElement('iframe');
570 var length = enumBugKeys.length;
571 var lt = '<';
572 var script = 'script';
573 var gt = '>';
574 var js = 'java' + script + ':';
575 var iframeDocument;
576 iframe.style.display = 'none';
577 html.appendChild(iframe);
578 iframe.src = String(js);
579 iframeDocument = iframe.contentWindow.document;
580 iframeDocument.open();
581 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
582 iframeDocument.close();
583 createDict = iframeDocument.F;
584 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
585 return createDict();
586 };
587
588 // `Object.create` method
589 // https://tc39.github.io/ecma262/#sec-object.create
590 var objectCreate = Object.create || function create(O, Properties) {
591 var result;
592 if (O !== null) {
593 Empty[PROTOTYPE] = anObject(O);
594 result = new Empty();
595 Empty[PROTOTYPE] = null;
596 // add "__proto__" for Object.getPrototypeOf polyfill
597 result[IE_PROTO] = O;
598 } else result = createDict();
599 return Properties === undefined ? result : objectDefineProperties(result, Properties);
600 };
601
602 hiddenKeys[IE_PROTO] = true;
603
604 var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
605
606 var toString$1 = {}.toString;
607
608 var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
609 ? Object.getOwnPropertyNames(window) : [];
610
611 var getWindowNames = function (it) {
612 try {
613 return nativeGetOwnPropertyNames(it);
614 } catch (error) {
615 return windowNames.slice();
616 }
617 };
618
619 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
620 var f$5 = function getOwnPropertyNames(it) {
621 return windowNames && toString$1.call(it) == '[object Window]'
622 ? getWindowNames(it)
623 : nativeGetOwnPropertyNames(toIndexedObject(it));
624 };
625
626 var objectGetOwnPropertyNamesExternal = {
627 f: f$5
628 };
629
630 var Symbol$1 = global_1.Symbol;
631 var store$1 = shared('wks');
632
633 var wellKnownSymbol = function (name) {
634 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
635 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
636 };
637
638 var f$6 = wellKnownSymbol;
639
640 var wrappedWellKnownSymbol = {
641 f: f$6
642 };
643
644 var defineProperty = objectDefineProperty.f;
645
646 var defineWellKnownSymbol = function (NAME) {
647 var Symbol = path.Symbol || (path.Symbol = {});
648 if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
649 value: wrappedWellKnownSymbol.f(NAME)
650 });
651 };
652
653 var defineProperty$1 = objectDefineProperty.f;
654
655
656
657 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
658
659 var setToStringTag = function (it, TAG, STATIC) {
660 if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
661 defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });
662 }
663 };
664
665 var aFunction$1 = function (it) {
666 if (typeof it != 'function') {
667 throw TypeError(String(it) + ' is not a function');
668 } return it;
669 };
670
671 // optional / simple context binding
672 var bindContext = function (fn, that, length) {
673 aFunction$1(fn);
674 if (that === undefined) return fn;
675 switch (length) {
676 case 0: return function () {
677 return fn.call(that);
678 };
679 case 1: return function (a) {
680 return fn.call(that, a);
681 };
682 case 2: return function (a, b) {
683 return fn.call(that, a, b);
684 };
685 case 3: return function (a, b, c) {
686 return fn.call(that, a, b, c);
687 };
688 }
689 return function (/* ...args */) {
690 return fn.apply(that, arguments);
691 };
692 };
693
694 var SPECIES = wellKnownSymbol('species');
695
696 // `ArraySpeciesCreate` abstract operation
697 // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
698 var arraySpeciesCreate = function (originalArray, length) {
699 var C;
700 if (isArray(originalArray)) {
701 C = originalArray.constructor;
702 // cross-realm fallback
703 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
704 else if (isObject(C)) {
705 C = C[SPECIES];
706 if (C === null) C = undefined;
707 }
708 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
709 };
710
711 var push = [].push;
712
713 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
714 var createMethod$1 = function (TYPE) {
715 var IS_MAP = TYPE == 1;
716 var IS_FILTER = TYPE == 2;
717 var IS_SOME = TYPE == 3;
718 var IS_EVERY = TYPE == 4;
719 var IS_FIND_INDEX = TYPE == 6;
720 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
721 return function ($this, callbackfn, that, specificCreate) {
722 var O = toObject($this);
723 var self = indexedObject(O);
724 var boundFunction = bindContext(callbackfn, that, 3);
725 var length = toLength(self.length);
726 var index = 0;
727 var create = specificCreate || arraySpeciesCreate;
728 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
729 var value, result;
730 for (;length > index; index++) if (NO_HOLES || index in self) {
731 value = self[index];
732 result = boundFunction(value, index, O);
733 if (TYPE) {
734 if (IS_MAP) target[index] = result; // map
735 else if (result) switch (TYPE) {
736 case 3: return true; // some
737 case 5: return value; // find
738 case 6: return index; // findIndex
739 case 2: push.call(target, value); // filter
740 } else if (IS_EVERY) return false; // every
741 }
742 }
743 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
744 };
745 };
746
747 var arrayIteration = {
748 // `Array.prototype.forEach` method
749 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
750 forEach: createMethod$1(0),
751 // `Array.prototype.map` method
752 // https://tc39.github.io/ecma262/#sec-array.prototype.map
753 map: createMethod$1(1),
754 // `Array.prototype.filter` method
755 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
756 filter: createMethod$1(2),
757 // `Array.prototype.some` method
758 // https://tc39.github.io/ecma262/#sec-array.prototype.some
759 some: createMethod$1(3),
760 // `Array.prototype.every` method
761 // https://tc39.github.io/ecma262/#sec-array.prototype.every
762 every: createMethod$1(4),
763 // `Array.prototype.find` method
764 // https://tc39.github.io/ecma262/#sec-array.prototype.find
765 find: createMethod$1(5),
766 // `Array.prototype.findIndex` method
767 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
768 findIndex: createMethod$1(6)
769 };
770
771 var $forEach = arrayIteration.forEach;
772
773 var HIDDEN = sharedKey('hidden');
774 var SYMBOL = 'Symbol';
775 var PROTOTYPE$1 = 'prototype';
776 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
777 var setInternalState = internalState.set;
778 var getInternalState = internalState.getterFor(SYMBOL);
779 var ObjectPrototype = Object[PROTOTYPE$1];
780 var $Symbol = global_1.Symbol;
781 var JSON$1 = global_1.JSON;
782 var nativeJSONStringify = JSON$1 && JSON$1.stringify;
783 var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
784 var nativeDefineProperty$1 = objectDefineProperty.f;
785 var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
786 var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
787 var AllSymbols = shared('symbols');
788 var ObjectPrototypeSymbols = shared('op-symbols');
789 var StringToSymbolRegistry = shared('string-to-symbol-registry');
790 var SymbolToStringRegistry = shared('symbol-to-string-registry');
791 var WellKnownSymbolsStore = shared('wks');
792 var QObject = global_1.QObject;
793 // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
794 var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
795
796 // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
797 var setSymbolDescriptor = descriptors && fails(function () {
798 return objectCreate(nativeDefineProperty$1({}, 'a', {
799 get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
800 })).a != 7;
801 }) ? function (O, P, Attributes) {
802 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
803 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
804 nativeDefineProperty$1(O, P, Attributes);
805 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
806 nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
807 }
808 } : nativeDefineProperty$1;
809
810 var wrap = function (tag, description) {
811 var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
812 setInternalState(symbol, {
813 type: SYMBOL,
814 tag: tag,
815 description: description
816 });
817 if (!descriptors) symbol.description = description;
818 return symbol;
819 };
820
821 var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (it) {
822 return typeof it == 'symbol';
823 } : function (it) {
824 return Object(it) instanceof $Symbol;
825 };
826
827 var $defineProperty = function defineProperty(O, P, Attributes) {
828 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
829 anObject(O);
830 var key = toPrimitive(P, true);
831 anObject(Attributes);
832 if (has(AllSymbols, key)) {
833 if (!Attributes.enumerable) {
834 if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
835 O[HIDDEN][key] = true;
836 } else {
837 if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
838 Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
839 } return setSymbolDescriptor(O, key, Attributes);
840 } return nativeDefineProperty$1(O, key, Attributes);
841 };
842
843 var $defineProperties = function defineProperties(O, Properties) {
844 anObject(O);
845 var properties = toIndexedObject(Properties);
846 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
847 $forEach(keys, function (key) {
848 if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
849 });
850 return O;
851 };
852
853 var $create = function create(O, Properties) {
854 return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
855 };
856
857 var $propertyIsEnumerable = function propertyIsEnumerable(V) {
858 var P = toPrimitive(V, true);
859 var enumerable = nativePropertyIsEnumerable$1.call(this, P);
860 if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
861 return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
862 };
863
864 var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
865 var it = toIndexedObject(O);
866 var key = toPrimitive(P, true);
867 if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
868 var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
869 if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
870 descriptor.enumerable = true;
871 }
872 return descriptor;
873 };
874
875 var $getOwnPropertyNames = function getOwnPropertyNames(O) {
876 var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
877 var result = [];
878 $forEach(names, function (key) {
879 if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
880 });
881 return result;
882 };
883
884 var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
885 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
886 var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
887 var result = [];
888 $forEach(names, function (key) {
889 if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
890 result.push(AllSymbols[key]);
891 }
892 });
893 return result;
894 };
895
896 // `Symbol` constructor
897 // https://tc39.github.io/ecma262/#sec-symbol-constructor
898 if (!nativeSymbol) {
899 $Symbol = function Symbol() {
900 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
901 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
902 var tag = uid(description);
903 var setter = function (value) {
904 if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
905 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
906 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
907 };
908 if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
909 return wrap(tag, description);
910 };
911
912 redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
913 return getInternalState(this).tag;
914 });
915
916 objectPropertyIsEnumerable.f = $propertyIsEnumerable;
917 objectDefineProperty.f = $defineProperty;
918 objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
919 objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
920 objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
921
922 if (descriptors) {
923 // https://github.com/tc39/proposal-Symbol-description
924 nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
925 configurable: true,
926 get: function description() {
927 return getInternalState(this).description;
928 }
929 });
930 {
931 redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
932 }
933 }
934
935 wrappedWellKnownSymbol.f = function (name) {
936 return wrap(wellKnownSymbol(name), name);
937 };
938 }
939
940 _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
941 Symbol: $Symbol
942 });
943
944 $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
945 defineWellKnownSymbol(name);
946 });
947
948 _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
949 // `Symbol.for` method
950 // https://tc39.github.io/ecma262/#sec-symbol.for
951 'for': function (key) {
952 var string = String(key);
953 if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
954 var symbol = $Symbol(string);
955 StringToSymbolRegistry[string] = symbol;
956 SymbolToStringRegistry[symbol] = string;
957 return symbol;
958 },
959 // `Symbol.keyFor` method
960 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
961 keyFor: function keyFor(sym) {
962 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
963 if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
964 },
965 useSetter: function () { USE_SETTER = true; },
966 useSimple: function () { USE_SETTER = false; }
967 });
968
969 _export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
970 // `Object.create` method
971 // https://tc39.github.io/ecma262/#sec-object.create
972 create: $create,
973 // `Object.defineProperty` method
974 // https://tc39.github.io/ecma262/#sec-object.defineproperty
975 defineProperty: $defineProperty,
976 // `Object.defineProperties` method
977 // https://tc39.github.io/ecma262/#sec-object.defineproperties
978 defineProperties: $defineProperties,
979 // `Object.getOwnPropertyDescriptor` method
980 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
981 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
982 });
983
984 _export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
985 // `Object.getOwnPropertyNames` method
986 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
987 getOwnPropertyNames: $getOwnPropertyNames,
988 // `Object.getOwnPropertySymbols` method
989 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
990 getOwnPropertySymbols: $getOwnPropertySymbols
991 });
992
993 // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
994 // https://bugs.chromium.org/p/v8/issues/detail?id=3443
995 _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
996 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
997 return objectGetOwnPropertySymbols.f(toObject(it));
998 }
999 });
1000
1001 // `JSON.stringify` method behavior with symbols
1002 // https://tc39.github.io/ecma262/#sec-json.stringify
1003 JSON$1 && _export({ target: 'JSON', stat: true, forced: !nativeSymbol || fails(function () {
1004 var symbol = $Symbol();
1005 // MS Edge converts symbol values to JSON as {}
1006 return nativeJSONStringify([symbol]) != '[null]'
1007 // WebKit converts symbol values to JSON as null
1008 || nativeJSONStringify({ a: symbol }) != '{}'
1009 // V8 throws on boxed symbols
1010 || nativeJSONStringify(Object(symbol)) != '{}';
1011 }) }, {
1012 stringify: function stringify(it) {
1013 var args = [it];
1014 var index = 1;
1015 var replacer, $replacer;
1016 while (arguments.length > index) args.push(arguments[index++]);
1017 $replacer = replacer = args[1];
1018 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
1019 if (!isArray(replacer)) replacer = function (key, value) {
1020 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
1021 if (!isSymbol(value)) return value;
1022 };
1023 args[1] = replacer;
1024 return nativeJSONStringify.apply(JSON$1, args);
1025 }
1026 });
1027
1028 // `Symbol.prototype[@@toPrimitive]` method
1029 // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
1030 if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) hide($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
1031 // `Symbol.prototype[@@toStringTag]` property
1032 // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
1033 setToStringTag($Symbol, SYMBOL);
1034
1035 hiddenKeys[HIDDEN] = true;
1036
1037 var defineProperty$2 = objectDefineProperty.f;
1038
1039
1040 var NativeSymbol = global_1.Symbol;
1041
1042 if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
1043 // Safari 12 bug
1044 NativeSymbol().description !== undefined
1045 )) {
1046 var EmptyStringDescriptionStore = {};
1047 // wrap Symbol constructor for correct work with undefined description
1048 var SymbolWrapper = function Symbol() {
1049 var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
1050 var result = this instanceof SymbolWrapper
1051 ? new NativeSymbol(description)
1052 // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1053 : description === undefined ? NativeSymbol() : NativeSymbol(description);
1054 if (description === '') EmptyStringDescriptionStore[result] = true;
1055 return result;
1056 };
1057 copyConstructorProperties(SymbolWrapper, NativeSymbol);
1058 var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
1059 symbolPrototype.constructor = SymbolWrapper;
1060
1061 var symbolToString = symbolPrototype.toString;
1062 var native = String(NativeSymbol('test')) == 'Symbol(test)';
1063 var regexp = /^Symbol\((.*)\)[^)]+$/;
1064 defineProperty$2(symbolPrototype, 'description', {
1065 configurable: true,
1066 get: function description() {
1067 var symbol = isObject(this) ? this.valueOf() : this;
1068 var string = symbolToString.call(symbol);
1069 if (has(EmptyStringDescriptionStore, symbol)) return '';
1070 var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
1071 return desc === '' ? undefined : desc;
1072 }
1073 });
1074
1075 _export({ global: true, forced: true }, {
1076 Symbol: SymbolWrapper
1077 });
1078 }
1079
1080 // `Symbol.iterator` well-known symbol
1081 // https://tc39.github.io/ecma262/#sec-symbol.iterator
1082 defineWellKnownSymbol('iterator');
1083
1084 var createProperty = function (object, key, value) {
1085 var propertyKey = toPrimitive(key);
1086 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1087 else object[propertyKey] = value;
1088 };
1089
1090 var SPECIES$1 = wellKnownSymbol('species');
1091
1092 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1093 return !fails(function () {
1094 var array = [];
1095 var constructor = array.constructor = {};
1096 constructor[SPECIES$1] = function () {
1097 return { foo: 1 };
1098 };
1099 return array[METHOD_NAME](Boolean).foo !== 1;
1100 });
1101 };
1102
1103 var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1104 var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1105 var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
1106
1107 var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
1108 var array = [];
1109 array[IS_CONCAT_SPREADABLE] = false;
1110 return array.concat()[0] !== array;
1111 });
1112
1113 var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
1114
1115 var isConcatSpreadable = function (O) {
1116 if (!isObject(O)) return false;
1117 var spreadable = O[IS_CONCAT_SPREADABLE];
1118 return spreadable !== undefined ? !!spreadable : isArray(O);
1119 };
1120
1121 var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1122
1123 // `Array.prototype.concat` method
1124 // https://tc39.github.io/ecma262/#sec-array.prototype.concat
1125 // with adding support of @@isConcatSpreadable and @@species
1126 _export({ target: 'Array', proto: true, forced: FORCED }, {
1127 concat: function concat(arg) { // eslint-disable-line no-unused-vars
1128 var O = toObject(this);
1129 var A = arraySpeciesCreate(O, 0);
1130 var n = 0;
1131 var i, k, length, len, E;
1132 for (i = -1, length = arguments.length; i < length; i++) {
1133 E = i === -1 ? O : arguments[i];
1134 if (isConcatSpreadable(E)) {
1135 len = toLength(E.length);
1136 if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1137 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1138 } else {
1139 if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1140 createProperty(A, n++, E);
1141 }
1142 }
1143 A.length = n;
1144 return A;
1145 }
1146 });
1147
1148 var $filter = arrayIteration.filter;
1149
1150
1151 // `Array.prototype.filter` method
1152 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
1153 // with adding support of @@species
1154 _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
1155 filter: function filter(callbackfn /* , thisArg */) {
1156 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1157 }
1158 });
1159
1160 var UNSCOPABLES = wellKnownSymbol('unscopables');
1161 var ArrayPrototype = Array.prototype;
1162
1163 // Array.prototype[@@unscopables]
1164 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1165 if (ArrayPrototype[UNSCOPABLES] == undefined) {
1166 hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
1167 }
1168
1169 // add a key to Array.prototype[@@unscopables]
1170 var addToUnscopables = function (key) {
1171 ArrayPrototype[UNSCOPABLES][key] = true;
1172 };
1173
1174 var $find = arrayIteration.find;
1175
1176
1177 var FIND = 'find';
1178 var SKIPS_HOLES = true;
1179
1180 // Shouldn't skip holes
1181 if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
1182
1183 // `Array.prototype.find` method
1184 // https://tc39.github.io/ecma262/#sec-array.prototype.find
1185 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
1186 find: function find(callbackfn /* , that = undefined */) {
1187 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1188 }
1189 });
1190
1191 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1192 addToUnscopables(FIND);
1193
1194 var $findIndex = arrayIteration.findIndex;
1195
1196
1197 var FIND_INDEX = 'findIndex';
1198 var SKIPS_HOLES$1 = true;
1199
1200 // Shouldn't skip holes
1201 if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; });
1202
1203 // `Array.prototype.findIndex` method
1204 // https://tc39.github.io/ecma262/#sec-array.prototype.findindex
1205 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, {
1206 findIndex: function findIndex(callbackfn /* , that = undefined */) {
1207 return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1208 }
1209 });
1210
1211 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1212 addToUnscopables(FIND_INDEX);
1213
1214 var $includes = arrayIncludes.includes;
1215
1216
1217 // `Array.prototype.includes` method
1218 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
1219 _export({ target: 'Array', proto: true }, {
1220 includes: function includes(el /* , fromIndex = 0 */) {
1221 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1222 }
1223 });
1224
1225 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1226 addToUnscopables('includes');
1227
1228 var sloppyArrayMethod = function (METHOD_NAME, argument) {
1229 var method = [][METHOD_NAME];
1230 return !method || !fails(function () {
1231 // eslint-disable-next-line no-useless-call,no-throw-literal
1232 method.call(null, argument || function () { throw 1; }, 1);
1233 });
1234 };
1235
1236 var $indexOf = arrayIncludes.indexOf;
1237
1238
1239 var nativeIndexOf = [].indexOf;
1240
1241 var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
1242 var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
1243
1244 // `Array.prototype.indexOf` method
1245 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
1246 _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
1247 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
1248 return NEGATIVE_ZERO
1249 // convert -0 to +0
1250 ? nativeIndexOf.apply(this, arguments) || 0
1251 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
1252 }
1253 });
1254
1255 var correctPrototypeGetter = !fails(function () {
1256 function F() { /* empty */ }
1257 F.prototype.constructor = null;
1258 return Object.getPrototypeOf(new F()) !== F.prototype;
1259 });
1260
1261 var IE_PROTO$1 = sharedKey('IE_PROTO');
1262 var ObjectPrototype$1 = Object.prototype;
1263
1264 // `Object.getPrototypeOf` method
1265 // https://tc39.github.io/ecma262/#sec-object.getprototypeof
1266 var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
1267 O = toObject(O);
1268 if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
1269 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
1270 return O.constructor.prototype;
1271 } return O instanceof Object ? ObjectPrototype$1 : null;
1272 };
1273
1274 var ITERATOR = wellKnownSymbol('iterator');
1275 var BUGGY_SAFARI_ITERATORS = false;
1276
1277 var returnThis = function () { return this; };
1278
1279 // `%IteratorPrototype%` object
1280 // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
1281 var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
1282
1283 if ([].keys) {
1284 arrayIterator = [].keys();
1285 // Safari 8 has buggy iterators w/o `next`
1286 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
1287 else {
1288 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
1289 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
1290 }
1291 }
1292
1293 if (IteratorPrototype == undefined) IteratorPrototype = {};
1294
1295 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
1296 if ( !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
1297
1298 var iteratorsCore = {
1299 IteratorPrototype: IteratorPrototype,
1300 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
1301 };
1302
1303 var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1304
1305 var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
1306 var TO_STRING_TAG = NAME + ' Iterator';
1307 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
1308 setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
1309 return IteratorConstructor;
1310 };
1311
1312 var aPossiblePrototype = function (it) {
1313 if (!isObject(it) && it !== null) {
1314 throw TypeError("Can't set " + String(it) + ' as a prototype');
1315 } return it;
1316 };
1317
1318 // `Object.setPrototypeOf` method
1319 // https://tc39.github.io/ecma262/#sec-object.setprototypeof
1320 // Works with __proto__ only. Old v8 can't work with null proto objects.
1321 /* eslint-disable no-proto */
1322 var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1323 var CORRECT_SETTER = false;
1324 var test = {};
1325 var setter;
1326 try {
1327 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
1328 setter.call(test, []);
1329 CORRECT_SETTER = test instanceof Array;
1330 } catch (error) { /* empty */ }
1331 return function setPrototypeOf(O, proto) {
1332 anObject(O);
1333 aPossiblePrototype(proto);
1334 if (CORRECT_SETTER) setter.call(O, proto);
1335 else O.__proto__ = proto;
1336 return O;
1337 };
1338 }() : undefined);
1339
1340 var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
1341 var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
1342 var ITERATOR$1 = wellKnownSymbol('iterator');
1343 var KEYS = 'keys';
1344 var VALUES = 'values';
1345 var ENTRIES = 'entries';
1346
1347 var returnThis$1 = function () { return this; };
1348
1349 var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1350 createIteratorConstructor(IteratorConstructor, NAME, next);
1351
1352 var getIterationMethod = function (KIND) {
1353 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1354 if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
1355 switch (KIND) {
1356 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1357 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1358 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1359 } return function () { return new IteratorConstructor(this); };
1360 };
1361
1362 var TO_STRING_TAG = NAME + ' Iterator';
1363 var INCORRECT_VALUES_NAME = false;
1364 var IterablePrototype = Iterable.prototype;
1365 var nativeIterator = IterablePrototype[ITERATOR$1]
1366 || IterablePrototype['@@iterator']
1367 || DEFAULT && IterablePrototype[DEFAULT];
1368 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
1369 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1370 var CurrentIteratorPrototype, methods, KEY;
1371
1372 // fix native
1373 if (anyNativeIterator) {
1374 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
1375 if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
1376 if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
1377 if (objectSetPrototypeOf) {
1378 objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
1379 } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
1380 hide(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
1381 }
1382 }
1383 // Set @@toStringTag to native iterators
1384 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
1385 }
1386 }
1387
1388 // fix Array#{values, @@iterator}.name in V8 / FF
1389 if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1390 INCORRECT_VALUES_NAME = true;
1391 defaultIterator = function values() { return nativeIterator.call(this); };
1392 }
1393
1394 // define iterator
1395 if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
1396 hide(IterablePrototype, ITERATOR$1, defaultIterator);
1397 }
1398
1399 // export additional methods
1400 if (DEFAULT) {
1401 methods = {
1402 values: getIterationMethod(VALUES),
1403 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1404 entries: getIterationMethod(ENTRIES)
1405 };
1406 if (FORCED) for (KEY in methods) {
1407 if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1408 redefine(IterablePrototype, KEY, methods[KEY]);
1409 }
1410 } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
1411 }
1412
1413 return methods;
1414 };
1415
1416 var ARRAY_ITERATOR = 'Array Iterator';
1417 var setInternalState$1 = internalState.set;
1418 var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
1419
1420 // `Array.prototype.entries` method
1421 // https://tc39.github.io/ecma262/#sec-array.prototype.entries
1422 // `Array.prototype.keys` method
1423 // https://tc39.github.io/ecma262/#sec-array.prototype.keys
1424 // `Array.prototype.values` method
1425 // https://tc39.github.io/ecma262/#sec-array.prototype.values
1426 // `Array.prototype[@@iterator]` method
1427 // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
1428 // `CreateArrayIterator` internal method
1429 // https://tc39.github.io/ecma262/#sec-createarrayiterator
1430 var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1431 setInternalState$1(this, {
1432 type: ARRAY_ITERATOR,
1433 target: toIndexedObject(iterated), // target
1434 index: 0, // next index
1435 kind: kind // kind
1436 });
1437 // `%ArrayIteratorPrototype%.next` method
1438 // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
1439 }, function () {
1440 var state = getInternalState$1(this);
1441 var target = state.target;
1442 var kind = state.kind;
1443 var index = state.index++;
1444 if (!target || index >= target.length) {
1445 state.target = undefined;
1446 return { value: undefined, done: true };
1447 }
1448 if (kind == 'keys') return { value: index, done: false };
1449 if (kind == 'values') return { value: target[index], done: false };
1450 return { value: [index, target[index]], done: false };
1451 }, 'values');
1452
1453 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1454 addToUnscopables('keys');
1455 addToUnscopables('values');
1456 addToUnscopables('entries');
1457
1458 var nativeJoin = [].join;
1459
1460 var ES3_STRINGS = indexedObject != Object;
1461 var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
1462
1463 // `Array.prototype.join` method
1464 // https://tc39.github.io/ecma262/#sec-array.prototype.join
1465 _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
1466 join: function join(separator) {
1467 return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
1468 }
1469 });
1470
1471 var SPECIES$2 = wellKnownSymbol('species');
1472 var nativeSlice = [].slice;
1473 var max$1 = Math.max;
1474
1475 // `Array.prototype.slice` method
1476 // https://tc39.github.io/ecma262/#sec-array.prototype.slice
1477 // fallback for not array-like ES3 strings and DOM objects
1478 _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
1479 slice: function slice(start, end) {
1480 var O = toIndexedObject(this);
1481 var length = toLength(O.length);
1482 var k = toAbsoluteIndex(start, length);
1483 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
1484 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
1485 var Constructor, result, n;
1486 if (isArray(O)) {
1487 Constructor = O.constructor;
1488 // cross-realm fallback
1489 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
1490 Constructor = undefined;
1491 } else if (isObject(Constructor)) {
1492 Constructor = Constructor[SPECIES$2];
1493 if (Constructor === null) Constructor = undefined;
1494 }
1495 if (Constructor === Array || Constructor === undefined) {
1496 return nativeSlice.call(O, k, fin);
1497 }
1498 }
1499 result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
1500 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
1501 result.length = n;
1502 return result;
1503 }
1504 });
1505
1506 var nativeSort = [].sort;
1507 var test = [1, 2, 3];
1508
1509 // IE8-
1510 var FAILS_ON_UNDEFINED = fails(function () {
1511 test.sort(undefined);
1512 });
1513 // V8 bug
1514 var FAILS_ON_NULL = fails(function () {
1515 test.sort(null);
1516 });
1517 // Old WebKit
1518 var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
1519
1520 var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
1521
1522 // `Array.prototype.sort` method
1523 // https://tc39.github.io/ecma262/#sec-array.prototype.sort
1524 _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
1525 sort: function sort(comparefn) {
1526 return comparefn === undefined
1527 ? nativeSort.call(toObject(this))
1528 : nativeSort.call(toObject(this), aFunction$1(comparefn));
1529 }
1530 });
1531
1532 var max$2 = Math.max;
1533 var min$2 = Math.min;
1534 var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
1535 var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
1536
1537 // `Array.prototype.splice` method
1538 // https://tc39.github.io/ecma262/#sec-array.prototype.splice
1539 // with adding support of @@species
1540 _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, {
1541 splice: function splice(start, deleteCount /* , ...items */) {
1542 var O = toObject(this);
1543 var len = toLength(O.length);
1544 var actualStart = toAbsoluteIndex(start, len);
1545 var argumentsLength = arguments.length;
1546 var insertCount, actualDeleteCount, A, k, from, to;
1547 if (argumentsLength === 0) {
1548 insertCount = actualDeleteCount = 0;
1549 } else if (argumentsLength === 1) {
1550 insertCount = 0;
1551 actualDeleteCount = len - actualStart;
1552 } else {
1553 insertCount = argumentsLength - 2;
1554 actualDeleteCount = min$2(max$2(toInteger(deleteCount), 0), len - actualStart);
1555 }
1556 if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {
1557 throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
1558 }
1559 A = arraySpeciesCreate(O, actualDeleteCount);
1560 for (k = 0; k < actualDeleteCount; k++) {
1561 from = actualStart + k;
1562 if (from in O) createProperty(A, k, O[from]);
1563 }
1564 A.length = actualDeleteCount;
1565 if (insertCount < actualDeleteCount) {
1566 for (k = actualStart; k < len - actualDeleteCount; k++) {
1567 from = k + actualDeleteCount;
1568 to = k + insertCount;
1569 if (from in O) O[to] = O[from];
1570 else delete O[to];
1571 }
1572 for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
1573 } else if (insertCount > actualDeleteCount) {
1574 for (k = len - actualDeleteCount; k > actualStart; k--) {
1575 from = k + actualDeleteCount - 1;
1576 to = k + insertCount - 1;
1577 if (from in O) O[to] = O[from];
1578 else delete O[to];
1579 }
1580 }
1581 for (k = 0; k < insertCount; k++) {
1582 O[k + actualStart] = arguments[k + 2];
1583 }
1584 O.length = len - actualDeleteCount + insertCount;
1585 return A;
1586 }
1587 });
1588
1589 // makes subclassing work correct for wrapped built-ins
1590 var inheritIfRequired = function ($this, dummy, Wrapper) {
1591 var NewTarget, NewTargetPrototype;
1592 if (
1593 // it can work only with native `setPrototypeOf`
1594 objectSetPrototypeOf &&
1595 // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
1596 typeof (NewTarget = dummy.constructor) == 'function' &&
1597 NewTarget !== Wrapper &&
1598 isObject(NewTargetPrototype = NewTarget.prototype) &&
1599 NewTargetPrototype !== Wrapper.prototype
1600 ) objectSetPrototypeOf($this, NewTargetPrototype);
1601 return $this;
1602 };
1603
1604 // a string of all valid unicode whitespaces
1605 // eslint-disable-next-line max-len
1606 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';
1607
1608 var whitespace = '[' + whitespaces + ']';
1609 var ltrim = RegExp('^' + whitespace + whitespace + '*');
1610 var rtrim = RegExp(whitespace + whitespace + '*$');
1611
1612 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1613 var createMethod$2 = function (TYPE) {
1614 return function ($this) {
1615 var string = String(requireObjectCoercible($this));
1616 if (TYPE & 1) string = string.replace(ltrim, '');
1617 if (TYPE & 2) string = string.replace(rtrim, '');
1618 return string;
1619 };
1620 };
1621
1622 var stringTrim = {
1623 // `String.prototype.{ trimLeft, trimStart }` methods
1624 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1625 start: createMethod$2(1),
1626 // `String.prototype.{ trimRight, trimEnd }` methods
1627 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1628 end: createMethod$2(2),
1629 // `String.prototype.trim` method
1630 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1631 trim: createMethod$2(3)
1632 };
1633
1634 var getOwnPropertyNames = objectGetOwnPropertyNames.f;
1635 var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
1636 var defineProperty$3 = objectDefineProperty.f;
1637 var trim = stringTrim.trim;
1638
1639 var NUMBER = 'Number';
1640 var NativeNumber = global_1[NUMBER];
1641 var NumberPrototype = NativeNumber.prototype;
1642
1643 // Opera ~12 has broken Object#toString
1644 var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
1645
1646 // `ToNumber` abstract operation
1647 // https://tc39.github.io/ecma262/#sec-tonumber
1648 var toNumber = function (argument) {
1649 var it = toPrimitive(argument, false);
1650 var first, third, radix, maxCode, digits, length, index, code;
1651 if (typeof it == 'string' && it.length > 2) {
1652 it = trim(it);
1653 first = it.charCodeAt(0);
1654 if (first === 43 || first === 45) {
1655 third = it.charCodeAt(2);
1656 if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
1657 } else if (first === 48) {
1658 switch (it.charCodeAt(1)) {
1659 case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
1660 case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
1661 default: return +it;
1662 }
1663 digits = it.slice(2);
1664 length = digits.length;
1665 for (index = 0; index < length; index++) {
1666 code = digits.charCodeAt(index);
1667 // parseInt parses a string to a first unavailable symbol
1668 // but ToNumber should return NaN if a string contains unavailable symbols
1669 if (code < 48 || code > maxCode) return NaN;
1670 } return parseInt(digits, radix);
1671 }
1672 } return +it;
1673 };
1674
1675 // `Number` constructor
1676 // https://tc39.github.io/ecma262/#sec-number-constructor
1677 if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
1678 var NumberWrapper = function Number(value) {
1679 var it = arguments.length < 1 ? 0 : value;
1680 var dummy = this;
1681 return dummy instanceof NumberWrapper
1682 // check on 1..constructor(foo) case
1683 && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
1684 ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
1685 };
1686 for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (
1687 // ES3:
1688 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
1689 // ES2015 (in case, if modules with ES2015 Number statics required before):
1690 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
1691 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
1692 ).split(','), j = 0, key; keys$1.length > j; j++) {
1693 if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {
1694 defineProperty$3(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
1695 }
1696 }
1697 NumberWrapper.prototype = NumberPrototype;
1698 NumberPrototype.constructor = NumberWrapper;
1699 redefine(global_1, NUMBER, NumberWrapper);
1700 }
1701
1702 var nativeAssign = Object.assign;
1703
1704 // `Object.assign` method
1705 // https://tc39.github.io/ecma262/#sec-object.assign
1706 // should work with symbols and should have deterministic property order (V8 bug)
1707 var objectAssign = !nativeAssign || fails(function () {
1708 var A = {};
1709 var B = {};
1710 // eslint-disable-next-line no-undef
1711 var symbol = Symbol();
1712 var alphabet = 'abcdefghijklmnopqrst';
1713 A[symbol] = 7;
1714 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1715 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
1716 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
1717 var T = toObject(target);
1718 var argumentsLength = arguments.length;
1719 var index = 1;
1720 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1721 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1722 while (argumentsLength > index) {
1723 var S = indexedObject(arguments[index++]);
1724 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
1725 var length = keys.length;
1726 var j = 0;
1727 var key;
1728 while (length > j) {
1729 key = keys[j++];
1730 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
1731 }
1732 } return T;
1733 } : nativeAssign;
1734
1735 // `Object.assign` method
1736 // https://tc39.github.io/ecma262/#sec-object.assign
1737 _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
1738 assign: objectAssign
1739 });
1740
1741 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1742
1743 // `Object.{ entries, values }` methods implementation
1744 var createMethod$3 = function (TO_ENTRIES) {
1745 return function (it) {
1746 var O = toIndexedObject(it);
1747 var keys = objectKeys(O);
1748 var length = keys.length;
1749 var i = 0;
1750 var result = [];
1751 var key;
1752 while (length > i) {
1753 key = keys[i++];
1754 if (!descriptors || propertyIsEnumerable.call(O, key)) {
1755 result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
1756 }
1757 }
1758 return result;
1759 };
1760 };
1761
1762 var objectToArray = {
1763 // `Object.entries` method
1764 // https://tc39.github.io/ecma262/#sec-object.entries
1765 entries: createMethod$3(true),
1766 // `Object.values` method
1767 // https://tc39.github.io/ecma262/#sec-object.values
1768 values: createMethod$3(false)
1769 };
1770
1771 var $entries = objectToArray.entries;
1772
1773 // `Object.entries` method
1774 // https://tc39.github.io/ecma262/#sec-object.entries
1775 _export({ target: 'Object', stat: true }, {
1776 entries: function entries(O) {
1777 return $entries(O);
1778 }
1779 });
1780
1781 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1782 // ES3 wrong here
1783 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1784
1785 // fallback for IE11 Script Access Denied error
1786 var tryGet = function (it, key) {
1787 try {
1788 return it[key];
1789 } catch (error) { /* empty */ }
1790 };
1791
1792 // getting tag from ES6+ `Object.prototype.toString`
1793 var classof = function (it) {
1794 var O, tag, result;
1795 return it === undefined ? 'Undefined' : it === null ? 'Null'
1796 // @@toStringTag case
1797 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
1798 // builtinTag case
1799 : CORRECT_ARGUMENTS ? classofRaw(O)
1800 // ES3 arguments fallback
1801 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1802 };
1803
1804 var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
1805 var test$1 = {};
1806
1807 test$1[TO_STRING_TAG$2] = 'z';
1808
1809 // `Object.prototype.toString` method implementation
1810 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1811 var objectToString = String(test$1) !== '[object z]' ? function toString() {
1812 return '[object ' + classof(this) + ']';
1813 } : test$1.toString;
1814
1815 var ObjectPrototype$2 = Object.prototype;
1816
1817 // `Object.prototype.toString` method
1818 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1819 if (objectToString !== ObjectPrototype$2.toString) {
1820 redefine(ObjectPrototype$2, 'toString', objectToString, { unsafe: true });
1821 }
1822
1823 var trim$1 = stringTrim.trim;
1824
1825
1826 var nativeParseFloat = global_1.parseFloat;
1827 var FORCED$2 = 1 / nativeParseFloat(whitespaces + '-0') !== -Infinity;
1828
1829 // `parseFloat` method
1830 // https://tc39.github.io/ecma262/#sec-parsefloat-string
1831 var _parseFloat = FORCED$2 ? function parseFloat(string) {
1832 var trimmedString = trim$1(String(string));
1833 var result = nativeParseFloat(trimmedString);
1834 return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
1835 } : nativeParseFloat;
1836
1837 // `parseFloat` method
1838 // https://tc39.github.io/ecma262/#sec-parsefloat-string
1839 _export({ global: true, forced: parseFloat != _parseFloat }, {
1840 parseFloat: _parseFloat
1841 });
1842
1843 var trim$2 = stringTrim.trim;
1844
1845
1846 var nativeParseInt = global_1.parseInt;
1847 var hex = /^[+-]?0[Xx]/;
1848 var FORCED$3 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
1849
1850 // `parseInt` method
1851 // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1852 var _parseInt = FORCED$3 ? function parseInt(string, radix) {
1853 var S = trim$2(String(string));
1854 return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
1855 } : nativeParseInt;
1856
1857 // `parseInt` method
1858 // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1859 _export({ global: true, forced: parseInt != _parseInt }, {
1860 parseInt: _parseInt
1861 });
1862
1863 // `RegExp.prototype.flags` getter implementation
1864 // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
1865 var regexpFlags = function () {
1866 var that = anObject(this);
1867 var result = '';
1868 if (that.global) result += 'g';
1869 if (that.ignoreCase) result += 'i';
1870 if (that.multiline) result += 'm';
1871 if (that.dotAll) result += 's';
1872 if (that.unicode) result += 'u';
1873 if (that.sticky) result += 'y';
1874 return result;
1875 };
1876
1877 var TO_STRING = 'toString';
1878 var RegExpPrototype = RegExp.prototype;
1879 var nativeToString = RegExpPrototype[TO_STRING];
1880
1881 var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
1882 // FF44- RegExp#toString has a wrong name
1883 var INCORRECT_NAME = nativeToString.name != TO_STRING;
1884
1885 // `RegExp.prototype.toString` method
1886 // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
1887 if (NOT_GENERIC || INCORRECT_NAME) {
1888 redefine(RegExp.prototype, TO_STRING, function toString() {
1889 var R = anObject(this);
1890 var p = String(R.source);
1891 var rf = R.flags;
1892 var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
1893 return '/' + p + '/' + f;
1894 }, { unsafe: true });
1895 }
1896
1897 var MATCH = wellKnownSymbol('match');
1898
1899 // `IsRegExp` abstract operation
1900 // https://tc39.github.io/ecma262/#sec-isregexp
1901 var isRegexp = function (it) {
1902 var isRegExp;
1903 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1904 };
1905
1906 var notARegexp = function (it) {
1907 if (isRegexp(it)) {
1908 throw TypeError("The method doesn't accept regular expressions");
1909 } return it;
1910 };
1911
1912 var MATCH$1 = wellKnownSymbol('match');
1913
1914 var correctIsRegexpLogic = function (METHOD_NAME) {
1915 var regexp = /./;
1916 try {
1917 '/./'[METHOD_NAME](regexp);
1918 } catch (e) {
1919 try {
1920 regexp[MATCH$1] = false;
1921 return '/./'[METHOD_NAME](regexp);
1922 } catch (f) { /* empty */ }
1923 } return false;
1924 };
1925
1926 // `String.prototype.includes` method
1927 // https://tc39.github.io/ecma262/#sec-string.prototype.includes
1928 _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
1929 includes: function includes(searchString /* , position = 0 */) {
1930 return !!~String(requireObjectCoercible(this))
1931 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
1932 }
1933 });
1934
1935 // `String.prototype.{ codePointAt, at }` methods implementation
1936 var createMethod$4 = function (CONVERT_TO_STRING) {
1937 return function ($this, pos) {
1938 var S = String(requireObjectCoercible($this));
1939 var position = toInteger(pos);
1940 var size = S.length;
1941 var first, second;
1942 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1943 first = S.charCodeAt(position);
1944 return first < 0xD800 || first > 0xDBFF || position + 1 === size
1945 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
1946 ? CONVERT_TO_STRING ? S.charAt(position) : first
1947 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1948 };
1949 };
1950
1951 var stringMultibyte = {
1952 // `String.prototype.codePointAt` method
1953 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1954 codeAt: createMethod$4(false),
1955 // `String.prototype.at` method
1956 // https://github.com/mathiasbynens/String.prototype.at
1957 charAt: createMethod$4(true)
1958 };
1959
1960 var charAt = stringMultibyte.charAt;
1961
1962
1963
1964 var STRING_ITERATOR = 'String Iterator';
1965 var setInternalState$2 = internalState.set;
1966 var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
1967
1968 // `String.prototype[@@iterator]` method
1969 // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
1970 defineIterator(String, 'String', function (iterated) {
1971 setInternalState$2(this, {
1972 type: STRING_ITERATOR,
1973 string: String(iterated),
1974 index: 0
1975 });
1976 // `%StringIteratorPrototype%.next` method
1977 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
1978 }, function next() {
1979 var state = getInternalState$2(this);
1980 var string = state.string;
1981 var index = state.index;
1982 var point;
1983 if (index >= string.length) return { value: undefined, done: true };
1984 point = charAt(string, index);
1985 state.index += point.length;
1986 return { value: point, done: false };
1987 });
1988
1989 var nativeExec = RegExp.prototype.exec;
1990 // This always refers to the native implementation, because the
1991 // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
1992 // which loads this file before patching the method.
1993 var nativeReplace = String.prototype.replace;
1994
1995 var patchedExec = nativeExec;
1996
1997 var UPDATES_LAST_INDEX_WRONG = (function () {
1998 var re1 = /a/;
1999 var re2 = /b*/g;
2000 nativeExec.call(re1, 'a');
2001 nativeExec.call(re2, 'a');
2002 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
2003 })();
2004
2005 // nonparticipating capturing group, copied from es5-shim's String#split patch.
2006 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
2007
2008 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
2009
2010 if (PATCH) {
2011 patchedExec = function exec(str) {
2012 var re = this;
2013 var lastIndex, reCopy, match, i;
2014
2015 if (NPCG_INCLUDED) {
2016 reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
2017 }
2018 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
2019
2020 match = nativeExec.call(re, str);
2021
2022 if (UPDATES_LAST_INDEX_WRONG && match) {
2023 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
2024 }
2025 if (NPCG_INCLUDED && match && match.length > 1) {
2026 // Fix browsers whose `exec` methods don't consistently return `undefined`
2027 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
2028 nativeReplace.call(match[0], reCopy, function () {
2029 for (i = 1; i < arguments.length - 2; i++) {
2030 if (arguments[i] === undefined) match[i] = undefined;
2031 }
2032 });
2033 }
2034
2035 return match;
2036 };
2037 }
2038
2039 var regexpExec = patchedExec;
2040
2041 var SPECIES$3 = wellKnownSymbol('species');
2042
2043 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
2044 // #replace needs built-in support for named groups.
2045 // #match works fine because it just return the exec results, even if it has
2046 // a "grops" property.
2047 var re = /./;
2048 re.exec = function () {
2049 var result = [];
2050 result.groups = { a: '7' };
2051 return result;
2052 };
2053 return ''.replace(re, '$<a>') !== '7';
2054 });
2055
2056 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
2057 // Weex JS has frozen built-in prototypes, so use try / catch wrapper
2058 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
2059 var re = /(?:)/;
2060 var originalExec = re.exec;
2061 re.exec = function () { return originalExec.apply(this, arguments); };
2062 var result = 'ab'.split(re);
2063 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
2064 });
2065
2066 var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
2067 var SYMBOL = wellKnownSymbol(KEY);
2068
2069 var DELEGATES_TO_SYMBOL = !fails(function () {
2070 // String methods call symbol-named RegEp methods
2071 var O = {};
2072 O[SYMBOL] = function () { return 7; };
2073 return ''[KEY](O) != 7;
2074 });
2075
2076 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
2077 // Symbol-named RegExp methods call .exec
2078 var execCalled = false;
2079 var re = /a/;
2080 re.exec = function () { execCalled = true; return null; };
2081
2082 if (KEY === 'split') {
2083 // RegExp[@@split] doesn't call the regex's exec method, but first creates
2084 // a new one. We need to return the patched regex when creating the new one.
2085 re.constructor = {};
2086 re.constructor[SPECIES$3] = function () { return re; };
2087 }
2088
2089 re[SYMBOL]('');
2090 return !execCalled;
2091 });
2092
2093 if (
2094 !DELEGATES_TO_SYMBOL ||
2095 !DELEGATES_TO_EXEC ||
2096 (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
2097 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
2098 ) {
2099 var nativeRegExpMethod = /./[SYMBOL];
2100 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
2101 if (regexp.exec === regexpExec) {
2102 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
2103 // The native String method already delegates to @@method (this
2104 // polyfilled function), leasing to infinite recursion.
2105 // We avoid it by directly calling the native @@method method.
2106 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
2107 }
2108 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
2109 }
2110 return { done: false };
2111 });
2112 var stringMethod = methods[0];
2113 var regexMethod = methods[1];
2114
2115 redefine(String.prototype, KEY, stringMethod);
2116 redefine(RegExp.prototype, SYMBOL, length == 2
2117 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
2118 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
2119 ? function (string, arg) { return regexMethod.call(string, this, arg); }
2120 // 21.2.5.6 RegExp.prototype[@@match](string)
2121 // 21.2.5.9 RegExp.prototype[@@search](string)
2122 : function (string) { return regexMethod.call(string, this); }
2123 );
2124 if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
2125 }
2126 };
2127
2128 var charAt$1 = stringMultibyte.charAt;
2129
2130 // `AdvanceStringIndex` abstract operation
2131 // https://tc39.github.io/ecma262/#sec-advancestringindex
2132 var advanceStringIndex = function (S, index, unicode) {
2133 return index + (unicode ? charAt$1(S, index).length : 1);
2134 };
2135
2136 // `RegExpExec` abstract operation
2137 // https://tc39.github.io/ecma262/#sec-regexpexec
2138 var regexpExecAbstract = function (R, S) {
2139 var exec = R.exec;
2140 if (typeof exec === 'function') {
2141 var result = exec.call(R, S);
2142 if (typeof result !== 'object') {
2143 throw TypeError('RegExp exec method returned something other than an Object or null');
2144 }
2145 return result;
2146 }
2147
2148 if (classofRaw(R) !== 'RegExp') {
2149 throw TypeError('RegExp#exec called on incompatible receiver');
2150 }
2151
2152 return regexpExec.call(R, S);
2153 };
2154
2155 var max$3 = Math.max;
2156 var min$3 = Math.min;
2157 var floor$1 = Math.floor;
2158 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
2159 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
2160
2161 var maybeToString = function (it) {
2162 return it === undefined ? it : String(it);
2163 };
2164
2165 // @@replace logic
2166 fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
2167 return [
2168 // `String.prototype.replace` method
2169 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
2170 function replace(searchValue, replaceValue) {
2171 var O = requireObjectCoercible(this);
2172 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
2173 return replacer !== undefined
2174 ? replacer.call(searchValue, O, replaceValue)
2175 : nativeReplace.call(String(O), searchValue, replaceValue);
2176 },
2177 // `RegExp.prototype[@@replace]` method
2178 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
2179 function (regexp, replaceValue) {
2180 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
2181 if (res.done) return res.value;
2182
2183 var rx = anObject(regexp);
2184 var S = String(this);
2185
2186 var functionalReplace = typeof replaceValue === 'function';
2187 if (!functionalReplace) replaceValue = String(replaceValue);
2188
2189 var global = rx.global;
2190 if (global) {
2191 var fullUnicode = rx.unicode;
2192 rx.lastIndex = 0;
2193 }
2194 var results = [];
2195 while (true) {
2196 var result = regexpExecAbstract(rx, S);
2197 if (result === null) break;
2198
2199 results.push(result);
2200 if (!global) break;
2201
2202 var matchStr = String(result[0]);
2203 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2204 }
2205
2206 var accumulatedResult = '';
2207 var nextSourcePosition = 0;
2208 for (var i = 0; i < results.length; i++) {
2209 result = results[i];
2210
2211 var matched = String(result[0]);
2212 var position = max$3(min$3(toInteger(result.index), S.length), 0);
2213 var captures = [];
2214 // NOTE: This is equivalent to
2215 // captures = result.slice(1).map(maybeToString)
2216 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2217 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2218 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2219 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
2220 var namedCaptures = result.groups;
2221 if (functionalReplace) {
2222 var replacerArgs = [matched].concat(captures, position, S);
2223 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
2224 var replacement = String(replaceValue.apply(undefined, replacerArgs));
2225 } else {
2226 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2227 }
2228 if (position >= nextSourcePosition) {
2229 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
2230 nextSourcePosition = position + matched.length;
2231 }
2232 }
2233 return accumulatedResult + S.slice(nextSourcePosition);
2234 }
2235 ];
2236
2237 // https://tc39.github.io/ecma262/#sec-getsubstitution
2238 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
2239 var tailPos = position + matched.length;
2240 var m = captures.length;
2241 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
2242 if (namedCaptures !== undefined) {
2243 namedCaptures = toObject(namedCaptures);
2244 symbols = SUBSTITUTION_SYMBOLS;
2245 }
2246 return nativeReplace.call(replacement, symbols, function (match, ch) {
2247 var capture;
2248 switch (ch.charAt(0)) {
2249 case '$': return '$';
2250 case '&': return matched;
2251 case '`': return str.slice(0, position);
2252 case "'": return str.slice(tailPos);
2253 case '<':
2254 capture = namedCaptures[ch.slice(1, -1)];
2255 break;
2256 default: // \d\d?
2257 var n = +ch;
2258 if (n === 0) return match;
2259 if (n > m) {
2260 var f = floor$1(n / 10);
2261 if (f === 0) return match;
2262 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
2263 return match;
2264 }
2265 capture = captures[n - 1];
2266 }
2267 return capture === undefined ? '' : capture;
2268 });
2269 }
2270 });
2271
2272 // `SameValue` abstract operation
2273 // https://tc39.github.io/ecma262/#sec-samevalue
2274 var sameValue = Object.is || function is(x, y) {
2275 // eslint-disable-next-line no-self-compare
2276 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
2277 };
2278
2279 // @@search logic
2280 fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
2281 return [
2282 // `String.prototype.search` method
2283 // https://tc39.github.io/ecma262/#sec-string.prototype.search
2284 function search(regexp) {
2285 var O = requireObjectCoercible(this);
2286 var searcher = regexp == undefined ? undefined : regexp[SEARCH];
2287 return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
2288 },
2289 // `RegExp.prototype[@@search]` method
2290 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
2291 function (regexp) {
2292 var res = maybeCallNative(nativeSearch, regexp, this);
2293 if (res.done) return res.value;
2294
2295 var rx = anObject(regexp);
2296 var S = String(this);
2297
2298 var previousLastIndex = rx.lastIndex;
2299 if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
2300 var result = regexpExecAbstract(rx, S);
2301 if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
2302 return result === null ? -1 : result.index;
2303 }
2304 ];
2305 });
2306
2307 var SPECIES$4 = wellKnownSymbol('species');
2308
2309 // `SpeciesConstructor` abstract operation
2310 // https://tc39.github.io/ecma262/#sec-speciesconstructor
2311 var speciesConstructor = function (O, defaultConstructor) {
2312 var C = anObject(O).constructor;
2313 var S;
2314 return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
2315 };
2316
2317 var arrayPush = [].push;
2318 var min$4 = Math.min;
2319 var MAX_UINT32 = 0xFFFFFFFF;
2320
2321 // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
2322 var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
2323
2324 // @@split logic
2325 fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
2326 var internalSplit;
2327 if (
2328 'abbc'.split(/(b)*/)[1] == 'c' ||
2329 'test'.split(/(?:)/, -1).length != 4 ||
2330 'ab'.split(/(?:ab)*/).length != 2 ||
2331 '.'.split(/(.?)(.?)/).length != 4 ||
2332 '.'.split(/()()/).length > 1 ||
2333 ''.split(/.?/).length
2334 ) {
2335 // based on es5-shim implementation, need to rework it
2336 internalSplit = function (separator, limit) {
2337 var string = String(requireObjectCoercible(this));
2338 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2339 if (lim === 0) return [];
2340 if (separator === undefined) return [string];
2341 // If `separator` is not a regex, use native split
2342 if (!isRegexp(separator)) {
2343 return nativeSplit.call(string, separator, lim);
2344 }
2345 var output = [];
2346 var flags = (separator.ignoreCase ? 'i' : '') +
2347 (separator.multiline ? 'm' : '') +
2348 (separator.unicode ? 'u' : '') +
2349 (separator.sticky ? 'y' : '');
2350 var lastLastIndex = 0;
2351 // Make `global` and avoid `lastIndex` issues by working with a copy
2352 var separatorCopy = new RegExp(separator.source, flags + 'g');
2353 var match, lastIndex, lastLength;
2354 while (match = regexpExec.call(separatorCopy, string)) {
2355 lastIndex = separatorCopy.lastIndex;
2356 if (lastIndex > lastLastIndex) {
2357 output.push(string.slice(lastLastIndex, match.index));
2358 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
2359 lastLength = match[0].length;
2360 lastLastIndex = lastIndex;
2361 if (output.length >= lim) break;
2362 }
2363 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
2364 }
2365 if (lastLastIndex === string.length) {
2366 if (lastLength || !separatorCopy.test('')) output.push('');
2367 } else output.push(string.slice(lastLastIndex));
2368 return output.length > lim ? output.slice(0, lim) : output;
2369 };
2370 // Chakra, V8
2371 } else if ('0'.split(undefined, 0).length) {
2372 internalSplit = function (separator, limit) {
2373 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
2374 };
2375 } else internalSplit = nativeSplit;
2376
2377 return [
2378 // `String.prototype.split` method
2379 // https://tc39.github.io/ecma262/#sec-string.prototype.split
2380 function split(separator, limit) {
2381 var O = requireObjectCoercible(this);
2382 var splitter = separator == undefined ? undefined : separator[SPLIT];
2383 return splitter !== undefined
2384 ? splitter.call(separator, O, limit)
2385 : internalSplit.call(String(O), separator, limit);
2386 },
2387 // `RegExp.prototype[@@split]` method
2388 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
2389 //
2390 // NOTE: This cannot be properly polyfilled in engines that don't support
2391 // the 'y' flag.
2392 function (regexp, limit) {
2393 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
2394 if (res.done) return res.value;
2395
2396 var rx = anObject(regexp);
2397 var S = String(this);
2398 var C = speciesConstructor(rx, RegExp);
2399
2400 var unicodeMatching = rx.unicode;
2401 var flags = (rx.ignoreCase ? 'i' : '') +
2402 (rx.multiline ? 'm' : '') +
2403 (rx.unicode ? 'u' : '') +
2404 (SUPPORTS_Y ? 'y' : 'g');
2405
2406 // ^(? + rx + ) is needed, in combination with some S slicing, to
2407 // simulate the 'y' flag.
2408 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
2409 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2410 if (lim === 0) return [];
2411 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
2412 var p = 0;
2413 var q = 0;
2414 var A = [];
2415 while (q < S.length) {
2416 splitter.lastIndex = SUPPORTS_Y ? q : 0;
2417 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
2418 var e;
2419 if (
2420 z === null ||
2421 (e = min$4(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
2422 ) {
2423 q = advanceStringIndex(S, q, unicodeMatching);
2424 } else {
2425 A.push(S.slice(p, q));
2426 if (A.length === lim) return A;
2427 for (var i = 1; i <= z.length - 1; i++) {
2428 A.push(z[i]);
2429 if (A.length === lim) return A;
2430 }
2431 q = p = e;
2432 }
2433 }
2434 A.push(S.slice(p));
2435 return A;
2436 }
2437 ];
2438 }, !SUPPORTS_Y);
2439
2440 var non = '\u200B\u0085\u180E';
2441
2442 // check that a method works with the correct list
2443 // of whitespaces and has a correct name
2444 var forcedStringTrimMethod = function (METHOD_NAME) {
2445 return fails(function () {
2446 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
2447 });
2448 };
2449
2450 var $trim = stringTrim.trim;
2451
2452
2453 // `String.prototype.trim` method
2454 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
2455 _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
2456 trim: function trim() {
2457 return $trim(this);
2458 }
2459 });
2460
2461 // iterable DOM collections
2462 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2463 var domIterables = {
2464 CSSRuleList: 0,
2465 CSSStyleDeclaration: 0,
2466 CSSValueList: 0,
2467 ClientRectList: 0,
2468 DOMRectList: 0,
2469 DOMStringList: 0,
2470 DOMTokenList: 1,
2471 DataTransferItemList: 0,
2472 FileList: 0,
2473 HTMLAllCollection: 0,
2474 HTMLCollection: 0,
2475 HTMLFormElement: 0,
2476 HTMLSelectElement: 0,
2477 MediaList: 0,
2478 MimeTypeArray: 0,
2479 NamedNodeMap: 0,
2480 NodeList: 1,
2481 PaintRequestList: 0,
2482 Plugin: 0,
2483 PluginArray: 0,
2484 SVGLengthList: 0,
2485 SVGNumberList: 0,
2486 SVGPathSegList: 0,
2487 SVGPointList: 0,
2488 SVGStringList: 0,
2489 SVGTransformList: 0,
2490 SourceBufferList: 0,
2491 StyleSheetList: 0,
2492 TextTrackCueList: 0,
2493 TextTrackList: 0,
2494 TouchList: 0
2495 };
2496
2497 var $forEach$1 = arrayIteration.forEach;
2498
2499
2500 // `Array.prototype.forEach` method implementation
2501 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
2502 var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
2503 return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2504 } : [].forEach;
2505
2506 for (var COLLECTION_NAME in domIterables) {
2507 var Collection = global_1[COLLECTION_NAME];
2508 var CollectionPrototype = Collection && Collection.prototype;
2509 // some Chrome versions have non-configurable methods on DOMTokenList
2510 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
2511 hide(CollectionPrototype, 'forEach', arrayForEach);
2512 } catch (error) {
2513 CollectionPrototype.forEach = arrayForEach;
2514 }
2515 }
2516
2517 var ITERATOR$2 = wellKnownSymbol('iterator');
2518 var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
2519 var ArrayValues = es_array_iterator.values;
2520
2521 for (var COLLECTION_NAME$1 in domIterables) {
2522 var Collection$1 = global_1[COLLECTION_NAME$1];
2523 var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
2524 if (CollectionPrototype$1) {
2525 // some Chrome versions have non-configurable methods on DOMTokenList
2526 if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {
2527 hide(CollectionPrototype$1, ITERATOR$2, ArrayValues);
2528 } catch (error) {
2529 CollectionPrototype$1[ITERATOR$2] = ArrayValues;
2530 }
2531 if (!CollectionPrototype$1[TO_STRING_TAG$3]) hide(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);
2532 if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {
2533 // some Chrome versions have non-configurable methods on DOMTokenList
2534 if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
2535 hide(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
2536 } catch (error) {
2537 CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
2538 }
2539 }
2540 }
2541 }
2542
2543 function _typeof(obj) {
2544 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2545 _typeof = function (obj) {
2546 return typeof obj;
2547 };
2548 } else {
2549 _typeof = function (obj) {
2550 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2551 };
2552 }
2553
2554 return _typeof(obj);
2555 }
2556
2557 function _classCallCheck(instance, Constructor) {
2558 if (!(instance instanceof Constructor)) {
2559 throw new TypeError("Cannot call a class as a function");
2560 }
2561 }
2562
2563 function _defineProperties(target, props) {
2564 for (var i = 0; i < props.length; i++) {
2565 var descriptor = props[i];
2566 descriptor.enumerable = descriptor.enumerable || false;
2567 descriptor.configurable = true;
2568 if ("value" in descriptor) descriptor.writable = true;
2569 Object.defineProperty(target, descriptor.key, descriptor);
2570 }
2571 }
2572
2573 function _createClass(Constructor, protoProps, staticProps) {
2574 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2575 if (staticProps) _defineProperties(Constructor, staticProps);
2576 return Constructor;
2577 }
2578
2579 function _slicedToArray(arr, i) {
2580 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
2581 }
2582
2583 function _toConsumableArray(arr) {
2584 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
2585 }
2586
2587 function _arrayWithoutHoles(arr) {
2588 if (Array.isArray(arr)) {
2589 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
2590
2591 return arr2;
2592 }
2593 }
2594
2595 function _arrayWithHoles(arr) {
2596 if (Array.isArray(arr)) return arr;
2597 }
2598
2599 function _iterableToArray(iter) {
2600 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
2601 }
2602
2603 function _iterableToArrayLimit(arr, i) {
2604 var _arr = [];
2605 var _n = true;
2606 var _d = false;
2607 var _e = undefined;
2608
2609 try {
2610 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
2611 _arr.push(_s.value);
2612
2613 if (i && _arr.length === i) break;
2614 }
2615 } catch (err) {
2616 _d = true;
2617 _e = err;
2618 } finally {
2619 try {
2620 if (!_n && _i["return"] != null) _i["return"]();
2621 } finally {
2622 if (_d) throw _e;
2623 }
2624 }
2625
2626 return _arr;
2627 }
2628
2629 function _nonIterableSpread() {
2630 throw new TypeError("Invalid attempt to spread non-iterable instance");
2631 }
2632
2633 function _nonIterableRest() {
2634 throw new TypeError("Invalid attempt to destructure non-iterable instance");
2635 }
2636
2637 var VERSION = '1.15.4';
2638 var bootstrapVersion = 4;
2639
2640 try {
2641 var rawVersion = $.fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
2642 // It is undefined in older versions of Bootstrap (tested with 3.1.1).
2643
2644 if (rawVersion !== undefined) {
2645 bootstrapVersion = parseInt(rawVersion, 10);
2646 }
2647 } catch (e) {// ignore
2648 }
2649
2650 var CONSTANTS = {
2651 3: {
2652 iconsPrefix: 'glyphicon',
2653 icons: {
2654 paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
2655 paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
2656 refresh: 'glyphicon-refresh icon-refresh',
2657 toggleOff: 'glyphicon-list-alt icon-list-alt',
2658 toggleOn: 'glyphicon-list-alt icon-list-alt',
2659 columns: 'glyphicon-th icon-th',
2660 detailOpen: 'glyphicon-plus icon-plus',
2661 detailClose: 'glyphicon-minus icon-minus',
2662 fullscreen: 'glyphicon-fullscreen',
2663 search: 'glyphicon-search',
2664 clearSearch: 'glyphicon-trash'
2665 },
2666 classes: {
2667 buttonsPrefix: 'btn',
2668 buttons: 'default',
2669 buttonsGroup: 'btn-group',
2670 buttonsDropdown: 'btn-group',
2671 pull: 'pull',
2672 inputGroup: 'input-group',
2673 input: 'form-control',
2674 paginationDropdown: 'btn-group dropdown',
2675 dropup: 'dropup',
2676 dropdownActive: 'active',
2677 paginationActive: 'active',
2678 buttonActive: 'active'
2679 },
2680 html: {
2681 toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
2682 toolbarDropdownItem: '<li role="menuitem"><label>%s</label></li>',
2683 toolbarDropdownSeperator: '<li class="divider"></li>',
2684 pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
2685 pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
2686 dropdownCaret: '<span class="caret"></span>',
2687 pagination: ['<ul class="pagination%s">', '</ul>'],
2688 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
2689 icon: '<i class="%s %s"></i>',
2690 inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
2691 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
2692 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
2693 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
2694 }
2695 },
2696 4: {
2697 iconsPrefix: 'fa',
2698 icons: {
2699 paginationSwitchDown: 'fa-caret-square-down',
2700 paginationSwitchUp: 'fa-caret-square-up',
2701 refresh: 'fa-sync',
2702 toggleOff: 'fa-toggle-off',
2703 toggleOn: 'fa-toggle-on',
2704 columns: 'fa-th-list',
2705 detailOpen: 'fa-plus',
2706 detailClose: 'fa-minus',
2707 fullscreen: 'fa-arrows-alt',
2708 search: 'fa-search',
2709 clearSearch: 'fa-trash'
2710 },
2711 classes: {
2712 buttonsPrefix: 'btn',
2713 buttons: 'secondary',
2714 buttonsGroup: 'btn-group',
2715 buttonsDropdown: 'btn-group',
2716 pull: 'float',
2717 inputGroup: 'btn-group',
2718 input: 'form-control',
2719 paginationDropdown: 'btn-group dropdown',
2720 dropup: 'dropup',
2721 dropdownActive: 'active',
2722 paginationActive: 'active',
2723 buttonActive: 'active'
2724 },
2725 html: {
2726 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
2727 toolbarDropdownItem: '<label class="dropdown-item">%s</label>',
2728 pageDropdown: ['<div class="dropdown-menu">', '</div>'],
2729 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
2730 toolbarDropdownSeperator: '<div class="dropdown-divider"></div>',
2731 dropdownCaret: '<span class="caret"></span>',
2732 pagination: ['<ul class="pagination%s">', '</ul>'],
2733 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
2734 icon: '<i class="%s %s"></i>',
2735 inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
2736 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
2737 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
2738 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
2739 }
2740 }
2741 }[bootstrapVersion];
2742 var DEFAULTS = {
2743 height: undefined,
2744 classes: 'table table-bordered table-hover',
2745 theadClasses: '',
2746 rowStyle: function rowStyle(row, index) {
2747 return {};
2748 },
2749 rowAttributes: function rowAttributes(row, index) {
2750 return {};
2751 },
2752 undefinedText: '-',
2753 locale: undefined,
2754 virtualScroll: false,
2755 virtualScrollItemHeight: undefined,
2756 sortable: true,
2757 sortClass: undefined,
2758 silentSort: true,
2759 sortName: undefined,
2760 sortOrder: 'asc',
2761 sortStable: false,
2762 rememberOrder: false,
2763 customSort: undefined,
2764 columns: [[]],
2765 data: [],
2766 url: undefined,
2767 method: 'get',
2768 cache: true,
2769 contentType: 'application/json',
2770 dataType: 'json',
2771 ajax: undefined,
2772 ajaxOptions: {},
2773 queryParams: function queryParams(params) {
2774 return params;
2775 },
2776 queryParamsType: 'limit',
2777 // 'limit', undefined
2778 responseHandler: function responseHandler(res) {
2779 return res;
2780 },
2781 totalField: 'total',
2782 totalNotFilteredField: 'totalNotFiltered',
2783 dataField: 'rows',
2784 pagination: false,
2785 onlyInfoPagination: false,
2786 showExtendedPagination: false,
2787 paginationLoop: true,
2788 sidePagination: 'client',
2789 // client or server
2790 totalRows: 0,
2791 totalNotFiltered: 0,
2792 pageNumber: 1,
2793 pageSize: 10,
2794 pageList: [10, 25, 50, 100],
2795 paginationHAlign: 'right',
2796 // right, left
2797 paginationVAlign: 'bottom',
2798 // bottom, top, both
2799 paginationDetailHAlign: 'left',
2800 // right, left
2801 paginationPreText: '&lsaquo;',
2802 paginationNextText: '&rsaquo;',
2803 paginationSuccessivelySize: 5,
2804 // Maximum successively number of pages in a row
2805 paginationPagesBySide: 1,
2806 // Number of pages on each side (right, left) of the current page.
2807 paginationUseIntermediate: false,
2808 // Calculate intermediate pages for quick access
2809 search: false,
2810 searchOnEnterKey: false,
2811 strictSearch: false,
2812 visibleSearch: false,
2813 showButtonIcons: true,
2814 showButtonText: false,
2815 showSearchButton: false,
2816 showSearchClearButton: false,
2817 trimOnSearch: true,
2818 searchAlign: 'right',
2819 searchTimeOut: 500,
2820 searchText: '',
2821 customSearch: undefined,
2822 showHeader: true,
2823 showFooter: false,
2824 footerStyle: function footerStyle(row, index) {
2825 return {};
2826 },
2827 showColumns: false,
2828 showColumnsToggleAll: false,
2829 minimumCountColumns: 1,
2830 showPaginationSwitch: false,
2831 showRefresh: false,
2832 showToggle: false,
2833 showFullscreen: false,
2834 smartDisplay: true,
2835 escape: false,
2836 filterOptions: {
2837 filterAlgorithm: 'and'
2838 },
2839 idField: undefined,
2840 selectItemName: 'btSelectItem',
2841 clickToSelect: false,
2842 ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
2843 var tagName = _ref.tagName;
2844 return ['A', 'BUTTON'].includes(tagName);
2845 },
2846 singleSelect: false,
2847 checkboxHeader: true,
2848 maintainMetaData: false,
2849 multipleSelectRow: false,
2850 uniqueId: undefined,
2851 cardView: false,
2852 detailView: false,
2853 detailViewIcon: true,
2854 detailViewByClick: false,
2855 detailFormatter: function detailFormatter(index, row) {
2856 return '';
2857 },
2858 detailFilter: function detailFilter(index, row) {
2859 return true;
2860 },
2861 toolbar: undefined,
2862 toolbarAlign: 'left',
2863 buttonsToolbar: undefined,
2864 buttonsAlign: 'right',
2865 buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
2866 buttonsClass: CONSTANTS.classes.buttons,
2867 icons: CONSTANTS.icons,
2868 html: CONSTANTS.html,
2869 iconSize: undefined,
2870 iconsPrefix: CONSTANTS.iconsPrefix,
2871 // glyphicon or fa(font-awesome)
2872 onAll: function onAll(name, args) {
2873 return false;
2874 },
2875 onClickCell: function onClickCell(field, value, row, $element) {
2876 return false;
2877 },
2878 onDblClickCell: function onDblClickCell(field, value, row, $element) {
2879 return false;
2880 },
2881 onClickRow: function onClickRow(item, $element) {
2882 return false;
2883 },
2884 onDblClickRow: function onDblClickRow(item, $element) {
2885 return false;
2886 },
2887 onSort: function onSort(name, order) {
2888 return false;
2889 },
2890 onCheck: function onCheck(row) {
2891 return false;
2892 },
2893 onUncheck: function onUncheck(row) {
2894 return false;
2895 },
2896 onCheckAll: function onCheckAll(rows) {
2897 return false;
2898 },
2899 onUncheckAll: function onUncheckAll(rows) {
2900 return false;
2901 },
2902 onCheckSome: function onCheckSome(rows) {
2903 return false;
2904 },
2905 onUncheckSome: function onUncheckSome(rows) {
2906 return false;
2907 },
2908 onLoadSuccess: function onLoadSuccess(data) {
2909 return false;
2910 },
2911 onLoadError: function onLoadError(status) {
2912 return false;
2913 },
2914 onColumnSwitch: function onColumnSwitch(field, checked) {
2915 return false;
2916 },
2917 onPageChange: function onPageChange(number, size) {
2918 return false;
2919 },
2920 onSearch: function onSearch(text) {
2921 return false;
2922 },
2923 onToggle: function onToggle(cardView) {
2924 return false;
2925 },
2926 onPreBody: function onPreBody(data) {
2927 return false;
2928 },
2929 onPostBody: function onPostBody() {
2930 return false;
2931 },
2932 onPostHeader: function onPostHeader() {
2933 return false;
2934 },
2935 onPostFooter: function onPostFooter() {
2936 return false;
2937 },
2938 onExpandRow: function onExpandRow(index, row, $detail) {
2939 return false;
2940 },
2941 onCollapseRow: function onCollapseRow(index, row) {
2942 return false;
2943 },
2944 onRefreshOptions: function onRefreshOptions(options) {
2945 return false;
2946 },
2947 onRefresh: function onRefresh(params) {
2948 return false;
2949 },
2950 onResetView: function onResetView() {
2951 return false;
2952 },
2953 onScrollBody: function onScrollBody() {
2954 return false;
2955 }
2956 };
2957 var EN = {
2958 formatLoadingMessage: function formatLoadingMessage() {
2959 return 'Loading, please wait';
2960 },
2961 formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
2962 return "".concat(pageNumber, " rows per page");
2963 },
2964 formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
2965 if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
2966 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
2967 }
2968
2969 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
2970 },
2971 formatSRPaginationPreText: function formatSRPaginationPreText() {
2972 return 'previous page';
2973 },
2974 formatSRPaginationPageText: function formatSRPaginationPageText(page) {
2975 return "to page ".concat(page);
2976 },
2977 formatSRPaginationNextText: function formatSRPaginationNextText() {
2978 return 'next page';
2979 },
2980 formatDetailPagination: function formatDetailPagination(totalRows) {
2981 return "Showing ".concat(totalRows, " rows");
2982 },
2983 formatSearch: function formatSearch() {
2984 return 'Search';
2985 },
2986 formatClearSearch: function formatClearSearch() {
2987 return 'Clear Search';
2988 },
2989 formatNoMatches: function formatNoMatches() {
2990 return 'No matching records found';
2991 },
2992 formatPaginationSwitch: function formatPaginationSwitch() {
2993 return 'Hide/Show pagination';
2994 },
2995 formatPaginationSwitchDown: function formatPaginationSwitchDown() {
2996 return 'Show pagination';
2997 },
2998 formatPaginationSwitchUp: function formatPaginationSwitchUp() {
2999 return 'Hide pagination';
3000 },
3001 formatRefresh: function formatRefresh() {
3002 return 'Refresh';
3003 },
3004 formatToggle: function formatToggle() {
3005 return 'Toggle';
3006 },
3007 formatToggleOn: function formatToggleOn() {
3008 return 'Show card view';
3009 },
3010 formatToggleOff: function formatToggleOff() {
3011 return 'Hide card view';
3012 },
3013 formatColumns: function formatColumns() {
3014 return 'Columns';
3015 },
3016 formatColumnsToggleAll: function formatColumnsToggleAll() {
3017 return 'Toggle all';
3018 },
3019 formatFullscreen: function formatFullscreen() {
3020 return 'Fullscreen';
3021 },
3022 formatAllRows: function formatAllRows() {
3023 return 'All';
3024 }
3025 };
3026 var COLUMN_DEFAULTS = {
3027 field: undefined,
3028 title: undefined,
3029 titleTooltip: undefined,
3030 'class': undefined,
3031 width: undefined,
3032 widthUnit: 'px',
3033 rowspan: undefined,
3034 colspan: undefined,
3035 align: undefined,
3036 // left, right, center
3037 halign: undefined,
3038 // left, right, center
3039 falign: undefined,
3040 // left, right, center
3041 valign: undefined,
3042 // top, middle, bottom
3043 cellStyle: undefined,
3044 radio: false,
3045 checkbox: false,
3046 checkboxEnabled: true,
3047 clickToSelect: true,
3048 showSelectTitle: false,
3049 sortable: false,
3050 sortName: undefined,
3051 order: 'asc',
3052 // asc, desc
3053 sorter: undefined,
3054 visible: true,
3055 switchable: true,
3056 cardVisible: true,
3057 searchable: true,
3058 formatter: undefined,
3059 footerFormatter: undefined,
3060 detailFormatter: undefined,
3061 searchFormatter: true,
3062 escape: false,
3063 events: undefined
3064 };
3065 var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'getAllSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'resetWidth', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText'];
3066 var EVENTS = {
3067 'all.bs.table': 'onAll',
3068 'click-row.bs.table': 'onClickRow',
3069 'dbl-click-row.bs.table': 'onDblClickRow',
3070 'click-cell.bs.table': 'onClickCell',
3071 'dbl-click-cell.bs.table': 'onDblClickCell',
3072 'sort.bs.table': 'onSort',
3073 'check.bs.table': 'onCheck',
3074 'uncheck.bs.table': 'onUncheck',
3075 'check-all.bs.table': 'onCheckAll',
3076 'uncheck-all.bs.table': 'onUncheckAll',
3077 'check-some.bs.table': 'onCheckSome',
3078 'uncheck-some.bs.table': 'onUncheckSome',
3079 'load-success.bs.table': 'onLoadSuccess',
3080 'load-error.bs.table': 'onLoadError',
3081 'column-switch.bs.table': 'onColumnSwitch',
3082 'page-change.bs.table': 'onPageChange',
3083 'search.bs.table': 'onSearch',
3084 'toggle.bs.table': 'onToggle',
3085 'pre-body.bs.table': 'onPreBody',
3086 'post-body.bs.table': 'onPostBody',
3087 'post-header.bs.table': 'onPostHeader',
3088 'post-footer.bs.table': 'onPostFooter',
3089 'expand-row.bs.table': 'onExpandRow',
3090 'collapse-row.bs.table': 'onCollapseRow',
3091 'refresh-options.bs.table': 'onRefreshOptions',
3092 'reset-view.bs.table': 'onResetView',
3093 'refresh.bs.table': 'onRefresh',
3094 'scroll-body.bs.table': 'onScrollBody'
3095 };
3096 Object.assign(DEFAULTS, EN);
3097 var Constants = {
3098 VERSION: VERSION,
3099 THEME: "bootstrap".concat(bootstrapVersion),
3100 CONSTANTS: CONSTANTS,
3101 DEFAULTS: DEFAULTS,
3102 COLUMN_DEFAULTS: COLUMN_DEFAULTS,
3103 METHODS: METHODS,
3104 EVENTS: EVENTS,
3105 LOCALES: {
3106 en: EN,
3107 'en-US': EN
3108 }
3109 };
3110
3111 // `FlattenIntoArray` abstract operation
3112 // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
3113 var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
3114 var targetIndex = start;
3115 var sourceIndex = 0;
3116 var mapFn = mapper ? bindContext(mapper, thisArg, 3) : false;
3117 var element;
3118
3119 while (sourceIndex < sourceLen) {
3120 if (sourceIndex in source) {
3121 element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
3122
3123 if (depth > 0 && isArray(element)) {
3124 targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
3125 } else {
3126 if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
3127 target[targetIndex] = element;
3128 }
3129
3130 targetIndex++;
3131 }
3132 sourceIndex++;
3133 }
3134 return targetIndex;
3135 };
3136
3137 var flattenIntoArray_1 = flattenIntoArray;
3138
3139 // `Array.prototype.flat` method
3140 // https://github.com/tc39/proposal-flatMap
3141 _export({ target: 'Array', proto: true }, {
3142 flat: function flat(/* depthArg = 1 */) {
3143 var depthArg = arguments.length ? arguments[0] : undefined;
3144 var O = toObject(this);
3145 var sourceLen = toLength(O.length);
3146 var A = arraySpeciesCreate(O, 0);
3147 A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
3148 return A;
3149 }
3150 });
3151
3152 // this method was added to unscopables after implementation
3153 // in popular engines, so it's moved to a separate module
3154
3155
3156 addToUnscopables('flat');
3157
3158 var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
3159
3160 // `Object.keys` method
3161 // https://tc39.github.io/ecma262/#sec-object.keys
3162 _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
3163 keys: function keys(it) {
3164 return objectKeys(toObject(it));
3165 }
3166 });
3167
3168 var Utils = {
3169 // it only does '%s', and return '' when arguments are undefined
3170 sprintf: function sprintf(_str) {
3171 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3172 args[_key - 1] = arguments[_key];
3173 }
3174
3175 var flag = true;
3176 var i = 0;
3177
3178 var str = _str.replace(/%s/g, function () {
3179 var arg = args[i++];
3180
3181 if (typeof arg === 'undefined') {
3182 flag = false;
3183 return '';
3184 }
3185
3186 return arg;
3187 });
3188
3189 return flag ? str : '';
3190 },
3191 isEmptyObject: function isEmptyObject() {
3192 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3193 return Object.entries(obj).length === 0 && obj.constructor === Object;
3194 },
3195 isNumeric: function isNumeric(n) {
3196 return !isNaN(parseFloat(n)) && isFinite(n);
3197 },
3198 getFieldTitle: function getFieldTitle(list, value) {
3199 var _iteratorNormalCompletion = true;
3200 var _didIteratorError = false;
3201 var _iteratorError = undefined;
3202
3203 try {
3204 for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3205 var item = _step.value;
3206
3207 if (item.field === value) {
3208 return item.title;
3209 }
3210 }
3211 } catch (err) {
3212 _didIteratorError = true;
3213 _iteratorError = err;
3214 } finally {
3215 try {
3216 if (!_iteratorNormalCompletion && _iterator.return != null) {
3217 _iterator.return();
3218 }
3219 } finally {
3220 if (_didIteratorError) {
3221 throw _iteratorError;
3222 }
3223 }
3224 }
3225
3226 return '';
3227 },
3228 setFieldIndex: function setFieldIndex(columns) {
3229 var totalCol = 0;
3230 var flag = [];
3231 var _iteratorNormalCompletion2 = true;
3232 var _didIteratorError2 = false;
3233 var _iteratorError2 = undefined;
3234
3235 try {
3236 for (var _iterator2 = columns[0][Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
3237 var column = _step2.value;
3238 totalCol += column.colspan || 1;
3239 }
3240 } catch (err) {
3241 _didIteratorError2 = true;
3242 _iteratorError2 = err;
3243 } finally {
3244 try {
3245 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
3246 _iterator2.return();
3247 }
3248 } finally {
3249 if (_didIteratorError2) {
3250 throw _iteratorError2;
3251 }
3252 }
3253 }
3254
3255 for (var i = 0; i < columns.length; i++) {
3256 flag[i] = [];
3257
3258 for (var j = 0; j < totalCol; j++) {
3259 flag[i][j] = false;
3260 }
3261 }
3262
3263 for (var _i = 0; _i < columns.length; _i++) {
3264 var _iteratorNormalCompletion3 = true;
3265 var _didIteratorError3 = false;
3266 var _iteratorError3 = undefined;
3267
3268 try {
3269 for (var _iterator3 = columns[_i][Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
3270 var r = _step3.value;
3271 var rowspan = r.rowspan || 1;
3272 var colspan = r.colspan || 1;
3273
3274 var index = flag[_i].indexOf(false);
3275
3276 r.colspanIndex = index;
3277
3278 if (colspan === 1) {
3279 r.fieldIndex = index; // when field is undefined, use index instead
3280
3281 if (typeof r.field === 'undefined') {
3282 r.field = index;
3283 }
3284 } else {
3285 r.colspanGroup = r.colspan;
3286 }
3287
3288 for (var k = 0; k < rowspan; k++) {
3289 flag[_i + k][index] = true;
3290 }
3291
3292 for (var _k = 0; _k < colspan; _k++) {
3293 flag[_i][index + _k] = true;
3294 }
3295 }
3296 } catch (err) {
3297 _didIteratorError3 = true;
3298 _iteratorError3 = err;
3299 } finally {
3300 try {
3301 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
3302 _iterator3.return();
3303 }
3304 } finally {
3305 if (_didIteratorError3) {
3306 throw _iteratorError3;
3307 }
3308 }
3309 }
3310 }
3311 },
3312 updateFieldGroup: function updateFieldGroup(columns) {
3313 var allColumns = columns.flat();
3314 var _iteratorNormalCompletion4 = true;
3315 var _didIteratorError4 = false;
3316 var _iteratorError4 = undefined;
3317
3318 try {
3319 for (var _iterator4 = columns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
3320 var c = _step4.value;
3321 var _iteratorNormalCompletion5 = true;
3322 var _didIteratorError5 = false;
3323 var _iteratorError5 = undefined;
3324
3325 try {
3326 for (var _iterator5 = c[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
3327 var r = _step5.value;
3328
3329 if (r.colspanGroup > 1) {
3330 var colspan = 0;
3331
3332 var _loop = function _loop(i) {
3333 var column = allColumns.find(function (col) {
3334 return col.fieldIndex === i;
3335 });
3336
3337 if (column.visible) {
3338 colspan++;
3339 }
3340 };
3341
3342 for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
3343 _loop(i);
3344 }
3345
3346 r.colspan = colspan;
3347 r.visible = colspan > 0;
3348 }
3349 }
3350 } catch (err) {
3351 _didIteratorError5 = true;
3352 _iteratorError5 = err;
3353 } finally {
3354 try {
3355 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
3356 _iterator5.return();
3357 }
3358 } finally {
3359 if (_didIteratorError5) {
3360 throw _iteratorError5;
3361 }
3362 }
3363 }
3364 }
3365 } catch (err) {
3366 _didIteratorError4 = true;
3367 _iteratorError4 = err;
3368 } finally {
3369 try {
3370 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
3371 _iterator4.return();
3372 }
3373 } finally {
3374 if (_didIteratorError4) {
3375 throw _iteratorError4;
3376 }
3377 }
3378 }
3379 },
3380 getScrollBarWidth: function getScrollBarWidth() {
3381 if (this.cachedWidth === undefined) {
3382 var $inner = $('<div/>').addClass('fixed-table-scroll-inner');
3383 var $outer = $('<div/>').addClass('fixed-table-scroll-outer');
3384 $outer.append($inner);
3385 $('body').append($outer);
3386 var w1 = $inner[0].offsetWidth;
3387 $outer.css('overflow', 'scroll');
3388 var w2 = $inner[0].offsetWidth;
3389
3390 if (w1 === w2) {
3391 w2 = $outer[0].clientWidth;
3392 }
3393
3394 $outer.remove();
3395 this.cachedWidth = w1 - w2;
3396 }
3397
3398 return this.cachedWidth;
3399 },
3400 calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
3401 var func = name;
3402
3403 if (typeof name === 'string') {
3404 // support obj.func1.func2
3405 var names = name.split('.');
3406
3407 if (names.length > 1) {
3408 func = window;
3409 var _iteratorNormalCompletion6 = true;
3410 var _didIteratorError6 = false;
3411 var _iteratorError6 = undefined;
3412
3413 try {
3414 for (var _iterator6 = names[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
3415 var f = _step6.value;
3416 func = func[f];
3417 }
3418 } catch (err) {
3419 _didIteratorError6 = true;
3420 _iteratorError6 = err;
3421 } finally {
3422 try {
3423 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
3424 _iterator6.return();
3425 }
3426 } finally {
3427 if (_didIteratorError6) {
3428 throw _iteratorError6;
3429 }
3430 }
3431 }
3432 } else {
3433 func = window[name];
3434 }
3435 }
3436
3437 if (func !== null && _typeof(func) === 'object') {
3438 return func;
3439 }
3440
3441 if (typeof func === 'function') {
3442 return func.apply(self, args || []);
3443 }
3444
3445 if (!func && typeof name === 'string' && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
3446 return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
3447 }
3448
3449 return defaultValue;
3450 },
3451 compareObjects: function compareObjects(objectA, objectB, compareLength) {
3452 var aKeys = Object.keys(objectA);
3453 var bKeys = Object.keys(objectB);
3454
3455 if (compareLength && aKeys.length !== bKeys.length) {
3456 return false;
3457 }
3458
3459 for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
3460 var key = _aKeys[_i2];
3461
3462 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
3463 return false;
3464 }
3465 }
3466
3467 return true;
3468 },
3469 escapeHTML: function escapeHTML(text) {
3470 if (typeof text === 'string') {
3471 return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/`/g, '&#x60;');
3472 }
3473
3474 return text;
3475 },
3476 getRealDataAttr: function getRealDataAttr(dataAttr) {
3477 for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
3478 var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
3479 attr = _Object$entries$_i[0],
3480 value = _Object$entries$_i[1];
3481
3482 var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
3483
3484 if (auxAttr !== attr) {
3485 dataAttr[auxAttr] = value;
3486 delete dataAttr[attr];
3487 }
3488 }
3489
3490 return dataAttr;
3491 },
3492 getItemField: function getItemField(item, field, escape) {
3493 var value = item;
3494
3495 if (typeof field !== 'string' || item.hasOwnProperty(field)) {
3496 return escape ? this.escapeHTML(item[field]) : item[field];
3497 }
3498
3499 var props = field.split('.');
3500 var _iteratorNormalCompletion7 = true;
3501 var _didIteratorError7 = false;
3502 var _iteratorError7 = undefined;
3503
3504 try {
3505 for (var _iterator7 = props[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
3506 var p = _step7.value;
3507 value = value && value[p];
3508 }
3509 } catch (err) {
3510 _didIteratorError7 = true;
3511 _iteratorError7 = err;
3512 } finally {
3513 try {
3514 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
3515 _iterator7.return();
3516 }
3517 } finally {
3518 if (_didIteratorError7) {
3519 throw _iteratorError7;
3520 }
3521 }
3522 }
3523
3524 return escape ? this.escapeHTML(value) : value;
3525 },
3526 isIEBrowser: function isIEBrowser() {
3527 return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
3528 },
3529 findIndex: function findIndex(items, item) {
3530 var _iteratorNormalCompletion8 = true;
3531 var _didIteratorError8 = false;
3532 var _iteratorError8 = undefined;
3533
3534 try {
3535 for (var _iterator8 = items[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
3536 var it = _step8.value;
3537
3538 if (JSON.stringify(it) === JSON.stringify(item)) {
3539 return items.indexOf(it);
3540 }
3541 }
3542 } catch (err) {
3543 _didIteratorError8 = true;
3544 _iteratorError8 = err;
3545 } finally {
3546 try {
3547 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
3548 _iterator8.return();
3549 }
3550 } finally {
3551 if (_didIteratorError8) {
3552 throw _iteratorError8;
3553 }
3554 }
3555 }
3556
3557 return -1;
3558 },
3559 trToData: function trToData(columns, $els) {
3560 var _this = this;
3561
3562 var data = [];
3563 var m = [];
3564 $els.each(function (y, el) {
3565 var row = {}; // save tr's id, class and data-* attributes
3566
3567 row._id = $(el).attr('id');
3568 row._class = $(el).attr('class');
3569 row._data = _this.getRealDataAttr($(el).data());
3570 $(el).find('>td,>th').each(function (_x, el) {
3571 var cspan = +$(el).attr('colspan') || 1;
3572 var rspan = +$(el).attr('rowspan') || 1;
3573 var x = _x; // skip already occupied cells in current row
3574
3575 for (; m[y] && m[y][x]; x++) {} // ignore
3576 // mark matrix elements occupied by current cell with true
3577
3578
3579 for (var tx = x; tx < x + cspan; tx++) {
3580 for (var ty = y; ty < y + rspan; ty++) {
3581 if (!m[ty]) {
3582 // fill missing rows
3583 m[ty] = [];
3584 }
3585
3586 m[ty][tx] = true;
3587 }
3588 }
3589
3590 var field = columns[x].field;
3591 row[field] = $(el).html().trim(); // save td's id, class and data-* attributes
3592
3593 row["_".concat(field, "_id")] = $(el).attr('id');
3594 row["_".concat(field, "_class")] = $(el).attr('class');
3595 row["_".concat(field, "_rowspan")] = $(el).attr('rowspan');
3596 row["_".concat(field, "_colspan")] = $(el).attr('colspan');
3597 row["_".concat(field, "_title")] = $(el).attr('title');
3598 row["_".concat(field, "_data")] = _this.getRealDataAttr($(el).data());
3599 });
3600 data.push(row);
3601 });
3602 return data;
3603 },
3604 sort: function sort(a, b, order, sortStable) {
3605 if (a === undefined || a === null) {
3606 a = '';
3607 }
3608
3609 if (b === undefined || b === null) {
3610 b = '';
3611 }
3612
3613 if (sortStable && a === b) {
3614 a = a._position;
3615 b = b._position;
3616 } // If both values are numeric, do a numeric comparison
3617
3618
3619 if (this.isNumeric(a) && this.isNumeric(b)) {
3620 // Convert numerical values form string to float.
3621 a = parseFloat(a);
3622 b = parseFloat(b);
3623
3624 if (a < b) {
3625 return order * -1;
3626 }
3627
3628 if (a > b) {
3629 return order;
3630 }
3631
3632 return 0;
3633 }
3634
3635 if (a === b) {
3636 return 0;
3637 } // If value is not a string, convert to string
3638
3639
3640 if (typeof a !== 'string') {
3641 a = a.toString();
3642 }
3643
3644 if (a.localeCompare(b) === -1) {
3645 return order * -1;
3646 }
3647
3648 return order;
3649 }
3650 };
3651
3652 var BLOCK_ROWS = 50;
3653 var CLUSTER_BLOCKS = 4;
3654
3655 var VirtualScroll =
3656 /*#__PURE__*/
3657 function () {
3658 function VirtualScroll(options) {
3659 var _this = this;
3660
3661 _classCallCheck(this, VirtualScroll);
3662
3663 this.rows = options.rows;
3664 this.scrollEl = options.scrollEl;
3665 this.contentEl = options.contentEl;
3666 this.callback = options.callback;
3667 this.itemHeight = options.itemHeight;
3668 this.cache = {};
3669 this.scrollTop = this.scrollEl.scrollTop;
3670 this.initDOM(this.rows);
3671 this.scrollEl.scrollTop = this.scrollTop;
3672 this.lastCluster = 0;
3673
3674 var onScroll = function onScroll() {
3675 if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
3676 _this.initDOM(_this.rows);
3677
3678 _this.callback();
3679 }
3680 };
3681
3682 this.scrollEl.addEventListener('scroll', onScroll, false);
3683
3684 this.destroy = function () {
3685 _this.contentEl.innerHtml = '';
3686
3687 _this.scrollEl.removeEventListener('scroll', onScroll, false);
3688 };
3689 }
3690
3691 _createClass(VirtualScroll, [{
3692 key: "initDOM",
3693 value: function initDOM(rows) {
3694 if (typeof this.clusterHeight === 'undefined') {
3695 this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
3696 this.getRowsHeight(rows);
3697 }
3698
3699 var data = this.initData(rows, this.getNum());
3700 var thisRows = data.rows.join('');
3701 var dataChanged = this.checkChanges('data', thisRows);
3702 var topOffsetChanged = this.checkChanges('top', data.topOffset);
3703 var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
3704 var html = [];
3705
3706 if (dataChanged && topOffsetChanged) {
3707 if (data.topOffset) {
3708 html.push(this.getExtra('top', data.topOffset));
3709 }
3710
3711 html.push(thisRows);
3712
3713 if (data.bottomOffset) {
3714 html.push(this.getExtra('bottom', data.bottomOffset));
3715 }
3716
3717 this.contentEl.innerHTML = html.join('');
3718 } else if (bottomOffsetChanged) {
3719 this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
3720 }
3721 }
3722 }, {
3723 key: "getRowsHeight",
3724 value: function getRowsHeight() {
3725 if (typeof this.itemHeight === 'undefined') {
3726 var nodes = this.contentEl.children;
3727 var node = nodes[Math.floor(nodes.length / 2)];
3728 this.itemHeight = node.offsetHeight;
3729 }
3730
3731 this.blockHeight = this.itemHeight * BLOCK_ROWS;
3732 this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
3733 this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
3734 }
3735 }, {
3736 key: "getNum",
3737 value: function getNum() {
3738 this.scrollTop = this.scrollEl.scrollTop;
3739 return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
3740 }
3741 }, {
3742 key: "initData",
3743 value: function initData(rows, num) {
3744 if (rows.length < BLOCK_ROWS) {
3745 return {
3746 topOffset: 0,
3747 bottomOffset: 0,
3748 rowsAbove: 0,
3749 rows: rows
3750 };
3751 }
3752
3753 var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
3754 var end = start + this.clusterRows;
3755 var topOffset = Math.max(start * this.itemHeight, 0);
3756 var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
3757 var thisRows = [];
3758 var rowsAbove = start;
3759
3760 if (topOffset < 1) {
3761 rowsAbove++;
3762 }
3763
3764 for (var i = start; i < end; i++) {
3765 rows[i] && thisRows.push(rows[i]);
3766 }
3767
3768 return {
3769 topOffset: topOffset,
3770 bottomOffset: bottomOffset,
3771 rowsAbove: rowsAbove,
3772 rows: thisRows
3773 };
3774 }
3775 }, {
3776 key: "checkChanges",
3777 value: function checkChanges(type, value) {
3778 var changed = value !== this.cache[type];
3779 this.cache[type] = value;
3780 return changed;
3781 }
3782 }, {
3783 key: "getExtra",
3784 value: function getExtra(className, height) {
3785 var tag = document.createElement('tr');
3786 tag.className = "virtual-scroll-".concat(className);
3787
3788 if (height) {
3789 tag.style.height = "".concat(height, "px");
3790 }
3791
3792 return tag.outerHTML;
3793 }
3794 }]);
3795
3796 return VirtualScroll;
3797 }();
3798
3799 var BootstrapTable =
3800 /*#__PURE__*/
3801 function () {
3802 function BootstrapTable(el, options) {
3803 _classCallCheck(this, BootstrapTable);
3804
3805 this.options = options;
3806 this.$el = $(el);
3807 this.$el_ = this.$el.clone();
3808 this.timeoutId_ = 0;
3809 this.timeoutFooter_ = 0;
3810 this.init();
3811 }
3812
3813 _createClass(BootstrapTable, [{
3814 key: "init",
3815 value: function init() {
3816 this.initConstants();
3817 this.initLocale();
3818 this.initContainer();
3819 this.initTable();
3820 this.initHeader();
3821 this.initData();
3822 this.initHiddenRows();
3823 this.initToolbar();
3824 this.initPagination();
3825 this.initBody();
3826 this.initSearchText();
3827 this.initServer();
3828 }
3829 }, {
3830 key: "initConstants",
3831 value: function initConstants() {
3832 var o = this.options;
3833 this.constants = Constants.CONSTANTS;
3834 this.constants.theme = $.fn.bootstrapTable.theme;
3835 var buttonsPrefix = o.buttonsPrefix ? "".concat(o.buttonsPrefix, "-") : '';
3836 this.constants.buttonsClass = [o.buttonsPrefix, buttonsPrefix + o.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), o.iconSize)].join(' ').trim();
3837 }
3838 }, {
3839 key: "initLocale",
3840 value: function initLocale() {
3841 if (this.options.locale) {
3842 var locales = $.fn.bootstrapTable.locales;
3843 var parts = this.options.locale.split(/-|_/);
3844 parts[0] = parts[0].toLowerCase();
3845
3846 if (parts[1]) {
3847 parts[1] = parts[1].toUpperCase();
3848 }
3849
3850 if (locales[this.options.locale]) {
3851 $.extend(this.options, locales[this.options.locale]);
3852 } else if (locales[parts.join('-')]) {
3853 $.extend(this.options, locales[parts.join('-')]);
3854 } else if (locales[parts[0]]) {
3855 $.extend(this.options, locales[parts[0]]);
3856 }
3857 }
3858 }
3859 }, {
3860 key: "initContainer",
3861 value: function initContainer() {
3862 var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
3863 var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
3864 this.$container = $("\n <div class=\"bootstrap-table ".concat(this.constants.theme, "\">\n <div class=\"fixed-table-toolbar\"></div>\n ").concat(topPagination, "\n <div class=\"fixed-table-container\">\n <div class=\"fixed-table-header\"><table></table></div>\n <div class=\"fixed-table-body\">\n <div class=\"fixed-table-loading\">\n <span class=\"loading-wrap\">\n <span class=\"loading-text\">").concat(this.options.formatLoadingMessage(), "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n </div>\n </div>\n <div class=\"fixed-table-footer\"><table><thead><tr></tr></thead></table></div>\n </div>\n ").concat(bottomPagination, "\n </div>\n "));
3865 this.$container.insertAfter(this.$el);
3866 this.$tableContainer = this.$container.find('.fixed-table-container');
3867 this.$tableHeader = this.$container.find('.fixed-table-header');
3868 this.$tableBody = this.$container.find('.fixed-table-body');
3869 this.$tableLoading = this.$container.find('.fixed-table-loading');
3870 this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
3871
3872 if (this.options.buttonsToolbar) {
3873 this.$toolbar = $('body').find(this.options.buttonsToolbar);
3874 } else {
3875 this.$toolbar = this.$container.find('.fixed-table-toolbar');
3876 }
3877
3878 this.$pagination = this.$container.find('.fixed-table-pagination');
3879 this.$tableBody.append(this.$el);
3880 this.$container.after('<div class="clearfix"></div>');
3881 this.$el.addClass(this.options.classes);
3882 this.$tableLoading.addClass(this.options.classes);
3883
3884 if (this.options.height) {
3885 this.$tableContainer.addClass('fixed-height');
3886
3887 if (this.options.showFooter) {
3888 this.$tableContainer.addClass('has-footer');
3889 }
3890
3891 if (this.options.classes.split(' ').includes('table-bordered')) {
3892 this.$tableBody.append('<div class="fixed-table-border"></div>');
3893 this.$tableBorder = this.$tableBody.find('.fixed-table-border');
3894 this.$tableLoading.addClass('fixed-table-border');
3895 }
3896
3897 this.$tableFooter = this.$container.find('.fixed-table-footer');
3898 } else {
3899 if (!this.$tableFooter.length) {
3900 this.$el.append('<tfoot><tr></tr></tfoot>');
3901 this.$tableFooter = this.$el.find('tfoot');
3902 }
3903 }
3904 }
3905 }, {
3906 key: "initTable",
3907 value: function initTable() {
3908 var _this = this;
3909
3910 var columns = [];
3911 var data = [];
3912 this.$header = this.$el.find('>thead');
3913
3914 if (!this.$header.length) {
3915 this.$header = $("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
3916 } else if (this.options.theadClasses) {
3917 this.$header.addClass(this.options.theadClasses);
3918 }
3919
3920 this.$header.find('tr').each(function (i, el) {
3921 var column = [];
3922 $(el).find('th').each(function (i, el) {
3923 // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
3924 if (typeof $(el).data('field') !== 'undefined') {
3925 $(el).data('field', "".concat($(el).data('field')));
3926 }
3927
3928 column.push($.extend({}, {
3929 title: $(el).html(),
3930 'class': $(el).attr('class'),
3931 titleTooltip: $(el).attr('title'),
3932 rowspan: $(el).attr('rowspan') ? +$(el).attr('rowspan') : undefined,
3933 colspan: $(el).attr('colspan') ? +$(el).attr('colspan') : undefined
3934 }, $(el).data()));
3935 });
3936 columns.push(column);
3937 });
3938
3939 if (!Array.isArray(this.options.columns[0])) {
3940 this.options.columns = [this.options.columns];
3941 }
3942
3943 this.options.columns = $.extend(true, [], columns, this.options.columns);
3944 this.columns = [];
3945 this.fieldsColumnsIndex = [];
3946 Utils.setFieldIndex(this.options.columns);
3947 this.options.columns.forEach(function (columns, i) {
3948 columns.forEach(function (_column, j) {
3949 var column = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
3950
3951 if (typeof column.fieldIndex !== 'undefined') {
3952 _this.columns[column.fieldIndex] = column;
3953 _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
3954 }
3955
3956 _this.options.columns[i][j] = column;
3957 });
3958 }); // if options.data is setting, do not process tbody and tfoot data
3959
3960 if (!this.options.data.length) {
3961 this.options.data = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
3962
3963 if (data.length) {
3964 this.fromHtml = true;
3965 }
3966 }
3967
3968 this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
3969
3970 if (this.footerData) {
3971 this.$el.find('tfoot').html('<tr></tr>');
3972 }
3973
3974 if (!this.options.showFooter || this.options.cardView) {
3975 this.$tableFooter.hide();
3976 } else {
3977 this.$tableFooter.show();
3978 }
3979 }
3980 }, {
3981 key: "initHeader",
3982 value: function initHeader() {
3983 var _this2 = this;
3984
3985 var visibleColumns = {};
3986 var html = [];
3987 this.header = {
3988 fields: [],
3989 styles: [],
3990 classes: [],
3991 formatters: [],
3992 detailFormatters: [],
3993 events: [],
3994 sorters: [],
3995 sortNames: [],
3996 cellStyles: [],
3997 searchables: []
3998 };
3999 Utils.updateFieldGroup(this.options.columns);
4000 this.options.columns.forEach(function (columns, i) {
4001 html.push('<tr>');
4002
4003 if (i === 0 && !_this2.options.cardView && _this2.options.detailView && _this2.options.detailViewIcon) {
4004 html.push("<th class=\"detail\" rowspan=\"".concat(_this2.options.columns.length, "\">\n <div class=\"fht-cell\"></div>\n </th>\n "));
4005 }
4006
4007 columns.forEach(function (column, j) {
4008 var class_ = Utils.sprintf(' class="%s"', column['class']);
4009 var unitWidth = column.widthUnit;
4010 var width = parseFloat(column.width);
4011 var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
4012 var align = Utils.sprintf('text-align: %s; ', column.align);
4013 var style = Utils.sprintf('vertical-align: %s; ', column.valign);
4014 style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
4015
4016 if (typeof column.fieldIndex === 'undefined' && !column.visible) {
4017 return;
4018 }
4019
4020 if (typeof column.fieldIndex !== 'undefined') {
4021 _this2.header.fields[column.fieldIndex] = column.field;
4022 _this2.header.styles[column.fieldIndex] = align + style;
4023 _this2.header.classes[column.fieldIndex] = class_;
4024 _this2.header.formatters[column.fieldIndex] = column.formatter;
4025 _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
4026 _this2.header.events[column.fieldIndex] = column.events;
4027 _this2.header.sorters[column.fieldIndex] = column.sorter;
4028 _this2.header.sortNames[column.fieldIndex] = column.sortName;
4029 _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
4030 _this2.header.searchables[column.fieldIndex] = column.searchable;
4031
4032 if (!column.visible) {
4033 return;
4034 }
4035
4036 if (_this2.options.cardView && !column.cardVisible) {
4037 return;
4038 }
4039
4040 visibleColumns[column.field] = column;
4041 }
4042
4043 html.push("<th".concat(Utils.sprintf(' title="%s"', column.titleTooltip)), column.checkbox || column.radio ? Utils.sprintf(' class="bs-checkbox %s"', column['class'] || '') : class_, Utils.sprintf(' style="%s"', halign + style), Utils.sprintf(' rowspan="%s"', column.rowspan), Utils.sprintf(' colspan="%s"', column.colspan), Utils.sprintf(' data-field="%s"', column.field), // If `column` is not the first element of `this.options.columns[0]`, then className 'data-not-first-th' should be added.
4044 j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
4045 html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
4046 var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
4047 var title = text;
4048
4049 if (column.checkbox) {
4050 text = '';
4051
4052 if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
4053 text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
4054 }
4055
4056 _this2.header.stateField = column.field;
4057 }
4058
4059 if (column.radio) {
4060 text = '';
4061 _this2.header.stateField = column.field;
4062 _this2.options.singleSelect = true;
4063 }
4064
4065 if (!text && column.showSelectTitle) {
4066 text += title;
4067 }
4068
4069 html.push(text);
4070 html.push('</div>');
4071 html.push('<div class="fht-cell"></div>');
4072 html.push('</div>');
4073 html.push('</th>');
4074 });
4075 html.push('</tr>');
4076 });
4077 this.$header.html(html.join(''));
4078 this.$header.find('th[data-field]').each(function (i, el) {
4079 $(el).data(visibleColumns[$(el).data('field')]);
4080 });
4081 this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
4082 var $this = $(e.currentTarget);
4083
4084 if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
4085 if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
4086 return false;
4087 }
4088 }
4089
4090 if (_this2.options.sortable && $this.parent().data().sortable) {
4091 _this2.onSort(e);
4092 }
4093 });
4094 this.$header.children().children().off('keypress').on('keypress', function (e) {
4095 if (_this2.options.sortable && $(e.currentTarget).data().sortable) {
4096 var code = e.keyCode || e.which;
4097
4098 if (code === 13) {
4099 // Enter keycode
4100 _this2.onSort(e);
4101 }
4102 }
4103 });
4104 var resizeEvent = "resize.bootstrap-table".concat(this.$el.attr('id') || '');
4105 $(window).off(resizeEvent);
4106
4107 if (!this.options.showHeader || this.options.cardView) {
4108 this.$header.hide();
4109 this.$tableHeader.hide();
4110 this.$tableLoading.css('top', 0);
4111 } else {
4112 this.$header.show();
4113 this.$tableHeader.show();
4114 this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
4115
4116 this.getCaret();
4117 $(window).on(resizeEvent, function (e) {
4118 return _this2.resetWidth(e);
4119 });
4120 }
4121
4122 this.$selectAll = this.$header.find('[name="btSelectAll"]');
4123 this.$selectAll.off('click').on('click', function (_ref) {
4124 var currentTarget = _ref.currentTarget;
4125 var checked = $(currentTarget).prop('checked');
4126
4127 _this2[checked ? 'checkAll' : 'uncheckAll']();
4128
4129 _this2.updateSelected();
4130 });
4131 }
4132 }, {
4133 key: "initData",
4134 value: function initData(data, type) {
4135 if (type === 'append') {
4136 this.options.data = this.options.data.concat(data);
4137 } else if (type === 'prepend') {
4138 this.options.data = [].concat(data).concat(this.options.data);
4139 } else {
4140 this.options.data = data || this.options.data;
4141 }
4142
4143 this.data = this.options.data;
4144
4145 if (this.options.sidePagination === 'server') {
4146 return;
4147 }
4148
4149 this.initSort();
4150 }
4151 }, {
4152 key: "initSort",
4153 value: function initSort() {
4154 var _this3 = this;
4155
4156 var name = this.options.sortName;
4157 var order = this.options.sortOrder === 'desc' ? -1 : 1;
4158 var index = this.header.fields.indexOf(this.options.sortName);
4159 var timeoutId = 0;
4160
4161 if (index !== -1) {
4162 if (this.options.sortStable) {
4163 this.data.forEach(function (row, i) {
4164 if (!row.hasOwnProperty('_position')) {
4165 row._position = i;
4166 }
4167 });
4168 }
4169
4170 if (this.options.customSort) {
4171 Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
4172 } else {
4173 this.data.sort(function (a, b) {
4174 if (_this3.header.sortNames[index]) {
4175 name = _this3.header.sortNames[index];
4176 }
4177
4178 var aa = Utils.getItemField(a, name, _this3.options.escape);
4179 var bb = Utils.getItemField(b, name, _this3.options.escape);
4180 var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
4181
4182 if (value !== undefined) {
4183 if (_this3.options.sortStable && value === 0) {
4184 return order * (a._position - b._position);
4185 }
4186
4187 return order * value;
4188 }
4189
4190 return Utils.sort(aa, bb, order, _this3.options.sortStable);
4191 });
4192 }
4193
4194 if (this.options.sortClass !== undefined) {
4195 clearTimeout(timeoutId);
4196 timeoutId = setTimeout(function () {
4197 _this3.$el.removeClass(_this3.options.sortClass);
4198
4199 var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
4200
4201 _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
4202 }, 250);
4203 }
4204 }
4205 }
4206 }, {
4207 key: "onSort",
4208 value: function onSort(_ref2) {
4209 var type = _ref2.type,
4210 currentTarget = _ref2.currentTarget;
4211 var $this = type === 'keypress' ? $(currentTarget) : $(currentTarget).parent();
4212 var $this_ = this.$header.find('th').eq($this.index());
4213 this.$header.add(this.$header_).find('span.order').remove();
4214
4215 if (this.options.sortName === $this.data('field')) {
4216 this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
4217 } else {
4218 this.options.sortName = $this.data('field');
4219
4220 if (this.options.rememberOrder) {
4221 this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
4222 } else {
4223 this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
4224 }
4225 }
4226
4227 this.trigger('sort', this.options.sortName, this.options.sortOrder);
4228 $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
4229
4230 this.getCaret();
4231
4232 if (this.options.sidePagination === 'server') {
4233 this.options.pageNumber = 1;
4234 this.initServer(this.options.silentSort);
4235 return;
4236 }
4237
4238 this.initSort();
4239 this.initBody();
4240 }
4241 }, {
4242 key: "initToolbar",
4243 value: function initToolbar() {
4244 var _this4 = this;
4245
4246 var o = this.options;
4247 var html = [];
4248 var timeoutId = 0;
4249 var $keepOpen;
4250 var $search;
4251 var switchableCount = 0;
4252
4253 if (this.$toolbar.find('.bs-bars').children().length) {
4254 $('body').append($(o.toolbar));
4255 }
4256
4257 this.$toolbar.html('');
4258
4259 if (typeof o.toolbar === 'string' || _typeof(o.toolbar) === 'object') {
4260 $(Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, o.toolbarAlign)).appendTo(this.$toolbar).append($(o.toolbar));
4261 } // showColumns, showToggle, showRefresh
4262
4263
4264 html = ["<div class=\"".concat(['columns', "columns-".concat(o.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(o.buttonsAlign)].join(' '), "\">")];
4265
4266 if (typeof o.icons === 'string') {
4267 o.icons = Utils.calculateObjectValue(null, o.icons);
4268 }
4269
4270 if (o.showPaginationSwitch) {
4271 html.push("<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"paginationSwitch\"\n aria-label=\"Pagination Switch\" title=\"").concat(o.formatPaginationSwitch(), "\">\n ").concat(o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.paginationSwitchDown) : '', "\n ").concat(o.showButtonText ? o.formatPaginationSwitchUp() : '', "\n </button>"));
4272 }
4273
4274 if (o.showRefresh) {
4275 html.push("<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"refresh\"\n aria-label=\"Refresh\" title=\"").concat(o.formatRefresh(), "\">\n ").concat(o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.refresh) : '', "\n ").concat(o.showButtonText ? o.formatRefresh() : '', "\n </button>"));
4276 }
4277
4278 if (o.showToggle) {
4279 html.push("<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"toggle\"\n aria-label=\"Toggle\" title=\"").concat(o.formatToggle(), "\">\n ").concat(o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.toggleOff) : '', "\n ").concat(o.showButtonText ? o.formatToggleOn() : '', "\n </button>"));
4280 }
4281
4282 if (o.showFullscreen) {
4283 html.push("<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"fullscreen\"\n aria-label=\"Fullscreen\" title=\"").concat(o.formatFullscreen(), "\">\n ").concat(o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.fullscreen) : '', "\n ").concat(o.showButtonText ? o.formatFullscreen() : '', "\n </button>"));
4284 }
4285
4286 if (o.showColumns) {
4287 html.push("<div class=\"keep-open ".concat(this.constants.classes.buttonsDropdown, "\" title=\"").concat(o.formatColumns(), "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\"\n aria-label=\"Columns\" title=\"").concat(o.formatColumns(), "\">\n ").concat(o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.columns) : '', "\n ").concat(o.showButtonText ? o.formatColumns() : '', "\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.toolbarDropdown[0]));
4288
4289 if (o.showColumnsToggleAll) {
4290 var allFieldsVisible = this.getVisibleColumns().length === this.columns.length;
4291 html.push(Utils.sprintf(this.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', o.formatColumnsToggleAll())));
4292 html.push(this.constants.html.toolbarDropdownSeperator);
4293 }
4294
4295 this.columns.forEach(function (column, i) {
4296 if (column.radio || column.checkbox) {
4297 return;
4298 }
4299
4300 if (o.cardView && !column.cardVisible) {
4301 return;
4302 }
4303
4304 var checked = column.visible ? ' checked="checked"' : '';
4305
4306 if (column.switchable) {
4307 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" data-field="%s" value="%s"%s> <span>%s</span>', column.field, i, checked, column.title)));
4308 switchableCount++;
4309 }
4310 });
4311 html.push(this.constants.html.toolbarDropdown[1], '</div>');
4312 }
4313
4314 html.push('</div>'); // Fix #188: this.showToolbar is for extensions
4315
4316 if (this.showToolbar || html.length > 2) {
4317 this.$toolbar.append(html.join(''));
4318 }
4319
4320 if (o.showPaginationSwitch) {
4321 this.$toolbar.find('button[name="paginationSwitch"]').off('click').on('click', function () {
4322 return _this4.togglePagination();
4323 });
4324 }
4325
4326 if (o.showFullscreen) {
4327 this.$toolbar.find('button[name="fullscreen"]').off('click').on('click', function () {
4328 return _this4.toggleFullscreen();
4329 });
4330 }
4331
4332 if (o.showRefresh) {
4333 this.$toolbar.find('button[name="refresh"]').off('click').on('click', function () {
4334 return _this4.refresh();
4335 });
4336 }
4337
4338 if (o.showToggle) {
4339 this.$toolbar.find('button[name="toggle"]').off('click').on('click', function () {
4340 _this4.toggleView();
4341 });
4342 }
4343
4344 if (o.showColumns) {
4345 $keepOpen = this.$toolbar.find('.keep-open');
4346 var $checkboxes = $keepOpen.find('input:not(".toggle-all")');
4347 var $toggleAll = $keepOpen.find('input.toggle-all');
4348
4349 if (switchableCount <= o.minimumCountColumns) {
4350 $keepOpen.find('input').prop('disabled', true);
4351 }
4352
4353 $keepOpen.find('li, label').off('click').on('click', function (e) {
4354 e.stopImmediatePropagation();
4355 });
4356 $checkboxes.off('click').on('click', function (_ref3) {
4357 var currentTarget = _ref3.currentTarget;
4358 var $this = $(currentTarget);
4359
4360 _this4._toggleColumn($this.val(), $this.prop('checked'), false);
4361
4362 _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
4363
4364 $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.length);
4365 });
4366 $toggleAll.off('click').on('click', function (_ref4) {
4367 var currentTarget = _ref4.currentTarget;
4368
4369 _this4._toggleAllColumns($(currentTarget).prop('checked'));
4370 });
4371 } // Fix #4516: this.showSearchClearButton is for extensions
4372
4373
4374 if (o.search || this.showSearchClearButton) {
4375 html = [];
4376 var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, o.formatSearch(), o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.search) : '', o.showButtonText ? o.formatSearch() : '');
4377 var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, o.formatClearSearch(), o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.clearSearch) : '', o.showButtonText ? o.formatClearSearch() : '');
4378 var searchInputHtml = "<input class=\"".concat(this.constants.classes.input).concat(Utils.sprintf(' input-%s', o.iconSize), " search-input\" type=\"text\" placeholder=\"").concat(o.formatSearch(), "\">");
4379 var searchInputFinalHtml = searchInputHtml;
4380
4381 if (o.showSearchButton || o.showSearchClearButton) {
4382 var buttonsHtml = (o.showSearchButton ? showSearchButton : '') + (o.showSearchClearButton ? showSearchClearButton : '');
4383 searchInputFinalHtml = o.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, buttonsHtml) : buttonsHtml;
4384 }
4385
4386 html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(o.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml));
4387 this.$toolbar.append(html.join(''));
4388 var $searchInput = this.$toolbar.find('.search input');
4389 $search = o.showSearchButton ? this.$toolbar.find('.search button[name=search]') : $searchInput;
4390 var eventTriggers = o.showSearchButton ? 'click' : Utils.isIEBrowser() ? 'mouseup' : 'keyup drop blur';
4391 $search.off(eventTriggers).on(eventTriggers, function (event) {
4392 if (o.searchOnEnterKey && event.keyCode !== 13) {
4393 return;
4394 }
4395
4396 if ([37, 38, 39, 40].includes(event.keyCode)) {
4397 return;
4398 }
4399
4400 clearTimeout(timeoutId); // doesn't matter if it's 0
4401
4402 timeoutId = setTimeout(function () {
4403 _this4.onSearch(o.showSearchButton ? {
4404 currentTarget: $searchInput
4405 } : event);
4406 }, o.searchTimeOut);
4407 });
4408
4409 if (o.showSearchClearButton) {
4410 this.$toolbar.find('.search button[name=clearSearch]').click(function () {
4411 _this4.resetSearch();
4412 });
4413 }
4414 }
4415 }
4416 }, {
4417 key: "onSearch",
4418 value: function onSearch() {
4419 var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4420 currentTarget = _ref5.currentTarget,
4421 firedByInitSearchText = _ref5.firedByInitSearchText;
4422
4423 var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4424
4425 if (currentTarget !== undefined && $(currentTarget).length && overwriteSearchText) {
4426 var text = $(currentTarget).val().trim();
4427
4428 if (this.options.trimOnSearch && $(currentTarget).val() !== text) {
4429 $(currentTarget).val(text);
4430 }
4431
4432 if (this.searchText === text) {
4433 return;
4434 }
4435
4436 if ($(currentTarget).hasClass('search-input')) {
4437 this.searchText = text;
4438 this.options.searchText = text;
4439 }
4440 }
4441
4442 if (!firedByInitSearchText) {
4443 this.options.pageNumber = 1;
4444 }
4445
4446 this.initSearch();
4447
4448 if (firedByInitSearchText) {
4449 if (this.options.sidePagination === 'client') {
4450 this.updatePagination();
4451 }
4452 } else {
4453 this.updatePagination();
4454 }
4455
4456 this.trigger('search', this.searchText);
4457 }
4458 }, {
4459 key: "initSearch",
4460 value: function initSearch() {
4461 var _this5 = this;
4462
4463 this.filterOptions = this.filterOptions || this.options.filterOptions;
4464
4465 if (this.options.sidePagination !== 'server') {
4466 if (this.options.customSearch) {
4467 this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
4468 return;
4469 }
4470
4471 var s = this.searchText && (this.options.escape ? Utils.escapeHTML(this.searchText) : this.searchText).toLowerCase();
4472 var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns; // Check filter
4473
4474 if (typeof this.filterOptions.filterAlgorithm === 'function') {
4475 this.data = this.options.data.filter(function (item, i) {
4476 return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
4477 });
4478 } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
4479 this.data = f ? this.options.data.filter(function (item, i) {
4480 var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
4481
4482 if (filterAlgorithm === 'and') {
4483 for (var key in f) {
4484 if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
4485 return false;
4486 }
4487 }
4488 } else if (filterAlgorithm === 'or') {
4489 var match = false;
4490
4491 for (var _key in f) {
4492 if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
4493 match = true;
4494 }
4495 }
4496
4497 return match;
4498 }
4499
4500 return true;
4501 }) : this.options.data;
4502 }
4503
4504 var visibleFields = this.getVisibleFields();
4505 this.data = s ? this.data.filter(function (item, i) {
4506 for (var j = 0; j < _this5.header.fields.length; j++) {
4507 if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
4508 continue;
4509 }
4510
4511 var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
4512 var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
4513 var value = void 0;
4514
4515 if (typeof key === 'string') {
4516 value = item;
4517 var props = key.split('.');
4518
4519 for (var _i = 0; _i < props.length; _i++) {
4520 if (value[props[_i]] !== null) {
4521 value = value[props[_i]];
4522 }
4523 }
4524 } else {
4525 value = item[key];
4526 } // Fix #142: respect searchFormatter boolean
4527
4528
4529 if (column && column.searchFormatter) {
4530 value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
4531 }
4532
4533 if (typeof value === 'string' || typeof value === 'number') {
4534 if (_this5.options.strictSearch) {
4535 if ("".concat(value).toLowerCase() === s) {
4536 return true;
4537 }
4538 } else {
4539 var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
4540 var matches = largerSmallerEqualsRegex.exec(s);
4541 var comparisonCheck = false;
4542
4543 if (matches) {
4544 var operator = matches[1] || "".concat(matches[5], "l");
4545 var comparisonValue = matches[2] || matches[3];
4546 var int = parseInt(value, 10);
4547 var comparisonInt = parseInt(comparisonValue, 10);
4548
4549 switch (operator) {
4550 case '>':
4551 case '<l':
4552 comparisonCheck = int > comparisonInt;
4553 break;
4554
4555 case '<':
4556 case '>l':
4557 comparisonCheck = int < comparisonInt;
4558 break;
4559
4560 case '<=':
4561 case '=<':
4562 case '>=l':
4563 case '=>l':
4564 comparisonCheck = int <= comparisonInt;
4565 break;
4566
4567 case '>=':
4568 case '=>':
4569 case '<=l':
4570 case '=<l':
4571 comparisonCheck = int >= comparisonInt;
4572 break;
4573
4574 default:
4575 break;
4576 }
4577 }
4578
4579 if (comparisonCheck || "".concat(value).toLowerCase().includes(s)) {
4580 return true;
4581 }
4582 }
4583 }
4584 }
4585
4586 return false;
4587 }) : this.data;
4588 }
4589 }
4590 }, {
4591 key: "initPagination",
4592 value: function initPagination() {
4593 var _this6 = this;
4594
4595 var o = this.options;
4596
4597 if (!o.pagination) {
4598 this.$pagination.hide();
4599 return;
4600 }
4601
4602 this.$pagination.show();
4603 var html = [];
4604 var $allSelected = false;
4605 var i;
4606 var from;
4607 var to;
4608 var $pageList;
4609 var $pre;
4610 var $next;
4611 var $number;
4612 var data = this.getData({
4613 includeHiddenRows: false
4614 });
4615 var pageList = o.pageList;
4616
4617 if (o.sidePagination !== 'server') {
4618 o.totalRows = data.length;
4619 }
4620
4621 this.totalPages = 0;
4622
4623 if (o.totalRows) {
4624 if (o.pageSize === o.formatAllRows()) {
4625 o.pageSize = o.totalRows;
4626 $allSelected = true;
4627 } else if (o.pageSize === o.totalRows) {
4628 // Fix #667 Table with pagination,
4629 // multiple pages and a search this matches to one page throws exception
4630 var pageLst = typeof o.pageList === 'string' ? o.pageList.replace('[', '').replace(']', '').replace(/ /g, '').toLowerCase().split(',') : o.pageList;
4631
4632 if (pageLst.includes(o.formatAllRows().toLowerCase())) {
4633 $allSelected = true;
4634 }
4635 }
4636
4637 this.totalPages = ~~((o.totalRows - 1) / o.pageSize) + 1;
4638 o.totalPages = this.totalPages;
4639 }
4640
4641 if (this.totalPages > 0 && o.pageNumber > this.totalPages) {
4642 o.pageNumber = this.totalPages;
4643 }
4644
4645 this.pageFrom = (o.pageNumber - 1) * o.pageSize + 1;
4646 this.pageTo = o.pageNumber * o.pageSize;
4647
4648 if (this.pageTo > o.totalRows) {
4649 this.pageTo = o.totalRows;
4650 }
4651
4652 if (this.options.pagination && this.options.sidePagination !== 'server') {
4653 this.options.totalNotFiltered = this.options.data.length;
4654 }
4655
4656 if (!this.options.showExtendedPagination) {
4657 this.options.totalNotFiltered = undefined;
4658 }
4659
4660 var paginationInfo = o.onlyInfoPagination ? o.formatDetailPagination(o.totalRows) : o.formatShowingRows(this.pageFrom, this.pageTo, o.totalRows, o.totalNotFiltered);
4661 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(o.paginationDetailHAlign, " pagination-detail\">\n <span class=\"pagination-info\">\n ").concat(paginationInfo, "\n </span>"));
4662
4663 if (!o.onlyInfoPagination) {
4664 html.push('<span class="page-list">');
4665 var pageNumber = ["<span class=\"".concat(this.constants.classes.paginationDropdown, "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\">\n <span class=\"page-size\">\n ").concat($allSelected ? o.formatAllRows() : o.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])];
4666
4667 if (typeof o.pageList === 'string') {
4668 var list = o.pageList.replace('[', '').replace(']', '').replace(/ /g, '').split(',');
4669 pageList = [];
4670 var _iteratorNormalCompletion = true;
4671 var _didIteratorError = false;
4672 var _iteratorError = undefined;
4673
4674 try {
4675 for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
4676 var value = _step.value;
4677 pageList.push(value.toLowerCase() === o.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? o.formatAllRows() : +value);
4678 }
4679 } catch (err) {
4680 _didIteratorError = true;
4681 _iteratorError = err;
4682 } finally {
4683 try {
4684 if (!_iteratorNormalCompletion && _iterator.return != null) {
4685 _iterator.return();
4686 }
4687 } finally {
4688 if (_didIteratorError) {
4689 throw _iteratorError;
4690 }
4691 }
4692 }
4693 }
4694
4695 pageList.forEach(function (page, i) {
4696 if (!o.smartDisplay || i === 0 || pageList[i - 1] < o.totalRows) {
4697 var active;
4698
4699 if ($allSelected) {
4700 active = page === o.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
4701 } else {
4702 active = page === o.pageSize ? _this6.constants.classes.dropdownActive : '';
4703 }
4704
4705 pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
4706 }
4707 });
4708 pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</span>"));
4709 html.push(o.formatRecordsPerPage(pageNumber.join('')));
4710 html.push('</span></div>');
4711 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(o.paginationHAlign, " pagination\">"), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', o.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', o.formatSRPaginationPreText(), o.paginationPreText));
4712
4713 if (this.totalPages < o.paginationSuccessivelySize) {
4714 from = 1;
4715 to = this.totalPages;
4716 } else {
4717 from = o.pageNumber - o.paginationPagesBySide;
4718 to = from + o.paginationPagesBySide * 2;
4719 }
4720
4721 if (o.pageNumber < o.paginationSuccessivelySize - 1) {
4722 to = o.paginationSuccessivelySize;
4723 }
4724
4725 if (o.paginationSuccessivelySize > this.totalPages - from) {
4726 from = from - (o.paginationSuccessivelySize - (this.totalPages - from)) + 1;
4727 }
4728
4729 if (from < 1) {
4730 from = 1;
4731 }
4732
4733 if (to > this.totalPages) {
4734 to = this.totalPages;
4735 }
4736
4737 var middleSize = Math.round(o.paginationPagesBySide / 2);
4738
4739 var pageItem = function pageItem(i) {
4740 var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
4741 return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === o.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), o.formatSRPaginationPageText(i), i);
4742 };
4743
4744 if (from > 1) {
4745 var max = o.paginationPagesBySide;
4746 if (max >= from) max = from - 1;
4747
4748 for (i = 1; i <= max; i++) {
4749 html.push(pageItem(i));
4750 }
4751
4752 if (from - 1 === max + 1) {
4753 i = from - 1;
4754 html.push(pageItem(i));
4755 } else {
4756 if (from - 1 > max) {
4757 if (from - o.paginationPagesBySide * 2 > o.paginationPagesBySide && o.paginationUseIntermediate) {
4758 i = Math.round((from - middleSize) / 2 + middleSize);
4759 html.push(pageItem(i, ' page-intermediate'));
4760 } else {
4761 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
4762 }
4763 }
4764 }
4765 }
4766
4767 for (i = from; i <= to; i++) {
4768 html.push(pageItem(i));
4769 }
4770
4771 if (this.totalPages > to) {
4772 var min = this.totalPages - (o.paginationPagesBySide - 1);
4773 if (to >= min) min = to + 1;
4774
4775 if (to + 1 === min - 1) {
4776 i = to + 1;
4777 html.push(pageItem(i));
4778 } else {
4779 if (min > to + 1) {
4780 if (this.totalPages - to > o.paginationPagesBySide * 2 && o.paginationUseIntermediate) {
4781 i = Math.round((this.totalPages - middleSize - to) / 2 + to);
4782 html.push(pageItem(i, ' page-intermediate'));
4783 } else {
4784 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
4785 }
4786 }
4787 }
4788
4789 for (i = min; i <= this.totalPages; i++) {
4790 html.push(pageItem(i));
4791 }
4792 }
4793
4794 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', o.formatSRPaginationNextText(), o.paginationNextText));
4795 html.push(this.constants.html.pagination[1], '</div>');
4796 }
4797
4798 this.$pagination.html(html.join(''));
4799 var dropupClass = ['bottom', 'both'].includes(o.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
4800 this.$pagination.last().find('.page-list > span').addClass(dropupClass);
4801
4802 if (!o.onlyInfoPagination) {
4803 $pageList = this.$pagination.find('.page-list a');
4804 $pre = this.$pagination.find('.page-pre');
4805 $next = this.$pagination.find('.page-next');
4806 $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
4807
4808 if (this.totalPages <= 1) {
4809 this.$pagination.find('div.pagination').hide();
4810 }
4811
4812 if (o.smartDisplay) {
4813 if (pageList.length < 2 || o.totalRows <= pageList[0]) {
4814 this.$pagination.find('span.page-list').hide();
4815 }
4816 } // when data is empty, hide the pagination
4817
4818
4819 this.$pagination[this.getData().length ? 'show' : 'hide']();
4820
4821 if (!o.paginationLoop) {
4822 if (o.pageNumber === 1) {
4823 $pre.addClass('disabled');
4824 }
4825
4826 if (o.pageNumber === this.totalPages) {
4827 $next.addClass('disabled');
4828 }
4829 }
4830
4831 if ($allSelected) {
4832 o.pageSize = o.formatAllRows();
4833 } // removed the events for last and first, onPageNumber executeds the same logic
4834
4835
4836 $pageList.off('click').on('click', function (e) {
4837 return _this6.onPageListChange(e);
4838 });
4839 $pre.off('click').on('click', function (e) {
4840 return _this6.onPagePre(e);
4841 });
4842 $next.off('click').on('click', function (e) {
4843 return _this6.onPageNext(e);
4844 });
4845 $number.off('click').on('click', function (e) {
4846 return _this6.onPageNumber(e);
4847 });
4848 }
4849 }
4850 }, {
4851 key: "updatePagination",
4852 value: function updatePagination(event) {
4853 // Fix #171: IE disabled button can be clicked bug.
4854 if (event && $(event.currentTarget).hasClass('disabled')) {
4855 return;
4856 }
4857
4858 if (!this.options.maintainMetaData) {
4859 this.resetRows();
4860 }
4861
4862 this.initPagination();
4863
4864 if (this.options.sidePagination === 'server') {
4865 this.initServer();
4866 } else {
4867 this.initBody();
4868 }
4869
4870 this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
4871 }
4872 }, {
4873 key: "onPageListChange",
4874 value: function onPageListChange(event) {
4875 event.preventDefault();
4876 var $this = $(event.currentTarget);
4877 $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
4878 this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
4879 this.$toolbar.find('.page-size').text(this.options.pageSize);
4880 this.updatePagination(event);
4881 return false;
4882 }
4883 }, {
4884 key: "onPagePre",
4885 value: function onPagePre(event) {
4886 event.preventDefault();
4887
4888 if (this.options.pageNumber - 1 === 0) {
4889 this.options.pageNumber = this.options.totalPages;
4890 } else {
4891 this.options.pageNumber--;
4892 }
4893
4894 this.updatePagination(event);
4895 return false;
4896 }
4897 }, {
4898 key: "onPageNext",
4899 value: function onPageNext(event) {
4900 event.preventDefault();
4901
4902 if (this.options.pageNumber + 1 > this.options.totalPages) {
4903 this.options.pageNumber = 1;
4904 } else {
4905 this.options.pageNumber++;
4906 }
4907
4908 this.updatePagination(event);
4909 return false;
4910 }
4911 }, {
4912 key: "onPageNumber",
4913 value: function onPageNumber(event) {
4914 event.preventDefault();
4915
4916 if (this.options.pageNumber === +$(event.currentTarget).text()) {
4917 return;
4918 }
4919
4920 this.options.pageNumber = +$(event.currentTarget).text();
4921 this.updatePagination(event);
4922 return false;
4923 }
4924 }, {
4925 key: "initRow",
4926 value: function initRow(item, i, data, trFragments) {
4927 var _this7 = this;
4928
4929 var html = [];
4930 var style = {};
4931 var csses = [];
4932 var data_ = '';
4933 var attributes = {};
4934 var htmlAttributes = [];
4935
4936 if (Utils.findIndex(this.hiddenRows, item) > -1) {
4937 return;
4938 }
4939
4940 style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
4941
4942 if (style && style.css) {
4943 for (var _i2 = 0, _Object$entries = Object.entries(style.css); _i2 < _Object$entries.length; _i2++) {
4944 var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
4945 key = _Object$entries$_i[0],
4946 value = _Object$entries$_i[1];
4947
4948 csses.push("".concat(key, ": ").concat(value));
4949 }
4950 }
4951
4952 attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
4953
4954 if (attributes) {
4955 for (var _i3 = 0, _Object$entries2 = Object.entries(attributes); _i3 < _Object$entries2.length; _i3++) {
4956 var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2),
4957 key = _Object$entries2$_i[0],
4958 value = _Object$entries2$_i[1];
4959
4960 htmlAttributes.push("".concat(key, "=\"").concat(Utils.escapeHTML(value), "\""));
4961 }
4962 }
4963
4964 if (item._data && !Utils.isEmptyObject(item._data)) {
4965 for (var _i4 = 0, _Object$entries3 = Object.entries(item._data); _i4 < _Object$entries3.length; _i4++) {
4966 var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2),
4967 k = _Object$entries3$_i[0],
4968 v = _Object$entries3$_i[1];
4969
4970 // ignore data-index
4971 if (k === 'index') {
4972 return;
4973 }
4974
4975 data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
4976 }
4977 }
4978
4979 html.push('<tr', Utils.sprintf(' %s', htmlAttributes.length ? htmlAttributes.join(' ') : undefined), Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id), Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)), " data-index=\"".concat(i, "\""), Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)), Utils.sprintf(' data-has-detail-view="%s"', !this.options.cardView && this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>');
4980
4981 if (this.options.cardView) {
4982 html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
4983 }
4984
4985 if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
4986 html.push('<td>');
4987
4988 if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
4989 html.push("\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n "));
4990 }
4991
4992 html.push('</td>');
4993 }
4994
4995 this.header.fields.forEach(function (field, j) {
4996 var text = '';
4997 var value_ = Utils.getItemField(item, field, _this7.options.escape);
4998 var value = '';
4999 var type = '';
5000 var cellStyle = {};
5001 var id_ = '';
5002 var class_ = _this7.header.classes[j];
5003 var style_ = '';
5004 var data_ = '';
5005 var rowspan_ = '';
5006 var colspan_ = '';
5007 var title_ = '';
5008 var column = _this7.columns[j];
5009
5010 if (_this7.fromHtml && typeof value_ === 'undefined') {
5011 if (!column.checkbox && !column.radio) {
5012 return;
5013 }
5014 }
5015
5016 if (!column.visible) {
5017 return;
5018 }
5019
5020 if (_this7.options.cardView && !column.cardVisible) {
5021 return;
5022 }
5023
5024 if (column.escape) {
5025 value_ = Utils.escapeHTML(value_);
5026 }
5027
5028 if (csses.concat([_this7.header.styles[j]]).length) {
5029 style_ = " style=\"".concat(csses.concat([_this7.header.styles[j]]).join('; '), "\"");
5030 } // handle td's id and class
5031
5032
5033 if (item["_".concat(field, "_id")]) {
5034 id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
5035 }
5036
5037 if (item["_".concat(field, "_class")]) {
5038 class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
5039 }
5040
5041 if (item["_".concat(field, "_rowspan")]) {
5042 rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
5043 }
5044
5045 if (item["_".concat(field, "_colspan")]) {
5046 colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
5047 }
5048
5049 if (item["_".concat(field, "_title")]) {
5050 title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
5051 }
5052
5053 cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
5054
5055 if (cellStyle.classes) {
5056 class_ = " class=\"".concat(cellStyle.classes, "\"");
5057 }
5058
5059 if (cellStyle.css) {
5060 var csses_ = [];
5061
5062 for (var _i5 = 0, _Object$entries4 = Object.entries(cellStyle.css); _i5 < _Object$entries4.length; _i5++) {
5063 var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i5], 2),
5064 key = _Object$entries4$_i[0],
5065 _value = _Object$entries4$_i[1];
5066
5067 csses_.push("".concat(key, ": ").concat(_value));
5068 }
5069
5070 style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
5071 }
5072
5073 value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
5074
5075 if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
5076 for (var _i6 = 0, _Object$entries5 = Object.entries(item["_".concat(field, "_data")]); _i6 < _Object$entries5.length; _i6++) {
5077 var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i6], 2),
5078 k = _Object$entries5$_i[0],
5079 v = _Object$entries5$_i[1];
5080
5081 // ignore data-index
5082 if (k === 'index') {
5083 return;
5084 }
5085
5086 data_ += " data-".concat(k, "=\"").concat(v, "\"");
5087 }
5088 }
5089
5090 if (column.checkbox || column.radio) {
5091 type = column.checkbox ? 'checkbox' : type;
5092 type = column.radio ? 'radio' : type;
5093 var c = column['class'] || '';
5094 var isChecked = (value === true || value_ || value && value.checked) && value !== false;
5095 var isDisabled = !column.checkboxEnabled || value && value.disabled;
5096 text = [_this7.options.cardView ? "<div class=\"card-view ".concat(c, "\">") : "<td class=\"bs-checkbox ".concat(c, "\"").concat(class_).concat(style_, ">"), "<label>\n <input\n data-index=\"".concat(i, "\"\n name=\"").concat(_this7.options.selectItemName, "\"\n type=\"").concat(type, "\"\n ").concat(Utils.sprintf('value="%s"', item[_this7.options.idField]), "\n ").concat(Utils.sprintf('checked="%s"', isChecked ? 'checked' : undefined), "\n ").concat(Utils.sprintf('disabled="%s"', isDisabled ? 'disabled' : undefined), " />\n <span></span>\n </label>"), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '</div>' : '</td>'].join('');
5097 item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
5098 } else {
5099 value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
5100
5101 if (_this7.options.cardView) {
5102 var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title\"".concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
5103 text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value\">").concat(value, "</span></div>");
5104
5105 if (_this7.options.smartDisplay && value === '') {
5106 text = '<div class="card-view"></div>';
5107 }
5108 } else {
5109 text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
5110 }
5111 }
5112
5113 html.push(text);
5114 });
5115
5116 if (this.options.cardView) {
5117 html.push('</div></td>');
5118 }
5119
5120 html.push('</tr>');
5121 return html.join('');
5122 }
5123 }, {
5124 key: "initBody",
5125 value: function initBody(fixedScroll) {
5126 var _this8 = this;
5127
5128 var data = this.getData();
5129 this.trigger('pre-body', data);
5130 this.$body = this.$el.find('>tbody');
5131
5132 if (!this.$body.length) {
5133 this.$body = $('<tbody></tbody>').appendTo(this.$el);
5134 } // Fix #389 Bootstrap-table-flatJSON is not working
5135
5136
5137 if (!this.options.pagination || this.options.sidePagination === 'server') {
5138 this.pageFrom = 1;
5139 this.pageTo = data.length;
5140 }
5141
5142 var rows = [];
5143 var trFragments = $(document.createDocumentFragment());
5144 var hasTr = false;
5145
5146 for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
5147 var item = data[i];
5148 var tr = this.initRow(item, i, data, trFragments);
5149 hasTr = hasTr || !!tr;
5150
5151 if (tr && typeof tr === 'string') {
5152 if (!this.options.virtualScroll) {
5153 trFragments.append(tr);
5154 } else {
5155 rows.push(tr);
5156 }
5157 }
5158 } // show no records
5159
5160
5161 if (!hasTr) {
5162 this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.$header.find('th').length, this.options.formatNoMatches()), "</tr>"));
5163 } else {
5164 if (!this.options.virtualScroll) {
5165 this.$body.html(trFragments);
5166 } else {
5167 if (this.virtualScroll) {
5168 this.virtualScroll.destroy();
5169 }
5170
5171 this.virtualScroll = new VirtualScroll({
5172 rows: rows,
5173 scrollEl: this.$tableBody[0],
5174 contentEl: this.$body[0],
5175 itemHeight: this.options.virtualScrollItemHeight,
5176 callback: function callback() {
5177 _this8.fitHeader();
5178 }
5179 });
5180 }
5181 }
5182
5183 if (!fixedScroll) {
5184 this.scrollTo(0);
5185 } // click to select by column
5186
5187
5188 this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
5189 var $td = $(e.currentTarget);
5190 var $tr = $td.parent();
5191 var $cardViewArr = $(e.target).parents('.card-views').children();
5192 var $cardViewTarget = $(e.target).parents('.card-view');
5193 var rowIndex = $tr.data('index');
5194 var item = _this8.data[rowIndex];
5195 var index = _this8.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
5196
5197 var fields = _this8.getVisibleFields();
5198
5199 var field = fields[_this8.options.detailView && _this8.detailViewIcon && !_this8.options.cardView ? index - 1 : index];
5200 var column = _this8.columns[_this8.fieldsColumnsIndex[field]];
5201 var value = Utils.getItemField(item, field, _this8.options.escape);
5202
5203 if ($td.find('.detail-icon').length) {
5204 return;
5205 }
5206
5207 _this8.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
5208
5209 _this8.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
5210
5211
5212 if (e.type === 'click' && _this8.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this8.options, _this8.options.ignoreClickToSelectOn, [e.target])) {
5213 var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this8.options.selectItemName));
5214
5215 if ($selectItem.length) {
5216 $selectItem[0].click();
5217 }
5218 }
5219
5220 if (e.type === 'click' && _this8.options.detailViewByClick) {
5221 _this8.toggleDetailView(rowIndex, _this8.header.detailFormatters[_this8.fieldsColumnsIndex[field]]);
5222 }
5223 }).off('mousedown').on('mousedown', function (e) {
5224 // https://github.com/jquery/jquery/issues/1741
5225 _this8.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
5226 _this8.multipleSelectRowShiftKey = e.shiftKey;
5227 });
5228 this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
5229 e.preventDefault();
5230
5231 _this8.toggleDetailView($(e.currentTarget).parent().parent().data('index'));
5232
5233 return false;
5234 });
5235 this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
5236 this.$selectItem.off('click').on('click', function (e) {
5237 e.stopImmediatePropagation();
5238 var $this = $(e.currentTarget);
5239
5240 _this8._toggleCheck($this.prop('checked'), $this.data('index'));
5241 });
5242 this.header.events.forEach(function (_events, i) {
5243 var events = _events;
5244
5245 if (!events) {
5246 return;
5247 } // fix bug, if events is defined with namespace
5248
5249
5250 if (typeof events === 'string') {
5251 events = Utils.calculateObjectValue(null, events);
5252 }
5253
5254 var field = _this8.header.fields[i];
5255
5256 var fieldIndex = _this8.getVisibleFields().indexOf(field);
5257
5258 if (fieldIndex === -1) {
5259 return;
5260 }
5261
5262 if (_this8.options.detailView && !_this8.options.cardView) {
5263 fieldIndex += 1;
5264 }
5265
5266 var _loop = function _loop(key) {
5267 if (!events.hasOwnProperty(key)) {
5268 return "continue";
5269 }
5270
5271 var event = events[key];
5272
5273 _this8.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
5274 var $tr = $(tr);
5275 var $td = $tr.find(_this8.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
5276 var index = key.indexOf(' ');
5277 var name = key.substring(0, index);
5278 var el = key.substring(index + 1);
5279 $td.find(el).off(name).on(name, function (e) {
5280 var index = $tr.data('index');
5281 var row = _this8.data[index];
5282 var value = row[field];
5283 event.apply(_this8, [e, value, row, index]);
5284 });
5285 });
5286 };
5287
5288 for (var key in events) {
5289 var _ret = _loop(key);
5290
5291 if (_ret === "continue") continue;
5292 }
5293 });
5294 this.updateSelected();
5295 this.initFooter();
5296 this.resetView();
5297
5298 if (this.options.sidePagination !== 'server') {
5299 this.options.totalRows = data.length;
5300 }
5301
5302 this.trigger('post-body', data);
5303 }
5304 }, {
5305 key: "initServer",
5306 value: function initServer(silent, query, url) {
5307 var _this9 = this;
5308
5309 var data = {};
5310 var index = this.header.fields.indexOf(this.options.sortName);
5311 var params = {
5312 searchText: this.searchText,
5313 sortName: this.options.sortName,
5314 sortOrder: this.options.sortOrder
5315 };
5316
5317 if (this.header.sortNames[index]) {
5318 params.sortName = this.header.sortNames[index];
5319 }
5320
5321 if (this.options.pagination && this.options.sidePagination === 'server') {
5322 params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
5323 params.pageNumber = this.options.pageNumber;
5324 }
5325
5326 if (!(url || this.options.url) && !this.options.ajax) {
5327 return;
5328 }
5329
5330 if (this.options.queryParamsType === 'limit') {
5331 params = {
5332 search: params.searchText,
5333 sort: params.sortName,
5334 order: params.sortOrder
5335 };
5336
5337 if (this.options.pagination && this.options.sidePagination === 'server') {
5338 params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
5339 params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
5340
5341 if (params.limit === 0) {
5342 delete params.limit;
5343 }
5344 }
5345 }
5346
5347 if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
5348 params.filter = JSON.stringify(this.filterColumnsPartial, null);
5349 }
5350
5351 $.extend(params, query || {});
5352 data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
5353
5354 if (data === false) {
5355 return;
5356 }
5357
5358 if (!silent) {
5359 this.showLoading();
5360 }
5361
5362 var request = $.extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
5363 type: this.options.method,
5364 url: url || this.options.url,
5365 data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
5366 cache: this.options.cache,
5367 contentType: this.options.contentType,
5368 dataType: this.options.dataType,
5369 success: function success(_res) {
5370 var res = Utils.calculateObjectValue(_this9.options, _this9.options.responseHandler, [_res], _res);
5371
5372 _this9.load(res);
5373
5374 _this9.trigger('load-success', res);
5375
5376 if (!silent) {
5377 _this9.hideLoading();
5378 }
5379 },
5380 error: function error(jqXHR) {
5381 var data = [];
5382
5383 if (_this9.options.sidePagination === 'server') {
5384 data = {};
5385 data[_this9.options.totalField] = 0;
5386 data[_this9.options.dataField] = [];
5387 }
5388
5389 _this9.load(data);
5390
5391 _this9.trigger('load-error', jqXHR.status, jqXHR);
5392
5393 if (!silent) _this9.$tableLoading.hide();
5394 }
5395 });
5396
5397 if (this.options.ajax) {
5398 Utils.calculateObjectValue(this, this.options.ajax, [request], null);
5399 } else {
5400 if (this._xhr && this._xhr.readyState !== 4) {
5401 this._xhr.abort();
5402 }
5403
5404 this._xhr = $.ajax(request);
5405 }
5406
5407 return data;
5408 }
5409 }, {
5410 key: "initSearchText",
5411 value: function initSearchText() {
5412 if (this.options.search) {
5413 this.searchText = '';
5414
5415 if (this.options.searchText !== '') {
5416 var $search = this.$toolbar.find('.search input');
5417 $search.val(this.options.searchText);
5418 this.onSearch({
5419 currentTarget: $search,
5420 firedByInitSearchText: true
5421 });
5422 }
5423 }
5424 }
5425 }, {
5426 key: "getCaret",
5427 value: function getCaret() {
5428 var _this10 = this;
5429
5430 this.$header.find('th').each(function (i, th) {
5431 $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === _this10.options.sortName ? _this10.options.sortOrder : 'both');
5432 });
5433 }
5434 }, {
5435 key: "updateSelected",
5436 value: function updateSelected() {
5437 var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
5438 this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
5439 this.$selectItem.each(function (i, el) {
5440 $(el).closest('tr')[$(el).prop('checked') ? 'addClass' : 'removeClass']('selected');
5441 });
5442 }
5443 }, {
5444 key: "updateRows",
5445 value: function updateRows() {
5446 var _this11 = this;
5447
5448 this.$selectItem.each(function (i, el) {
5449 _this11.data[$(el).data('index')][_this11.header.stateField] = $(el).prop('checked');
5450 });
5451 }
5452 }, {
5453 key: "resetRows",
5454 value: function resetRows() {
5455 var _iteratorNormalCompletion2 = true;
5456 var _didIteratorError2 = false;
5457 var _iteratorError2 = undefined;
5458
5459 try {
5460 for (var _iterator2 = this.data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5461 var row = _step2.value;
5462 this.$selectAll.prop('checked', false);
5463 this.$selectItem.prop('checked', false);
5464
5465 if (this.header.stateField) {
5466 row[this.header.stateField] = false;
5467 }
5468 }
5469 } catch (err) {
5470 _didIteratorError2 = true;
5471 _iteratorError2 = err;
5472 } finally {
5473 try {
5474 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
5475 _iterator2.return();
5476 }
5477 } finally {
5478 if (_didIteratorError2) {
5479 throw _iteratorError2;
5480 }
5481 }
5482 }
5483
5484 this.initHiddenRows();
5485 }
5486 }, {
5487 key: "trigger",
5488 value: function trigger(_name) {
5489 var _this$options;
5490
5491 var name = "".concat(_name, ".bs.table");
5492
5493 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
5494 args[_key2 - 1] = arguments[_key2];
5495 }
5496
5497 (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, args);
5498
5499 this.$el.trigger($.Event(name), args);
5500 this.options.onAll(name, args);
5501 this.$el.trigger($.Event('all.bs.table'), [name, args]);
5502 }
5503 }, {
5504 key: "resetHeader",
5505 value: function resetHeader() {
5506 var _this12 = this;
5507
5508 // fix #61: the hidden table reset header bug.
5509 // fix bug: get $el.css('width') error sometime (height = 500)
5510 clearTimeout(this.timeoutId_);
5511 this.timeoutId_ = setTimeout(function () {
5512 return _this12.fitHeader();
5513 }, this.$el.is(':hidden') ? 100 : 0);
5514 }
5515 }, {
5516 key: "fitHeader",
5517 value: function fitHeader() {
5518 var _this13 = this;
5519
5520 if (this.$el.is(':hidden')) {
5521 this.timeoutId_ = setTimeout(function () {
5522 return _this13.fitHeader();
5523 }, 100);
5524 return;
5525 }
5526
5527 var fixedBody = this.$tableBody.get(0);
5528 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
5529 this.$el.css('margin-top', -this.$header.outerHeight());
5530 var focused = $(':focus');
5531
5532 if (focused.length > 0) {
5533 var $th = focused.parents('th');
5534
5535 if ($th.length > 0) {
5536 var dataField = $th.attr('data-field');
5537
5538 if (dataField !== undefined) {
5539 var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
5540
5541 if ($headerTh.length > 0) {
5542 $headerTh.find(':input').addClass('focus-temp');
5543 }
5544 }
5545 }
5546 }
5547
5548 this.$header_ = this.$header.clone(true, true);
5549 this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
5550 this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
5551 this.$tableLoading.css('width', this.$el.outerWidth());
5552 var focusedTemp = $('.focus-temp:visible:eq(0)');
5553
5554 if (focusedTemp.length > 0) {
5555 focusedTemp.focus();
5556 this.$header.find('.focus-temp').removeClass('focus-temp');
5557 } // fix bug: $.data() is not working as expected after $.append()
5558
5559
5560 this.$header.find('th[data-field]').each(function (i, el) {
5561 _this13.$header_.find(Utils.sprintf('th[data-field="%s"]', $(el).data('field'))).data($(el).data());
5562 });
5563 var visibleFields = this.getVisibleFields();
5564 var $ths = this.$header_.find('th');
5565 var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
5566
5567 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
5568 $tr = $tr.next();
5569 }
5570
5571 $tr.find('> *').each(function (i, el) {
5572 var $this = $(el);
5573 var index = i;
5574
5575 if (_this13.options.detailView && _this13.options.detailViewIcon && !_this13.options.cardView) {
5576 if (i === 0) {
5577 var $thDetail = $ths.filter('.detail');
5578
5579 var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
5580
5581 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
5582 }
5583
5584 index = i - 1;
5585 }
5586
5587 if (index === -1) {
5588 return;
5589 }
5590
5591 var $th = _this13.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
5592
5593 if ($th.length > 1) {
5594 $th = $($ths[$this[0].cellIndex]);
5595 }
5596
5597 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
5598 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
5599 });
5600 this.horizontalScroll();
5601 this.trigger('post-header');
5602 }
5603 }, {
5604 key: "initFooter",
5605 value: function initFooter() {
5606 if (!this.options.showFooter || this.options.cardView) {
5607 // do nothing
5608 return;
5609 }
5610
5611 var data = this.getData();
5612 var html = [];
5613
5614 if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
5615 html.push('<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>');
5616 }
5617
5618 var _iteratorNormalCompletion3 = true;
5619 var _didIteratorError3 = false;
5620 var _iteratorError3 = undefined;
5621
5622 try {
5623 for (var _iterator3 = this.columns[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5624 var column = _step3.value;
5625 var falign = '';
5626 var valign = '';
5627 var csses = [];
5628 var style = {};
5629 var class_ = Utils.sprintf(' class="%s"', column['class']);
5630
5631 if (!column.visible) {
5632 continue;
5633 }
5634
5635 if (this.options.cardView && !column.cardVisible) {
5636 return;
5637 }
5638
5639 falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
5640 valign = Utils.sprintf('vertical-align: %s; ', column.valign);
5641 style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
5642
5643 if (style && style.css) {
5644 for (var _i7 = 0, _Object$entries6 = Object.entries(style.css); _i7 < _Object$entries6.length; _i7++) {
5645 var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i7], 2),
5646 key = _Object$entries6$_i[0],
5647 value = _Object$entries6$_i[1];
5648
5649 csses.push("".concat(key, ": ").concat(value));
5650 }
5651 }
5652
5653 if (style && style.classes) {
5654 class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
5655 }
5656
5657 html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')), '>');
5658 html.push('<div class="th-inner">');
5659 html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data], this.footerData[0] && this.footerData[0][column.field] || ''));
5660 html.push('</div>');
5661 html.push('<div class="fht-cell"></div>');
5662 html.push('</div>');
5663 html.push('</th>');
5664 }
5665 } catch (err) {
5666 _didIteratorError3 = true;
5667 _iteratorError3 = err;
5668 } finally {
5669 try {
5670 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
5671 _iterator3.return();
5672 }
5673 } finally {
5674 if (_didIteratorError3) {
5675 throw _iteratorError3;
5676 }
5677 }
5678 }
5679
5680 this.$tableFooter.find('tr').html(html.join(''));
5681 this.trigger('post-footer', this.$tableFooter);
5682 }
5683 }, {
5684 key: "fitFooter",
5685 value: function fitFooter() {
5686 var _this14 = this;
5687
5688 if (this.$el.is(':hidden')) {
5689 setTimeout(function () {
5690 return _this14.fitFooter();
5691 }, 100);
5692 return;
5693 }
5694
5695 var fixedBody = this.$tableBody.get(0);
5696 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
5697 this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
5698 var visibleFields = this.getVisibleFields();
5699 var $ths = this.$tableFooter.find('th');
5700 var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
5701
5702 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
5703 $tr = $tr.next();
5704 }
5705
5706 $tr.find('> *').each(function (i, el) {
5707 var $this = $(el);
5708 var index = i;
5709
5710 if (_this14.options.detailView && !_this14.options.cardView) {
5711 if (i === 0) {
5712 var $thDetail = $ths.filter('.detail');
5713
5714 var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
5715
5716 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
5717 }
5718
5719 index = i - 1;
5720 }
5721
5722 if (index === -1) {
5723 return;
5724 }
5725
5726 var $th = $ths.eq(i);
5727 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
5728 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
5729 });
5730 this.horizontalScroll();
5731 }
5732 }, {
5733 key: "horizontalScroll",
5734 value: function horizontalScroll() {
5735 var _this15 = this;
5736
5737 // horizontal scroll event
5738 // TODO: it's probably better improving the layout than binding to scroll event
5739 this.trigger('scroll-body');
5740 this.$tableBody.off('scroll').on('scroll', function (_ref6) {
5741 var currentTarget = _ref6.currentTarget;
5742
5743 if (_this15.options.showHeader && _this15.options.height) {
5744 _this15.$tableHeader.scrollLeft($(currentTarget).scrollLeft());
5745 }
5746
5747 if (_this15.options.showFooter && !_this15.options.cardView) {
5748 _this15.$tableFooter.scrollLeft($(currentTarget).scrollLeft());
5749 }
5750 });
5751 }
5752 }, {
5753 key: "getVisibleFields",
5754 value: function getVisibleFields() {
5755 var visibleFields = [];
5756 var _iteratorNormalCompletion4 = true;
5757 var _didIteratorError4 = false;
5758 var _iteratorError4 = undefined;
5759
5760 try {
5761 for (var _iterator4 = this.header.fields[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
5762 var field = _step4.value;
5763 var column = this.columns[this.fieldsColumnsIndex[field]];
5764
5765 if (!column || !column.visible) {
5766 continue;
5767 }
5768
5769 visibleFields.push(field);
5770 }
5771 } catch (err) {
5772 _didIteratorError4 = true;
5773 _iteratorError4 = err;
5774 } finally {
5775 try {
5776 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
5777 _iterator4.return();
5778 }
5779 } finally {
5780 if (_didIteratorError4) {
5781 throw _iteratorError4;
5782 }
5783 }
5784 }
5785
5786 return visibleFields;
5787 }
5788 }, {
5789 key: "initHiddenRows",
5790 value: function initHiddenRows() {
5791 this.hiddenRows = [];
5792 } // PUBLIC FUNCTION DEFINITION
5793 // =======================
5794
5795 }, {
5796 key: "getOptions",
5797 value: function getOptions() {
5798 // deep copy and remove data
5799 var options = $.extend({}, this.options);
5800 delete options.data;
5801 return $.extend(true, {}, options);
5802 }
5803 }, {
5804 key: "refreshOptions",
5805 value: function refreshOptions(options) {
5806 // If the objects are equivalent then avoid the call of destroy / init methods
5807 if (Utils.compareObjects(this.options, options, true)) {
5808 return;
5809 }
5810
5811 this.options = $.extend(this.options, options);
5812 this.trigger('refresh-options', this.options);
5813 this.destroy();
5814 this.init();
5815 }
5816 }, {
5817 key: "getData",
5818 value: function getData(params) {
5819 var data = this.options.data;
5820
5821 if (this.searchText || this.options.sortName || !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) {
5822 data = this.data;
5823 }
5824
5825 if (params && params.useCurrentPage) {
5826 data = data.slice(this.pageFrom - 1, this.pageTo);
5827 }
5828
5829 if (params && !params.includeHiddenRows) {
5830 var hiddenRows = this.getHiddenRows();
5831 data = data.filter(function (row) {
5832 return Utils.findIndex(hiddenRows, row) === -1;
5833 });
5834 }
5835
5836 return data;
5837 }
5838 }, {
5839 key: "getSelections",
5840 value: function getSelections() {
5841 var _this16 = this;
5842
5843 // fix #2424: from html with checkbox
5844 return this.data.filter(function (row) {
5845 return row[_this16.header.stateField] === true;
5846 });
5847 }
5848 }, {
5849 key: "getAllSelections",
5850 value: function getAllSelections() {
5851 var _this17 = this;
5852
5853 return this.options.data.filter(function (row) {
5854 return row[_this17.header.stateField] === true;
5855 });
5856 }
5857 }, {
5858 key: "load",
5859 value: function load(_data) {
5860 var fixedScroll = false;
5861 var data = _data; // #431: support pagination
5862
5863 if (this.options.pagination && this.options.sidePagination === 'server') {
5864 this.options.totalRows = data[this.options.totalField];
5865 }
5866
5867 if (this.options.pagination && this.options.sidePagination === 'server') {
5868 this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
5869 }
5870
5871 fixedScroll = data.fixedScroll;
5872 data = Array.isArray(data) ? data : data[this.options.dataField];
5873 this.initData(data);
5874 this.initSearch();
5875 this.initPagination();
5876 this.initBody(fixedScroll);
5877 }
5878 }, {
5879 key: "append",
5880 value: function append(data) {
5881 this.initData(data, 'append');
5882 this.initSearch();
5883 this.initPagination();
5884 this.initSort();
5885 this.initBody(true);
5886 }
5887 }, {
5888 key: "prepend",
5889 value: function prepend(data) {
5890 this.initData(data, 'prepend');
5891 this.initSearch();
5892 this.initPagination();
5893 this.initSort();
5894 this.initBody(true);
5895 }
5896 }, {
5897 key: "remove",
5898 value: function remove(params) {
5899 var len = this.options.data.length;
5900 var i;
5901 var row;
5902
5903 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('values')) {
5904 return;
5905 }
5906
5907 for (i = len - 1; i >= 0; i--) {
5908 row = this.options.data[i];
5909
5910 if (!row.hasOwnProperty(params.field)) {
5911 continue;
5912 }
5913
5914 if (params.values.includes(row[params.field])) {
5915 this.options.data.splice(i, 1);
5916
5917 if (this.options.sidePagination === 'server') {
5918 this.options.totalRows -= 1;
5919 }
5920 }
5921 }
5922
5923 if (len === this.options.data.length) {
5924 return;
5925 }
5926
5927 this.initSearch();
5928 this.initPagination();
5929 this.initSort();
5930 this.initBody(true);
5931 }
5932 }, {
5933 key: "removeAll",
5934 value: function removeAll() {
5935 if (this.options.data.length > 0) {
5936 this.options.data.splice(0, this.options.data.length);
5937 this.initSearch();
5938 this.initPagination();
5939 this.initBody(true);
5940 }
5941 }
5942 }, {
5943 key: "insertRow",
5944 value: function insertRow(params) {
5945 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
5946 return;
5947 }
5948
5949 this.options.data.splice(params.index, 0, params.row);
5950 this.initSearch();
5951 this.initPagination();
5952 this.initSort();
5953 this.initBody(true);
5954 }
5955 }, {
5956 key: "updateRow",
5957 value: function updateRow(params) {
5958 var allParams = Array.isArray(params) ? params : [params];
5959 var _iteratorNormalCompletion5 = true;
5960 var _didIteratorError5 = false;
5961 var _iteratorError5 = undefined;
5962
5963 try {
5964 for (var _iterator5 = allParams[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
5965 var _params = _step5.value;
5966
5967 if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
5968 continue;
5969 }
5970
5971 $.extend(this.options.data[_params.index], _params.row);
5972
5973 if (_params.hasOwnProperty('replace') && _params.replace) {
5974 this.options.data[_params.index] = _params.row;
5975 } else {
5976 $.extend(this.options.data[_params.index], _params.row);
5977 }
5978 }
5979 } catch (err) {
5980 _didIteratorError5 = true;
5981 _iteratorError5 = err;
5982 } finally {
5983 try {
5984 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
5985 _iterator5.return();
5986 }
5987 } finally {
5988 if (_didIteratorError5) {
5989 throw _iteratorError5;
5990 }
5991 }
5992 }
5993
5994 this.initSearch();
5995 this.initPagination();
5996 this.initSort();
5997 this.initBody(true);
5998 }
5999 }, {
6000 key: "getRowByUniqueId",
6001 value: function getRowByUniqueId(_id) {
6002 var uniqueId = this.options.uniqueId;
6003 var len = this.options.data.length;
6004 var id = _id;
6005 var dataRow = null;
6006 var i;
6007 var row;
6008 var rowUniqueId;
6009
6010 for (i = len - 1; i >= 0; i--) {
6011 row = this.options.data[i];
6012
6013 if (row.hasOwnProperty(uniqueId)) {
6014 // uniqueId is a column
6015 rowUniqueId = row[uniqueId];
6016 } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
6017 // uniqueId is a row data property
6018 rowUniqueId = row._data[uniqueId];
6019 } else {
6020 continue;
6021 }
6022
6023 if (typeof rowUniqueId === 'string') {
6024 id = id.toString();
6025 } else if (typeof rowUniqueId === 'number') {
6026 if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
6027 id = parseInt(id);
6028 } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
6029 id = parseFloat(id);
6030 }
6031 }
6032
6033 if (rowUniqueId === id) {
6034 dataRow = row;
6035 break;
6036 }
6037 }
6038
6039 return dataRow;
6040 }
6041 }, {
6042 key: "updateByUniqueId",
6043 value: function updateByUniqueId(params) {
6044 var allParams = Array.isArray(params) ? params : [params];
6045 var _iteratorNormalCompletion6 = true;
6046 var _didIteratorError6 = false;
6047 var _iteratorError6 = undefined;
6048
6049 try {
6050 for (var _iterator6 = allParams[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
6051 var _params2 = _step6.value;
6052
6053 if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
6054 continue;
6055 }
6056
6057 var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
6058
6059 if (rowId === -1) {
6060 continue;
6061 }
6062
6063 if (_params2.hasOwnProperty('replace') && _params2.replace) {
6064 this.options.data[rowId] = _params2.row;
6065 } else {
6066 $.extend(this.options.data[rowId], _params2.row);
6067 }
6068 }
6069 } catch (err) {
6070 _didIteratorError6 = true;
6071 _iteratorError6 = err;
6072 } finally {
6073 try {
6074 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
6075 _iterator6.return();
6076 }
6077 } finally {
6078 if (_didIteratorError6) {
6079 throw _iteratorError6;
6080 }
6081 }
6082 }
6083
6084 this.initSearch();
6085 this.initPagination();
6086 this.initSort();
6087 this.initBody(true);
6088 }
6089 }, {
6090 key: "removeByUniqueId",
6091 value: function removeByUniqueId(id) {
6092 var len = this.options.data.length;
6093 var row = this.getRowByUniqueId(id);
6094
6095 if (row) {
6096 this.options.data.splice(this.options.data.indexOf(row), 1);
6097 }
6098
6099 if (len === this.options.data.length) {
6100 return;
6101 }
6102
6103 this.initSearch();
6104 this.initPagination();
6105 this.initBody(true);
6106 }
6107 }, {
6108 key: "updateCell",
6109 value: function updateCell(params) {
6110 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
6111 return;
6112 }
6113
6114 this.data[params.index][params.field] = params.value;
6115
6116 if (params.reinit === false) {
6117 return;
6118 }
6119
6120 this.initSort();
6121 this.initBody(true);
6122 }
6123 }, {
6124 key: "updateCellByUniqueId",
6125 value: function updateCellByUniqueId(params) {
6126 var _this18 = this;
6127
6128 if (!params.hasOwnProperty('id') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
6129 return;
6130 }
6131
6132 var allParams = Array.isArray(params) ? params : [params];
6133 allParams.forEach(function (_ref7) {
6134 var id = _ref7.id,
6135 field = _ref7.field,
6136 value = _ref7.value;
6137
6138 var rowId = _this18.options.data.indexOf(_this18.getRowByUniqueId(id));
6139
6140 if (rowId === -1) {
6141 return;
6142 }
6143
6144 _this18.options.data[rowId][field] = value;
6145 });
6146
6147 if (params.reinit === false) {
6148 return;
6149 }
6150
6151 this.initSort();
6152 this.initBody(true);
6153 }
6154 }, {
6155 key: "showRow",
6156 value: function showRow(params) {
6157 this._toggleRow(params, true);
6158 }
6159 }, {
6160 key: "hideRow",
6161 value: function hideRow(params) {
6162 this._toggleRow(params, false);
6163 }
6164 }, {
6165 key: "_toggleRow",
6166 value: function _toggleRow(params, visible) {
6167 var row;
6168
6169 if (params.hasOwnProperty('index')) {
6170 row = this.getData()[params.index];
6171 } else if (params.hasOwnProperty('uniqueId')) {
6172 row = this.getRowByUniqueId(params.uniqueId);
6173 }
6174
6175 if (!row) {
6176 return;
6177 }
6178
6179 var index = Utils.findIndex(this.hiddenRows, row);
6180
6181 if (!visible && index === -1) {
6182 this.hiddenRows.push(row);
6183 } else if (visible && index > -1) {
6184 this.hiddenRows.splice(index, 1);
6185 }
6186
6187 if (visible) {
6188 this.updatePagination();
6189 } else {
6190 this.initBody(true);
6191 this.initPagination();
6192 }
6193 }
6194 }, {
6195 key: "getHiddenRows",
6196 value: function getHiddenRows(show) {
6197 if (show) {
6198 this.initHiddenRows();
6199 this.initBody(true);
6200 return;
6201 }
6202
6203 var data = this.getData();
6204 var rows = [];
6205 var _iteratorNormalCompletion7 = true;
6206 var _didIteratorError7 = false;
6207 var _iteratorError7 = undefined;
6208
6209 try {
6210 for (var _iterator7 = data[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
6211 var row = _step7.value;
6212
6213 if (this.hiddenRows.includes(row)) {
6214 rows.push(row);
6215 }
6216 }
6217 } catch (err) {
6218 _didIteratorError7 = true;
6219 _iteratorError7 = err;
6220 } finally {
6221 try {
6222 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
6223 _iterator7.return();
6224 }
6225 } finally {
6226 if (_didIteratorError7) {
6227 throw _iteratorError7;
6228 }
6229 }
6230 }
6231
6232 this.hiddenRows = rows;
6233 return rows;
6234 }
6235 }, {
6236 key: "showColumn",
6237 value: function showColumn(field) {
6238 var _this19 = this;
6239
6240 var fields = Array.isArray(field) ? field : [field];
6241 fields.forEach(function (field) {
6242 _this19._toggleColumn(_this19.fieldsColumnsIndex[field], true, true);
6243 });
6244 }
6245 }, {
6246 key: "hideColumn",
6247 value: function hideColumn(field) {
6248 var _this20 = this;
6249
6250 var fields = Array.isArray(field) ? field : [field];
6251 fields.forEach(function (field) {
6252 _this20._toggleColumn(_this20.fieldsColumnsIndex[field], false, true);
6253 });
6254 }
6255 }, {
6256 key: "_toggleColumn",
6257 value: function _toggleColumn(index, checked, needUpdate) {
6258 if (index === -1 || this.columns[index].visible === checked) {
6259 return;
6260 }
6261
6262 this.columns[index].visible = checked;
6263 this.initHeader();
6264 this.initSearch();
6265 this.initPagination();
6266 this.initBody();
6267
6268 if (this.options.showColumns) {
6269 var $items = this.$toolbar.find('.keep-open input').prop('disabled', false);
6270
6271 if (needUpdate) {
6272 $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
6273 }
6274
6275 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
6276 $items.filter(':checked').prop('disabled', true);
6277 }
6278 }
6279 }
6280 }, {
6281 key: "getVisibleColumns",
6282 value: function getVisibleColumns() {
6283 return this.columns.filter(function (_ref8) {
6284 var visible = _ref8.visible;
6285 return visible;
6286 });
6287 }
6288 }, {
6289 key: "getHiddenColumns",
6290 value: function getHiddenColumns() {
6291 return this.columns.filter(function (_ref9) {
6292 var visible = _ref9.visible;
6293 return !visible;
6294 });
6295 }
6296 }, {
6297 key: "showAllColumns",
6298 value: function showAllColumns() {
6299 this._toggleAllColumns(true);
6300 }
6301 }, {
6302 key: "hideAllColumns",
6303 value: function hideAllColumns() {
6304 this._toggleAllColumns(false);
6305 }
6306 }, {
6307 key: "_toggleAllColumns",
6308 value: function _toggleAllColumns(visible) {
6309 var _this21 = this;
6310
6311 var _iteratorNormalCompletion8 = true;
6312 var _didIteratorError8 = false;
6313 var _iteratorError8 = undefined;
6314
6315 try {
6316 for (var _iterator8 = this.columns.slice().reverse()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
6317 var column = _step8.value;
6318
6319 if (column.switchable) {
6320 if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) {
6321 continue;
6322 }
6323
6324 column.visible = visible;
6325 }
6326 }
6327 } catch (err) {
6328 _didIteratorError8 = true;
6329 _iteratorError8 = err;
6330 } finally {
6331 try {
6332 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
6333 _iterator8.return();
6334 }
6335 } finally {
6336 if (_didIteratorError8) {
6337 throw _iteratorError8;
6338 }
6339 }
6340 }
6341
6342 this.initHeader();
6343 this.initSearch();
6344 this.initPagination();
6345 this.initBody();
6346
6347 if (this.options.showColumns) {
6348 var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
6349
6350 if (visible) {
6351 $items.prop('checked', visible);
6352 } else {
6353 $items.get().reverse().forEach(function (item) {
6354 if ($items.filter(':checked').length > _this21.options.minimumCountColumns) {
6355 $(item).prop('checked', visible);
6356 }
6357 });
6358 }
6359
6360 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
6361 $items.filter(':checked').prop('disabled', true);
6362 }
6363 }
6364 }
6365 }, {
6366 key: "mergeCells",
6367 value: function mergeCells(options) {
6368 var row = options.index;
6369 var col = this.getVisibleFields().indexOf(options.field);
6370 var rowspan = options.rowspan || 1;
6371 var colspan = options.colspan || 1;
6372 var i;
6373 var j;
6374 var $tr = this.$body.find('>tr');
6375
6376 if (this.options.detailView && !this.options.cardView) {
6377 col += 1;
6378 }
6379
6380 var $td = $tr.eq(row).find('>td').eq(col);
6381
6382 if (row < 0 || col < 0 || row >= this.data.length) {
6383 return;
6384 }
6385
6386 for (i = row; i < row + rowspan; i++) {
6387 for (j = col; j < col + colspan; j++) {
6388 $tr.eq(i).find('>td').eq(j).hide();
6389 }
6390 }
6391
6392 $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
6393 }
6394 }, {
6395 key: "checkAll",
6396 value: function checkAll() {
6397 this._toggleCheckAll(true);
6398 }
6399 }, {
6400 key: "uncheckAll",
6401 value: function uncheckAll() {
6402 this._toggleCheckAll(false);
6403 }
6404 }, {
6405 key: "_toggleCheckAll",
6406 value: function _toggleCheckAll(checked) {
6407 var rowsBefore = this.getSelections();
6408 this.$selectAll.add(this.$selectAll_).prop('checked', checked);
6409 this.$selectItem.filter(':enabled').prop('checked', checked);
6410 this.updateRows();
6411 var rowsAfter = this.getSelections();
6412
6413 if (checked) {
6414 this.trigger('check-all', rowsAfter, rowsBefore);
6415 return;
6416 }
6417
6418 this.trigger('uncheck-all', rowsAfter, rowsBefore);
6419 }
6420 }, {
6421 key: "checkInvert",
6422 value: function checkInvert() {
6423 var $items = this.$selectItem.filter(':enabled');
6424 var checked = $items.filter(':checked');
6425 $items.each(function (i, el) {
6426 $(el).prop('checked', !$(el).prop('checked'));
6427 });
6428 this.updateRows();
6429 this.updateSelected();
6430 this.trigger('uncheck-some', checked);
6431 checked = this.getSelections();
6432 this.trigger('check-some', checked);
6433 }
6434 }, {
6435 key: "check",
6436 value: function check(index) {
6437 this._toggleCheck(true, index);
6438 }
6439 }, {
6440 key: "uncheck",
6441 value: function uncheck(index) {
6442 this._toggleCheck(false, index);
6443 }
6444 }, {
6445 key: "_toggleCheck",
6446 value: function _toggleCheck(checked, index) {
6447 var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
6448 var row = this.data[index];
6449
6450 if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
6451 var _iteratorNormalCompletion9 = true;
6452 var _didIteratorError9 = false;
6453 var _iteratorError9 = undefined;
6454
6455 try {
6456 for (var _iterator9 = this.options.data[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
6457 var r = _step9.value;
6458 r[this.header.stateField] = false;
6459 }
6460 } catch (err) {
6461 _didIteratorError9 = true;
6462 _iteratorError9 = err;
6463 } finally {
6464 try {
6465 if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
6466 _iterator9.return();
6467 }
6468 } finally {
6469 if (_didIteratorError9) {
6470 throw _iteratorError9;
6471 }
6472 }
6473 }
6474
6475 this.$selectItem.filter(':checked').not($el).prop('checked', false);
6476 }
6477
6478 row[this.header.stateField] = checked;
6479
6480 if (this.options.multipleSelectRow) {
6481 if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
6482 var indexes = [this.multipleSelectRowLastSelectedIndex, index].sort();
6483
6484 for (var i = indexes[0] + 1; i < indexes[1]; i++) {
6485 this.data[i][this.header.stateField] = true;
6486 this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
6487 }
6488 }
6489
6490 this.multipleSelectRowCtrlKey = false;
6491 this.multipleSelectRowShiftKey = false;
6492 this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
6493 }
6494
6495 $el.prop('checked', checked);
6496 this.updateSelected();
6497 this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
6498 }
6499 }, {
6500 key: "checkBy",
6501 value: function checkBy(obj) {
6502 this._toggleCheckBy(true, obj);
6503 }
6504 }, {
6505 key: "uncheckBy",
6506 value: function uncheckBy(obj) {
6507 this._toggleCheckBy(false, obj);
6508 }
6509 }, {
6510 key: "_toggleCheckBy",
6511 value: function _toggleCheckBy(checked, obj) {
6512 var _this22 = this;
6513
6514 if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
6515 return;
6516 }
6517
6518 var rows = [];
6519 this.data.forEach(function (row, i) {
6520 if (!row.hasOwnProperty(obj.field)) {
6521 return false;
6522 }
6523
6524 if (obj.values.includes(row[obj.field])) {
6525 var $el = _this22.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
6526
6527 $el = checked ? $el.not(':checked') : $el.filter(':checked');
6528
6529 if (!$el.length) {
6530 return;
6531 }
6532
6533 $el.prop('checked', checked);
6534 row[_this22.header.stateField] = checked;
6535 rows.push(row);
6536
6537 _this22.trigger(checked ? 'check' : 'uncheck', row, $el);
6538 }
6539 });
6540 this.updateSelected();
6541 this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
6542 }
6543 }, {
6544 key: "refresh",
6545 value: function refresh(params) {
6546 if (params && params.url) {
6547 this.options.url = params.url;
6548 }
6549
6550 if (params && params.pageNumber) {
6551 this.options.pageNumber = params.pageNumber;
6552 }
6553
6554 if (params && params.pageSize) {
6555 this.options.pageSize = params.pageSize;
6556 }
6557
6558 this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
6559 }
6560 }, {
6561 key: "destroy",
6562 value: function destroy() {
6563 this.$el.insertBefore(this.$container);
6564 $(this.options.toolbar).insertBefore(this.$el);
6565 this.$container.next().remove();
6566 this.$container.remove();
6567 this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
6568 }
6569 }, {
6570 key: "resetView",
6571 value: function resetView(params) {
6572 var padding = 0;
6573
6574 if (params && params.height) {
6575 this.options.height = params.height;
6576 }
6577
6578 this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length);
6579 this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
6580
6581 if (!this.options.cardView && this.options.showHeader && this.options.height) {
6582 this.$tableHeader.show();
6583 this.resetHeader();
6584 padding += this.$header.outerHeight(true);
6585 } else {
6586 this.$tableHeader.hide();
6587 this.trigger('post-header');
6588 }
6589
6590 if (!this.options.cardView && this.options.showFooter) {
6591 this.$tableFooter.show();
6592 this.fitFooter();
6593
6594 if (this.options.height) {
6595 padding += this.$tableFooter.outerHeight(true);
6596 }
6597 }
6598
6599 if (this.options.height) {
6600 var toolbarHeight = this.$toolbar.outerHeight(true);
6601 var paginationHeight = this.$pagination.outerHeight(true);
6602 var height = this.options.height - toolbarHeight - paginationHeight;
6603 var tableHeight = this.$tableBody.find('table').outerHeight(true);
6604 this.$tableContainer.css('height', "".concat(height, "px"));
6605 this.$tableBorder && this.$tableBorder.css('height', "".concat(height - tableHeight - padding - 1, "px"));
6606 }
6607
6608 if (this.options.cardView) {
6609 // remove the element css
6610 this.$el.css('margin-top', '0');
6611 this.$tableContainer.css('padding-bottom', '0');
6612 this.$tableFooter.hide();
6613 } else {
6614 // Assign the correct sortable arrow
6615 this.getCaret();
6616 this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
6617 }
6618
6619 this.trigger('reset-view');
6620 }
6621 }, {
6622 key: "resetWidth",
6623 value: function resetWidth() {
6624 if (this.options.showHeader && this.options.height) {
6625 this.fitHeader();
6626 }
6627
6628 if (this.options.showFooter && !this.options.cardView) {
6629 this.fitFooter();
6630 }
6631 }
6632 }, {
6633 key: "showLoading",
6634 value: function showLoading() {
6635 this.$tableLoading.css('display', 'flex');
6636 }
6637 }, {
6638 key: "hideLoading",
6639 value: function hideLoading() {
6640 this.$tableLoading.css('display', 'none');
6641 }
6642 }, {
6643 key: "togglePagination",
6644 value: function togglePagination() {
6645 this.options.pagination = !this.options.pagination;
6646 var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
6647 var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
6648 this.$toolbar.find('button[name="paginationSwitch"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
6649 this.updatePagination();
6650 }
6651 }, {
6652 key: "toggleFullscreen",
6653 value: function toggleFullscreen() {
6654 this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
6655 this.resetView();
6656 }
6657 }, {
6658 key: "toggleView",
6659 value: function toggleView() {
6660 this.options.cardView = !this.options.cardView;
6661 this.initHeader();
6662 var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
6663 var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
6664 this.$toolbar.find('button[name="toggle"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
6665 this.initBody();
6666 this.trigger('toggle', this.options.cardView);
6667 }
6668 }, {
6669 key: "resetSearch",
6670 value: function resetSearch(text) {
6671 var $search = this.$toolbar.find('.search input');
6672 $search.val(text || '');
6673 this.onSearch({
6674 currentTarget: $search
6675 });
6676 }
6677 }, {
6678 key: "filterBy",
6679 value: function filterBy(columns, options) {
6680 this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $.extend(this.options.filterOptions, options);
6681 this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
6682 this.options.pageNumber = 1;
6683 this.initSearch();
6684 this.updatePagination();
6685 }
6686 }, {
6687 key: "scrollTo",
6688 value: function scrollTo(params) {
6689 if (typeof params === 'undefined') {
6690 return this.$tableBody.scrollTop();
6691 }
6692
6693 var options = {
6694 unit: 'px',
6695 value: 0
6696 };
6697
6698 if (_typeof(params) === 'object') {
6699 options = Object.assign(options, params);
6700 } else if (typeof params === 'string' && params === 'bottom') {
6701 options.value = this.$tableBody[0].scrollHeight;
6702 } else if (typeof params === 'string') {
6703 options.value = params;
6704 }
6705
6706 var scrollTo = options.value;
6707
6708 if (options.unit === 'rows') {
6709 scrollTo = 0;
6710 this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
6711 scrollTo += $(el).outerHeight(true);
6712 });
6713 }
6714
6715 this.$tableBody.scrollTop(scrollTo);
6716 }
6717 }, {
6718 key: "getScrollPosition",
6719 value: function getScrollPosition() {
6720 return this.scrollTo();
6721 }
6722 }, {
6723 key: "selectPage",
6724 value: function selectPage(page) {
6725 if (page > 0 && page <= this.options.totalPages) {
6726 this.options.pageNumber = page;
6727 this.updatePagination();
6728 }
6729 }
6730 }, {
6731 key: "prevPage",
6732 value: function prevPage() {
6733 if (this.options.pageNumber > 1) {
6734 this.options.pageNumber--;
6735 this.updatePagination();
6736 }
6737 }
6738 }, {
6739 key: "nextPage",
6740 value: function nextPage() {
6741 if (this.options.pageNumber < this.options.totalPages) {
6742 this.options.pageNumber++;
6743 this.updatePagination();
6744 }
6745 }
6746 }, {
6747 key: "toggleDetailView",
6748 value: function toggleDetailView(index, _columnDetailFormatter) {
6749 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
6750
6751 if ($tr.next().is('tr.detail-view')) {
6752 this.collapseRow(index);
6753 } else {
6754 this.expandRow(index, _columnDetailFormatter);
6755 }
6756
6757 this.resetView();
6758 }
6759 }, {
6760 key: "expandRow",
6761 value: function expandRow(index, _columnDetailFormatter) {
6762 var row = this.data[index];
6763 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
6764
6765 if ($tr.next().is('tr.detail-view')) {
6766 return;
6767 }
6768
6769 if (this.options.detailViewIcon) {
6770 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
6771 }
6772
6773 $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
6774 var $element = $tr.next().find('td');
6775 var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
6776 var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
6777
6778 if ($element.length === 1) {
6779 $element.append(content);
6780 }
6781
6782 this.trigger('expand-row', index, row, $element);
6783 }
6784 }, {
6785 key: "collapseRow",
6786 value: function collapseRow(index) {
6787 var row = this.data[index];
6788 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
6789
6790 if (!$tr.next().is('tr.detail-view')) {
6791 return;
6792 }
6793
6794 if (this.options.detailViewIcon) {
6795 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
6796 }
6797
6798 this.trigger('collapse-row', index, row, $tr.next());
6799 $tr.next().remove();
6800 }
6801 }, {
6802 key: "expandAllRows",
6803 value: function expandAllRows() {
6804 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
6805
6806 for (var i = 0; i < trs.length; i++) {
6807 this.expandRow($(trs[i]).data('index'));
6808 }
6809 }
6810 }, {
6811 key: "collapseAllRows",
6812 value: function collapseAllRows() {
6813 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
6814
6815 for (var i = 0; i < trs.length; i++) {
6816 this.collapseRow($(trs[i]).data('index'));
6817 }
6818 }
6819 }, {
6820 key: "updateColumnTitle",
6821 value: function updateColumnTitle(params) {
6822 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
6823 return;
6824 }
6825
6826 this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
6827
6828 if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
6829 var header = this.options.height !== undefined ? this.$tableHeader : this.$header;
6830 header.find('th[data-field]').each(function (i, el) {
6831 if ($(el).data('field') === params.field) {
6832 $($(el).find('.th-inner')[0]).text(params.title);
6833 return false;
6834 }
6835 });
6836 }
6837 }
6838 }, {
6839 key: "updateFormatText",
6840 value: function updateFormatText(formatName, text) {
6841 if (!/^format/.test(formatName) || !this.options[formatName]) {
6842 return;
6843 }
6844
6845 if (typeof text === 'string') {
6846 this.options[formatName] = function () {
6847 return text;
6848 };
6849 } else if (typeof text === 'function') {
6850 this.options[formatName] = text;
6851 }
6852
6853 this.initToolbar();
6854 this.initPagination();
6855 this.initBody();
6856 }
6857 }]);
6858
6859 return BootstrapTable;
6860 }();
6861
6862 BootstrapTable.VERSION = Constants.VERSION;
6863 BootstrapTable.DEFAULTS = Constants.DEFAULTS;
6864 BootstrapTable.LOCALES = Constants.LOCALES;
6865 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
6866 BootstrapTable.METHODS = Constants.METHODS;
6867 BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
6868 // =======================
6869
6870 $.BootstrapTable = BootstrapTable;
6871
6872 $.fn.bootstrapTable = function (option) {
6873 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
6874 args[_key3 - 1] = arguments[_key3];
6875 }
6876
6877 var value;
6878 this.each(function (i, el) {
6879 var data = $(el).data('bootstrap.table');
6880 var options = $.extend({}, BootstrapTable.DEFAULTS, $(el).data(), _typeof(option) === 'object' && option);
6881
6882 if (typeof option === 'string') {
6883 var _data2;
6884
6885 if (!Constants.METHODS.includes(option)) {
6886 throw new Error("Unknown method: ".concat(option));
6887 }
6888
6889 if (!data) {
6890 return;
6891 }
6892
6893 value = (_data2 = data)[option].apply(_data2, args);
6894
6895 if (option === 'destroy') {
6896 $(el).removeData('bootstrap.table');
6897 }
6898 }
6899
6900 if (!data) {
6901 $(el).data('bootstrap.table', data = new $.BootstrapTable(el, options));
6902 }
6903 });
6904 return typeof value === 'undefined' ? this : value;
6905 };
6906
6907 $.fn.bootstrapTable.Constructor = BootstrapTable;
6908 $.fn.bootstrapTable.theme = Constants.THEME;
6909 $.fn.bootstrapTable.VERSION = Constants.VERSION;
6910 $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
6911 $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
6912 $.fn.bootstrapTable.events = BootstrapTable.EVENTS;
6913 $.fn.bootstrapTable.locales = BootstrapTable.LOCALES;
6914 $.fn.bootstrapTable.methods = BootstrapTable.METHODS;
6915 $.fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
6916 // =======================
6917
6918 $(function () {
6919 $('[data-toggle="table"]').bootstrapTable();
6920 });
6921
6922 return BootstrapTable;
6923
6924}));