UNPKG

242 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.5';
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 inputPrefix: 'input-',
2674 input: 'form-control',
2675 paginationDropdown: 'btn-group dropdown',
2676 dropup: 'dropup',
2677 dropdownActive: 'active',
2678 paginationActive: 'active',
2679 buttonActive: 'active'
2680 },
2681 html: {
2682 toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
2683 toolbarDropdownItem: '<li role="menuitem"><label>%s</label></li>',
2684 toolbarDropdownSeparator: '<li class="divider"></li>',
2685 pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
2686 pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
2687 dropdownCaret: '<span class="caret"></span>',
2688 pagination: ['<ul class="pagination%s">', '</ul>'],
2689 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
2690 icon: '<i class="%s %s"></i>',
2691 inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
2692 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
2693 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
2694 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
2695 }
2696 },
2697 4: {
2698 iconsPrefix: 'fa',
2699 icons: {
2700 paginationSwitchDown: 'fa-caret-square-down',
2701 paginationSwitchUp: 'fa-caret-square-up',
2702 refresh: 'fa-sync',
2703 toggleOff: 'fa-toggle-off',
2704 toggleOn: 'fa-toggle-on',
2705 columns: 'fa-th-list',
2706 detailOpen: 'fa-plus',
2707 detailClose: 'fa-minus',
2708 fullscreen: 'fa-arrows-alt',
2709 search: 'fa-search',
2710 clearSearch: 'fa-trash'
2711 },
2712 classes: {
2713 buttonsPrefix: 'btn',
2714 buttons: 'secondary',
2715 buttonsGroup: 'btn-group',
2716 buttonsDropdown: 'btn-group',
2717 pull: 'float',
2718 inputGroup: 'btn-group',
2719 inputPrefix: 'form-control-',
2720 input: 'form-control',
2721 paginationDropdown: 'btn-group dropdown',
2722 dropup: 'dropup',
2723 dropdownActive: 'active',
2724 paginationActive: 'active',
2725 buttonActive: 'active'
2726 },
2727 html: {
2728 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
2729 toolbarDropdownItem: '<label class="dropdown-item">%s</label>',
2730 pageDropdown: ['<div class="dropdown-menu">', '</div>'],
2731 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
2732 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
2733 dropdownCaret: '<span class="caret"></span>',
2734 pagination: ['<ul class="pagination%s">', '</ul>'],
2735 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
2736 icon: '<i class="%s %s"></i>',
2737 inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
2738 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
2739 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
2740 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
2741 }
2742 }
2743 }[bootstrapVersion];
2744 var DEFAULTS = {
2745 height: undefined,
2746 classes: 'table table-bordered table-hover',
2747 theadClasses: '',
2748 rowStyle: function rowStyle(row, index) {
2749 return {};
2750 },
2751 rowAttributes: function rowAttributes(row, index) {
2752 return {};
2753 },
2754 undefinedText: '-',
2755 locale: undefined,
2756 virtualScroll: false,
2757 virtualScrollItemHeight: undefined,
2758 sortable: true,
2759 sortClass: undefined,
2760 silentSort: true,
2761 sortName: undefined,
2762 sortOrder: 'asc',
2763 sortStable: false,
2764 rememberOrder: false,
2765 customSort: undefined,
2766 columns: [[]],
2767 data: [],
2768 url: undefined,
2769 method: 'get',
2770 cache: true,
2771 contentType: 'application/json',
2772 dataType: 'json',
2773 ajax: undefined,
2774 ajaxOptions: {},
2775 queryParams: function queryParams(params) {
2776 return params;
2777 },
2778 queryParamsType: 'limit',
2779 // 'limit', undefined
2780 responseHandler: function responseHandler(res) {
2781 return res;
2782 },
2783 totalField: 'total',
2784 totalNotFilteredField: 'totalNotFiltered',
2785 dataField: 'rows',
2786 pagination: false,
2787 onlyInfoPagination: false,
2788 showExtendedPagination: false,
2789 paginationLoop: true,
2790 sidePagination: 'client',
2791 // client or server
2792 totalRows: 0,
2793 totalNotFiltered: 0,
2794 pageNumber: 1,
2795 pageSize: 10,
2796 pageList: [10, 25, 50, 100],
2797 paginationHAlign: 'right',
2798 // right, left
2799 paginationVAlign: 'bottom',
2800 // bottom, top, both
2801 paginationDetailHAlign: 'left',
2802 // right, left
2803 paginationPreText: '&lsaquo;',
2804 paginationNextText: '&rsaquo;',
2805 paginationSuccessivelySize: 5,
2806 // Maximum successively number of pages in a row
2807 paginationPagesBySide: 1,
2808 // Number of pages on each side (right, left) of the current page.
2809 paginationUseIntermediate: false,
2810 // Calculate intermediate pages for quick access
2811 search: false,
2812 searchOnEnterKey: false,
2813 strictSearch: false,
2814 visibleSearch: false,
2815 showButtonIcons: true,
2816 showButtonText: false,
2817 showSearchButton: false,
2818 showSearchClearButton: false,
2819 trimOnSearch: true,
2820 searchAlign: 'right',
2821 searchTimeOut: 500,
2822 searchText: '',
2823 customSearch: undefined,
2824 showHeader: true,
2825 showFooter: false,
2826 footerStyle: function footerStyle(row, index) {
2827 return {};
2828 },
2829 showColumns: false,
2830 showColumnsToggleAll: false,
2831 minimumCountColumns: 1,
2832 showPaginationSwitch: false,
2833 showRefresh: false,
2834 showToggle: false,
2835 showFullscreen: false,
2836 smartDisplay: true,
2837 escape: false,
2838 filterOptions: {
2839 filterAlgorithm: 'and'
2840 },
2841 idField: undefined,
2842 selectItemName: 'btSelectItem',
2843 clickToSelect: false,
2844 ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
2845 var tagName = _ref.tagName;
2846 return ['A', 'BUTTON'].includes(tagName);
2847 },
2848 singleSelect: false,
2849 checkboxHeader: true,
2850 maintainMetaData: false,
2851 multipleSelectRow: false,
2852 uniqueId: undefined,
2853 cardView: false,
2854 detailView: false,
2855 detailViewIcon: true,
2856 detailViewByClick: false,
2857 detailFormatter: function detailFormatter(index, row) {
2858 return '';
2859 },
2860 detailFilter: function detailFilter(index, row) {
2861 return true;
2862 },
2863 toolbar: undefined,
2864 toolbarAlign: 'left',
2865 buttonsToolbar: undefined,
2866 buttonsAlign: 'right',
2867 buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
2868 buttonsClass: CONSTANTS.classes.buttons,
2869 icons: CONSTANTS.icons,
2870 html: CONSTANTS.html,
2871 iconSize: undefined,
2872 iconsPrefix: CONSTANTS.iconsPrefix,
2873 // glyphicon or fa(font-awesome)
2874 onAll: function onAll(name, args) {
2875 return false;
2876 },
2877 onClickCell: function onClickCell(field, value, row, $element) {
2878 return false;
2879 },
2880 onDblClickCell: function onDblClickCell(field, value, row, $element) {
2881 return false;
2882 },
2883 onClickRow: function onClickRow(item, $element) {
2884 return false;
2885 },
2886 onDblClickRow: function onDblClickRow(item, $element) {
2887 return false;
2888 },
2889 onSort: function onSort(name, order) {
2890 return false;
2891 },
2892 onCheck: function onCheck(row) {
2893 return false;
2894 },
2895 onUncheck: function onUncheck(row) {
2896 return false;
2897 },
2898 onCheckAll: function onCheckAll(rows) {
2899 return false;
2900 },
2901 onUncheckAll: function onUncheckAll(rows) {
2902 return false;
2903 },
2904 onCheckSome: function onCheckSome(rows) {
2905 return false;
2906 },
2907 onUncheckSome: function onUncheckSome(rows) {
2908 return false;
2909 },
2910 onLoadSuccess: function onLoadSuccess(data) {
2911 return false;
2912 },
2913 onLoadError: function onLoadError(status) {
2914 return false;
2915 },
2916 onColumnSwitch: function onColumnSwitch(field, checked) {
2917 return false;
2918 },
2919 onPageChange: function onPageChange(number, size) {
2920 return false;
2921 },
2922 onSearch: function onSearch(text) {
2923 return false;
2924 },
2925 onToggle: function onToggle(cardView) {
2926 return false;
2927 },
2928 onPreBody: function onPreBody(data) {
2929 return false;
2930 },
2931 onPostBody: function onPostBody() {
2932 return false;
2933 },
2934 onPostHeader: function onPostHeader() {
2935 return false;
2936 },
2937 onPostFooter: function onPostFooter() {
2938 return false;
2939 },
2940 onExpandRow: function onExpandRow(index, row, $detail) {
2941 return false;
2942 },
2943 onCollapseRow: function onCollapseRow(index, row) {
2944 return false;
2945 },
2946 onRefreshOptions: function onRefreshOptions(options) {
2947 return false;
2948 },
2949 onRefresh: function onRefresh(params) {
2950 return false;
2951 },
2952 onResetView: function onResetView() {
2953 return false;
2954 },
2955 onScrollBody: function onScrollBody() {
2956 return false;
2957 }
2958 };
2959 var EN = {
2960 formatLoadingMessage: function formatLoadingMessage() {
2961 return 'Loading, please wait';
2962 },
2963 formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
2964 return "".concat(pageNumber, " rows per page");
2965 },
2966 formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
2967 if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
2968 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
2969 }
2970
2971 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
2972 },
2973 formatSRPaginationPreText: function formatSRPaginationPreText() {
2974 return 'previous page';
2975 },
2976 formatSRPaginationPageText: function formatSRPaginationPageText(page) {
2977 return "to page ".concat(page);
2978 },
2979 formatSRPaginationNextText: function formatSRPaginationNextText() {
2980 return 'next page';
2981 },
2982 formatDetailPagination: function formatDetailPagination(totalRows) {
2983 return "Showing ".concat(totalRows, " rows");
2984 },
2985 formatSearch: function formatSearch() {
2986 return 'Search';
2987 },
2988 formatClearSearch: function formatClearSearch() {
2989 return 'Clear Search';
2990 },
2991 formatNoMatches: function formatNoMatches() {
2992 return 'No matching records found';
2993 },
2994 formatPaginationSwitch: function formatPaginationSwitch() {
2995 return 'Hide/Show pagination';
2996 },
2997 formatPaginationSwitchDown: function formatPaginationSwitchDown() {
2998 return 'Show pagination';
2999 },
3000 formatPaginationSwitchUp: function formatPaginationSwitchUp() {
3001 return 'Hide pagination';
3002 },
3003 formatRefresh: function formatRefresh() {
3004 return 'Refresh';
3005 },
3006 formatToggle: function formatToggle() {
3007 return 'Toggle';
3008 },
3009 formatToggleOn: function formatToggleOn() {
3010 return 'Show card view';
3011 },
3012 formatToggleOff: function formatToggleOff() {
3013 return 'Hide card view';
3014 },
3015 formatColumns: function formatColumns() {
3016 return 'Columns';
3017 },
3018 formatColumnsToggleAll: function formatColumnsToggleAll() {
3019 return 'Toggle all';
3020 },
3021 formatFullscreen: function formatFullscreen() {
3022 return 'Fullscreen';
3023 },
3024 formatAllRows: function formatAllRows() {
3025 return 'All';
3026 }
3027 };
3028 var COLUMN_DEFAULTS = {
3029 field: undefined,
3030 title: undefined,
3031 titleTooltip: undefined,
3032 'class': undefined,
3033 width: undefined,
3034 widthUnit: 'px',
3035 rowspan: undefined,
3036 colspan: undefined,
3037 align: undefined,
3038 // left, right, center
3039 halign: undefined,
3040 // left, right, center
3041 falign: undefined,
3042 // left, right, center
3043 valign: undefined,
3044 // top, middle, bottom
3045 cellStyle: undefined,
3046 radio: false,
3047 checkbox: false,
3048 checkboxEnabled: true,
3049 clickToSelect: true,
3050 showSelectTitle: false,
3051 sortable: false,
3052 sortName: undefined,
3053 order: 'asc',
3054 // asc, desc
3055 sorter: undefined,
3056 visible: true,
3057 switchable: true,
3058 cardVisible: true,
3059 searchable: true,
3060 formatter: undefined,
3061 footerFormatter: undefined,
3062 detailFormatter: undefined,
3063 searchFormatter: true,
3064 escape: false,
3065 events: undefined
3066 };
3067 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'];
3068 var EVENTS = {
3069 'all.bs.table': 'onAll',
3070 'click-row.bs.table': 'onClickRow',
3071 'dbl-click-row.bs.table': 'onDblClickRow',
3072 'click-cell.bs.table': 'onClickCell',
3073 'dbl-click-cell.bs.table': 'onDblClickCell',
3074 'sort.bs.table': 'onSort',
3075 'check.bs.table': 'onCheck',
3076 'uncheck.bs.table': 'onUncheck',
3077 'check-all.bs.table': 'onCheckAll',
3078 'uncheck-all.bs.table': 'onUncheckAll',
3079 'check-some.bs.table': 'onCheckSome',
3080 'uncheck-some.bs.table': 'onUncheckSome',
3081 'load-success.bs.table': 'onLoadSuccess',
3082 'load-error.bs.table': 'onLoadError',
3083 'column-switch.bs.table': 'onColumnSwitch',
3084 'page-change.bs.table': 'onPageChange',
3085 'search.bs.table': 'onSearch',
3086 'toggle.bs.table': 'onToggle',
3087 'pre-body.bs.table': 'onPreBody',
3088 'post-body.bs.table': 'onPostBody',
3089 'post-header.bs.table': 'onPostHeader',
3090 'post-footer.bs.table': 'onPostFooter',
3091 'expand-row.bs.table': 'onExpandRow',
3092 'collapse-row.bs.table': 'onCollapseRow',
3093 'refresh-options.bs.table': 'onRefreshOptions',
3094 'reset-view.bs.table': 'onResetView',
3095 'refresh.bs.table': 'onRefresh',
3096 'scroll-body.bs.table': 'onScrollBody'
3097 };
3098 Object.assign(DEFAULTS, EN);
3099 var Constants = {
3100 VERSION: VERSION,
3101 THEME: "bootstrap".concat(bootstrapVersion),
3102 CONSTANTS: CONSTANTS,
3103 DEFAULTS: DEFAULTS,
3104 COLUMN_DEFAULTS: COLUMN_DEFAULTS,
3105 METHODS: METHODS,
3106 EVENTS: EVENTS,
3107 LOCALES: {
3108 en: EN,
3109 'en-US': EN
3110 }
3111 };
3112
3113 // `FlattenIntoArray` abstract operation
3114 // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
3115 var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
3116 var targetIndex = start;
3117 var sourceIndex = 0;
3118 var mapFn = mapper ? bindContext(mapper, thisArg, 3) : false;
3119 var element;
3120
3121 while (sourceIndex < sourceLen) {
3122 if (sourceIndex in source) {
3123 element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
3124
3125 if (depth > 0 && isArray(element)) {
3126 targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
3127 } else {
3128 if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
3129 target[targetIndex] = element;
3130 }
3131
3132 targetIndex++;
3133 }
3134 sourceIndex++;
3135 }
3136 return targetIndex;
3137 };
3138
3139 var flattenIntoArray_1 = flattenIntoArray;
3140
3141 // `Array.prototype.flat` method
3142 // https://github.com/tc39/proposal-flatMap
3143 _export({ target: 'Array', proto: true }, {
3144 flat: function flat(/* depthArg = 1 */) {
3145 var depthArg = arguments.length ? arguments[0] : undefined;
3146 var O = toObject(this);
3147 var sourceLen = toLength(O.length);
3148 var A = arraySpeciesCreate(O, 0);
3149 A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
3150 return A;
3151 }
3152 });
3153
3154 // this method was added to unscopables after implementation
3155 // in popular engines, so it's moved to a separate module
3156
3157
3158 addToUnscopables('flat');
3159
3160 var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
3161
3162 // `Object.keys` method
3163 // https://tc39.github.io/ecma262/#sec-object.keys
3164 _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
3165 keys: function keys(it) {
3166 return objectKeys(toObject(it));
3167 }
3168 });
3169
3170 var Utils = {
3171 // it only does '%s', and return '' when arguments are undefined
3172 sprintf: function sprintf(_str) {
3173 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3174 args[_key - 1] = arguments[_key];
3175 }
3176
3177 var flag = true;
3178 var i = 0;
3179
3180 var str = _str.replace(/%s/g, function () {
3181 var arg = args[i++];
3182
3183 if (typeof arg === 'undefined') {
3184 flag = false;
3185 return '';
3186 }
3187
3188 return arg;
3189 });
3190
3191 return flag ? str : '';
3192 },
3193 isEmptyObject: function isEmptyObject() {
3194 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3195 return Object.entries(obj).length === 0 && obj.constructor === Object;
3196 },
3197 isNumeric: function isNumeric(n) {
3198 return !isNaN(parseFloat(n)) && isFinite(n);
3199 },
3200 getFieldTitle: function getFieldTitle(list, value) {
3201 var _iteratorNormalCompletion = true;
3202 var _didIteratorError = false;
3203 var _iteratorError = undefined;
3204
3205 try {
3206 for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3207 var item = _step.value;
3208
3209 if (item.field === value) {
3210 return item.title;
3211 }
3212 }
3213 } catch (err) {
3214 _didIteratorError = true;
3215 _iteratorError = err;
3216 } finally {
3217 try {
3218 if (!_iteratorNormalCompletion && _iterator.return != null) {
3219 _iterator.return();
3220 }
3221 } finally {
3222 if (_didIteratorError) {
3223 throw _iteratorError;
3224 }
3225 }
3226 }
3227
3228 return '';
3229 },
3230 setFieldIndex: function setFieldIndex(columns) {
3231 var totalCol = 0;
3232 var flag = [];
3233 var _iteratorNormalCompletion2 = true;
3234 var _didIteratorError2 = false;
3235 var _iteratorError2 = undefined;
3236
3237 try {
3238 for (var _iterator2 = columns[0][Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
3239 var column = _step2.value;
3240 totalCol += column.colspan || 1;
3241 }
3242 } catch (err) {
3243 _didIteratorError2 = true;
3244 _iteratorError2 = err;
3245 } finally {
3246 try {
3247 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
3248 _iterator2.return();
3249 }
3250 } finally {
3251 if (_didIteratorError2) {
3252 throw _iteratorError2;
3253 }
3254 }
3255 }
3256
3257 for (var i = 0; i < columns.length; i++) {
3258 flag[i] = [];
3259
3260 for (var j = 0; j < totalCol; j++) {
3261 flag[i][j] = false;
3262 }
3263 }
3264
3265 for (var _i = 0; _i < columns.length; _i++) {
3266 var _iteratorNormalCompletion3 = true;
3267 var _didIteratorError3 = false;
3268 var _iteratorError3 = undefined;
3269
3270 try {
3271 for (var _iterator3 = columns[_i][Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
3272 var r = _step3.value;
3273 var rowspan = r.rowspan || 1;
3274 var colspan = r.colspan || 1;
3275
3276 var index = flag[_i].indexOf(false);
3277
3278 r.colspanIndex = index;
3279
3280 if (colspan === 1) {
3281 r.fieldIndex = index; // when field is undefined, use index instead
3282
3283 if (typeof r.field === 'undefined') {
3284 r.field = index;
3285 }
3286 } else {
3287 r.colspanGroup = r.colspan;
3288 }
3289
3290 for (var k = 0; k < rowspan; k++) {
3291 flag[_i + k][index] = true;
3292 }
3293
3294 for (var _k = 0; _k < colspan; _k++) {
3295 flag[_i][index + _k] = true;
3296 }
3297 }
3298 } catch (err) {
3299 _didIteratorError3 = true;
3300 _iteratorError3 = err;
3301 } finally {
3302 try {
3303 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
3304 _iterator3.return();
3305 }
3306 } finally {
3307 if (_didIteratorError3) {
3308 throw _iteratorError3;
3309 }
3310 }
3311 }
3312 }
3313 },
3314 updateFieldGroup: function updateFieldGroup(columns) {
3315 var allColumns = columns.flat();
3316 var _iteratorNormalCompletion4 = true;
3317 var _didIteratorError4 = false;
3318 var _iteratorError4 = undefined;
3319
3320 try {
3321 for (var _iterator4 = columns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
3322 var c = _step4.value;
3323 var _iteratorNormalCompletion5 = true;
3324 var _didIteratorError5 = false;
3325 var _iteratorError5 = undefined;
3326
3327 try {
3328 for (var _iterator5 = c[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
3329 var r = _step5.value;
3330
3331 if (r.colspanGroup > 1) {
3332 var colspan = 0;
3333
3334 var _loop = function _loop(i) {
3335 var column = allColumns.find(function (col) {
3336 return col.fieldIndex === i;
3337 });
3338
3339 if (column.visible) {
3340 colspan++;
3341 }
3342 };
3343
3344 for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
3345 _loop(i);
3346 }
3347
3348 r.colspan = colspan;
3349 r.visible = colspan > 0;
3350 }
3351 }
3352 } catch (err) {
3353 _didIteratorError5 = true;
3354 _iteratorError5 = err;
3355 } finally {
3356 try {
3357 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
3358 _iterator5.return();
3359 }
3360 } finally {
3361 if (_didIteratorError5) {
3362 throw _iteratorError5;
3363 }
3364 }
3365 }
3366 }
3367 } catch (err) {
3368 _didIteratorError4 = true;
3369 _iteratorError4 = err;
3370 } finally {
3371 try {
3372 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
3373 _iterator4.return();
3374 }
3375 } finally {
3376 if (_didIteratorError4) {
3377 throw _iteratorError4;
3378 }
3379 }
3380 }
3381 },
3382 getScrollBarWidth: function getScrollBarWidth() {
3383 if (this.cachedWidth === undefined) {
3384 var $inner = $('<div/>').addClass('fixed-table-scroll-inner');
3385 var $outer = $('<div/>').addClass('fixed-table-scroll-outer');
3386 $outer.append($inner);
3387 $('body').append($outer);
3388 var w1 = $inner[0].offsetWidth;
3389 $outer.css('overflow', 'scroll');
3390 var w2 = $inner[0].offsetWidth;
3391
3392 if (w1 === w2) {
3393 w2 = $outer[0].clientWidth;
3394 }
3395
3396 $outer.remove();
3397 this.cachedWidth = w1 - w2;
3398 }
3399
3400 return this.cachedWidth;
3401 },
3402 calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
3403 var func = name;
3404
3405 if (typeof name === 'string') {
3406 // support obj.func1.func2
3407 var names = name.split('.');
3408
3409 if (names.length > 1) {
3410 func = window;
3411 var _iteratorNormalCompletion6 = true;
3412 var _didIteratorError6 = false;
3413 var _iteratorError6 = undefined;
3414
3415 try {
3416 for (var _iterator6 = names[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
3417 var f = _step6.value;
3418 func = func[f];
3419 }
3420 } catch (err) {
3421 _didIteratorError6 = true;
3422 _iteratorError6 = err;
3423 } finally {
3424 try {
3425 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
3426 _iterator6.return();
3427 }
3428 } finally {
3429 if (_didIteratorError6) {
3430 throw _iteratorError6;
3431 }
3432 }
3433 }
3434 } else {
3435 func = window[name];
3436 }
3437 }
3438
3439 if (func !== null && _typeof(func) === 'object') {
3440 return func;
3441 }
3442
3443 if (typeof func === 'function') {
3444 return func.apply(self, args || []);
3445 }
3446
3447 if (!func && typeof name === 'string' && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
3448 return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
3449 }
3450
3451 return defaultValue;
3452 },
3453 compareObjects: function compareObjects(objectA, objectB, compareLength) {
3454 var aKeys = Object.keys(objectA);
3455 var bKeys = Object.keys(objectB);
3456
3457 if (compareLength && aKeys.length !== bKeys.length) {
3458 return false;
3459 }
3460
3461 for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
3462 var key = _aKeys[_i2];
3463
3464 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
3465 return false;
3466 }
3467 }
3468
3469 return true;
3470 },
3471 escapeHTML: function escapeHTML(text) {
3472 if (typeof text === 'string') {
3473 return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/`/g, '&#x60;');
3474 }
3475
3476 return text;
3477 },
3478 getRealDataAttr: function getRealDataAttr(dataAttr) {
3479 for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
3480 var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
3481 attr = _Object$entries$_i[0],
3482 value = _Object$entries$_i[1];
3483
3484 var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
3485
3486 if (auxAttr !== attr) {
3487 dataAttr[auxAttr] = value;
3488 delete dataAttr[attr];
3489 }
3490 }
3491
3492 return dataAttr;
3493 },
3494 getItemField: function getItemField(item, field, escape) {
3495 var value = item;
3496
3497 if (typeof field !== 'string' || item.hasOwnProperty(field)) {
3498 return escape ? this.escapeHTML(item[field]) : item[field];
3499 }
3500
3501 var props = field.split('.');
3502 var _iteratorNormalCompletion7 = true;
3503 var _didIteratorError7 = false;
3504 var _iteratorError7 = undefined;
3505
3506 try {
3507 for (var _iterator7 = props[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
3508 var p = _step7.value;
3509 value = value && value[p];
3510 }
3511 } catch (err) {
3512 _didIteratorError7 = true;
3513 _iteratorError7 = err;
3514 } finally {
3515 try {
3516 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
3517 _iterator7.return();
3518 }
3519 } finally {
3520 if (_didIteratorError7) {
3521 throw _iteratorError7;
3522 }
3523 }
3524 }
3525
3526 return escape ? this.escapeHTML(value) : value;
3527 },
3528 isIEBrowser: function isIEBrowser() {
3529 return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
3530 },
3531 findIndex: function findIndex(items, item) {
3532 var _iteratorNormalCompletion8 = true;
3533 var _didIteratorError8 = false;
3534 var _iteratorError8 = undefined;
3535
3536 try {
3537 for (var _iterator8 = items[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
3538 var it = _step8.value;
3539
3540 if (JSON.stringify(it) === JSON.stringify(item)) {
3541 return items.indexOf(it);
3542 }
3543 }
3544 } catch (err) {
3545 _didIteratorError8 = true;
3546 _iteratorError8 = err;
3547 } finally {
3548 try {
3549 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
3550 _iterator8.return();
3551 }
3552 } finally {
3553 if (_didIteratorError8) {
3554 throw _iteratorError8;
3555 }
3556 }
3557 }
3558
3559 return -1;
3560 },
3561 trToData: function trToData(columns, $els) {
3562 var _this = this;
3563
3564 var data = [];
3565 var m = [];
3566 $els.each(function (y, el) {
3567 var row = {}; // save tr's id, class and data-* attributes
3568
3569 row._id = $(el).attr('id');
3570 row._class = $(el).attr('class');
3571 row._data = _this.getRealDataAttr($(el).data());
3572 $(el).find('>td,>th').each(function (_x, el) {
3573 var cspan = +$(el).attr('colspan') || 1;
3574 var rspan = +$(el).attr('rowspan') || 1;
3575 var x = _x; // skip already occupied cells in current row
3576
3577 for (; m[y] && m[y][x]; x++) {} // ignore
3578 // mark matrix elements occupied by current cell with true
3579
3580
3581 for (var tx = x; tx < x + cspan; tx++) {
3582 for (var ty = y; ty < y + rspan; ty++) {
3583 if (!m[ty]) {
3584 // fill missing rows
3585 m[ty] = [];
3586 }
3587
3588 m[ty][tx] = true;
3589 }
3590 }
3591
3592 var field = columns[x].field;
3593 row[field] = $(el).html().trim(); // save td's id, class and data-* attributes
3594
3595 row["_".concat(field, "_id")] = $(el).attr('id');
3596 row["_".concat(field, "_class")] = $(el).attr('class');
3597 row["_".concat(field, "_rowspan")] = $(el).attr('rowspan');
3598 row["_".concat(field, "_colspan")] = $(el).attr('colspan');
3599 row["_".concat(field, "_title")] = $(el).attr('title');
3600 row["_".concat(field, "_data")] = _this.getRealDataAttr($(el).data());
3601 });
3602 data.push(row);
3603 });
3604 return data;
3605 },
3606 sort: function sort(a, b, order, sortStable) {
3607 if (a === undefined || a === null) {
3608 a = '';
3609 }
3610
3611 if (b === undefined || b === null) {
3612 b = '';
3613 }
3614
3615 if (sortStable && a === b) {
3616 a = a._position;
3617 b = b._position;
3618 } // If both values are numeric, do a numeric comparison
3619
3620
3621 if (this.isNumeric(a) && this.isNumeric(b)) {
3622 // Convert numerical values form string to float.
3623 a = parseFloat(a);
3624 b = parseFloat(b);
3625
3626 if (a < b) {
3627 return order * -1;
3628 }
3629
3630 if (a > b) {
3631 return order;
3632 }
3633
3634 return 0;
3635 }
3636
3637 if (a === b) {
3638 return 0;
3639 } // If value is not a string, convert to string
3640
3641
3642 if (typeof a !== 'string') {
3643 a = a.toString();
3644 }
3645
3646 if (a.localeCompare(b) === -1) {
3647 return order * -1;
3648 }
3649
3650 return order;
3651 }
3652 };
3653
3654 var BLOCK_ROWS = 50;
3655 var CLUSTER_BLOCKS = 4;
3656
3657 var VirtualScroll =
3658 /*#__PURE__*/
3659 function () {
3660 function VirtualScroll(options) {
3661 var _this = this;
3662
3663 _classCallCheck(this, VirtualScroll);
3664
3665 this.rows = options.rows;
3666 this.scrollEl = options.scrollEl;
3667 this.contentEl = options.contentEl;
3668 this.callback = options.callback;
3669 this.itemHeight = options.itemHeight;
3670 this.cache = {};
3671 this.scrollTop = this.scrollEl.scrollTop;
3672 this.initDOM(this.rows, options.fixedScroll);
3673 this.scrollEl.scrollTop = this.scrollTop;
3674 this.lastCluster = 0;
3675
3676 var onScroll = function onScroll() {
3677 if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
3678 _this.initDOM(_this.rows);
3679
3680 _this.callback();
3681 }
3682 };
3683
3684 this.scrollEl.addEventListener('scroll', onScroll, false);
3685
3686 this.destroy = function () {
3687 _this.contentEl.innerHtml = '';
3688
3689 _this.scrollEl.removeEventListener('scroll', onScroll, false);
3690 };
3691 }
3692
3693 _createClass(VirtualScroll, [{
3694 key: "initDOM",
3695 value: function initDOM(rows, fixedScroll) {
3696 if (typeof this.clusterHeight === 'undefined') {
3697 this.cache.scrollTop = this.scrollEl.scrollTop;
3698 this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
3699 this.getRowsHeight(rows);
3700 }
3701
3702 var data = this.initData(rows, this.getNum(fixedScroll));
3703 var thisRows = data.rows.join('');
3704 var dataChanged = this.checkChanges('data', thisRows);
3705 var topOffsetChanged = this.checkChanges('top', data.topOffset);
3706 var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
3707 var html = [];
3708
3709 if (dataChanged && topOffsetChanged) {
3710 if (data.topOffset) {
3711 html.push(this.getExtra('top', data.topOffset));
3712 }
3713
3714 html.push(thisRows);
3715
3716 if (data.bottomOffset) {
3717 html.push(this.getExtra('bottom', data.bottomOffset));
3718 }
3719
3720 this.contentEl.innerHTML = html.join('');
3721
3722 if (fixedScroll) {
3723 this.contentEl.scrollTop = this.cache.scrollTop;
3724 }
3725 } else if (bottomOffsetChanged) {
3726 this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
3727 }
3728 }
3729 }, {
3730 key: "getRowsHeight",
3731 value: function getRowsHeight() {
3732 if (typeof this.itemHeight === 'undefined') {
3733 var nodes = this.contentEl.children;
3734 var node = nodes[Math.floor(nodes.length / 2)];
3735 this.itemHeight = node.offsetHeight;
3736 }
3737
3738 this.blockHeight = this.itemHeight * BLOCK_ROWS;
3739 this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
3740 this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
3741 }
3742 }, {
3743 key: "getNum",
3744 value: function getNum(fixedScroll) {
3745 this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
3746 return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
3747 }
3748 }, {
3749 key: "initData",
3750 value: function initData(rows, num) {
3751 if (rows.length < BLOCK_ROWS) {
3752 return {
3753 topOffset: 0,
3754 bottomOffset: 0,
3755 rowsAbove: 0,
3756 rows: rows
3757 };
3758 }
3759
3760 var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
3761 var end = start + this.clusterRows;
3762 var topOffset = Math.max(start * this.itemHeight, 0);
3763 var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
3764 var thisRows = [];
3765 var rowsAbove = start;
3766
3767 if (topOffset < 1) {
3768 rowsAbove++;
3769 }
3770
3771 for (var i = start; i < end; i++) {
3772 rows[i] && thisRows.push(rows[i]);
3773 }
3774
3775 return {
3776 topOffset: topOffset,
3777 bottomOffset: bottomOffset,
3778 rowsAbove: rowsAbove,
3779 rows: thisRows
3780 };
3781 }
3782 }, {
3783 key: "checkChanges",
3784 value: function checkChanges(type, value) {
3785 var changed = value !== this.cache[type];
3786 this.cache[type] = value;
3787 return changed;
3788 }
3789 }, {
3790 key: "getExtra",
3791 value: function getExtra(className, height) {
3792 var tag = document.createElement('tr');
3793 tag.className = "virtual-scroll-".concat(className);
3794
3795 if (height) {
3796 tag.style.height = "".concat(height, "px");
3797 }
3798
3799 return tag.outerHTML;
3800 }
3801 }]);
3802
3803 return VirtualScroll;
3804 }();
3805
3806 var BootstrapTable =
3807 /*#__PURE__*/
3808 function () {
3809 function BootstrapTable(el, options) {
3810 _classCallCheck(this, BootstrapTable);
3811
3812 this.options = options;
3813 this.$el = $(el);
3814 this.$el_ = this.$el.clone();
3815 this.timeoutId_ = 0;
3816 this.timeoutFooter_ = 0;
3817 this.init();
3818 }
3819
3820 _createClass(BootstrapTable, [{
3821 key: "init",
3822 value: function init() {
3823 this.initConstants();
3824 this.initLocale();
3825 this.initContainer();
3826 this.initTable();
3827 this.initHeader();
3828 this.initData();
3829 this.initHiddenRows();
3830 this.initToolbar();
3831 this.initPagination();
3832 this.initBody();
3833 this.initSearchText();
3834 this.initServer();
3835 }
3836 }, {
3837 key: "initConstants",
3838 value: function initConstants() {
3839 var o = this.options;
3840 this.constants = Constants.CONSTANTS;
3841 this.constants.theme = $.fn.bootstrapTable.theme;
3842 var buttonsPrefix = o.buttonsPrefix ? "".concat(o.buttonsPrefix, "-") : '';
3843 this.constants.buttonsClass = [o.buttonsPrefix, buttonsPrefix + o.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), o.iconSize)].join(' ').trim();
3844 }
3845 }, {
3846 key: "initLocale",
3847 value: function initLocale() {
3848 if (this.options.locale) {
3849 var locales = $.fn.bootstrapTable.locales;
3850 var parts = this.options.locale.split(/-|_/);
3851 parts[0] = parts[0].toLowerCase();
3852
3853 if (parts[1]) {
3854 parts[1] = parts[1].toUpperCase();
3855 }
3856
3857 if (locales[this.options.locale]) {
3858 $.extend(this.options, locales[this.options.locale]);
3859 } else if (locales[parts.join('-')]) {
3860 $.extend(this.options, locales[parts.join('-')]);
3861 } else if (locales[parts[0]]) {
3862 $.extend(this.options, locales[parts[0]]);
3863 }
3864 }
3865 }
3866 }, {
3867 key: "initContainer",
3868 value: function initContainer() {
3869 var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
3870 var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
3871 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 "));
3872 this.$container.insertAfter(this.$el);
3873 this.$tableContainer = this.$container.find('.fixed-table-container');
3874 this.$tableHeader = this.$container.find('.fixed-table-header');
3875 this.$tableBody = this.$container.find('.fixed-table-body');
3876 this.$tableLoading = this.$container.find('.fixed-table-loading');
3877 this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
3878
3879 if (this.options.buttonsToolbar) {
3880 this.$toolbar = $('body').find(this.options.buttonsToolbar);
3881 } else {
3882 this.$toolbar = this.$container.find('.fixed-table-toolbar');
3883 }
3884
3885 this.$pagination = this.$container.find('.fixed-table-pagination');
3886 this.$tableBody.append(this.$el);
3887 this.$container.after('<div class="clearfix"></div>');
3888 this.$el.addClass(this.options.classes);
3889 this.$tableLoading.addClass(this.options.classes);
3890
3891 if (this.options.height) {
3892 this.$tableContainer.addClass('fixed-height');
3893
3894 if (this.options.showFooter) {
3895 this.$tableContainer.addClass('has-footer');
3896 }
3897
3898 if (this.options.classes.split(' ').includes('table-bordered')) {
3899 this.$tableBody.append('<div class="fixed-table-border"></div>');
3900 this.$tableBorder = this.$tableBody.find('.fixed-table-border');
3901 this.$tableLoading.addClass('fixed-table-border');
3902 }
3903
3904 this.$tableFooter = this.$container.find('.fixed-table-footer');
3905 } else {
3906 if (!this.$tableFooter.length) {
3907 this.$el.append('<tfoot><tr></tr></tfoot>');
3908 this.$tableFooter = this.$el.find('tfoot');
3909 }
3910 }
3911 }
3912 }, {
3913 key: "initTable",
3914 value: function initTable() {
3915 var _this = this;
3916
3917 var columns = [];
3918 var data = [];
3919 this.$header = this.$el.find('>thead');
3920
3921 if (!this.$header.length) {
3922 this.$header = $("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
3923 } else if (this.options.theadClasses) {
3924 this.$header.addClass(this.options.theadClasses);
3925 }
3926
3927 this.$header.find('tr').each(function (i, el) {
3928 var column = [];
3929 $(el).find('th').each(function (i, el) {
3930 // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
3931 if (typeof $(el).data('field') !== 'undefined') {
3932 $(el).data('field', "".concat($(el).data('field')));
3933 }
3934
3935 column.push($.extend({}, {
3936 title: $(el).html(),
3937 'class': $(el).attr('class'),
3938 titleTooltip: $(el).attr('title'),
3939 rowspan: $(el).attr('rowspan') ? +$(el).attr('rowspan') : undefined,
3940 colspan: $(el).attr('colspan') ? +$(el).attr('colspan') : undefined
3941 }, $(el).data()));
3942 });
3943 columns.push(column);
3944 });
3945
3946 if (!Array.isArray(this.options.columns[0])) {
3947 this.options.columns = [this.options.columns];
3948 }
3949
3950 this.options.columns = $.extend(true, [], columns, this.options.columns);
3951 this.columns = [];
3952 this.fieldsColumnsIndex = [];
3953 Utils.setFieldIndex(this.options.columns);
3954 this.options.columns.forEach(function (columns, i) {
3955 columns.forEach(function (_column, j) {
3956 var column = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
3957
3958 if (typeof column.fieldIndex !== 'undefined') {
3959 _this.columns[column.fieldIndex] = column;
3960 _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
3961 }
3962
3963 _this.options.columns[i][j] = column;
3964 });
3965 }); // if options.data is setting, do not process tbody and tfoot data
3966
3967 if (!this.options.data.length) {
3968 this.options.data = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
3969
3970 if (data.length) {
3971 this.fromHtml = true;
3972 }
3973 }
3974
3975 this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
3976
3977 if (this.footerData) {
3978 this.$el.find('tfoot').html('<tr></tr>');
3979 }
3980
3981 if (!this.options.showFooter || this.options.cardView) {
3982 this.$tableFooter.hide();
3983 } else {
3984 this.$tableFooter.show();
3985 }
3986 }
3987 }, {
3988 key: "initHeader",
3989 value: function initHeader() {
3990 var _this2 = this;
3991
3992 var visibleColumns = {};
3993 var html = [];
3994 this.header = {
3995 fields: [],
3996 styles: [],
3997 classes: [],
3998 formatters: [],
3999 detailFormatters: [],
4000 events: [],
4001 sorters: [],
4002 sortNames: [],
4003 cellStyles: [],
4004 searchables: []
4005 };
4006 Utils.updateFieldGroup(this.options.columns);
4007 this.options.columns.forEach(function (columns, i) {
4008 html.push('<tr>');
4009
4010 if (i === 0 && !_this2.options.cardView && _this2.options.detailView && _this2.options.detailViewIcon) {
4011 html.push("<th class=\"detail\" rowspan=\"".concat(_this2.options.columns.length, "\">\n <div class=\"fht-cell\"></div>\n </th>\n "));
4012 }
4013
4014 columns.forEach(function (column, j) {
4015 var class_ = Utils.sprintf(' class="%s"', column['class']);
4016 var unitWidth = column.widthUnit;
4017 var width = parseFloat(column.width);
4018 var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
4019 var align = Utils.sprintf('text-align: %s; ', column.align);
4020 var style = Utils.sprintf('vertical-align: %s; ', column.valign);
4021 style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
4022
4023 if (typeof column.fieldIndex === 'undefined' && !column.visible) {
4024 return;
4025 }
4026
4027 if (typeof column.fieldIndex !== 'undefined') {
4028 _this2.header.fields[column.fieldIndex] = column.field;
4029 _this2.header.styles[column.fieldIndex] = align + style;
4030 _this2.header.classes[column.fieldIndex] = class_;
4031 _this2.header.formatters[column.fieldIndex] = column.formatter;
4032 _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
4033 _this2.header.events[column.fieldIndex] = column.events;
4034 _this2.header.sorters[column.fieldIndex] = column.sorter;
4035 _this2.header.sortNames[column.fieldIndex] = column.sortName;
4036 _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
4037 _this2.header.searchables[column.fieldIndex] = column.searchable;
4038
4039 if (!column.visible) {
4040 return;
4041 }
4042
4043 if (_this2.options.cardView && !column.cardVisible) {
4044 return;
4045 }
4046
4047 visibleColumns[column.field] = column;
4048 }
4049
4050 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.
4051 j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
4052 html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
4053 var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
4054 var title = text;
4055
4056 if (column.checkbox) {
4057 text = '';
4058
4059 if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
4060 text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
4061 }
4062
4063 _this2.header.stateField = column.field;
4064 }
4065
4066 if (column.radio) {
4067 text = '';
4068 _this2.header.stateField = column.field;
4069 _this2.options.singleSelect = true;
4070 }
4071
4072 if (!text && column.showSelectTitle) {
4073 text += title;
4074 }
4075
4076 html.push(text);
4077 html.push('</div>');
4078 html.push('<div class="fht-cell"></div>');
4079 html.push('</div>');
4080 html.push('</th>');
4081 });
4082 html.push('</tr>');
4083 });
4084 this.$header.html(html.join(''));
4085 this.$header.find('th[data-field]').each(function (i, el) {
4086 $(el).data(visibleColumns[$(el).data('field')]);
4087 });
4088 this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
4089 var $this = $(e.currentTarget);
4090
4091 if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
4092 if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
4093 return false;
4094 }
4095 }
4096
4097 if (_this2.options.sortable && $this.parent().data().sortable) {
4098 _this2.onSort(e);
4099 }
4100 });
4101 this.$header.children().children().off('keypress').on('keypress', function (e) {
4102 if (_this2.options.sortable && $(e.currentTarget).data().sortable) {
4103 var code = e.keyCode || e.which;
4104
4105 if (code === 13) {
4106 // Enter keycode
4107 _this2.onSort(e);
4108 }
4109 }
4110 });
4111 var resizeEvent = "resize.bootstrap-table".concat(this.$el.attr('id') || '');
4112 $(window).off(resizeEvent);
4113
4114 if (!this.options.showHeader || this.options.cardView) {
4115 this.$header.hide();
4116 this.$tableHeader.hide();
4117 this.$tableLoading.css('top', 0);
4118 } else {
4119 this.$header.show();
4120 this.$tableHeader.show();
4121 this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
4122
4123 this.getCaret();
4124 $(window).on(resizeEvent, function (e) {
4125 return _this2.resetWidth(e);
4126 });
4127 }
4128
4129 this.$selectAll = this.$header.find('[name="btSelectAll"]');
4130 this.$selectAll.off('click').on('click', function (_ref) {
4131 var currentTarget = _ref.currentTarget;
4132 var checked = $(currentTarget).prop('checked');
4133
4134 _this2[checked ? 'checkAll' : 'uncheckAll']();
4135
4136 _this2.updateSelected();
4137 });
4138 }
4139 }, {
4140 key: "initData",
4141 value: function initData(data, type) {
4142 if (type === 'append') {
4143 this.options.data = this.options.data.concat(data);
4144 } else if (type === 'prepend') {
4145 this.options.data = [].concat(data).concat(this.options.data);
4146 } else {
4147 this.options.data = data || this.options.data;
4148 }
4149
4150 this.data = this.options.data;
4151
4152 if (this.options.sidePagination === 'server') {
4153 return;
4154 }
4155
4156 this.initSort();
4157 }
4158 }, {
4159 key: "initSort",
4160 value: function initSort() {
4161 var _this3 = this;
4162
4163 var name = this.options.sortName;
4164 var order = this.options.sortOrder === 'desc' ? -1 : 1;
4165 var index = this.header.fields.indexOf(this.options.sortName);
4166 var timeoutId = 0;
4167
4168 if (index !== -1) {
4169 if (this.options.sortStable) {
4170 this.data.forEach(function (row, i) {
4171 if (!row.hasOwnProperty('_position')) {
4172 row._position = i;
4173 }
4174 });
4175 }
4176
4177 if (this.options.customSort) {
4178 Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
4179 } else {
4180 this.data.sort(function (a, b) {
4181 if (_this3.header.sortNames[index]) {
4182 name = _this3.header.sortNames[index];
4183 }
4184
4185 var aa = Utils.getItemField(a, name, _this3.options.escape);
4186 var bb = Utils.getItemField(b, name, _this3.options.escape);
4187 var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
4188
4189 if (value !== undefined) {
4190 if (_this3.options.sortStable && value === 0) {
4191 return order * (a._position - b._position);
4192 }
4193
4194 return order * value;
4195 }
4196
4197 return Utils.sort(aa, bb, order, _this3.options.sortStable);
4198 });
4199 }
4200
4201 if (this.options.sortClass !== undefined) {
4202 clearTimeout(timeoutId);
4203 timeoutId = setTimeout(function () {
4204 _this3.$el.removeClass(_this3.options.sortClass);
4205
4206 var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
4207
4208 _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
4209 }, 250);
4210 }
4211 }
4212 }
4213 }, {
4214 key: "onSort",
4215 value: function onSort(_ref2) {
4216 var type = _ref2.type,
4217 currentTarget = _ref2.currentTarget;
4218 var $this = type === 'keypress' ? $(currentTarget) : $(currentTarget).parent();
4219 var $this_ = this.$header.find('th').eq($this.index());
4220 this.$header.add(this.$header_).find('span.order').remove();
4221
4222 if (this.options.sortName === $this.data('field')) {
4223 this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
4224 } else {
4225 this.options.sortName = $this.data('field');
4226
4227 if (this.options.rememberOrder) {
4228 this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
4229 } else {
4230 this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
4231 }
4232 }
4233
4234 this.trigger('sort', this.options.sortName, this.options.sortOrder);
4235 $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
4236
4237 this.getCaret();
4238
4239 if (this.options.sidePagination === 'server') {
4240 this.options.pageNumber = 1;
4241 this.initServer(this.options.silentSort);
4242 return;
4243 }
4244
4245 this.initSort();
4246 this.initBody();
4247 }
4248 }, {
4249 key: "initToolbar",
4250 value: function initToolbar() {
4251 var _this4 = this;
4252
4253 var o = this.options;
4254 var html = [];
4255 var timeoutId = 0;
4256 var $keepOpen;
4257 var switchableCount = 0;
4258
4259 if (this.$toolbar.find('.bs-bars').children().length) {
4260 $('body').append($(o.toolbar));
4261 }
4262
4263 this.$toolbar.html('');
4264
4265 if (typeof o.toolbar === 'string' || _typeof(o.toolbar) === 'object') {
4266 $(Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, o.toolbarAlign)).appendTo(this.$toolbar).append($(o.toolbar));
4267 } // showColumns, showToggle, showRefresh
4268
4269
4270 html = ["<div class=\"".concat(['columns', "columns-".concat(o.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(o.buttonsAlign)].join(' '), "\">")];
4271
4272 if (typeof o.icons === 'string') {
4273 o.icons = Utils.calculateObjectValue(null, o.icons);
4274 }
4275
4276 if (o.showPaginationSwitch) {
4277 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>"));
4278 }
4279
4280 if (o.showRefresh) {
4281 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>"));
4282 }
4283
4284 if (o.showToggle) {
4285 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>"));
4286 }
4287
4288 if (o.showFullscreen) {
4289 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>"));
4290 }
4291
4292 if (o.showColumns) {
4293 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]));
4294
4295 if (o.showColumnsToggleAll) {
4296 var allFieldsVisible = this.getVisibleColumns().length === this.columns.length;
4297 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())));
4298 html.push(this.constants.html.toolbarDropdownSeparator);
4299 }
4300
4301 this.columns.forEach(function (column, i) {
4302 if (column.radio || column.checkbox) {
4303 return;
4304 }
4305
4306 if (o.cardView && !column.cardVisible) {
4307 return;
4308 }
4309
4310 var checked = column.visible ? ' checked="checked"' : '';
4311
4312 if (column.switchable) {
4313 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)));
4314 switchableCount++;
4315 }
4316 });
4317 html.push(this.constants.html.toolbarDropdown[1], '</div>');
4318 }
4319
4320 html.push('</div>'); // Fix #188: this.showToolbar is for extensions
4321
4322 if (this.showToolbar || html.length > 2) {
4323 this.$toolbar.append(html.join(''));
4324 }
4325
4326 if (o.showPaginationSwitch) {
4327 this.$toolbar.find('button[name="paginationSwitch"]').off('click').on('click', function () {
4328 return _this4.togglePagination();
4329 });
4330 }
4331
4332 if (o.showFullscreen) {
4333 this.$toolbar.find('button[name="fullscreen"]').off('click').on('click', function () {
4334 return _this4.toggleFullscreen();
4335 });
4336 }
4337
4338 if (o.showRefresh) {
4339 this.$toolbar.find('button[name="refresh"]').off('click').on('click', function () {
4340 return _this4.refresh();
4341 });
4342 }
4343
4344 if (o.showToggle) {
4345 this.$toolbar.find('button[name="toggle"]').off('click').on('click', function () {
4346 _this4.toggleView();
4347 });
4348 }
4349
4350 if (o.showColumns) {
4351 $keepOpen = this.$toolbar.find('.keep-open');
4352 var $checkboxes = $keepOpen.find('input:not(".toggle-all")');
4353 var $toggleAll = $keepOpen.find('input.toggle-all');
4354
4355 if (switchableCount <= o.minimumCountColumns) {
4356 $keepOpen.find('input').prop('disabled', true);
4357 }
4358
4359 $keepOpen.find('li, label').off('click').on('click', function (e) {
4360 e.stopImmediatePropagation();
4361 });
4362 $checkboxes.off('click').on('click', function (_ref3) {
4363 var currentTarget = _ref3.currentTarget;
4364 var $this = $(currentTarget);
4365
4366 _this4._toggleColumn($this.val(), $this.prop('checked'), false);
4367
4368 _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
4369
4370 $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.length);
4371 });
4372 $toggleAll.off('click').on('click', function (_ref4) {
4373 var currentTarget = _ref4.currentTarget;
4374
4375 _this4._toggleAllColumns($(currentTarget).prop('checked'));
4376 });
4377 } // Fix #4516: this.showSearchClearButton is for extensions
4378
4379
4380 if (o.search || this.showSearchClearButton) {
4381 html = [];
4382 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() : '');
4383 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() : '');
4384 var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, o.iconSize), "\n search-input\" type=\"text\" placeholder=\"").concat(o.formatSearch(), "\">");
4385 var searchInputFinalHtml = searchInputHtml;
4386
4387 if (o.showSearchButton || o.showSearchClearButton) {
4388 var buttonsHtml = (o.showSearchButton ? showSearchButton : '') + (o.showSearchClearButton ? showSearchClearButton : '');
4389 searchInputFinalHtml = o.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, buttonsHtml) : buttonsHtml;
4390 }
4391
4392 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));
4393 this.$toolbar.append(html.join(''));
4394 var $searchInput = this.$toolbar.find('.search input');
4395
4396 var handleInputEvent = function handleInputEvent() {
4397 var eventTriggers = Utils.isIEBrowser() ? 'mouseup' : 'keyup drop blur';
4398 $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
4399 if (o.searchOnEnterKey && event.keyCode !== 13) {
4400 return;
4401 }
4402
4403 if ([37, 38, 39, 40].includes(event.keyCode)) {
4404 return;
4405 }
4406
4407 clearTimeout(timeoutId); // doesn't matter if it's 0
4408
4409 timeoutId = setTimeout(function () {
4410 _this4.onSearch(event);
4411 }, o.searchTimeOut);
4412 });
4413 };
4414
4415 if (o.showSearchButton) {
4416 this.$toolbar.find('.search button[name=search]').off('click').on('click', function (event) {
4417 clearTimeout(timeoutId); // doesn't matter if it's 0
4418
4419 timeoutId = setTimeout(function () {
4420 _this4.onSearch({
4421 currentTarget: $searchInput
4422 });
4423 }, o.searchTimeOut);
4424 });
4425
4426 if (o.searchOnEnterKey) {
4427 handleInputEvent();
4428 }
4429 } else {
4430 handleInputEvent();
4431 }
4432
4433 if (o.showSearchClearButton) {
4434 this.$toolbar.find('.search button[name=clearSearch]').click(function () {
4435 _this4.resetSearch();
4436 });
4437 }
4438 }
4439 }
4440 }, {
4441 key: "onSearch",
4442 value: function onSearch() {
4443 var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4444 currentTarget = _ref5.currentTarget,
4445 firedByInitSearchText = _ref5.firedByInitSearchText;
4446
4447 var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4448
4449 if (currentTarget !== undefined && $(currentTarget).length && overwriteSearchText) {
4450 var text = $(currentTarget).val().trim();
4451
4452 if (this.options.trimOnSearch && $(currentTarget).val() !== text) {
4453 $(currentTarget).val(text);
4454 }
4455
4456 if (this.searchText === text) {
4457 return;
4458 }
4459
4460 if ($(currentTarget).hasClass('search-input')) {
4461 this.searchText = text;
4462 this.options.searchText = text;
4463 }
4464 }
4465
4466 if (!firedByInitSearchText) {
4467 this.options.pageNumber = 1;
4468 }
4469
4470 this.initSearch();
4471
4472 if (firedByInitSearchText) {
4473 if (this.options.sidePagination === 'client') {
4474 this.updatePagination();
4475 }
4476 } else {
4477 this.updatePagination();
4478 }
4479
4480 this.trigger('search', this.searchText);
4481 }
4482 }, {
4483 key: "initSearch",
4484 value: function initSearch() {
4485 var _this5 = this;
4486
4487 this.filterOptions = this.filterOptions || this.options.filterOptions;
4488
4489 if (this.options.sidePagination !== 'server') {
4490 if (this.options.customSearch) {
4491 this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
4492 return;
4493 }
4494
4495 var s = this.searchText && (this.options.escape ? Utils.escapeHTML(this.searchText) : this.searchText).toLowerCase();
4496 var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns; // Check filter
4497
4498 if (typeof this.filterOptions.filterAlgorithm === 'function') {
4499 this.data = this.options.data.filter(function (item, i) {
4500 return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
4501 });
4502 } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
4503 this.data = f ? this.options.data.filter(function (item, i) {
4504 var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
4505
4506 if (filterAlgorithm === 'and') {
4507 for (var key in f) {
4508 if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
4509 return false;
4510 }
4511 }
4512 } else if (filterAlgorithm === 'or') {
4513 var match = false;
4514
4515 for (var _key in f) {
4516 if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
4517 match = true;
4518 }
4519 }
4520
4521 return match;
4522 }
4523
4524 return true;
4525 }) : this.options.data;
4526 }
4527
4528 var visibleFields = this.getVisibleFields();
4529 this.data = s ? this.data.filter(function (item, i) {
4530 for (var j = 0; j < _this5.header.fields.length; j++) {
4531 if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
4532 continue;
4533 }
4534
4535 var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
4536 var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
4537 var value = void 0;
4538
4539 if (typeof key === 'string') {
4540 value = item;
4541 var props = key.split('.');
4542
4543 for (var _i = 0; _i < props.length; _i++) {
4544 if (value[props[_i]] !== null) {
4545 value = value[props[_i]];
4546 }
4547 }
4548 } else {
4549 value = item[key];
4550 } // Fix #142: respect searchFormatter boolean
4551
4552
4553 if (column && column.searchFormatter) {
4554 value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
4555 }
4556
4557 if (typeof value === 'string' || typeof value === 'number') {
4558 if (_this5.options.strictSearch) {
4559 if ("".concat(value).toLowerCase() === s) {
4560 return true;
4561 }
4562 } else {
4563 var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
4564 var matches = largerSmallerEqualsRegex.exec(s);
4565 var comparisonCheck = false;
4566
4567 if (matches) {
4568 var operator = matches[1] || "".concat(matches[5], "l");
4569 var comparisonValue = matches[2] || matches[3];
4570 var int = parseInt(value, 10);
4571 var comparisonInt = parseInt(comparisonValue, 10);
4572
4573 switch (operator) {
4574 case '>':
4575 case '<l':
4576 comparisonCheck = int > comparisonInt;
4577 break;
4578
4579 case '<':
4580 case '>l':
4581 comparisonCheck = int < comparisonInt;
4582 break;
4583
4584 case '<=':
4585 case '=<':
4586 case '>=l':
4587 case '=>l':
4588 comparisonCheck = int <= comparisonInt;
4589 break;
4590
4591 case '>=':
4592 case '=>':
4593 case '<=l':
4594 case '=<l':
4595 comparisonCheck = int >= comparisonInt;
4596 break;
4597
4598 default:
4599 break;
4600 }
4601 }
4602
4603 if (comparisonCheck || "".concat(value).toLowerCase().includes(s)) {
4604 return true;
4605 }
4606 }
4607 }
4608 }
4609
4610 return false;
4611 }) : this.data;
4612 }
4613 }
4614 }, {
4615 key: "initPagination",
4616 value: function initPagination() {
4617 var _this6 = this;
4618
4619 var o = this.options;
4620
4621 if (!o.pagination) {
4622 this.$pagination.hide();
4623 return;
4624 }
4625
4626 this.$pagination.show();
4627 var html = [];
4628 var $allSelected = false;
4629 var i;
4630 var from;
4631 var to;
4632 var $pageList;
4633 var $pre;
4634 var $next;
4635 var $number;
4636 var data = this.getData({
4637 includeHiddenRows: false
4638 });
4639 var pageList = o.pageList;
4640
4641 if (o.sidePagination !== 'server') {
4642 o.totalRows = data.length;
4643 }
4644
4645 this.totalPages = 0;
4646
4647 if (o.totalRows) {
4648 if (o.pageSize === o.formatAllRows()) {
4649 o.pageSize = o.totalRows;
4650 $allSelected = true;
4651 } else if (o.pageSize === o.totalRows) {
4652 // Fix #667 Table with pagination,
4653 // multiple pages and a search this matches to one page throws exception
4654 var pageLst = typeof o.pageList === 'string' ? o.pageList.replace('[', '').replace(']', '').replace(/ /g, '').toLowerCase().split(',') : o.pageList;
4655
4656 if (pageLst.includes(o.formatAllRows().toLowerCase())) {
4657 $allSelected = true;
4658 }
4659 }
4660
4661 this.totalPages = ~~((o.totalRows - 1) / o.pageSize) + 1;
4662 o.totalPages = this.totalPages;
4663 }
4664
4665 if (this.totalPages > 0 && o.pageNumber > this.totalPages) {
4666 o.pageNumber = this.totalPages;
4667 }
4668
4669 this.pageFrom = (o.pageNumber - 1) * o.pageSize + 1;
4670 this.pageTo = o.pageNumber * o.pageSize;
4671
4672 if (this.pageTo > o.totalRows) {
4673 this.pageTo = o.totalRows;
4674 }
4675
4676 if (this.options.pagination && this.options.sidePagination !== 'server') {
4677 this.options.totalNotFiltered = this.options.data.length;
4678 }
4679
4680 if (!this.options.showExtendedPagination) {
4681 this.options.totalNotFiltered = undefined;
4682 }
4683
4684 var paginationInfo = o.onlyInfoPagination ? o.formatDetailPagination(o.totalRows) : o.formatShowingRows(this.pageFrom, this.pageTo, o.totalRows, o.totalNotFiltered);
4685 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(o.paginationDetailHAlign, " pagination-detail\">\n <span class=\"pagination-info\">\n ").concat(paginationInfo, "\n </span>"));
4686
4687 if (!o.onlyInfoPagination) {
4688 html.push('<span class="page-list">');
4689 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])];
4690
4691 if (typeof o.pageList === 'string') {
4692 var list = o.pageList.replace('[', '').replace(']', '').replace(/ /g, '').split(',');
4693 pageList = [];
4694 var _iteratorNormalCompletion = true;
4695 var _didIteratorError = false;
4696 var _iteratorError = undefined;
4697
4698 try {
4699 for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
4700 var value = _step.value;
4701 pageList.push(value.toLowerCase() === o.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? o.formatAllRows() : +value);
4702 }
4703 } catch (err) {
4704 _didIteratorError = true;
4705 _iteratorError = err;
4706 } finally {
4707 try {
4708 if (!_iteratorNormalCompletion && _iterator.return != null) {
4709 _iterator.return();
4710 }
4711 } finally {
4712 if (_didIteratorError) {
4713 throw _iteratorError;
4714 }
4715 }
4716 }
4717 }
4718
4719 pageList.forEach(function (page, i) {
4720 if (!o.smartDisplay || i === 0 || pageList[i - 1] < o.totalRows) {
4721 var active;
4722
4723 if ($allSelected) {
4724 active = page === o.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
4725 } else {
4726 active = page === o.pageSize ? _this6.constants.classes.dropdownActive : '';
4727 }
4728
4729 pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
4730 }
4731 });
4732 pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</span>"));
4733 html.push(o.formatRecordsPerPage(pageNumber.join('')));
4734 html.push('</span></div>');
4735 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));
4736
4737 if (this.totalPages < o.paginationSuccessivelySize) {
4738 from = 1;
4739 to = this.totalPages;
4740 } else {
4741 from = o.pageNumber - o.paginationPagesBySide;
4742 to = from + o.paginationPagesBySide * 2;
4743 }
4744
4745 if (o.pageNumber < o.paginationSuccessivelySize - 1) {
4746 to = o.paginationSuccessivelySize;
4747 }
4748
4749 if (o.paginationSuccessivelySize > this.totalPages - from) {
4750 from = from - (o.paginationSuccessivelySize - (this.totalPages - from)) + 1;
4751 }
4752
4753 if (from < 1) {
4754 from = 1;
4755 }
4756
4757 if (to > this.totalPages) {
4758 to = this.totalPages;
4759 }
4760
4761 var middleSize = Math.round(o.paginationPagesBySide / 2);
4762
4763 var pageItem = function pageItem(i) {
4764 var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
4765 return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === o.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), o.formatSRPaginationPageText(i), i);
4766 };
4767
4768 if (from > 1) {
4769 var max = o.paginationPagesBySide;
4770 if (max >= from) max = from - 1;
4771
4772 for (i = 1; i <= max; i++) {
4773 html.push(pageItem(i));
4774 }
4775
4776 if (from - 1 === max + 1) {
4777 i = from - 1;
4778 html.push(pageItem(i));
4779 } else {
4780 if (from - 1 > max) {
4781 if (from - o.paginationPagesBySide * 2 > o.paginationPagesBySide && o.paginationUseIntermediate) {
4782 i = Math.round((from - middleSize) / 2 + middleSize);
4783 html.push(pageItem(i, ' page-intermediate'));
4784 } else {
4785 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
4786 }
4787 }
4788 }
4789 }
4790
4791 for (i = from; i <= to; i++) {
4792 html.push(pageItem(i));
4793 }
4794
4795 if (this.totalPages > to) {
4796 var min = this.totalPages - (o.paginationPagesBySide - 1);
4797 if (to >= min) min = to + 1;
4798
4799 if (to + 1 === min - 1) {
4800 i = to + 1;
4801 html.push(pageItem(i));
4802 } else {
4803 if (min > to + 1) {
4804 if (this.totalPages - to > o.paginationPagesBySide * 2 && o.paginationUseIntermediate) {
4805 i = Math.round((this.totalPages - middleSize - to) / 2 + to);
4806 html.push(pageItem(i, ' page-intermediate'));
4807 } else {
4808 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
4809 }
4810 }
4811 }
4812
4813 for (i = min; i <= this.totalPages; i++) {
4814 html.push(pageItem(i));
4815 }
4816 }
4817
4818 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', o.formatSRPaginationNextText(), o.paginationNextText));
4819 html.push(this.constants.html.pagination[1], '</div>');
4820 }
4821
4822 this.$pagination.html(html.join(''));
4823 var dropupClass = ['bottom', 'both'].includes(o.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
4824 this.$pagination.last().find('.page-list > span').addClass(dropupClass);
4825
4826 if (!o.onlyInfoPagination) {
4827 $pageList = this.$pagination.find('.page-list a');
4828 $pre = this.$pagination.find('.page-pre');
4829 $next = this.$pagination.find('.page-next');
4830 $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
4831
4832 if (this.totalPages <= 1) {
4833 this.$pagination.find('div.pagination').hide();
4834 }
4835
4836 if (o.smartDisplay) {
4837 if (pageList.length < 2 || o.totalRows <= pageList[0]) {
4838 this.$pagination.find('span.page-list').hide();
4839 }
4840 } // when data is empty, hide the pagination
4841
4842
4843 this.$pagination[this.getData().length ? 'show' : 'hide']();
4844
4845 if (!o.paginationLoop) {
4846 if (o.pageNumber === 1) {
4847 $pre.addClass('disabled');
4848 }
4849
4850 if (o.pageNumber === this.totalPages) {
4851 $next.addClass('disabled');
4852 }
4853 }
4854
4855 if ($allSelected) {
4856 o.pageSize = o.formatAllRows();
4857 } // removed the events for last and first, onPageNumber executeds the same logic
4858
4859
4860 $pageList.off('click').on('click', function (e) {
4861 return _this6.onPageListChange(e);
4862 });
4863 $pre.off('click').on('click', function (e) {
4864 return _this6.onPagePre(e);
4865 });
4866 $next.off('click').on('click', function (e) {
4867 return _this6.onPageNext(e);
4868 });
4869 $number.off('click').on('click', function (e) {
4870 return _this6.onPageNumber(e);
4871 });
4872 }
4873 }
4874 }, {
4875 key: "updatePagination",
4876 value: function updatePagination(event) {
4877 // Fix #171: IE disabled button can be clicked bug.
4878 if (event && $(event.currentTarget).hasClass('disabled')) {
4879 return;
4880 }
4881
4882 if (!this.options.maintainMetaData) {
4883 this.resetRows();
4884 }
4885
4886 this.initPagination();
4887
4888 if (this.options.sidePagination === 'server') {
4889 this.initServer();
4890 } else {
4891 this.initBody();
4892 }
4893
4894 this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
4895 }
4896 }, {
4897 key: "onPageListChange",
4898 value: function onPageListChange(event) {
4899 event.preventDefault();
4900 var $this = $(event.currentTarget);
4901 $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
4902 this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
4903 this.$toolbar.find('.page-size').text(this.options.pageSize);
4904 this.updatePagination(event);
4905 return false;
4906 }
4907 }, {
4908 key: "onPagePre",
4909 value: function onPagePre(event) {
4910 event.preventDefault();
4911
4912 if (this.options.pageNumber - 1 === 0) {
4913 this.options.pageNumber = this.options.totalPages;
4914 } else {
4915 this.options.pageNumber--;
4916 }
4917
4918 this.updatePagination(event);
4919 return false;
4920 }
4921 }, {
4922 key: "onPageNext",
4923 value: function onPageNext(event) {
4924 event.preventDefault();
4925
4926 if (this.options.pageNumber + 1 > this.options.totalPages) {
4927 this.options.pageNumber = 1;
4928 } else {
4929 this.options.pageNumber++;
4930 }
4931
4932 this.updatePagination(event);
4933 return false;
4934 }
4935 }, {
4936 key: "onPageNumber",
4937 value: function onPageNumber(event) {
4938 event.preventDefault();
4939
4940 if (this.options.pageNumber === +$(event.currentTarget).text()) {
4941 return;
4942 }
4943
4944 this.options.pageNumber = +$(event.currentTarget).text();
4945 this.updatePagination(event);
4946 return false;
4947 }
4948 }, {
4949 key: "initRow",
4950 value: function initRow(item, i, data, trFragments) {
4951 var _this7 = this;
4952
4953 var html = [];
4954 var style = {};
4955 var csses = [];
4956 var data_ = '';
4957 var attributes = {};
4958 var htmlAttributes = [];
4959
4960 if (Utils.findIndex(this.hiddenRows, item) > -1) {
4961 return;
4962 }
4963
4964 style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
4965
4966 if (style && style.css) {
4967 for (var _i2 = 0, _Object$entries = Object.entries(style.css); _i2 < _Object$entries.length; _i2++) {
4968 var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
4969 key = _Object$entries$_i[0],
4970 value = _Object$entries$_i[1];
4971
4972 csses.push("".concat(key, ": ").concat(value));
4973 }
4974 }
4975
4976 attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
4977
4978 if (attributes) {
4979 for (var _i3 = 0, _Object$entries2 = Object.entries(attributes); _i3 < _Object$entries2.length; _i3++) {
4980 var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2),
4981 key = _Object$entries2$_i[0],
4982 value = _Object$entries2$_i[1];
4983
4984 htmlAttributes.push("".concat(key, "=\"").concat(Utils.escapeHTML(value), "\""));
4985 }
4986 }
4987
4988 if (item._data && !Utils.isEmptyObject(item._data)) {
4989 for (var _i4 = 0, _Object$entries3 = Object.entries(item._data); _i4 < _Object$entries3.length; _i4++) {
4990 var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2),
4991 k = _Object$entries3$_i[0],
4992 v = _Object$entries3$_i[1];
4993
4994 // ignore data-index
4995 if (k === 'index') {
4996 return;
4997 }
4998
4999 data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
5000 }
5001 }
5002
5003 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_), '>');
5004
5005 if (this.options.cardView) {
5006 html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
5007 }
5008
5009 if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
5010 html.push('<td>');
5011
5012 if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
5013 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 "));
5014 }
5015
5016 html.push('</td>');
5017 }
5018
5019 this.header.fields.forEach(function (field, j) {
5020 var text = '';
5021 var value_ = Utils.getItemField(item, field, _this7.options.escape);
5022 var value = '';
5023 var type = '';
5024 var cellStyle = {};
5025 var id_ = '';
5026 var class_ = _this7.header.classes[j];
5027 var style_ = '';
5028 var data_ = '';
5029 var rowspan_ = '';
5030 var colspan_ = '';
5031 var title_ = '';
5032 var column = _this7.columns[j];
5033
5034 if (_this7.fromHtml && typeof value_ === 'undefined') {
5035 if (!column.checkbox && !column.radio) {
5036 return;
5037 }
5038 }
5039
5040 if (!column.visible) {
5041 return;
5042 }
5043
5044 if (_this7.options.cardView && !column.cardVisible) {
5045 return;
5046 }
5047
5048 if (column.escape) {
5049 value_ = Utils.escapeHTML(value_);
5050 }
5051
5052 if (csses.concat([_this7.header.styles[j]]).length) {
5053 style_ = " style=\"".concat(csses.concat([_this7.header.styles[j]]).join('; '), "\"");
5054 } // handle td's id and class
5055
5056
5057 if (item["_".concat(field, "_id")]) {
5058 id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
5059 }
5060
5061 if (item["_".concat(field, "_class")]) {
5062 class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
5063 }
5064
5065 if (item["_".concat(field, "_rowspan")]) {
5066 rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
5067 }
5068
5069 if (item["_".concat(field, "_colspan")]) {
5070 colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
5071 }
5072
5073 if (item["_".concat(field, "_title")]) {
5074 title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
5075 }
5076
5077 cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
5078
5079 if (cellStyle.classes) {
5080 class_ = " class=\"".concat(cellStyle.classes, "\"");
5081 }
5082
5083 if (cellStyle.css) {
5084 var csses_ = [];
5085
5086 for (var _i5 = 0, _Object$entries4 = Object.entries(cellStyle.css); _i5 < _Object$entries4.length; _i5++) {
5087 var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i5], 2),
5088 key = _Object$entries4$_i[0],
5089 _value = _Object$entries4$_i[1];
5090
5091 csses_.push("".concat(key, ": ").concat(_value));
5092 }
5093
5094 style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
5095 }
5096
5097 value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
5098
5099 if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
5100 for (var _i6 = 0, _Object$entries5 = Object.entries(item["_".concat(field, "_data")]); _i6 < _Object$entries5.length; _i6++) {
5101 var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i6], 2),
5102 k = _Object$entries5$_i[0],
5103 v = _Object$entries5$_i[1];
5104
5105 // ignore data-index
5106 if (k === 'index') {
5107 return;
5108 }
5109
5110 data_ += " data-".concat(k, "=\"").concat(v, "\"");
5111 }
5112 }
5113
5114 if (column.checkbox || column.radio) {
5115 type = column.checkbox ? 'checkbox' : type;
5116 type = column.radio ? 'radio' : type;
5117 var c = column['class'] || '';
5118 var isChecked = (value === true || value_ || value && value.checked) && value !== false;
5119 var isDisabled = !column.checkboxEnabled || value && value.disabled;
5120 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('');
5121 item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
5122 } else {
5123 value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
5124
5125 if (_this7.options.cardView) {
5126 var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title\"".concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
5127 text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value\">").concat(value, "</span></div>");
5128
5129 if (_this7.options.smartDisplay && value === '') {
5130 text = '<div class="card-view"></div>';
5131 }
5132 } else {
5133 text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
5134 }
5135 }
5136
5137 html.push(text);
5138 });
5139
5140 if (this.options.cardView) {
5141 html.push('</div></td>');
5142 }
5143
5144 html.push('</tr>');
5145 return html.join('');
5146 }
5147 }, {
5148 key: "initBody",
5149 value: function initBody(fixedScroll) {
5150 var _this8 = this;
5151
5152 var data = this.getData();
5153 this.trigger('pre-body', data);
5154 this.$body = this.$el.find('>tbody');
5155
5156 if (!this.$body.length) {
5157 this.$body = $('<tbody></tbody>').appendTo(this.$el);
5158 } // Fix #389 Bootstrap-table-flatJSON is not working
5159
5160
5161 if (!this.options.pagination || this.options.sidePagination === 'server') {
5162 this.pageFrom = 1;
5163 this.pageTo = data.length;
5164 }
5165
5166 var rows = [];
5167 var trFragments = $(document.createDocumentFragment());
5168 var hasTr = false;
5169
5170 for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
5171 var item = data[i];
5172 var tr = this.initRow(item, i, data, trFragments);
5173 hasTr = hasTr || !!tr;
5174
5175 if (tr && typeof tr === 'string') {
5176 if (!this.options.virtualScroll) {
5177 trFragments.append(tr);
5178 } else {
5179 rows.push(tr);
5180 }
5181 }
5182 } // show no records
5183
5184
5185 if (!hasTr) {
5186 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>"));
5187 } else {
5188 if (!this.options.virtualScroll) {
5189 this.$body.html(trFragments);
5190 } else {
5191 if (this.virtualScroll) {
5192 this.virtualScroll.destroy();
5193 }
5194
5195 this.virtualScroll = new VirtualScroll({
5196 rows: rows,
5197 fixedScroll: fixedScroll,
5198 scrollEl: this.$tableBody[0],
5199 contentEl: this.$body[0],
5200 itemHeight: this.options.virtualScrollItemHeight,
5201 callback: function callback() {
5202 _this8.fitHeader();
5203
5204 _this8.initBodyEvent();
5205 }
5206 });
5207 }
5208 }
5209
5210 if (!fixedScroll) {
5211 this.scrollTo(0);
5212 }
5213
5214 this.initBodyEvent();
5215 this.updateSelected();
5216 this.initFooter();
5217 this.resetView();
5218
5219 if (this.options.sidePagination !== 'server') {
5220 this.options.totalRows = data.length;
5221 }
5222
5223 this.trigger('post-body', data);
5224 }
5225 }, {
5226 key: "initBodyEvent",
5227 value: function initBodyEvent() {
5228 var _this9 = this;
5229
5230 // click to select by column
5231 this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
5232 var $td = $(e.currentTarget);
5233 var $tr = $td.parent();
5234 var $cardViewArr = $(e.target).parents('.card-views').children();
5235 var $cardViewTarget = $(e.target).parents('.card-view');
5236 var rowIndex = $tr.data('index');
5237 var item = _this9.data[rowIndex];
5238 var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
5239
5240 var fields = _this9.getVisibleFields();
5241
5242 var field = fields[_this9.options.detailView && _this9.options.detailViewIcon && !_this9.options.cardView ? index - 1 : index];
5243 var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
5244 var value = Utils.getItemField(item, field, _this9.options.escape);
5245
5246 if ($td.find('.detail-icon').length) {
5247 return;
5248 }
5249
5250 _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
5251
5252 _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
5253
5254
5255 if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
5256 var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
5257
5258 if ($selectItem.length) {
5259 $selectItem[0].click();
5260 }
5261 }
5262
5263 if (e.type === 'click' && _this9.options.detailViewByClick) {
5264 _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
5265 }
5266 }).off('mousedown').on('mousedown', function (e) {
5267 // https://github.com/jquery/jquery/issues/1741
5268 _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
5269 _this9.multipleSelectRowShiftKey = e.shiftKey;
5270 });
5271 this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
5272 e.preventDefault();
5273
5274 _this9.toggleDetailView($(e.currentTarget).parent().parent().data('index'));
5275
5276 return false;
5277 });
5278 this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
5279 this.$selectItem.off('click').on('click', function (e) {
5280 e.stopImmediatePropagation();
5281 var $this = $(e.currentTarget);
5282
5283 _this9._toggleCheck($this.prop('checked'), $this.data('index'));
5284 });
5285 this.header.events.forEach(function (_events, i) {
5286 var events = _events;
5287
5288 if (!events) {
5289 return;
5290 } // fix bug, if events is defined with namespace
5291
5292
5293 if (typeof events === 'string') {
5294 events = Utils.calculateObjectValue(null, events);
5295 }
5296
5297 var field = _this9.header.fields[i];
5298
5299 var fieldIndex = _this9.getVisibleFields().indexOf(field);
5300
5301 if (fieldIndex === -1) {
5302 return;
5303 }
5304
5305 if (_this9.options.detailView && !_this9.options.cardView) {
5306 fieldIndex += 1;
5307 }
5308
5309 var _loop = function _loop(key) {
5310 if (!events.hasOwnProperty(key)) {
5311 return "continue";
5312 }
5313
5314 var event = events[key];
5315
5316 _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
5317 var $tr = $(tr);
5318 var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
5319 var index = key.indexOf(' ');
5320 var name = key.substring(0, index);
5321 var el = key.substring(index + 1);
5322 $td.find(el).off(name).on(name, function (e) {
5323 var index = $tr.data('index');
5324 var row = _this9.data[index];
5325 var value = row[field];
5326 event.apply(_this9, [e, value, row, index]);
5327 });
5328 });
5329 };
5330
5331 for (var key in events) {
5332 var _ret = _loop(key);
5333
5334 if (_ret === "continue") continue;
5335 }
5336 });
5337 }
5338 }, {
5339 key: "initServer",
5340 value: function initServer(silent, query, url) {
5341 var _this10 = this;
5342
5343 var data = {};
5344 var index = this.header.fields.indexOf(this.options.sortName);
5345 var params = {
5346 searchText: this.searchText,
5347 sortName: this.options.sortName,
5348 sortOrder: this.options.sortOrder
5349 };
5350
5351 if (this.header.sortNames[index]) {
5352 params.sortName = this.header.sortNames[index];
5353 }
5354
5355 if (this.options.pagination && this.options.sidePagination === 'server') {
5356 params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
5357 params.pageNumber = this.options.pageNumber;
5358 }
5359
5360 if (!(url || this.options.url) && !this.options.ajax) {
5361 return;
5362 }
5363
5364 if (this.options.queryParamsType === 'limit') {
5365 params = {
5366 search: params.searchText,
5367 sort: params.sortName,
5368 order: params.sortOrder
5369 };
5370
5371 if (this.options.pagination && this.options.sidePagination === 'server') {
5372 params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
5373 params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
5374
5375 if (params.limit === 0) {
5376 delete params.limit;
5377 }
5378 }
5379 }
5380
5381 if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
5382 params.filter = JSON.stringify(this.filterColumnsPartial, null);
5383 }
5384
5385 $.extend(params, query || {});
5386 data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
5387
5388 if (data === false) {
5389 return;
5390 }
5391
5392 if (!silent) {
5393 this.showLoading();
5394 }
5395
5396 var request = $.extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
5397 type: this.options.method,
5398 url: url || this.options.url,
5399 data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
5400 cache: this.options.cache,
5401 contentType: this.options.contentType,
5402 dataType: this.options.dataType,
5403 success: function success(_res, textStatus, jqXHR) {
5404 var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
5405
5406 _this10.load(res);
5407
5408 _this10.trigger('load-success', res, jqXHR.status, jqXHR);
5409
5410 if (!silent) {
5411 _this10.hideLoading();
5412 }
5413 },
5414 error: function error(jqXHR) {
5415 var data = [];
5416
5417 if (_this10.options.sidePagination === 'server') {
5418 data = {};
5419 data[_this10.options.totalField] = 0;
5420 data[_this10.options.dataField] = [];
5421 }
5422
5423 _this10.load(data);
5424
5425 _this10.trigger('load-error', jqXHR.status, jqXHR);
5426
5427 if (!silent) _this10.$tableLoading.hide();
5428 }
5429 });
5430
5431 if (this.options.ajax) {
5432 Utils.calculateObjectValue(this, this.options.ajax, [request], null);
5433 } else {
5434 if (this._xhr && this._xhr.readyState !== 4) {
5435 this._xhr.abort();
5436 }
5437
5438 this._xhr = $.ajax(request);
5439 }
5440
5441 return data;
5442 }
5443 }, {
5444 key: "initSearchText",
5445 value: function initSearchText() {
5446 if (this.options.search) {
5447 this.searchText = '';
5448
5449 if (this.options.searchText !== '') {
5450 var $search = this.$toolbar.find('.search input');
5451 $search.val(this.options.searchText);
5452 this.onSearch({
5453 currentTarget: $search,
5454 firedByInitSearchText: true
5455 });
5456 }
5457 }
5458 }
5459 }, {
5460 key: "getCaret",
5461 value: function getCaret() {
5462 var _this11 = this;
5463
5464 this.$header.find('th').each(function (i, th) {
5465 $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
5466 });
5467 }
5468 }, {
5469 key: "updateSelected",
5470 value: function updateSelected() {
5471 var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
5472 this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
5473 this.$selectItem.each(function (i, el) {
5474 $(el).closest('tr')[$(el).prop('checked') ? 'addClass' : 'removeClass']('selected');
5475 });
5476 }
5477 }, {
5478 key: "updateRows",
5479 value: function updateRows() {
5480 var _this12 = this;
5481
5482 this.$selectItem.each(function (i, el) {
5483 _this12.data[$(el).data('index')][_this12.header.stateField] = $(el).prop('checked');
5484 });
5485 }
5486 }, {
5487 key: "resetRows",
5488 value: function resetRows() {
5489 var _iteratorNormalCompletion2 = true;
5490 var _didIteratorError2 = false;
5491 var _iteratorError2 = undefined;
5492
5493 try {
5494 for (var _iterator2 = this.data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5495 var row = _step2.value;
5496 this.$selectAll.prop('checked', false);
5497 this.$selectItem.prop('checked', false);
5498
5499 if (this.header.stateField) {
5500 row[this.header.stateField] = false;
5501 }
5502 }
5503 } catch (err) {
5504 _didIteratorError2 = true;
5505 _iteratorError2 = err;
5506 } finally {
5507 try {
5508 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
5509 _iterator2.return();
5510 }
5511 } finally {
5512 if (_didIteratorError2) {
5513 throw _iteratorError2;
5514 }
5515 }
5516 }
5517
5518 this.initHiddenRows();
5519 }
5520 }, {
5521 key: "trigger",
5522 value: function trigger(_name) {
5523 var _this$options;
5524
5525 var name = "".concat(_name, ".bs.table");
5526
5527 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
5528 args[_key2 - 1] = arguments[_key2];
5529 }
5530
5531 (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, args);
5532
5533 this.$el.trigger($.Event(name), args);
5534 this.options.onAll(name, args);
5535 this.$el.trigger($.Event('all.bs.table'), [name, args]);
5536 }
5537 }, {
5538 key: "resetHeader",
5539 value: function resetHeader() {
5540 var _this13 = this;
5541
5542 // fix #61: the hidden table reset header bug.
5543 // fix bug: get $el.css('width') error sometime (height = 500)
5544 clearTimeout(this.timeoutId_);
5545 this.timeoutId_ = setTimeout(function () {
5546 return _this13.fitHeader();
5547 }, this.$el.is(':hidden') ? 100 : 0);
5548 }
5549 }, {
5550 key: "fitHeader",
5551 value: function fitHeader() {
5552 var _this14 = this;
5553
5554 if (this.$el.is(':hidden')) {
5555 this.timeoutId_ = setTimeout(function () {
5556 return _this14.fitHeader();
5557 }, 100);
5558 return;
5559 }
5560
5561 var fixedBody = this.$tableBody.get(0);
5562 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
5563 this.$el.css('margin-top', -this.$header.outerHeight());
5564 var focused = $(':focus');
5565
5566 if (focused.length > 0) {
5567 var $th = focused.parents('th');
5568
5569 if ($th.length > 0) {
5570 var dataField = $th.attr('data-field');
5571
5572 if (dataField !== undefined) {
5573 var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
5574
5575 if ($headerTh.length > 0) {
5576 $headerTh.find(':input').addClass('focus-temp');
5577 }
5578 }
5579 }
5580 }
5581
5582 this.$header_ = this.$header.clone(true, true);
5583 this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
5584 this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
5585 this.$tableLoading.css('width', this.$el.outerWidth());
5586 var focusedTemp = $('.focus-temp:visible:eq(0)');
5587
5588 if (focusedTemp.length > 0) {
5589 focusedTemp.focus();
5590 this.$header.find('.focus-temp').removeClass('focus-temp');
5591 } // fix bug: $.data() is not working as expected after $.append()
5592
5593
5594 this.$header.find('th[data-field]').each(function (i, el) {
5595 _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $(el).data('field'))).data($(el).data());
5596 });
5597 var visibleFields = this.getVisibleFields();
5598 var $ths = this.$header_.find('th');
5599 var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
5600
5601 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
5602 $tr = $tr.next();
5603 }
5604
5605 $tr.find('> *').each(function (i, el) {
5606 var $this = $(el);
5607 var index = i;
5608
5609 if (_this14.options.detailView && _this14.options.detailViewIcon && !_this14.options.cardView) {
5610 if (i === 0) {
5611 var $thDetail = $ths.filter('.detail');
5612
5613 var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
5614
5615 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
5616 }
5617
5618 index = i - 1;
5619 }
5620
5621 if (index === -1) {
5622 return;
5623 }
5624
5625 var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
5626
5627 if ($th.length > 1) {
5628 $th = $($ths[$this[0].cellIndex]);
5629 }
5630
5631 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
5632 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
5633 });
5634 this.horizontalScroll();
5635 this.trigger('post-header');
5636 }
5637 }, {
5638 key: "initFooter",
5639 value: function initFooter() {
5640 if (!this.options.showFooter || this.options.cardView) {
5641 // do nothing
5642 return;
5643 }
5644
5645 var data = this.getData();
5646 var html = [];
5647
5648 if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
5649 html.push('<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>');
5650 }
5651
5652 var _iteratorNormalCompletion3 = true;
5653 var _didIteratorError3 = false;
5654 var _iteratorError3 = undefined;
5655
5656 try {
5657 for (var _iterator3 = this.columns[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5658 var column = _step3.value;
5659 var falign = '';
5660 var valign = '';
5661 var csses = [];
5662 var style = {};
5663 var class_ = Utils.sprintf(' class="%s"', column['class']);
5664
5665 if (!column.visible) {
5666 continue;
5667 }
5668
5669 if (this.options.cardView && !column.cardVisible) {
5670 return;
5671 }
5672
5673 falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
5674 valign = Utils.sprintf('vertical-align: %s; ', column.valign);
5675 style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
5676
5677 if (style && style.css) {
5678 for (var _i7 = 0, _Object$entries6 = Object.entries(style.css); _i7 < _Object$entries6.length; _i7++) {
5679 var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i7], 2),
5680 key = _Object$entries6$_i[0],
5681 value = _Object$entries6$_i[1];
5682
5683 csses.push("".concat(key, ": ").concat(value));
5684 }
5685 }
5686
5687 if (style && style.classes) {
5688 class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
5689 }
5690
5691 html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')), '>');
5692 html.push('<div class="th-inner">');
5693 html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data], this.footerData[0] && this.footerData[0][column.field] || ''));
5694 html.push('</div>');
5695 html.push('<div class="fht-cell"></div>');
5696 html.push('</div>');
5697 html.push('</th>');
5698 }
5699 } catch (err) {
5700 _didIteratorError3 = true;
5701 _iteratorError3 = err;
5702 } finally {
5703 try {
5704 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
5705 _iterator3.return();
5706 }
5707 } finally {
5708 if (_didIteratorError3) {
5709 throw _iteratorError3;
5710 }
5711 }
5712 }
5713
5714 this.$tableFooter.find('tr').html(html.join(''));
5715 this.trigger('post-footer', this.$tableFooter);
5716 }
5717 }, {
5718 key: "fitFooter",
5719 value: function fitFooter() {
5720 var _this15 = this;
5721
5722 if (this.$el.is(':hidden')) {
5723 setTimeout(function () {
5724 return _this15.fitFooter();
5725 }, 100);
5726 return;
5727 }
5728
5729 var fixedBody = this.$tableBody.get(0);
5730 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
5731 this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
5732 var visibleFields = this.getVisibleFields();
5733 var $ths = this.$tableFooter.find('th');
5734 var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
5735
5736 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
5737 $tr = $tr.next();
5738 }
5739
5740 $tr.find('> *').each(function (i, el) {
5741 var $this = $(el);
5742 var index = i;
5743
5744 if (_this15.options.detailView && !_this15.options.cardView) {
5745 if (i === 0) {
5746 var $thDetail = $ths.filter('.detail');
5747
5748 var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
5749
5750 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
5751 }
5752
5753 index = i - 1;
5754 }
5755
5756 if (index === -1) {
5757 return;
5758 }
5759
5760 var $th = $ths.eq(i);
5761 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
5762 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
5763 });
5764 this.horizontalScroll();
5765 }
5766 }, {
5767 key: "horizontalScroll",
5768 value: function horizontalScroll() {
5769 var _this16 = this;
5770
5771 // horizontal scroll event
5772 // TODO: it's probably better improving the layout than binding to scroll event
5773 this.$tableBody.off('scroll').on('scroll', function (_ref6) {
5774 var currentTarget = _ref6.currentTarget;
5775
5776 if (_this16.options.showHeader && _this16.options.height) {
5777 _this16.$tableHeader.scrollLeft($(currentTarget).scrollLeft());
5778 }
5779
5780 if (_this16.options.showFooter && !_this16.options.cardView) {
5781 _this16.$tableFooter.scrollLeft($(currentTarget).scrollLeft());
5782 }
5783
5784 _this16.trigger('scroll-body', $(currentTarget));
5785 });
5786 }
5787 }, {
5788 key: "getVisibleFields",
5789 value: function getVisibleFields() {
5790 var visibleFields = [];
5791 var _iteratorNormalCompletion4 = true;
5792 var _didIteratorError4 = false;
5793 var _iteratorError4 = undefined;
5794
5795 try {
5796 for (var _iterator4 = this.header.fields[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
5797 var field = _step4.value;
5798 var column = this.columns[this.fieldsColumnsIndex[field]];
5799
5800 if (!column || !column.visible) {
5801 continue;
5802 }
5803
5804 visibleFields.push(field);
5805 }
5806 } catch (err) {
5807 _didIteratorError4 = true;
5808 _iteratorError4 = err;
5809 } finally {
5810 try {
5811 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
5812 _iterator4.return();
5813 }
5814 } finally {
5815 if (_didIteratorError4) {
5816 throw _iteratorError4;
5817 }
5818 }
5819 }
5820
5821 return visibleFields;
5822 }
5823 }, {
5824 key: "initHiddenRows",
5825 value: function initHiddenRows() {
5826 this.hiddenRows = [];
5827 } // PUBLIC FUNCTION DEFINITION
5828 // =======================
5829
5830 }, {
5831 key: "getOptions",
5832 value: function getOptions() {
5833 // deep copy and remove data
5834 var options = $.extend({}, this.options);
5835 delete options.data;
5836 return $.extend(true, {}, options);
5837 }
5838 }, {
5839 key: "refreshOptions",
5840 value: function refreshOptions(options) {
5841 // If the objects are equivalent then avoid the call of destroy / init methods
5842 if (Utils.compareObjects(this.options, options, true)) {
5843 return;
5844 }
5845
5846 this.options = $.extend(this.options, options);
5847 this.trigger('refresh-options', this.options);
5848 this.destroy();
5849 this.init();
5850 }
5851 }, {
5852 key: "getData",
5853 value: function getData(params) {
5854 var data = this.options.data;
5855
5856 if (this.searchText || this.options.sortName || !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) {
5857 data = this.data;
5858 }
5859
5860 if (params && params.useCurrentPage) {
5861 data = data.slice(this.pageFrom - 1, this.pageTo);
5862 }
5863
5864 if (params && !params.includeHiddenRows) {
5865 var hiddenRows = this.getHiddenRows();
5866 data = data.filter(function (row) {
5867 return Utils.findIndex(hiddenRows, row) === -1;
5868 });
5869 }
5870
5871 return data;
5872 }
5873 }, {
5874 key: "getSelections",
5875 value: function getSelections() {
5876 var _this17 = this;
5877
5878 // fix #2424: from html with checkbox
5879 return this.data.filter(function (row) {
5880 return row[_this17.header.stateField] === true;
5881 });
5882 }
5883 }, {
5884 key: "getAllSelections",
5885 value: function getAllSelections() {
5886 var _this18 = this;
5887
5888 return this.options.data.filter(function (row) {
5889 return row[_this18.header.stateField] === true;
5890 });
5891 }
5892 }, {
5893 key: "load",
5894 value: function load(_data) {
5895 var fixedScroll = false;
5896 var data = _data; // #431: support pagination
5897
5898 if (this.options.pagination && this.options.sidePagination === 'server') {
5899 this.options.totalRows = data[this.options.totalField];
5900 }
5901
5902 if (this.options.pagination && this.options.sidePagination === 'server') {
5903 this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
5904 }
5905
5906 fixedScroll = data.fixedScroll;
5907 data = Array.isArray(data) ? data : data[this.options.dataField];
5908 this.initData(data);
5909 this.initSearch();
5910 this.initPagination();
5911 this.initBody(fixedScroll);
5912 }
5913 }, {
5914 key: "append",
5915 value: function append(data) {
5916 this.initData(data, 'append');
5917 this.initSearch();
5918 this.initPagination();
5919 this.initSort();
5920 this.initBody(true);
5921 }
5922 }, {
5923 key: "prepend",
5924 value: function prepend(data) {
5925 this.initData(data, 'prepend');
5926 this.initSearch();
5927 this.initPagination();
5928 this.initSort();
5929 this.initBody(true);
5930 }
5931 }, {
5932 key: "remove",
5933 value: function remove(params) {
5934 var len = this.options.data.length;
5935 var i;
5936 var row;
5937
5938 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('values')) {
5939 return;
5940 }
5941
5942 for (i = len - 1; i >= 0; i--) {
5943 row = this.options.data[i];
5944
5945 if (!row.hasOwnProperty(params.field)) {
5946 continue;
5947 }
5948
5949 if (params.values.includes(row[params.field])) {
5950 this.options.data.splice(i, 1);
5951
5952 if (this.options.sidePagination === 'server') {
5953 this.options.totalRows -= 1;
5954 }
5955 }
5956 }
5957
5958 if (len === this.options.data.length) {
5959 return;
5960 }
5961
5962 this.initSearch();
5963 this.initPagination();
5964 this.initSort();
5965 this.initBody(true);
5966 }
5967 }, {
5968 key: "removeAll",
5969 value: function removeAll() {
5970 if (this.options.data.length > 0) {
5971 this.options.data.splice(0, this.options.data.length);
5972 this.initSearch();
5973 this.initPagination();
5974 this.initBody(true);
5975 }
5976 }
5977 }, {
5978 key: "insertRow",
5979 value: function insertRow(params) {
5980 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
5981 return;
5982 }
5983
5984 this.options.data.splice(params.index, 0, params.row);
5985 this.initSearch();
5986 this.initPagination();
5987 this.initSort();
5988 this.initBody(true);
5989 }
5990 }, {
5991 key: "updateRow",
5992 value: function updateRow(params) {
5993 var allParams = Array.isArray(params) ? params : [params];
5994 var _iteratorNormalCompletion5 = true;
5995 var _didIteratorError5 = false;
5996 var _iteratorError5 = undefined;
5997
5998 try {
5999 for (var _iterator5 = allParams[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
6000 var _params = _step5.value;
6001
6002 if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
6003 continue;
6004 }
6005
6006 $.extend(this.options.data[_params.index], _params.row);
6007
6008 if (_params.hasOwnProperty('replace') && _params.replace) {
6009 this.options.data[_params.index] = _params.row;
6010 } else {
6011 $.extend(this.options.data[_params.index], _params.row);
6012 }
6013 }
6014 } catch (err) {
6015 _didIteratorError5 = true;
6016 _iteratorError5 = err;
6017 } finally {
6018 try {
6019 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
6020 _iterator5.return();
6021 }
6022 } finally {
6023 if (_didIteratorError5) {
6024 throw _iteratorError5;
6025 }
6026 }
6027 }
6028
6029 this.initSearch();
6030 this.initPagination();
6031 this.initSort();
6032 this.initBody(true);
6033 }
6034 }, {
6035 key: "getRowByUniqueId",
6036 value: function getRowByUniqueId(_id) {
6037 var uniqueId = this.options.uniqueId;
6038 var len = this.options.data.length;
6039 var id = _id;
6040 var dataRow = null;
6041 var i;
6042 var row;
6043 var rowUniqueId;
6044
6045 for (i = len - 1; i >= 0; i--) {
6046 row = this.options.data[i];
6047
6048 if (row.hasOwnProperty(uniqueId)) {
6049 // uniqueId is a column
6050 rowUniqueId = row[uniqueId];
6051 } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
6052 // uniqueId is a row data property
6053 rowUniqueId = row._data[uniqueId];
6054 } else {
6055 continue;
6056 }
6057
6058 if (typeof rowUniqueId === 'string') {
6059 id = id.toString();
6060 } else if (typeof rowUniqueId === 'number') {
6061 if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
6062 id = parseInt(id);
6063 } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
6064 id = parseFloat(id);
6065 }
6066 }
6067
6068 if (rowUniqueId === id) {
6069 dataRow = row;
6070 break;
6071 }
6072 }
6073
6074 return dataRow;
6075 }
6076 }, {
6077 key: "updateByUniqueId",
6078 value: function updateByUniqueId(params) {
6079 var allParams = Array.isArray(params) ? params : [params];
6080 var _iteratorNormalCompletion6 = true;
6081 var _didIteratorError6 = false;
6082 var _iteratorError6 = undefined;
6083
6084 try {
6085 for (var _iterator6 = allParams[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
6086 var _params2 = _step6.value;
6087
6088 if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
6089 continue;
6090 }
6091
6092 var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
6093
6094 if (rowId === -1) {
6095 continue;
6096 }
6097
6098 if (_params2.hasOwnProperty('replace') && _params2.replace) {
6099 this.options.data[rowId] = _params2.row;
6100 } else {
6101 $.extend(this.options.data[rowId], _params2.row);
6102 }
6103 }
6104 } catch (err) {
6105 _didIteratorError6 = true;
6106 _iteratorError6 = err;
6107 } finally {
6108 try {
6109 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
6110 _iterator6.return();
6111 }
6112 } finally {
6113 if (_didIteratorError6) {
6114 throw _iteratorError6;
6115 }
6116 }
6117 }
6118
6119 this.initSearch();
6120 this.initPagination();
6121 this.initSort();
6122 this.initBody(true);
6123 }
6124 }, {
6125 key: "removeByUniqueId",
6126 value: function removeByUniqueId(id) {
6127 var len = this.options.data.length;
6128 var row = this.getRowByUniqueId(id);
6129
6130 if (row) {
6131 this.options.data.splice(this.options.data.indexOf(row), 1);
6132 }
6133
6134 if (len === this.options.data.length) {
6135 return;
6136 }
6137
6138 this.initSearch();
6139 this.initPagination();
6140 this.initBody(true);
6141 }
6142 }, {
6143 key: "updateCell",
6144 value: function updateCell(params) {
6145 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
6146 return;
6147 }
6148
6149 this.data[params.index][params.field] = params.value;
6150
6151 if (params.reinit === false) {
6152 return;
6153 }
6154
6155 this.initSort();
6156 this.initBody(true);
6157 }
6158 }, {
6159 key: "updateCellByUniqueId",
6160 value: function updateCellByUniqueId(params) {
6161 var _this19 = this;
6162
6163 if (!params.hasOwnProperty('id') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
6164 return;
6165 }
6166
6167 var allParams = Array.isArray(params) ? params : [params];
6168 allParams.forEach(function (_ref7) {
6169 var id = _ref7.id,
6170 field = _ref7.field,
6171 value = _ref7.value;
6172
6173 var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
6174
6175 if (rowId === -1) {
6176 return;
6177 }
6178
6179 _this19.options.data[rowId][field] = value;
6180 });
6181
6182 if (params.reinit === false) {
6183 return;
6184 }
6185
6186 this.initSort();
6187 this.initBody(true);
6188 }
6189 }, {
6190 key: "showRow",
6191 value: function showRow(params) {
6192 this._toggleRow(params, true);
6193 }
6194 }, {
6195 key: "hideRow",
6196 value: function hideRow(params) {
6197 this._toggleRow(params, false);
6198 }
6199 }, {
6200 key: "_toggleRow",
6201 value: function _toggleRow(params, visible) {
6202 var row;
6203
6204 if (params.hasOwnProperty('index')) {
6205 row = this.getData()[params.index];
6206 } else if (params.hasOwnProperty('uniqueId')) {
6207 row = this.getRowByUniqueId(params.uniqueId);
6208 }
6209
6210 if (!row) {
6211 return;
6212 }
6213
6214 var index = Utils.findIndex(this.hiddenRows, row);
6215
6216 if (!visible && index === -1) {
6217 this.hiddenRows.push(row);
6218 } else if (visible && index > -1) {
6219 this.hiddenRows.splice(index, 1);
6220 }
6221
6222 if (visible) {
6223 this.updatePagination();
6224 } else {
6225 this.initBody(true);
6226 this.initPagination();
6227 }
6228 }
6229 }, {
6230 key: "getHiddenRows",
6231 value: function getHiddenRows(show) {
6232 if (show) {
6233 this.initHiddenRows();
6234 this.initBody(true);
6235 return;
6236 }
6237
6238 var data = this.getData();
6239 var rows = [];
6240 var _iteratorNormalCompletion7 = true;
6241 var _didIteratorError7 = false;
6242 var _iteratorError7 = undefined;
6243
6244 try {
6245 for (var _iterator7 = data[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
6246 var row = _step7.value;
6247
6248 if (this.hiddenRows.includes(row)) {
6249 rows.push(row);
6250 }
6251 }
6252 } catch (err) {
6253 _didIteratorError7 = true;
6254 _iteratorError7 = err;
6255 } finally {
6256 try {
6257 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
6258 _iterator7.return();
6259 }
6260 } finally {
6261 if (_didIteratorError7) {
6262 throw _iteratorError7;
6263 }
6264 }
6265 }
6266
6267 this.hiddenRows = rows;
6268 return rows;
6269 }
6270 }, {
6271 key: "showColumn",
6272 value: function showColumn(field) {
6273 var _this20 = this;
6274
6275 var fields = Array.isArray(field) ? field : [field];
6276 fields.forEach(function (field) {
6277 _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
6278 });
6279 }
6280 }, {
6281 key: "hideColumn",
6282 value: function hideColumn(field) {
6283 var _this21 = this;
6284
6285 var fields = Array.isArray(field) ? field : [field];
6286 fields.forEach(function (field) {
6287 _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
6288 });
6289 }
6290 }, {
6291 key: "_toggleColumn",
6292 value: function _toggleColumn(index, checked, needUpdate) {
6293 if (index === -1 || this.columns[index].visible === checked) {
6294 return;
6295 }
6296
6297 this.columns[index].visible = checked;
6298 this.initHeader();
6299 this.initSearch();
6300 this.initPagination();
6301 this.initBody();
6302
6303 if (this.options.showColumns) {
6304 var $items = this.$toolbar.find('.keep-open input').prop('disabled', false);
6305
6306 if (needUpdate) {
6307 $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
6308 }
6309
6310 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
6311 $items.filter(':checked').prop('disabled', true);
6312 }
6313 }
6314 }
6315 }, {
6316 key: "getVisibleColumns",
6317 value: function getVisibleColumns() {
6318 return this.columns.filter(function (_ref8) {
6319 var visible = _ref8.visible;
6320 return visible;
6321 });
6322 }
6323 }, {
6324 key: "getHiddenColumns",
6325 value: function getHiddenColumns() {
6326 return this.columns.filter(function (_ref9) {
6327 var visible = _ref9.visible;
6328 return !visible;
6329 });
6330 }
6331 }, {
6332 key: "showAllColumns",
6333 value: function showAllColumns() {
6334 this._toggleAllColumns(true);
6335 }
6336 }, {
6337 key: "hideAllColumns",
6338 value: function hideAllColumns() {
6339 this._toggleAllColumns(false);
6340 }
6341 }, {
6342 key: "_toggleAllColumns",
6343 value: function _toggleAllColumns(visible) {
6344 var _this22 = this;
6345
6346 var _iteratorNormalCompletion8 = true;
6347 var _didIteratorError8 = false;
6348 var _iteratorError8 = undefined;
6349
6350 try {
6351 for (var _iterator8 = this.columns.slice().reverse()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
6352 var column = _step8.value;
6353
6354 if (column.switchable) {
6355 if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) {
6356 continue;
6357 }
6358
6359 column.visible = visible;
6360 }
6361 }
6362 } catch (err) {
6363 _didIteratorError8 = true;
6364 _iteratorError8 = err;
6365 } finally {
6366 try {
6367 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
6368 _iterator8.return();
6369 }
6370 } finally {
6371 if (_didIteratorError8) {
6372 throw _iteratorError8;
6373 }
6374 }
6375 }
6376
6377 this.initHeader();
6378 this.initSearch();
6379 this.initPagination();
6380 this.initBody();
6381
6382 if (this.options.showColumns) {
6383 var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
6384
6385 if (visible) {
6386 $items.prop('checked', visible);
6387 } else {
6388 $items.get().reverse().forEach(function (item) {
6389 if ($items.filter(':checked').length > _this22.options.minimumCountColumns) {
6390 $(item).prop('checked', visible);
6391 }
6392 });
6393 }
6394
6395 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
6396 $items.filter(':checked').prop('disabled', true);
6397 }
6398 }
6399 }
6400 }, {
6401 key: "mergeCells",
6402 value: function mergeCells(options) {
6403 var row = options.index;
6404 var col = this.getVisibleFields().indexOf(options.field);
6405 var rowspan = options.rowspan || 1;
6406 var colspan = options.colspan || 1;
6407 var i;
6408 var j;
6409 var $tr = this.$body.find('>tr');
6410
6411 if (this.options.detailView && !this.options.cardView) {
6412 col += 1;
6413 }
6414
6415 var $td = $tr.eq(row).find('>td').eq(col);
6416
6417 if (row < 0 || col < 0 || row >= this.data.length) {
6418 return;
6419 }
6420
6421 for (i = row; i < row + rowspan; i++) {
6422 for (j = col; j < col + colspan; j++) {
6423 $tr.eq(i).find('>td').eq(j).hide();
6424 }
6425 }
6426
6427 $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
6428 }
6429 }, {
6430 key: "checkAll",
6431 value: function checkAll() {
6432 this._toggleCheckAll(true);
6433 }
6434 }, {
6435 key: "uncheckAll",
6436 value: function uncheckAll() {
6437 this._toggleCheckAll(false);
6438 }
6439 }, {
6440 key: "_toggleCheckAll",
6441 value: function _toggleCheckAll(checked) {
6442 var rowsBefore = this.getSelections();
6443 this.$selectAll.add(this.$selectAll_).prop('checked', checked);
6444 this.$selectItem.filter(':enabled').prop('checked', checked);
6445 this.updateRows();
6446 var rowsAfter = this.getSelections();
6447
6448 if (checked) {
6449 this.trigger('check-all', rowsAfter, rowsBefore);
6450 return;
6451 }
6452
6453 this.trigger('uncheck-all', rowsAfter, rowsBefore);
6454 }
6455 }, {
6456 key: "checkInvert",
6457 value: function checkInvert() {
6458 var $items = this.$selectItem.filter(':enabled');
6459 var checked = $items.filter(':checked');
6460 $items.each(function (i, el) {
6461 $(el).prop('checked', !$(el).prop('checked'));
6462 });
6463 this.updateRows();
6464 this.updateSelected();
6465 this.trigger('uncheck-some', checked);
6466 checked = this.getSelections();
6467 this.trigger('check-some', checked);
6468 }
6469 }, {
6470 key: "check",
6471 value: function check(index) {
6472 this._toggleCheck(true, index);
6473 }
6474 }, {
6475 key: "uncheck",
6476 value: function uncheck(index) {
6477 this._toggleCheck(false, index);
6478 }
6479 }, {
6480 key: "_toggleCheck",
6481 value: function _toggleCheck(checked, index) {
6482 var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
6483 var row = this.data[index];
6484
6485 if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
6486 var _iteratorNormalCompletion9 = true;
6487 var _didIteratorError9 = false;
6488 var _iteratorError9 = undefined;
6489
6490 try {
6491 for (var _iterator9 = this.options.data[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
6492 var r = _step9.value;
6493 r[this.header.stateField] = false;
6494 }
6495 } catch (err) {
6496 _didIteratorError9 = true;
6497 _iteratorError9 = err;
6498 } finally {
6499 try {
6500 if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
6501 _iterator9.return();
6502 }
6503 } finally {
6504 if (_didIteratorError9) {
6505 throw _iteratorError9;
6506 }
6507 }
6508 }
6509
6510 this.$selectItem.filter(':checked').not($el).prop('checked', false);
6511 }
6512
6513 row[this.header.stateField] = checked;
6514
6515 if (this.options.multipleSelectRow) {
6516 if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
6517 var indexes = [this.multipleSelectRowLastSelectedIndex, index].sort();
6518
6519 for (var i = indexes[0] + 1; i < indexes[1]; i++) {
6520 this.data[i][this.header.stateField] = true;
6521 this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
6522 }
6523 }
6524
6525 this.multipleSelectRowCtrlKey = false;
6526 this.multipleSelectRowShiftKey = false;
6527 this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
6528 }
6529
6530 $el.prop('checked', checked);
6531 this.updateSelected();
6532 this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
6533 }
6534 }, {
6535 key: "checkBy",
6536 value: function checkBy(obj) {
6537 this._toggleCheckBy(true, obj);
6538 }
6539 }, {
6540 key: "uncheckBy",
6541 value: function uncheckBy(obj) {
6542 this._toggleCheckBy(false, obj);
6543 }
6544 }, {
6545 key: "_toggleCheckBy",
6546 value: function _toggleCheckBy(checked, obj) {
6547 var _this23 = this;
6548
6549 if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
6550 return;
6551 }
6552
6553 var rows = [];
6554 this.data.forEach(function (row, i) {
6555 if (!row.hasOwnProperty(obj.field)) {
6556 return false;
6557 }
6558
6559 if (obj.values.includes(row[obj.field])) {
6560 var $el = _this23.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
6561
6562 $el = checked ? $el.not(':checked') : $el.filter(':checked');
6563
6564 if (!$el.length) {
6565 return;
6566 }
6567
6568 $el.prop('checked', checked);
6569 row[_this23.header.stateField] = checked;
6570 rows.push(row);
6571
6572 _this23.trigger(checked ? 'check' : 'uncheck', row, $el);
6573 }
6574 });
6575 this.updateSelected();
6576 this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
6577 }
6578 }, {
6579 key: "refresh",
6580 value: function refresh(params) {
6581 if (params && params.url) {
6582 this.options.url = params.url;
6583 }
6584
6585 if (params && params.pageNumber) {
6586 this.options.pageNumber = params.pageNumber;
6587 }
6588
6589 if (params && params.pageSize) {
6590 this.options.pageSize = params.pageSize;
6591 }
6592
6593 this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
6594 }
6595 }, {
6596 key: "destroy",
6597 value: function destroy() {
6598 this.$el.insertBefore(this.$container);
6599 $(this.options.toolbar).insertBefore(this.$el);
6600 this.$container.next().remove();
6601 this.$container.remove();
6602 this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
6603 }
6604 }, {
6605 key: "resetView",
6606 value: function resetView(params) {
6607 var padding = 0;
6608
6609 if (params && params.height) {
6610 this.options.height = params.height;
6611 }
6612
6613 this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length);
6614 this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
6615
6616 if (!this.options.cardView && this.options.showHeader && this.options.height) {
6617 this.$tableHeader.show();
6618 this.resetHeader();
6619 padding += this.$header.outerHeight(true) + 1;
6620 } else {
6621 this.$tableHeader.hide();
6622 this.trigger('post-header');
6623 }
6624
6625 if (!this.options.cardView && this.options.showFooter) {
6626 this.$tableFooter.show();
6627 this.fitFooter();
6628
6629 if (this.options.height) {
6630 padding += this.$tableFooter.outerHeight(true);
6631 }
6632 }
6633
6634 if (this.options.height) {
6635 var toolbarHeight = this.$toolbar.outerHeight(true);
6636 var paginationHeight = this.$pagination.outerHeight(true);
6637 var height = this.options.height - toolbarHeight - paginationHeight;
6638 var tableHeight = this.$tableBody.find('table').outerHeight(true);
6639 this.$tableContainer.css('height', "".concat(height, "px"));
6640 this.$tableBorder && this.$tableBorder.css('height', "".concat(height - tableHeight - padding - 1, "px"));
6641 }
6642
6643 if (this.options.cardView) {
6644 // remove the element css
6645 this.$el.css('margin-top', '0');
6646 this.$tableContainer.css('padding-bottom', '0');
6647 this.$tableFooter.hide();
6648 } else {
6649 // Assign the correct sortable arrow
6650 this.getCaret();
6651 this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
6652 }
6653
6654 this.trigger('reset-view');
6655 }
6656 }, {
6657 key: "resetWidth",
6658 value: function resetWidth() {
6659 if (this.options.showHeader && this.options.height) {
6660 this.fitHeader();
6661 }
6662
6663 if (this.options.showFooter && !this.options.cardView) {
6664 this.fitFooter();
6665 }
6666 }
6667 }, {
6668 key: "showLoading",
6669 value: function showLoading() {
6670 this.$tableLoading.css('display', 'flex');
6671 }
6672 }, {
6673 key: "hideLoading",
6674 value: function hideLoading() {
6675 this.$tableLoading.css('display', 'none');
6676 }
6677 }, {
6678 key: "togglePagination",
6679 value: function togglePagination() {
6680 this.options.pagination = !this.options.pagination;
6681 var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
6682 var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
6683 this.$toolbar.find('button[name="paginationSwitch"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
6684 this.updatePagination();
6685 }
6686 }, {
6687 key: "toggleFullscreen",
6688 value: function toggleFullscreen() {
6689 this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
6690 this.resetView();
6691 }
6692 }, {
6693 key: "toggleView",
6694 value: function toggleView() {
6695 this.options.cardView = !this.options.cardView;
6696 this.initHeader();
6697 var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
6698 var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
6699 this.$toolbar.find('button[name="toggle"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
6700 this.initBody();
6701 this.trigger('toggle', this.options.cardView);
6702 }
6703 }, {
6704 key: "resetSearch",
6705 value: function resetSearch(text) {
6706 var $search = this.$toolbar.find('.search input');
6707 $search.val(text || '');
6708 this.onSearch({
6709 currentTarget: $search
6710 });
6711 }
6712 }, {
6713 key: "filterBy",
6714 value: function filterBy(columns, options) {
6715 this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $.extend(this.options.filterOptions, options);
6716 this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
6717 this.options.pageNumber = 1;
6718 this.initSearch();
6719 this.updatePagination();
6720 }
6721 }, {
6722 key: "scrollTo",
6723 value: function scrollTo(params) {
6724 if (typeof params === 'undefined') {
6725 return this.$tableBody.scrollTop();
6726 }
6727
6728 var options = {
6729 unit: 'px',
6730 value: 0
6731 };
6732
6733 if (_typeof(params) === 'object') {
6734 options = Object.assign(options, params);
6735 } else if (typeof params === 'string' && params === 'bottom') {
6736 options.value = this.$tableBody[0].scrollHeight;
6737 } else if (typeof params === 'string') {
6738 options.value = params;
6739 }
6740
6741 var scrollTo = options.value;
6742
6743 if (options.unit === 'rows') {
6744 scrollTo = 0;
6745 this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
6746 scrollTo += $(el).outerHeight(true);
6747 });
6748 }
6749
6750 this.$tableBody.scrollTop(scrollTo);
6751 }
6752 }, {
6753 key: "getScrollPosition",
6754 value: function getScrollPosition() {
6755 return this.scrollTo();
6756 }
6757 }, {
6758 key: "selectPage",
6759 value: function selectPage(page) {
6760 if (page > 0 && page <= this.options.totalPages) {
6761 this.options.pageNumber = page;
6762 this.updatePagination();
6763 }
6764 }
6765 }, {
6766 key: "prevPage",
6767 value: function prevPage() {
6768 if (this.options.pageNumber > 1) {
6769 this.options.pageNumber--;
6770 this.updatePagination();
6771 }
6772 }
6773 }, {
6774 key: "nextPage",
6775 value: function nextPage() {
6776 if (this.options.pageNumber < this.options.totalPages) {
6777 this.options.pageNumber++;
6778 this.updatePagination();
6779 }
6780 }
6781 }, {
6782 key: "toggleDetailView",
6783 value: function toggleDetailView(index, _columnDetailFormatter) {
6784 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
6785
6786 if ($tr.next().is('tr.detail-view')) {
6787 this.collapseRow(index);
6788 } else {
6789 this.expandRow(index, _columnDetailFormatter);
6790 }
6791
6792 this.resetView();
6793 }
6794 }, {
6795 key: "expandRow",
6796 value: function expandRow(index, _columnDetailFormatter) {
6797 var row = this.data[index];
6798 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
6799
6800 if ($tr.next().is('tr.detail-view')) {
6801 return;
6802 }
6803
6804 if (this.options.detailViewIcon) {
6805 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
6806 }
6807
6808 $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
6809 var $element = $tr.next().find('td');
6810 var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
6811 var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
6812
6813 if ($element.length === 1) {
6814 $element.append(content);
6815 }
6816
6817 this.trigger('expand-row', index, row, $element);
6818 }
6819 }, {
6820 key: "collapseRow",
6821 value: function collapseRow(index) {
6822 var row = this.data[index];
6823 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
6824
6825 if (!$tr.next().is('tr.detail-view')) {
6826 return;
6827 }
6828
6829 if (this.options.detailViewIcon) {
6830 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
6831 }
6832
6833 this.trigger('collapse-row', index, row, $tr.next());
6834 $tr.next().remove();
6835 }
6836 }, {
6837 key: "expandAllRows",
6838 value: function expandAllRows() {
6839 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
6840
6841 for (var i = 0; i < trs.length; i++) {
6842 this.expandRow($(trs[i]).data('index'));
6843 }
6844 }
6845 }, {
6846 key: "collapseAllRows",
6847 value: function collapseAllRows() {
6848 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
6849
6850 for (var i = 0; i < trs.length; i++) {
6851 this.collapseRow($(trs[i]).data('index'));
6852 }
6853 }
6854 }, {
6855 key: "updateColumnTitle",
6856 value: function updateColumnTitle(params) {
6857 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
6858 return;
6859 }
6860
6861 this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
6862
6863 if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
6864 var header = this.options.height !== undefined ? this.$tableHeader : this.$header;
6865 header.find('th[data-field]').each(function (i, el) {
6866 if ($(el).data('field') === params.field) {
6867 $($(el).find('.th-inner')[0]).text(params.title);
6868 return false;
6869 }
6870 });
6871 }
6872 }
6873 }, {
6874 key: "updateFormatText",
6875 value: function updateFormatText(formatName, text) {
6876 if (!/^format/.test(formatName) || !this.options[formatName]) {
6877 return;
6878 }
6879
6880 if (typeof text === 'string') {
6881 this.options[formatName] = function () {
6882 return text;
6883 };
6884 } else if (typeof text === 'function') {
6885 this.options[formatName] = text;
6886 }
6887
6888 this.initToolbar();
6889 this.initPagination();
6890 this.initBody();
6891 }
6892 }]);
6893
6894 return BootstrapTable;
6895 }();
6896
6897 BootstrapTable.VERSION = Constants.VERSION;
6898 BootstrapTable.DEFAULTS = Constants.DEFAULTS;
6899 BootstrapTable.LOCALES = Constants.LOCALES;
6900 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
6901 BootstrapTable.METHODS = Constants.METHODS;
6902 BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
6903 // =======================
6904
6905 $.BootstrapTable = BootstrapTable;
6906
6907 $.fn.bootstrapTable = function (option) {
6908 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
6909 args[_key3 - 1] = arguments[_key3];
6910 }
6911
6912 var value;
6913 this.each(function (i, el) {
6914 var data = $(el).data('bootstrap.table');
6915 var options = $.extend({}, BootstrapTable.DEFAULTS, $(el).data(), _typeof(option) === 'object' && option);
6916
6917 if (typeof option === 'string') {
6918 var _data2;
6919
6920 if (!Constants.METHODS.includes(option)) {
6921 throw new Error("Unknown method: ".concat(option));
6922 }
6923
6924 if (!data) {
6925 return;
6926 }
6927
6928 value = (_data2 = data)[option].apply(_data2, args);
6929
6930 if (option === 'destroy') {
6931 $(el).removeData('bootstrap.table');
6932 }
6933 }
6934
6935 if (!data) {
6936 $(el).data('bootstrap.table', data = new $.BootstrapTable(el, options));
6937 }
6938 });
6939 return typeof value === 'undefined' ? this : value;
6940 };
6941
6942 $.fn.bootstrapTable.Constructor = BootstrapTable;
6943 $.fn.bootstrapTable.theme = Constants.THEME;
6944 $.fn.bootstrapTable.VERSION = Constants.VERSION;
6945 $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
6946 $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
6947 $.fn.bootstrapTable.events = BootstrapTable.EVENTS;
6948 $.fn.bootstrapTable.locales = BootstrapTable.LOCALES;
6949 $.fn.bootstrapTable.methods = BootstrapTable.METHODS;
6950 $.fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
6951 // =======================
6952
6953 $(function () {
6954 $('[data-toggle="table"]').bootstrapTable();
6955 });
6956
6957 return BootstrapTable;
6958
6959}));