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