UNPKG

141 kBJavaScriptView Raw
1function _typeof(obj) {
2 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
3 _typeof = function (obj) {
4 return typeof obj;
5 };
6 } else {
7 _typeof = function (obj) {
8 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9 };
10 }
11
12 return _typeof(obj);
13}
14
15function _classCallCheck(instance, Constructor) {
16 if (!(instance instanceof Constructor)) {
17 throw new TypeError("Cannot call a class as a function");
18 }
19}
20
21function _defineProperties(target, props) {
22 for (var i = 0; i < props.length; i++) {
23 var descriptor = props[i];
24 descriptor.enumerable = descriptor.enumerable || false;
25 descriptor.configurable = true;
26 if ("value" in descriptor) descriptor.writable = true;
27 Object.defineProperty(target, descriptor.key, descriptor);
28 }
29}
30
31function _createClass(Constructor, protoProps, staticProps) {
32 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
33 if (staticProps) _defineProperties(Constructor, staticProps);
34 return Constructor;
35}
36
37function _slicedToArray(arr, i) {
38 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
39}
40
41function _toConsumableArray(arr) {
42 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
43}
44
45function _arrayWithoutHoles(arr) {
46 if (Array.isArray(arr)) {
47 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
48
49 return arr2;
50 }
51}
52
53function _arrayWithHoles(arr) {
54 if (Array.isArray(arr)) return arr;
55}
56
57function _iterableToArray(iter) {
58 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
59}
60
61function _iterableToArrayLimit(arr, i) {
62 if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
63 return;
64 }
65
66 var _arr = [];
67 var _n = true;
68 var _d = false;
69 var _e = undefined;
70
71 try {
72 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
73 _arr.push(_s.value);
74
75 if (i && _arr.length === i) break;
76 }
77 } catch (err) {
78 _d = true;
79 _e = err;
80 } finally {
81 try {
82 if (!_n && _i["return"] != null) _i["return"]();
83 } finally {
84 if (_d) throw _e;
85 }
86 }
87
88 return _arr;
89}
90
91function _nonIterableSpread() {
92 throw new TypeError("Invalid attempt to spread non-iterable instance");
93}
94
95function _nonIterableRest() {
96 throw new TypeError("Invalid attempt to destructure non-iterable instance");
97}
98
99var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
100
101function createCommonjsModule(fn, module) {
102 return module = { exports: {} }, fn(module, module.exports), module.exports;
103}
104
105var O = 'object';
106var check = function (it) {
107 return it && it.Math == Math && it;
108};
109
110// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
111var global_1 =
112 // eslint-disable-next-line no-undef
113 check(typeof globalThis == O && globalThis) ||
114 check(typeof window == O && window) ||
115 check(typeof self == O && self) ||
116 check(typeof commonjsGlobal == O && commonjsGlobal) ||
117 // eslint-disable-next-line no-new-func
118 Function('return this')();
119
120var fails = function (exec) {
121 try {
122 return !!exec();
123 } catch (error) {
124 return true;
125 }
126};
127
128// Thank's IE8 for his funny defineProperty
129var descriptors = !fails(function () {
130 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
131});
132
133var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
134var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
135
136// Nashorn ~ JDK8 bug
137var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
138
139// `Object.prototype.propertyIsEnumerable` method implementation
140// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
141var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
142 var descriptor = getOwnPropertyDescriptor(this, V);
143 return !!descriptor && descriptor.enumerable;
144} : nativePropertyIsEnumerable;
145
146var objectPropertyIsEnumerable = {
147 f: f
148};
149
150var createPropertyDescriptor = function (bitmap, value) {
151 return {
152 enumerable: !(bitmap & 1),
153 configurable: !(bitmap & 2),
154 writable: !(bitmap & 4),
155 value: value
156 };
157};
158
159var toString = {}.toString;
160
161var classofRaw = function (it) {
162 return toString.call(it).slice(8, -1);
163};
164
165var split = ''.split;
166
167// fallback for non-array-like ES3 and non-enumerable old V8 strings
168var indexedObject = fails(function () {
169 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
170 // eslint-disable-next-line no-prototype-builtins
171 return !Object('z').propertyIsEnumerable(0);
172}) ? function (it) {
173 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
174} : Object;
175
176// `RequireObjectCoercible` abstract operation
177// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
178var requireObjectCoercible = function (it) {
179 if (it == undefined) throw TypeError("Can't call method on " + it);
180 return it;
181};
182
183// toObject with fallback for non-array-like ES3 strings
184
185
186
187var toIndexedObject = function (it) {
188 return indexedObject(requireObjectCoercible(it));
189};
190
191var isObject = function (it) {
192 return typeof it === 'object' ? it !== null : typeof it === 'function';
193};
194
195// `ToPrimitive` abstract operation
196// https://tc39.github.io/ecma262/#sec-toprimitive
197// instead of the ES6 spec version, we didn't implement @@toPrimitive case
198// and the second argument - flag - preferred type is a string
199var toPrimitive = function (input, PREFERRED_STRING) {
200 if (!isObject(input)) return input;
201 var fn, val;
202 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
203 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
204 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
205 throw TypeError("Can't convert object to primitive value");
206};
207
208var hasOwnProperty = {}.hasOwnProperty;
209
210var has = function (it, key) {
211 return hasOwnProperty.call(it, key);
212};
213
214var document$1 = global_1.document;
215// typeof document.createElement is 'object' in old IE
216var EXISTS = isObject(document$1) && isObject(document$1.createElement);
217
218var documentCreateElement = function (it) {
219 return EXISTS ? document$1.createElement(it) : {};
220};
221
222// Thank's IE8 for his funny defineProperty
223var ie8DomDefine = !descriptors && !fails(function () {
224 return Object.defineProperty(documentCreateElement('div'), 'a', {
225 get: function () { return 7; }
226 }).a != 7;
227});
228
229var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
230
231// `Object.getOwnPropertyDescriptor` method
232// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
233var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
234 O = toIndexedObject(O);
235 P = toPrimitive(P, true);
236 if (ie8DomDefine) try {
237 return nativeGetOwnPropertyDescriptor(O, P);
238 } catch (error) { /* empty */ }
239 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
240};
241
242var objectGetOwnPropertyDescriptor = {
243 f: f$1
244};
245
246var anObject = function (it) {
247 if (!isObject(it)) {
248 throw TypeError(String(it) + ' is not an object');
249 } return it;
250};
251
252var nativeDefineProperty = Object.defineProperty;
253
254// `Object.defineProperty` method
255// https://tc39.github.io/ecma262/#sec-object.defineproperty
256var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
257 anObject(O);
258 P = toPrimitive(P, true);
259 anObject(Attributes);
260 if (ie8DomDefine) try {
261 return nativeDefineProperty(O, P, Attributes);
262 } catch (error) { /* empty */ }
263 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
264 if ('value' in Attributes) O[P] = Attributes.value;
265 return O;
266};
267
268var objectDefineProperty = {
269 f: f$2
270};
271
272var hide = descriptors ? function (object, key, value) {
273 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
274} : function (object, key, value) {
275 object[key] = value;
276 return object;
277};
278
279var setGlobal = function (key, value) {
280 try {
281 hide(global_1, key, value);
282 } catch (error) {
283 global_1[key] = value;
284 } return value;
285};
286
287var shared = createCommonjsModule(function (module) {
288var SHARED = '__core-js_shared__';
289var store = global_1[SHARED] || setGlobal(SHARED, {});
290
291(module.exports = function (key, value) {
292 return store[key] || (store[key] = value !== undefined ? value : {});
293})('versions', []).push({
294 version: '3.2.1',
295 mode: 'global',
296 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
297});
298});
299
300var functionToString = shared('native-function-to-string', Function.toString);
301
302var WeakMap = global_1.WeakMap;
303
304var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
305
306var id = 0;
307var postfix = Math.random();
308
309var uid = function (key) {
310 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
311};
312
313var keys = shared('keys');
314
315var sharedKey = function (key) {
316 return keys[key] || (keys[key] = uid(key));
317};
318
319var hiddenKeys = {};
320
321var WeakMap$1 = global_1.WeakMap;
322var set, get, has$1;
323
324var enforce = function (it) {
325 return has$1(it) ? get(it) : set(it, {});
326};
327
328var getterFor = function (TYPE) {
329 return function (it) {
330 var state;
331 if (!isObject(it) || (state = get(it)).type !== TYPE) {
332 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
333 } return state;
334 };
335};
336
337if (nativeWeakMap) {
338 var store = new WeakMap$1();
339 var wmget = store.get;
340 var wmhas = store.has;
341 var wmset = store.set;
342 set = function (it, metadata) {
343 wmset.call(store, it, metadata);
344 return metadata;
345 };
346 get = function (it) {
347 return wmget.call(store, it) || {};
348 };
349 has$1 = function (it) {
350 return wmhas.call(store, it);
351 };
352} else {
353 var STATE = sharedKey('state');
354 hiddenKeys[STATE] = true;
355 set = function (it, metadata) {
356 hide(it, STATE, metadata);
357 return metadata;
358 };
359 get = function (it) {
360 return has(it, STATE) ? it[STATE] : {};
361 };
362 has$1 = function (it) {
363 return has(it, STATE);
364 };
365}
366
367var internalState = {
368 set: set,
369 get: get,
370 has: has$1,
371 enforce: enforce,
372 getterFor: getterFor
373};
374
375var redefine = createCommonjsModule(function (module) {
376var getInternalState = internalState.get;
377var enforceInternalState = internalState.enforce;
378var TEMPLATE = String(functionToString).split('toString');
379
380shared('inspectSource', function (it) {
381 return functionToString.call(it);
382});
383
384(module.exports = function (O, key, value, options) {
385 var unsafe = options ? !!options.unsafe : false;
386 var simple = options ? !!options.enumerable : false;
387 var noTargetGet = options ? !!options.noTargetGet : false;
388 if (typeof value == 'function') {
389 if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
390 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
391 }
392 if (O === global_1) {
393 if (simple) O[key] = value;
394 else setGlobal(key, value);
395 return;
396 } else if (!unsafe) {
397 delete O[key];
398 } else if (!noTargetGet && O[key]) {
399 simple = true;
400 }
401 if (simple) O[key] = value;
402 else hide(O, key, value);
403// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
404})(Function.prototype, 'toString', function toString() {
405 return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
406});
407});
408
409var path = global_1;
410
411var aFunction = function (variable) {
412 return typeof variable == 'function' ? variable : undefined;
413};
414
415var getBuiltIn = function (namespace, method) {
416 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
417 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
418};
419
420var ceil = Math.ceil;
421var floor = Math.floor;
422
423// `ToInteger` abstract operation
424// https://tc39.github.io/ecma262/#sec-tointeger
425var toInteger = function (argument) {
426 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
427};
428
429var min = Math.min;
430
431// `ToLength` abstract operation
432// https://tc39.github.io/ecma262/#sec-tolength
433var toLength = function (argument) {
434 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
435};
436
437var max = Math.max;
438var min$1 = Math.min;
439
440// Helper for a popular repeating case of the spec:
441// Let integer be ? ToInteger(index).
442// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
443var toAbsoluteIndex = function (index, length) {
444 var integer = toInteger(index);
445 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
446};
447
448// `Array.prototype.{ indexOf, includes }` methods implementation
449var createMethod = function (IS_INCLUDES) {
450 return function ($this, el, fromIndex) {
451 var O = toIndexedObject($this);
452 var length = toLength(O.length);
453 var index = toAbsoluteIndex(fromIndex, length);
454 var value;
455 // Array#includes uses SameValueZero equality algorithm
456 // eslint-disable-next-line no-self-compare
457 if (IS_INCLUDES && el != el) while (length > index) {
458 value = O[index++];
459 // eslint-disable-next-line no-self-compare
460 if (value != value) return true;
461 // Array#indexOf ignores holes, Array#includes - not
462 } else for (;length > index; index++) {
463 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
464 } return !IS_INCLUDES && -1;
465 };
466};
467
468var arrayIncludes = {
469 // `Array.prototype.includes` method
470 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
471 includes: createMethod(true),
472 // `Array.prototype.indexOf` method
473 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
474 indexOf: createMethod(false)
475};
476
477var indexOf = arrayIncludes.indexOf;
478
479
480var objectKeysInternal = function (object, names) {
481 var O = toIndexedObject(object);
482 var i = 0;
483 var result = [];
484 var key;
485 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
486 // Don't enum bug & hidden keys
487 while (names.length > i) if (has(O, key = names[i++])) {
488 ~indexOf(result, key) || result.push(key);
489 }
490 return result;
491};
492
493// IE8- don't enum bug keys
494var enumBugKeys = [
495 'constructor',
496 'hasOwnProperty',
497 'isPrototypeOf',
498 'propertyIsEnumerable',
499 'toLocaleString',
500 'toString',
501 'valueOf'
502];
503
504var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
505
506// `Object.getOwnPropertyNames` method
507// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
508var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
509 return objectKeysInternal(O, hiddenKeys$1);
510};
511
512var objectGetOwnPropertyNames = {
513 f: f$3
514};
515
516var f$4 = Object.getOwnPropertySymbols;
517
518var objectGetOwnPropertySymbols = {
519 f: f$4
520};
521
522// all object keys, includes non-enumerable and symbols
523var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
524 var keys = objectGetOwnPropertyNames.f(anObject(it));
525 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
526 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
527};
528
529var copyConstructorProperties = function (target, source) {
530 var keys = ownKeys(source);
531 var defineProperty = objectDefineProperty.f;
532 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
533 for (var i = 0; i < keys.length; i++) {
534 var key = keys[i];
535 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
536 }
537};
538
539var replacement = /#|\.prototype\./;
540
541var isForced = function (feature, detection) {
542 var value = data[normalize(feature)];
543 return value == POLYFILL ? true
544 : value == NATIVE ? false
545 : typeof detection == 'function' ? fails(detection)
546 : !!detection;
547};
548
549var normalize = isForced.normalize = function (string) {
550 return String(string).replace(replacement, '.').toLowerCase();
551};
552
553var data = isForced.data = {};
554var NATIVE = isForced.NATIVE = 'N';
555var POLYFILL = isForced.POLYFILL = 'P';
556
557var isForced_1 = isForced;
558
559var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
560
561
562
563
564
565
566/*
567 options.target - name of the target object
568 options.global - target is the global object
569 options.stat - export as static methods of target
570 options.proto - export as prototype methods of target
571 options.real - real prototype method for the `pure` version
572 options.forced - export even if the native feature is available
573 options.bind - bind methods to the target, required for the `pure` version
574 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
575 options.unsafe - use the simple assignment of property instead of delete + defineProperty
576 options.sham - add a flag to not completely full polyfills
577 options.enumerable - export as enumerable property
578 options.noTargetGet - prevent calling a getter on target
579*/
580var _export = function (options, source) {
581 var TARGET = options.target;
582 var GLOBAL = options.global;
583 var STATIC = options.stat;
584 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
585 if (GLOBAL) {
586 target = global_1;
587 } else if (STATIC) {
588 target = global_1[TARGET] || setGlobal(TARGET, {});
589 } else {
590 target = (global_1[TARGET] || {}).prototype;
591 }
592 if (target) for (key in source) {
593 sourceProperty = source[key];
594 if (options.noTargetGet) {
595 descriptor = getOwnPropertyDescriptor$1(target, key);
596 targetProperty = descriptor && descriptor.value;
597 } else targetProperty = target[key];
598 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
599 // contained in target
600 if (!FORCED && targetProperty !== undefined) {
601 if (typeof sourceProperty === typeof targetProperty) continue;
602 copyConstructorProperties(sourceProperty, targetProperty);
603 }
604 // add a flag to not completely full polyfills
605 if (options.sham || (targetProperty && targetProperty.sham)) {
606 hide(sourceProperty, 'sham', true);
607 }
608 // extend global
609 redefine(target, key, sourceProperty, options);
610 }
611};
612
613var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
614 // Chrome 38 Symbol has incorrect toString conversion
615 // eslint-disable-next-line no-undef
616 return !String(Symbol());
617});
618
619var Symbol$1 = global_1.Symbol;
620var store$1 = shared('wks');
621
622var wellKnownSymbol = function (name) {
623 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
624 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
625};
626
627// `Object.keys` method
628// https://tc39.github.io/ecma262/#sec-object.keys
629var objectKeys = Object.keys || function keys(O) {
630 return objectKeysInternal(O, enumBugKeys);
631};
632
633// `Object.defineProperties` method
634// https://tc39.github.io/ecma262/#sec-object.defineproperties
635var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
636 anObject(O);
637 var keys = objectKeys(Properties);
638 var length = keys.length;
639 var index = 0;
640 var key;
641 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
642 return O;
643};
644
645var html = getBuiltIn('document', 'documentElement');
646
647var IE_PROTO = sharedKey('IE_PROTO');
648
649var PROTOTYPE = 'prototype';
650var Empty = function () { /* empty */ };
651
652// Create object with fake `null` prototype: use iframe Object with cleared prototype
653var createDict = function () {
654 // Thrash, waste and sodomy: IE GC bug
655 var iframe = documentCreateElement('iframe');
656 var length = enumBugKeys.length;
657 var lt = '<';
658 var script = 'script';
659 var gt = '>';
660 var js = 'java' + script + ':';
661 var iframeDocument;
662 iframe.style.display = 'none';
663 html.appendChild(iframe);
664 iframe.src = String(js);
665 iframeDocument = iframe.contentWindow.document;
666 iframeDocument.open();
667 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
668 iframeDocument.close();
669 createDict = iframeDocument.F;
670 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
671 return createDict();
672};
673
674// `Object.create` method
675// https://tc39.github.io/ecma262/#sec-object.create
676var objectCreate = Object.create || function create(O, Properties) {
677 var result;
678 if (O !== null) {
679 Empty[PROTOTYPE] = anObject(O);
680 result = new Empty();
681 Empty[PROTOTYPE] = null;
682 // add "__proto__" for Object.getPrototypeOf polyfill
683 result[IE_PROTO] = O;
684 } else result = createDict();
685 return Properties === undefined ? result : objectDefineProperties(result, Properties);
686};
687
688hiddenKeys[IE_PROTO] = true;
689
690var UNSCOPABLES = wellKnownSymbol('unscopables');
691var ArrayPrototype = Array.prototype;
692
693// Array.prototype[@@unscopables]
694// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
695if (ArrayPrototype[UNSCOPABLES] == undefined) {
696 hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
697}
698
699// add a key to Array.prototype[@@unscopables]
700var addToUnscopables = function (key) {
701 ArrayPrototype[UNSCOPABLES][key] = true;
702};
703
704var $includes = arrayIncludes.includes;
705
706
707// `Array.prototype.includes` method
708// https://tc39.github.io/ecma262/#sec-array.prototype.includes
709_export({ target: 'Array', proto: true }, {
710 includes: function includes(el /* , fromIndex = 0 */) {
711 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
712 }
713});
714
715// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
716addToUnscopables('includes');
717
718// `ToObject` abstract operation
719// https://tc39.github.io/ecma262/#sec-toobject
720var toObject = function (argument) {
721 return Object(requireObjectCoercible(argument));
722};
723
724var nativeAssign = Object.assign;
725
726// `Object.assign` method
727// https://tc39.github.io/ecma262/#sec-object.assign
728// should work with symbols and should have deterministic property order (V8 bug)
729var objectAssign = !nativeAssign || fails(function () {
730 var A = {};
731 var B = {};
732 // eslint-disable-next-line no-undef
733 var symbol = Symbol();
734 var alphabet = 'abcdefghijklmnopqrst';
735 A[symbol] = 7;
736 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
737 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
738}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
739 var T = toObject(target);
740 var argumentsLength = arguments.length;
741 var index = 1;
742 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
743 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
744 while (argumentsLength > index) {
745 var S = indexedObject(arguments[index++]);
746 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
747 var length = keys.length;
748 var j = 0;
749 var key;
750 while (length > j) {
751 key = keys[j++];
752 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
753 }
754 } return T;
755} : nativeAssign;
756
757// `Object.assign` method
758// https://tc39.github.io/ecma262/#sec-object.assign
759_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
760 assign: objectAssign
761});
762
763var MATCH = wellKnownSymbol('match');
764
765// `IsRegExp` abstract operation
766// https://tc39.github.io/ecma262/#sec-isregexp
767var isRegexp = function (it) {
768 var isRegExp;
769 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
770};
771
772var notARegexp = function (it) {
773 if (isRegexp(it)) {
774 throw TypeError("The method doesn't accept regular expressions");
775 } return it;
776};
777
778var MATCH$1 = wellKnownSymbol('match');
779
780var correctIsRegexpLogic = function (METHOD_NAME) {
781 var regexp = /./;
782 try {
783 '/./'[METHOD_NAME](regexp);
784 } catch (e) {
785 try {
786 regexp[MATCH$1] = false;
787 return '/./'[METHOD_NAME](regexp);
788 } catch (f) { /* empty */ }
789 } return false;
790};
791
792// `String.prototype.includes` method
793// https://tc39.github.io/ecma262/#sec-string.prototype.includes
794_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
795 includes: function includes(searchString /* , position = 0 */) {
796 return !!~String(requireObjectCoercible(this))
797 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
798 }
799});
800
801// a string of all valid unicode whitespaces
802// eslint-disable-next-line max-len
803var 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';
804
805var whitespace = '[' + whitespaces + ']';
806var ltrim = RegExp('^' + whitespace + whitespace + '*');
807var rtrim = RegExp(whitespace + whitespace + '*$');
808
809// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
810var createMethod$1 = function (TYPE) {
811 return function ($this) {
812 var string = String(requireObjectCoercible($this));
813 if (TYPE & 1) string = string.replace(ltrim, '');
814 if (TYPE & 2) string = string.replace(rtrim, '');
815 return string;
816 };
817};
818
819var stringTrim = {
820 // `String.prototype.{ trimLeft, trimStart }` methods
821 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
822 start: createMethod$1(1),
823 // `String.prototype.{ trimRight, trimEnd }` methods
824 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
825 end: createMethod$1(2),
826 // `String.prototype.trim` method
827 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
828 trim: createMethod$1(3)
829};
830
831var non = '\u200B\u0085\u180E';
832
833// check that a method works with the correct list
834// of whitespaces and has a correct name
835var forcedStringTrimMethod = function (METHOD_NAME) {
836 return fails(function () {
837 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
838 });
839};
840
841var $trim = stringTrim.trim;
842
843
844// `String.prototype.trim` method
845// https://tc39.github.io/ecma262/#sec-string.prototype.trim
846_export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
847 trim: function trim() {
848 return $trim(this);
849 }
850});
851
852var VERSION = '1.5.2';
853var BLOCK_ROWS = 50;
854var CLUSTER_BLOCKS = 4;
855var DEFAULTS = {
856 name: '',
857 placeholder: '',
858 data: undefined,
859 locale: undefined,
860 selectAll: true,
861 single: undefined,
862 singleRadio: false,
863 multiple: false,
864 hideOptgroupCheckboxes: false,
865 multipleWidth: 80,
866 width: undefined,
867 dropWidth: undefined,
868 maxHeight: 250,
869 maxHeightUnit: 'px',
870 position: 'bottom',
871 displayValues: false,
872 displayTitle: false,
873 displayDelimiter: ', ',
874 minimumCountSelected: 3,
875 ellipsis: false,
876 isOpen: false,
877 keepOpen: false,
878 openOnHover: false,
879 container: null,
880 filter: false,
881 filterGroup: false,
882 filterPlaceholder: '',
883 filterAcceptOnEnter: false,
884 filterByDataLength: undefined,
885 customFilter: function customFilter(label, text) {
886 // originalLabel, originalText
887 return label.includes(text);
888 },
889 showClear: false,
890 animate: undefined,
891 styler: function styler() {
892 return false;
893 },
894 textTemplate: function textTemplate($elm) {
895 return $elm[0].innerHTML.trim();
896 },
897 labelTemplate: function labelTemplate($elm) {
898 return $elm[0].getAttribute('label');
899 },
900 onOpen: function onOpen() {
901 return false;
902 },
903 onClose: function onClose() {
904 return false;
905 },
906 onCheckAll: function onCheckAll() {
907 return false;
908 },
909 onUncheckAll: function onUncheckAll() {
910 return false;
911 },
912 onFocus: function onFocus() {
913 return false;
914 },
915 onBlur: function onBlur() {
916 return false;
917 },
918 onOptgroupClick: function onOptgroupClick() {
919 return false;
920 },
921 onClick: function onClick() {
922 return false;
923 },
924 onFilter: function onFilter() {
925 return false;
926 },
927 onClear: function onClear() {
928 return false;
929 },
930 onAfterCreate: function onAfterCreate() {
931 return false;
932 }
933};
934var EN = {
935 formatSelectAll: function formatSelectAll() {
936 return '[Select all]';
937 },
938 formatAllSelected: function formatAllSelected() {
939 return 'All selected';
940 },
941 formatCountSelected: function formatCountSelected(count, total) {
942 return count + ' of ' + total + ' selected';
943 },
944 formatNoMatchesFound: function formatNoMatchesFound() {
945 return 'No matches found';
946 }
947};
948var METHODS = ['getOptions', 'refreshOptions', 'getSelects', 'setSelects', 'enable', 'disable', 'open', 'close', 'check', 'uncheck', 'checkAll', 'uncheckAll', 'checkInvert', 'focus', 'blur', 'refresh', 'destroy'];
949Object.assign(DEFAULTS, EN);
950var Constants = {
951 VERSION: VERSION,
952 BLOCK_ROWS: BLOCK_ROWS,
953 CLUSTER_BLOCKS: CLUSTER_BLOCKS,
954 DEFAULTS: DEFAULTS,
955 METHODS: METHODS,
956 LOCALES: {
957 en: EN,
958 'en-US': EN
959 }
960};
961
962// `IsArray` abstract operation
963// https://tc39.github.io/ecma262/#sec-isarray
964var isArray = Array.isArray || function isArray(arg) {
965 return classofRaw(arg) == 'Array';
966};
967
968var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
969
970var toString$1 = {}.toString;
971
972var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
973 ? Object.getOwnPropertyNames(window) : [];
974
975var getWindowNames = function (it) {
976 try {
977 return nativeGetOwnPropertyNames(it);
978 } catch (error) {
979 return windowNames.slice();
980 }
981};
982
983// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
984var f$5 = function getOwnPropertyNames(it) {
985 return windowNames && toString$1.call(it) == '[object Window]'
986 ? getWindowNames(it)
987 : nativeGetOwnPropertyNames(toIndexedObject(it));
988};
989
990var objectGetOwnPropertyNamesExternal = {
991 f: f$5
992};
993
994var f$6 = wellKnownSymbol;
995
996var wrappedWellKnownSymbol = {
997 f: f$6
998};
999
1000var defineProperty = objectDefineProperty.f;
1001
1002var defineWellKnownSymbol = function (NAME) {
1003 var Symbol = path.Symbol || (path.Symbol = {});
1004 if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
1005 value: wrappedWellKnownSymbol.f(NAME)
1006 });
1007};
1008
1009var defineProperty$1 = objectDefineProperty.f;
1010
1011
1012
1013var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1014
1015var setToStringTag = function (it, TAG, STATIC) {
1016 if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
1017 defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });
1018 }
1019};
1020
1021var aFunction$1 = function (it) {
1022 if (typeof it != 'function') {
1023 throw TypeError(String(it) + ' is not a function');
1024 } return it;
1025};
1026
1027// optional / simple context binding
1028var bindContext = function (fn, that, length) {
1029 aFunction$1(fn);
1030 if (that === undefined) return fn;
1031 switch (length) {
1032 case 0: return function () {
1033 return fn.call(that);
1034 };
1035 case 1: return function (a) {
1036 return fn.call(that, a);
1037 };
1038 case 2: return function (a, b) {
1039 return fn.call(that, a, b);
1040 };
1041 case 3: return function (a, b, c) {
1042 return fn.call(that, a, b, c);
1043 };
1044 }
1045 return function (/* ...args */) {
1046 return fn.apply(that, arguments);
1047 };
1048};
1049
1050var SPECIES = wellKnownSymbol('species');
1051
1052// `ArraySpeciesCreate` abstract operation
1053// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
1054var arraySpeciesCreate = function (originalArray, length) {
1055 var C;
1056 if (isArray(originalArray)) {
1057 C = originalArray.constructor;
1058 // cross-realm fallback
1059 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
1060 else if (isObject(C)) {
1061 C = C[SPECIES];
1062 if (C === null) C = undefined;
1063 }
1064 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
1065};
1066
1067var push = [].push;
1068
1069// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
1070var createMethod$2 = function (TYPE) {
1071 var IS_MAP = TYPE == 1;
1072 var IS_FILTER = TYPE == 2;
1073 var IS_SOME = TYPE == 3;
1074 var IS_EVERY = TYPE == 4;
1075 var IS_FIND_INDEX = TYPE == 6;
1076 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
1077 return function ($this, callbackfn, that, specificCreate) {
1078 var O = toObject($this);
1079 var self = indexedObject(O);
1080 var boundFunction = bindContext(callbackfn, that, 3);
1081 var length = toLength(self.length);
1082 var index = 0;
1083 var create = specificCreate || arraySpeciesCreate;
1084 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
1085 var value, result;
1086 for (;length > index; index++) if (NO_HOLES || index in self) {
1087 value = self[index];
1088 result = boundFunction(value, index, O);
1089 if (TYPE) {
1090 if (IS_MAP) target[index] = result; // map
1091 else if (result) switch (TYPE) {
1092 case 3: return true; // some
1093 case 5: return value; // find
1094 case 6: return index; // findIndex
1095 case 2: push.call(target, value); // filter
1096 } else if (IS_EVERY) return false; // every
1097 }
1098 }
1099 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
1100 };
1101};
1102
1103var arrayIteration = {
1104 // `Array.prototype.forEach` method
1105 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1106 forEach: createMethod$2(0),
1107 // `Array.prototype.map` method
1108 // https://tc39.github.io/ecma262/#sec-array.prototype.map
1109 map: createMethod$2(1),
1110 // `Array.prototype.filter` method
1111 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
1112 filter: createMethod$2(2),
1113 // `Array.prototype.some` method
1114 // https://tc39.github.io/ecma262/#sec-array.prototype.some
1115 some: createMethod$2(3),
1116 // `Array.prototype.every` method
1117 // https://tc39.github.io/ecma262/#sec-array.prototype.every
1118 every: createMethod$2(4),
1119 // `Array.prototype.find` method
1120 // https://tc39.github.io/ecma262/#sec-array.prototype.find
1121 find: createMethod$2(5),
1122 // `Array.prototype.findIndex` method
1123 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
1124 findIndex: createMethod$2(6)
1125};
1126
1127var $forEach = arrayIteration.forEach;
1128
1129var HIDDEN = sharedKey('hidden');
1130var SYMBOL = 'Symbol';
1131var PROTOTYPE$1 = 'prototype';
1132var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
1133var setInternalState = internalState.set;
1134var getInternalState = internalState.getterFor(SYMBOL);
1135var ObjectPrototype = Object[PROTOTYPE$1];
1136var $Symbol = global_1.Symbol;
1137var JSON = global_1.JSON;
1138var nativeJSONStringify = JSON && JSON.stringify;
1139var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1140var nativeDefineProperty$1 = objectDefineProperty.f;
1141var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
1142var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
1143var AllSymbols = shared('symbols');
1144var ObjectPrototypeSymbols = shared('op-symbols');
1145var StringToSymbolRegistry = shared('string-to-symbol-registry');
1146var SymbolToStringRegistry = shared('symbol-to-string-registry');
1147var WellKnownSymbolsStore = shared('wks');
1148var QObject = global_1.QObject;
1149// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
1150var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
1151
1152// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
1153var setSymbolDescriptor = descriptors && fails(function () {
1154 return objectCreate(nativeDefineProperty$1({}, 'a', {
1155 get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
1156 })).a != 7;
1157}) ? function (O, P, Attributes) {
1158 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
1159 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
1160 nativeDefineProperty$1(O, P, Attributes);
1161 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
1162 nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
1163 }
1164} : nativeDefineProperty$1;
1165
1166var wrap = function (tag, description) {
1167 var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
1168 setInternalState(symbol, {
1169 type: SYMBOL,
1170 tag: tag,
1171 description: description
1172 });
1173 if (!descriptors) symbol.description = description;
1174 return symbol;
1175};
1176
1177var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (it) {
1178 return typeof it == 'symbol';
1179} : function (it) {
1180 return Object(it) instanceof $Symbol;
1181};
1182
1183var $defineProperty = function defineProperty(O, P, Attributes) {
1184 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
1185 anObject(O);
1186 var key = toPrimitive(P, true);
1187 anObject(Attributes);
1188 if (has(AllSymbols, key)) {
1189 if (!Attributes.enumerable) {
1190 if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
1191 O[HIDDEN][key] = true;
1192 } else {
1193 if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
1194 Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
1195 } return setSymbolDescriptor(O, key, Attributes);
1196 } return nativeDefineProperty$1(O, key, Attributes);
1197};
1198
1199var $defineProperties = function defineProperties(O, Properties) {
1200 anObject(O);
1201 var properties = toIndexedObject(Properties);
1202 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
1203 $forEach(keys, function (key) {
1204 if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
1205 });
1206 return O;
1207};
1208
1209var $create = function create(O, Properties) {
1210 return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
1211};
1212
1213var $propertyIsEnumerable = function propertyIsEnumerable(V) {
1214 var P = toPrimitive(V, true);
1215 var enumerable = nativePropertyIsEnumerable$1.call(this, P);
1216 if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
1217 return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
1218};
1219
1220var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
1221 var it = toIndexedObject(O);
1222 var key = toPrimitive(P, true);
1223 if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
1224 var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
1225 if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
1226 descriptor.enumerable = true;
1227 }
1228 return descriptor;
1229};
1230
1231var $getOwnPropertyNames = function getOwnPropertyNames(O) {
1232 var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
1233 var result = [];
1234 $forEach(names, function (key) {
1235 if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
1236 });
1237 return result;
1238};
1239
1240var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
1241 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
1242 var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
1243 var result = [];
1244 $forEach(names, function (key) {
1245 if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
1246 result.push(AllSymbols[key]);
1247 }
1248 });
1249 return result;
1250};
1251
1252// `Symbol` constructor
1253// https://tc39.github.io/ecma262/#sec-symbol-constructor
1254if (!nativeSymbol) {
1255 $Symbol = function Symbol() {
1256 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
1257 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
1258 var tag = uid(description);
1259 var setter = function (value) {
1260 if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
1261 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
1262 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
1263 };
1264 if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
1265 return wrap(tag, description);
1266 };
1267
1268 redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
1269 return getInternalState(this).tag;
1270 });
1271
1272 objectPropertyIsEnumerable.f = $propertyIsEnumerable;
1273 objectDefineProperty.f = $defineProperty;
1274 objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
1275 objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
1276 objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
1277
1278 if (descriptors) {
1279 // https://github.com/tc39/proposal-Symbol-description
1280 nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
1281 configurable: true,
1282 get: function description() {
1283 return getInternalState(this).description;
1284 }
1285 });
1286 {
1287 redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
1288 }
1289 }
1290
1291 wrappedWellKnownSymbol.f = function (name) {
1292 return wrap(wellKnownSymbol(name), name);
1293 };
1294}
1295
1296_export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
1297 Symbol: $Symbol
1298});
1299
1300$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
1301 defineWellKnownSymbol(name);
1302});
1303
1304_export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
1305 // `Symbol.for` method
1306 // https://tc39.github.io/ecma262/#sec-symbol.for
1307 'for': function (key) {
1308 var string = String(key);
1309 if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
1310 var symbol = $Symbol(string);
1311 StringToSymbolRegistry[string] = symbol;
1312 SymbolToStringRegistry[symbol] = string;
1313 return symbol;
1314 },
1315 // `Symbol.keyFor` method
1316 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
1317 keyFor: function keyFor(sym) {
1318 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
1319 if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
1320 },
1321 useSetter: function () { USE_SETTER = true; },
1322 useSimple: function () { USE_SETTER = false; }
1323});
1324
1325_export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
1326 // `Object.create` method
1327 // https://tc39.github.io/ecma262/#sec-object.create
1328 create: $create,
1329 // `Object.defineProperty` method
1330 // https://tc39.github.io/ecma262/#sec-object.defineproperty
1331 defineProperty: $defineProperty,
1332 // `Object.defineProperties` method
1333 // https://tc39.github.io/ecma262/#sec-object.defineproperties
1334 defineProperties: $defineProperties,
1335 // `Object.getOwnPropertyDescriptor` method
1336 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
1337 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
1338});
1339
1340_export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
1341 // `Object.getOwnPropertyNames` method
1342 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
1343 getOwnPropertyNames: $getOwnPropertyNames,
1344 // `Object.getOwnPropertySymbols` method
1345 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
1346 getOwnPropertySymbols: $getOwnPropertySymbols
1347});
1348
1349// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
1350// https://bugs.chromium.org/p/v8/issues/detail?id=3443
1351_export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
1352 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
1353 return objectGetOwnPropertySymbols.f(toObject(it));
1354 }
1355});
1356
1357// `JSON.stringify` method behavior with symbols
1358// https://tc39.github.io/ecma262/#sec-json.stringify
1359JSON && _export({ target: 'JSON', stat: true, forced: !nativeSymbol || fails(function () {
1360 var symbol = $Symbol();
1361 // MS Edge converts symbol values to JSON as {}
1362 return nativeJSONStringify([symbol]) != '[null]'
1363 // WebKit converts symbol values to JSON as null
1364 || nativeJSONStringify({ a: symbol }) != '{}'
1365 // V8 throws on boxed symbols
1366 || nativeJSONStringify(Object(symbol)) != '{}';
1367}) }, {
1368 stringify: function stringify(it) {
1369 var args = [it];
1370 var index = 1;
1371 var replacer, $replacer;
1372 while (arguments.length > index) args.push(arguments[index++]);
1373 $replacer = replacer = args[1];
1374 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
1375 if (!isArray(replacer)) replacer = function (key, value) {
1376 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
1377 if (!isSymbol(value)) return value;
1378 };
1379 args[1] = replacer;
1380 return nativeJSONStringify.apply(JSON, args);
1381 }
1382});
1383
1384// `Symbol.prototype[@@toPrimitive]` method
1385// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
1386if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) hide($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
1387// `Symbol.prototype[@@toStringTag]` property
1388// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
1389setToStringTag($Symbol, SYMBOL);
1390
1391hiddenKeys[HIDDEN] = true;
1392
1393var defineProperty$2 = objectDefineProperty.f;
1394
1395
1396var NativeSymbol = global_1.Symbol;
1397
1398if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
1399 // Safari 12 bug
1400 NativeSymbol().description !== undefined
1401)) {
1402 var EmptyStringDescriptionStore = {};
1403 // wrap Symbol constructor for correct work with undefined description
1404 var SymbolWrapper = function Symbol() {
1405 var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
1406 var result = this instanceof SymbolWrapper
1407 ? new NativeSymbol(description)
1408 // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1409 : description === undefined ? NativeSymbol() : NativeSymbol(description);
1410 if (description === '') EmptyStringDescriptionStore[result] = true;
1411 return result;
1412 };
1413 copyConstructorProperties(SymbolWrapper, NativeSymbol);
1414 var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
1415 symbolPrototype.constructor = SymbolWrapper;
1416
1417 var symbolToString = symbolPrototype.toString;
1418 var native = String(NativeSymbol('test')) == 'Symbol(test)';
1419 var regexp = /^Symbol\((.*)\)[^)]+$/;
1420 defineProperty$2(symbolPrototype, 'description', {
1421 configurable: true,
1422 get: function description() {
1423 var symbol = isObject(this) ? this.valueOf() : this;
1424 var string = symbolToString.call(symbol);
1425 if (has(EmptyStringDescriptionStore, symbol)) return '';
1426 var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
1427 return desc === '' ? undefined : desc;
1428 }
1429 });
1430
1431 _export({ global: true, forced: true }, {
1432 Symbol: SymbolWrapper
1433 });
1434}
1435
1436// `Symbol.iterator` well-known symbol
1437// https://tc39.github.io/ecma262/#sec-symbol.iterator
1438defineWellKnownSymbol('iterator');
1439
1440var createProperty = function (object, key, value) {
1441 var propertyKey = toPrimitive(key);
1442 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1443 else object[propertyKey] = value;
1444};
1445
1446var SPECIES$1 = wellKnownSymbol('species');
1447
1448var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1449 return !fails(function () {
1450 var array = [];
1451 var constructor = array.constructor = {};
1452 constructor[SPECIES$1] = function () {
1453 return { foo: 1 };
1454 };
1455 return array[METHOD_NAME](Boolean).foo !== 1;
1456 });
1457};
1458
1459var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1460var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1461var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
1462
1463var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
1464 var array = [];
1465 array[IS_CONCAT_SPREADABLE] = false;
1466 return array.concat()[0] !== array;
1467});
1468
1469var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
1470
1471var isConcatSpreadable = function (O) {
1472 if (!isObject(O)) return false;
1473 var spreadable = O[IS_CONCAT_SPREADABLE];
1474 return spreadable !== undefined ? !!spreadable : isArray(O);
1475};
1476
1477var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1478
1479// `Array.prototype.concat` method
1480// https://tc39.github.io/ecma262/#sec-array.prototype.concat
1481// with adding support of @@isConcatSpreadable and @@species
1482_export({ target: 'Array', proto: true, forced: FORCED }, {
1483 concat: function concat(arg) { // eslint-disable-line no-unused-vars
1484 var O = toObject(this);
1485 var A = arraySpeciesCreate(O, 0);
1486 var n = 0;
1487 var i, k, length, len, E;
1488 for (i = -1, length = arguments.length; i < length; i++) {
1489 E = i === -1 ? O : arguments[i];
1490 if (isConcatSpreadable(E)) {
1491 len = toLength(E.length);
1492 if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1493 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1494 } else {
1495 if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1496 createProperty(A, n++, E);
1497 }
1498 }
1499 A.length = n;
1500 return A;
1501 }
1502});
1503
1504var $filter = arrayIteration.filter;
1505
1506
1507// `Array.prototype.filter` method
1508// https://tc39.github.io/ecma262/#sec-array.prototype.filter
1509// with adding support of @@species
1510_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
1511 filter: function filter(callbackfn /* , thisArg */) {
1512 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1513 }
1514});
1515
1516var $find = arrayIteration.find;
1517
1518
1519var FIND = 'find';
1520var SKIPS_HOLES = true;
1521
1522// Shouldn't skip holes
1523if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
1524
1525// `Array.prototype.find` method
1526// https://tc39.github.io/ecma262/#sec-array.prototype.find
1527_export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
1528 find: function find(callbackfn /* , that = undefined */) {
1529 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1530 }
1531});
1532
1533// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1534addToUnscopables(FIND);
1535
1536var correctPrototypeGetter = !fails(function () {
1537 function F() { /* empty */ }
1538 F.prototype.constructor = null;
1539 return Object.getPrototypeOf(new F()) !== F.prototype;
1540});
1541
1542var IE_PROTO$1 = sharedKey('IE_PROTO');
1543var ObjectPrototype$1 = Object.prototype;
1544
1545// `Object.getPrototypeOf` method
1546// https://tc39.github.io/ecma262/#sec-object.getprototypeof
1547var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
1548 O = toObject(O);
1549 if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
1550 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
1551 return O.constructor.prototype;
1552 } return O instanceof Object ? ObjectPrototype$1 : null;
1553};
1554
1555var ITERATOR = wellKnownSymbol('iterator');
1556var BUGGY_SAFARI_ITERATORS = false;
1557
1558var returnThis = function () { return this; };
1559
1560// `%IteratorPrototype%` object
1561// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
1562var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
1563
1564if ([].keys) {
1565 arrayIterator = [].keys();
1566 // Safari 8 has buggy iterators w/o `next`
1567 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
1568 else {
1569 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
1570 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
1571 }
1572}
1573
1574if (IteratorPrototype == undefined) IteratorPrototype = {};
1575
1576// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
1577if ( !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
1578
1579var iteratorsCore = {
1580 IteratorPrototype: IteratorPrototype,
1581 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
1582};
1583
1584var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1585
1586var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
1587 var TO_STRING_TAG = NAME + ' Iterator';
1588 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
1589 setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
1590 return IteratorConstructor;
1591};
1592
1593var aPossiblePrototype = function (it) {
1594 if (!isObject(it) && it !== null) {
1595 throw TypeError("Can't set " + String(it) + ' as a prototype');
1596 } return it;
1597};
1598
1599// `Object.setPrototypeOf` method
1600// https://tc39.github.io/ecma262/#sec-object.setprototypeof
1601// Works with __proto__ only. Old v8 can't work with null proto objects.
1602/* eslint-disable no-proto */
1603var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1604 var CORRECT_SETTER = false;
1605 var test = {};
1606 var setter;
1607 try {
1608 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
1609 setter.call(test, []);
1610 CORRECT_SETTER = test instanceof Array;
1611 } catch (error) { /* empty */ }
1612 return function setPrototypeOf(O, proto) {
1613 anObject(O);
1614 aPossiblePrototype(proto);
1615 if (CORRECT_SETTER) setter.call(O, proto);
1616 else O.__proto__ = proto;
1617 return O;
1618 };
1619}() : undefined);
1620
1621var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
1622var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
1623var ITERATOR$1 = wellKnownSymbol('iterator');
1624var KEYS = 'keys';
1625var VALUES = 'values';
1626var ENTRIES = 'entries';
1627
1628var returnThis$1 = function () { return this; };
1629
1630var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1631 createIteratorConstructor(IteratorConstructor, NAME, next);
1632
1633 var getIterationMethod = function (KIND) {
1634 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1635 if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
1636 switch (KIND) {
1637 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1638 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1639 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1640 } return function () { return new IteratorConstructor(this); };
1641 };
1642
1643 var TO_STRING_TAG = NAME + ' Iterator';
1644 var INCORRECT_VALUES_NAME = false;
1645 var IterablePrototype = Iterable.prototype;
1646 var nativeIterator = IterablePrototype[ITERATOR$1]
1647 || IterablePrototype['@@iterator']
1648 || DEFAULT && IterablePrototype[DEFAULT];
1649 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
1650 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1651 var CurrentIteratorPrototype, methods, KEY;
1652
1653 // fix native
1654 if (anyNativeIterator) {
1655 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
1656 if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
1657 if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
1658 if (objectSetPrototypeOf) {
1659 objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
1660 } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
1661 hide(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
1662 }
1663 }
1664 // Set @@toStringTag to native iterators
1665 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
1666 }
1667 }
1668
1669 // fix Array#{values, @@iterator}.name in V8 / FF
1670 if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1671 INCORRECT_VALUES_NAME = true;
1672 defaultIterator = function values() { return nativeIterator.call(this); };
1673 }
1674
1675 // define iterator
1676 if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
1677 hide(IterablePrototype, ITERATOR$1, defaultIterator);
1678 }
1679
1680 // export additional methods
1681 if (DEFAULT) {
1682 methods = {
1683 values: getIterationMethod(VALUES),
1684 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1685 entries: getIterationMethod(ENTRIES)
1686 };
1687 if (FORCED) for (KEY in methods) {
1688 if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1689 redefine(IterablePrototype, KEY, methods[KEY]);
1690 }
1691 } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
1692 }
1693
1694 return methods;
1695};
1696
1697var ARRAY_ITERATOR = 'Array Iterator';
1698var setInternalState$1 = internalState.set;
1699var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
1700
1701// `Array.prototype.entries` method
1702// https://tc39.github.io/ecma262/#sec-array.prototype.entries
1703// `Array.prototype.keys` method
1704// https://tc39.github.io/ecma262/#sec-array.prototype.keys
1705// `Array.prototype.values` method
1706// https://tc39.github.io/ecma262/#sec-array.prototype.values
1707// `Array.prototype[@@iterator]` method
1708// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
1709// `CreateArrayIterator` internal method
1710// https://tc39.github.io/ecma262/#sec-createarrayiterator
1711var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1712 setInternalState$1(this, {
1713 type: ARRAY_ITERATOR,
1714 target: toIndexedObject(iterated), // target
1715 index: 0, // next index
1716 kind: kind // kind
1717 });
1718// `%ArrayIteratorPrototype%.next` method
1719// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
1720}, function () {
1721 var state = getInternalState$1(this);
1722 var target = state.target;
1723 var kind = state.kind;
1724 var index = state.index++;
1725 if (!target || index >= target.length) {
1726 state.target = undefined;
1727 return { value: undefined, done: true };
1728 }
1729 if (kind == 'keys') return { value: index, done: false };
1730 if (kind == 'values') return { value: target[index], done: false };
1731 return { value: [index, target[index]], done: false };
1732}, 'values');
1733
1734// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1735addToUnscopables('keys');
1736addToUnscopables('values');
1737addToUnscopables('entries');
1738
1739var sloppyArrayMethod = function (METHOD_NAME, argument) {
1740 var method = [][METHOD_NAME];
1741 return !method || !fails(function () {
1742 // eslint-disable-next-line no-useless-call,no-throw-literal
1743 method.call(null, argument || function () { throw 1; }, 1);
1744 });
1745};
1746
1747var nativeJoin = [].join;
1748
1749var ES3_STRINGS = indexedObject != Object;
1750var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
1751
1752// `Array.prototype.join` method
1753// https://tc39.github.io/ecma262/#sec-array.prototype.join
1754_export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
1755 join: function join(separator) {
1756 return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
1757 }
1758});
1759
1760var $map = arrayIteration.map;
1761
1762
1763// `Array.prototype.map` method
1764// https://tc39.github.io/ecma262/#sec-array.prototype.map
1765// with adding support of @@species
1766_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, {
1767 map: function map(callbackfn /* , thisArg */) {
1768 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1769 }
1770});
1771
1772var SPECIES$2 = wellKnownSymbol('species');
1773var nativeSlice = [].slice;
1774var max$1 = Math.max;
1775
1776// `Array.prototype.slice` method
1777// https://tc39.github.io/ecma262/#sec-array.prototype.slice
1778// fallback for not array-like ES3 strings and DOM objects
1779_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
1780 slice: function slice(start, end) {
1781 var O = toIndexedObject(this);
1782 var length = toLength(O.length);
1783 var k = toAbsoluteIndex(start, length);
1784 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
1785 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
1786 var Constructor, result, n;
1787 if (isArray(O)) {
1788 Constructor = O.constructor;
1789 // cross-realm fallback
1790 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
1791 Constructor = undefined;
1792 } else if (isObject(Constructor)) {
1793 Constructor = Constructor[SPECIES$2];
1794 if (Constructor === null) Constructor = undefined;
1795 }
1796 if (Constructor === Array || Constructor === undefined) {
1797 return nativeSlice.call(O, k, fin);
1798 }
1799 }
1800 result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
1801 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
1802 result.length = n;
1803 return result;
1804 }
1805});
1806
1807var defineProperty$3 = objectDefineProperty.f;
1808
1809var FunctionPrototype = Function.prototype;
1810var FunctionPrototypeToString = FunctionPrototype.toString;
1811var nameRE = /^\s*function ([^ (]*)/;
1812var NAME = 'name';
1813
1814// Function instances `.name` property
1815// https://tc39.github.io/ecma262/#sec-function-instances-name
1816if (descriptors && !(NAME in FunctionPrototype)) {
1817 defineProperty$3(FunctionPrototype, NAME, {
1818 configurable: true,
1819 get: function () {
1820 try {
1821 return FunctionPrototypeToString.call(this).match(nameRE)[1];
1822 } catch (error) {
1823 return '';
1824 }
1825 }
1826 });
1827}
1828
1829var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1830
1831// `Object.{ entries, values }` methods implementation
1832var createMethod$3 = function (TO_ENTRIES) {
1833 return function (it) {
1834 var O = toIndexedObject(it);
1835 var keys = objectKeys(O);
1836 var length = keys.length;
1837 var i = 0;
1838 var result = [];
1839 var key;
1840 while (length > i) {
1841 key = keys[i++];
1842 if (!descriptors || propertyIsEnumerable.call(O, key)) {
1843 result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
1844 }
1845 }
1846 return result;
1847 };
1848};
1849
1850var objectToArray = {
1851 // `Object.entries` method
1852 // https://tc39.github.io/ecma262/#sec-object.entries
1853 entries: createMethod$3(true),
1854 // `Object.values` method
1855 // https://tc39.github.io/ecma262/#sec-object.values
1856 values: createMethod$3(false)
1857};
1858
1859var $entries = objectToArray.entries;
1860
1861// `Object.entries` method
1862// https://tc39.github.io/ecma262/#sec-object.entries
1863_export({ target: 'Object', stat: true }, {
1864 entries: function entries(O) {
1865 return $entries(O);
1866 }
1867});
1868
1869var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
1870
1871// `Object.keys` method
1872// https://tc39.github.io/ecma262/#sec-object.keys
1873_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
1874 keys: function keys(it) {
1875 return objectKeys(toObject(it));
1876 }
1877});
1878
1879var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1880// ES3 wrong here
1881var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1882
1883// fallback for IE11 Script Access Denied error
1884var tryGet = function (it, key) {
1885 try {
1886 return it[key];
1887 } catch (error) { /* empty */ }
1888};
1889
1890// getting tag from ES6+ `Object.prototype.toString`
1891var classof = function (it) {
1892 var O, tag, result;
1893 return it === undefined ? 'Undefined' : it === null ? 'Null'
1894 // @@toStringTag case
1895 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
1896 // builtinTag case
1897 : CORRECT_ARGUMENTS ? classofRaw(O)
1898 // ES3 arguments fallback
1899 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1900};
1901
1902var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
1903var test = {};
1904
1905test[TO_STRING_TAG$2] = 'z';
1906
1907// `Object.prototype.toString` method implementation
1908// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1909var objectToString = String(test) !== '[object z]' ? function toString() {
1910 return '[object ' + classof(this) + ']';
1911} : test.toString;
1912
1913var ObjectPrototype$2 = Object.prototype;
1914
1915// `Object.prototype.toString` method
1916// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1917if (objectToString !== ObjectPrototype$2.toString) {
1918 redefine(ObjectPrototype$2, 'toString', objectToString, { unsafe: true });
1919}
1920
1921// `String.prototype.{ codePointAt, at }` methods implementation
1922var createMethod$4 = function (CONVERT_TO_STRING) {
1923 return function ($this, pos) {
1924 var S = String(requireObjectCoercible($this));
1925 var position = toInteger(pos);
1926 var size = S.length;
1927 var first, second;
1928 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1929 first = S.charCodeAt(position);
1930 return first < 0xD800 || first > 0xDBFF || position + 1 === size
1931 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
1932 ? CONVERT_TO_STRING ? S.charAt(position) : first
1933 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1934 };
1935};
1936
1937var stringMultibyte = {
1938 // `String.prototype.codePointAt` method
1939 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1940 codeAt: createMethod$4(false),
1941 // `String.prototype.at` method
1942 // https://github.com/mathiasbynens/String.prototype.at
1943 charAt: createMethod$4(true)
1944};
1945
1946var charAt = stringMultibyte.charAt;
1947
1948
1949
1950var STRING_ITERATOR = 'String Iterator';
1951var setInternalState$2 = internalState.set;
1952var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
1953
1954// `String.prototype[@@iterator]` method
1955// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
1956defineIterator(String, 'String', function (iterated) {
1957 setInternalState$2(this, {
1958 type: STRING_ITERATOR,
1959 string: String(iterated),
1960 index: 0
1961 });
1962// `%StringIteratorPrototype%.next` method
1963// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
1964}, function next() {
1965 var state = getInternalState$2(this);
1966 var string = state.string;
1967 var index = state.index;
1968 var point;
1969 if (index >= string.length) return { value: undefined, done: true };
1970 point = charAt(string, index);
1971 state.index += point.length;
1972 return { value: point, done: false };
1973});
1974
1975// `RegExp.prototype.flags` getter implementation
1976// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
1977var regexpFlags = function () {
1978 var that = anObject(this);
1979 var result = '';
1980 if (that.global) result += 'g';
1981 if (that.ignoreCase) result += 'i';
1982 if (that.multiline) result += 'm';
1983 if (that.dotAll) result += 's';
1984 if (that.unicode) result += 'u';
1985 if (that.sticky) result += 'y';
1986 return result;
1987};
1988
1989var nativeExec = RegExp.prototype.exec;
1990// This always refers to the native implementation, because the
1991// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
1992// which loads this file before patching the method.
1993var nativeReplace = String.prototype.replace;
1994
1995var patchedExec = nativeExec;
1996
1997var UPDATES_LAST_INDEX_WRONG = (function () {
1998 var re1 = /a/;
1999 var re2 = /b*/g;
2000 nativeExec.call(re1, 'a');
2001 nativeExec.call(re2, 'a');
2002 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
2003})();
2004
2005// nonparticipating capturing group, copied from es5-shim's String#split patch.
2006var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
2007
2008var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
2009
2010if (PATCH) {
2011 patchedExec = function exec(str) {
2012 var re = this;
2013 var lastIndex, reCopy, match, i;
2014
2015 if (NPCG_INCLUDED) {
2016 reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
2017 }
2018 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
2019
2020 match = nativeExec.call(re, str);
2021
2022 if (UPDATES_LAST_INDEX_WRONG && match) {
2023 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
2024 }
2025 if (NPCG_INCLUDED && match && match.length > 1) {
2026 // Fix browsers whose `exec` methods don't consistently return `undefined`
2027 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
2028 nativeReplace.call(match[0], reCopy, function () {
2029 for (i = 1; i < arguments.length - 2; i++) {
2030 if (arguments[i] === undefined) match[i] = undefined;
2031 }
2032 });
2033 }
2034
2035 return match;
2036 };
2037}
2038
2039var regexpExec = patchedExec;
2040
2041var SPECIES$3 = wellKnownSymbol('species');
2042
2043var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
2044 // #replace needs built-in support for named groups.
2045 // #match works fine because it just return the exec results, even if it has
2046 // a "grops" property.
2047 var re = /./;
2048 re.exec = function () {
2049 var result = [];
2050 result.groups = { a: '7' };
2051 return result;
2052 };
2053 return ''.replace(re, '$<a>') !== '7';
2054});
2055
2056// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
2057// Weex JS has frozen built-in prototypes, so use try / catch wrapper
2058var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
2059 var re = /(?:)/;
2060 var originalExec = re.exec;
2061 re.exec = function () { return originalExec.apply(this, arguments); };
2062 var result = 'ab'.split(re);
2063 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
2064});
2065
2066var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
2067 var SYMBOL = wellKnownSymbol(KEY);
2068
2069 var DELEGATES_TO_SYMBOL = !fails(function () {
2070 // String methods call symbol-named RegEp methods
2071 var O = {};
2072 O[SYMBOL] = function () { return 7; };
2073 return ''[KEY](O) != 7;
2074 });
2075
2076 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
2077 // Symbol-named RegExp methods call .exec
2078 var execCalled = false;
2079 var re = /a/;
2080 re.exec = function () { execCalled = true; return null; };
2081
2082 if (KEY === 'split') {
2083 // RegExp[@@split] doesn't call the regex's exec method, but first creates
2084 // a new one. We need to return the patched regex when creating the new one.
2085 re.constructor = {};
2086 re.constructor[SPECIES$3] = function () { return re; };
2087 }
2088
2089 re[SYMBOL]('');
2090 return !execCalled;
2091 });
2092
2093 if (
2094 !DELEGATES_TO_SYMBOL ||
2095 !DELEGATES_TO_EXEC ||
2096 (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
2097 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
2098 ) {
2099 var nativeRegExpMethod = /./[SYMBOL];
2100 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
2101 if (regexp.exec === regexpExec) {
2102 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
2103 // The native String method already delegates to @@method (this
2104 // polyfilled function), leasing to infinite recursion.
2105 // We avoid it by directly calling the native @@method method.
2106 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
2107 }
2108 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
2109 }
2110 return { done: false };
2111 });
2112 var stringMethod = methods[0];
2113 var regexMethod = methods[1];
2114
2115 redefine(String.prototype, KEY, stringMethod);
2116 redefine(RegExp.prototype, SYMBOL, length == 2
2117 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
2118 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
2119 ? function (string, arg) { return regexMethod.call(string, this, arg); }
2120 // 21.2.5.6 RegExp.prototype[@@match](string)
2121 // 21.2.5.9 RegExp.prototype[@@search](string)
2122 : function (string) { return regexMethod.call(string, this); }
2123 );
2124 if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
2125 }
2126};
2127
2128var SPECIES$4 = wellKnownSymbol('species');
2129
2130// `SpeciesConstructor` abstract operation
2131// https://tc39.github.io/ecma262/#sec-speciesconstructor
2132var speciesConstructor = function (O, defaultConstructor) {
2133 var C = anObject(O).constructor;
2134 var S;
2135 return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
2136};
2137
2138var charAt$1 = stringMultibyte.charAt;
2139
2140// `AdvanceStringIndex` abstract operation
2141// https://tc39.github.io/ecma262/#sec-advancestringindex
2142var advanceStringIndex = function (S, index, unicode) {
2143 return index + (unicode ? charAt$1(S, index).length : 1);
2144};
2145
2146// `RegExpExec` abstract operation
2147// https://tc39.github.io/ecma262/#sec-regexpexec
2148var regexpExecAbstract = function (R, S) {
2149 var exec = R.exec;
2150 if (typeof exec === 'function') {
2151 var result = exec.call(R, S);
2152 if (typeof result !== 'object') {
2153 throw TypeError('RegExp exec method returned something other than an Object or null');
2154 }
2155 return result;
2156 }
2157
2158 if (classofRaw(R) !== 'RegExp') {
2159 throw TypeError('RegExp#exec called on incompatible receiver');
2160 }
2161
2162 return regexpExec.call(R, S);
2163};
2164
2165var arrayPush = [].push;
2166var min$2 = Math.min;
2167var MAX_UINT32 = 0xFFFFFFFF;
2168
2169// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
2170var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
2171
2172// @@split logic
2173fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
2174 var internalSplit;
2175 if (
2176 'abbc'.split(/(b)*/)[1] == 'c' ||
2177 'test'.split(/(?:)/, -1).length != 4 ||
2178 'ab'.split(/(?:ab)*/).length != 2 ||
2179 '.'.split(/(.?)(.?)/).length != 4 ||
2180 '.'.split(/()()/).length > 1 ||
2181 ''.split(/.?/).length
2182 ) {
2183 // based on es5-shim implementation, need to rework it
2184 internalSplit = function (separator, limit) {
2185 var string = String(requireObjectCoercible(this));
2186 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2187 if (lim === 0) return [];
2188 if (separator === undefined) return [string];
2189 // If `separator` is not a regex, use native split
2190 if (!isRegexp(separator)) {
2191 return nativeSplit.call(string, separator, lim);
2192 }
2193 var output = [];
2194 var flags = (separator.ignoreCase ? 'i' : '') +
2195 (separator.multiline ? 'm' : '') +
2196 (separator.unicode ? 'u' : '') +
2197 (separator.sticky ? 'y' : '');
2198 var lastLastIndex = 0;
2199 // Make `global` and avoid `lastIndex` issues by working with a copy
2200 var separatorCopy = new RegExp(separator.source, flags + 'g');
2201 var match, lastIndex, lastLength;
2202 while (match = regexpExec.call(separatorCopy, string)) {
2203 lastIndex = separatorCopy.lastIndex;
2204 if (lastIndex > lastLastIndex) {
2205 output.push(string.slice(lastLastIndex, match.index));
2206 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
2207 lastLength = match[0].length;
2208 lastLastIndex = lastIndex;
2209 if (output.length >= lim) break;
2210 }
2211 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
2212 }
2213 if (lastLastIndex === string.length) {
2214 if (lastLength || !separatorCopy.test('')) output.push('');
2215 } else output.push(string.slice(lastLastIndex));
2216 return output.length > lim ? output.slice(0, lim) : output;
2217 };
2218 // Chakra, V8
2219 } else if ('0'.split(undefined, 0).length) {
2220 internalSplit = function (separator, limit) {
2221 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
2222 };
2223 } else internalSplit = nativeSplit;
2224
2225 return [
2226 // `String.prototype.split` method
2227 // https://tc39.github.io/ecma262/#sec-string.prototype.split
2228 function split(separator, limit) {
2229 var O = requireObjectCoercible(this);
2230 var splitter = separator == undefined ? undefined : separator[SPLIT];
2231 return splitter !== undefined
2232 ? splitter.call(separator, O, limit)
2233 : internalSplit.call(String(O), separator, limit);
2234 },
2235 // `RegExp.prototype[@@split]` method
2236 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
2237 //
2238 // NOTE: This cannot be properly polyfilled in engines that don't support
2239 // the 'y' flag.
2240 function (regexp, limit) {
2241 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
2242 if (res.done) return res.value;
2243
2244 var rx = anObject(regexp);
2245 var S = String(this);
2246 var C = speciesConstructor(rx, RegExp);
2247
2248 var unicodeMatching = rx.unicode;
2249 var flags = (rx.ignoreCase ? 'i' : '') +
2250 (rx.multiline ? 'm' : '') +
2251 (rx.unicode ? 'u' : '') +
2252 (SUPPORTS_Y ? 'y' : 'g');
2253
2254 // ^(? + rx + ) is needed, in combination with some S slicing, to
2255 // simulate the 'y' flag.
2256 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
2257 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2258 if (lim === 0) return [];
2259 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
2260 var p = 0;
2261 var q = 0;
2262 var A = [];
2263 while (q < S.length) {
2264 splitter.lastIndex = SUPPORTS_Y ? q : 0;
2265 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
2266 var e;
2267 if (
2268 z === null ||
2269 (e = min$2(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
2270 ) {
2271 q = advanceStringIndex(S, q, unicodeMatching);
2272 } else {
2273 A.push(S.slice(p, q));
2274 if (A.length === lim) return A;
2275 for (var i = 1; i <= z.length - 1; i++) {
2276 A.push(z[i]);
2277 if (A.length === lim) return A;
2278 }
2279 q = p = e;
2280 }
2281 }
2282 A.push(S.slice(p));
2283 return A;
2284 }
2285 ];
2286}, !SUPPORTS_Y);
2287
2288// iterable DOM collections
2289// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2290var domIterables = {
2291 CSSRuleList: 0,
2292 CSSStyleDeclaration: 0,
2293 CSSValueList: 0,
2294 ClientRectList: 0,
2295 DOMRectList: 0,
2296 DOMStringList: 0,
2297 DOMTokenList: 1,
2298 DataTransferItemList: 0,
2299 FileList: 0,
2300 HTMLAllCollection: 0,
2301 HTMLCollection: 0,
2302 HTMLFormElement: 0,
2303 HTMLSelectElement: 0,
2304 MediaList: 0,
2305 MimeTypeArray: 0,
2306 NamedNodeMap: 0,
2307 NodeList: 1,
2308 PaintRequestList: 0,
2309 Plugin: 0,
2310 PluginArray: 0,
2311 SVGLengthList: 0,
2312 SVGNumberList: 0,
2313 SVGPathSegList: 0,
2314 SVGPointList: 0,
2315 SVGStringList: 0,
2316 SVGTransformList: 0,
2317 SourceBufferList: 0,
2318 StyleSheetList: 0,
2319 TextTrackCueList: 0,
2320 TextTrackList: 0,
2321 TouchList: 0
2322};
2323
2324var $forEach$1 = arrayIteration.forEach;
2325
2326
2327// `Array.prototype.forEach` method implementation
2328// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
2329var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
2330 return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2331} : [].forEach;
2332
2333for (var COLLECTION_NAME in domIterables) {
2334 var Collection = global_1[COLLECTION_NAME];
2335 var CollectionPrototype = Collection && Collection.prototype;
2336 // some Chrome versions have non-configurable methods on DOMTokenList
2337 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
2338 hide(CollectionPrototype, 'forEach', arrayForEach);
2339 } catch (error) {
2340 CollectionPrototype.forEach = arrayForEach;
2341 }
2342}
2343
2344var ITERATOR$2 = wellKnownSymbol('iterator');
2345var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
2346var ArrayValues = es_array_iterator.values;
2347
2348for (var COLLECTION_NAME$1 in domIterables) {
2349 var Collection$1 = global_1[COLLECTION_NAME$1];
2350 var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
2351 if (CollectionPrototype$1) {
2352 // some Chrome versions have non-configurable methods on DOMTokenList
2353 if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {
2354 hide(CollectionPrototype$1, ITERATOR$2, ArrayValues);
2355 } catch (error) {
2356 CollectionPrototype$1[ITERATOR$2] = ArrayValues;
2357 }
2358 if (!CollectionPrototype$1[TO_STRING_TAG$3]) hide(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);
2359 if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {
2360 // some Chrome versions have non-configurable methods on DOMTokenList
2361 if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
2362 hide(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
2363 } catch (error) {
2364 CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
2365 }
2366 }
2367 }
2368}
2369
2370var VirtualScroll =
2371/*#__PURE__*/
2372function () {
2373 function VirtualScroll(options) {
2374 var _this = this;
2375
2376 _classCallCheck(this, VirtualScroll);
2377
2378 this.rows = options.rows;
2379 this.scrollEl = options.scrollEl;
2380 this.contentEl = options.contentEl;
2381 this.callback = options.callback;
2382 this.cache = {};
2383 this.scrollTop = this.scrollEl.scrollTop;
2384 this.initDOM(this.rows);
2385 this.scrollEl.scrollTop = this.scrollTop;
2386 this.lastCluster = 0;
2387
2388 var onScroll = function onScroll() {
2389 if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
2390 _this.initDOM(_this.rows);
2391
2392 _this.callback();
2393 }
2394 };
2395
2396 this.scrollEl.addEventListener('scroll', onScroll, false);
2397
2398 this.destroy = function () {
2399 _this.contentEl.innerHtml = '';
2400
2401 _this.scrollEl.removeEventListener('scroll', onScroll, false);
2402 };
2403 }
2404
2405 _createClass(VirtualScroll, [{
2406 key: "initDOM",
2407 value: function initDOM(rows) {
2408 if (typeof this.clusterHeight === 'undefined') {
2409 this.cache.scrollTop = this.scrollEl.scrollTop;
2410 this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
2411 this.getRowsHeight(rows);
2412 }
2413
2414 var data = this.initData(rows, this.getNum());
2415 var thisRows = data.rows.join('');
2416 var dataChanged = this.checkChanges('data', thisRows);
2417 var topOffsetChanged = this.checkChanges('top', data.topOffset);
2418 var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
2419 var html = [];
2420
2421 if (dataChanged && topOffsetChanged) {
2422 if (data.topOffset) {
2423 html.push(this.getExtra('top', data.topOffset));
2424 }
2425
2426 html.push(thisRows);
2427
2428 if (data.bottomOffset) {
2429 html.push(this.getExtra('bottom', data.bottomOffset));
2430 }
2431
2432 this.contentEl.innerHTML = html.join('');
2433 } else if (bottomOffsetChanged) {
2434 this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
2435 }
2436 }
2437 }, {
2438 key: "getRowsHeight",
2439 value: function getRowsHeight() {
2440 if (typeof this.itemHeight === 'undefined') {
2441 var nodes = this.contentEl.children;
2442 var node = nodes[Math.floor(nodes.length / 2)];
2443 this.itemHeight = node.offsetHeight;
2444 }
2445
2446 this.blockHeight = this.itemHeight * Constants.BLOCK_ROWS;
2447 this.clusterRows = Constants.BLOCK_ROWS * Constants.CLUSTER_BLOCKS;
2448 this.clusterHeight = this.blockHeight * Constants.CLUSTER_BLOCKS;
2449 }
2450 }, {
2451 key: "getNum",
2452 value: function getNum() {
2453 this.scrollTop = this.scrollEl.scrollTop;
2454 return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
2455 }
2456 }, {
2457 key: "initData",
2458 value: function initData(rows, num) {
2459 if (rows.length < Constants.BLOCK_ROWS) {
2460 return {
2461 topOffset: 0,
2462 bottomOffset: 0,
2463 rowsAbove: 0,
2464 rows: rows
2465 };
2466 }
2467
2468 var start = Math.max((this.clusterRows - Constants.BLOCK_ROWS) * num, 0);
2469 var end = start + this.clusterRows;
2470 var topOffset = Math.max(start * this.itemHeight, 0);
2471 var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
2472 var thisRows = [];
2473 var rowsAbove = start;
2474
2475 if (topOffset < 1) {
2476 rowsAbove++;
2477 }
2478
2479 for (var i = start; i < end; i++) {
2480 rows[i] && thisRows.push(rows[i]);
2481 }
2482
2483 this.dataStart = start;
2484 this.dataEnd = end;
2485 return {
2486 topOffset: topOffset,
2487 bottomOffset: bottomOffset,
2488 rowsAbove: rowsAbove,
2489 rows: thisRows
2490 };
2491 }
2492 }, {
2493 key: "checkChanges",
2494 value: function checkChanges(type, value) {
2495 var changed = value !== this.cache[type];
2496 this.cache[type] = value;
2497 return changed;
2498 }
2499 }, {
2500 key: "getExtra",
2501 value: function getExtra(className, height) {
2502 var tag = document.createElement('li');
2503 tag.className = "virtual-scroll-".concat(className);
2504
2505 if (height) {
2506 tag.style.height = "".concat(height, "px");
2507 }
2508
2509 return tag.outerHTML;
2510 }
2511 }]);
2512
2513 return VirtualScroll;
2514}();
2515
2516var max$2 = Math.max;
2517var min$3 = Math.min;
2518var floor$1 = Math.floor;
2519var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
2520var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
2521
2522var maybeToString = function (it) {
2523 return it === undefined ? it : String(it);
2524};
2525
2526// @@replace logic
2527fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
2528 return [
2529 // `String.prototype.replace` method
2530 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
2531 function replace(searchValue, replaceValue) {
2532 var O = requireObjectCoercible(this);
2533 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
2534 return replacer !== undefined
2535 ? replacer.call(searchValue, O, replaceValue)
2536 : nativeReplace.call(String(O), searchValue, replaceValue);
2537 },
2538 // `RegExp.prototype[@@replace]` method
2539 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
2540 function (regexp, replaceValue) {
2541 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
2542 if (res.done) return res.value;
2543
2544 var rx = anObject(regexp);
2545 var S = String(this);
2546
2547 var functionalReplace = typeof replaceValue === 'function';
2548 if (!functionalReplace) replaceValue = String(replaceValue);
2549
2550 var global = rx.global;
2551 if (global) {
2552 var fullUnicode = rx.unicode;
2553 rx.lastIndex = 0;
2554 }
2555 var results = [];
2556 while (true) {
2557 var result = regexpExecAbstract(rx, S);
2558 if (result === null) break;
2559
2560 results.push(result);
2561 if (!global) break;
2562
2563 var matchStr = String(result[0]);
2564 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2565 }
2566
2567 var accumulatedResult = '';
2568 var nextSourcePosition = 0;
2569 for (var i = 0; i < results.length; i++) {
2570 result = results[i];
2571
2572 var matched = String(result[0]);
2573 var position = max$2(min$3(toInteger(result.index), S.length), 0);
2574 var captures = [];
2575 // NOTE: This is equivalent to
2576 // captures = result.slice(1).map(maybeToString)
2577 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2578 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2579 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2580 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
2581 var namedCaptures = result.groups;
2582 if (functionalReplace) {
2583 var replacerArgs = [matched].concat(captures, position, S);
2584 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
2585 var replacement = String(replaceValue.apply(undefined, replacerArgs));
2586 } else {
2587 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2588 }
2589 if (position >= nextSourcePosition) {
2590 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
2591 nextSourcePosition = position + matched.length;
2592 }
2593 }
2594 return accumulatedResult + S.slice(nextSourcePosition);
2595 }
2596 ];
2597
2598 // https://tc39.github.io/ecma262/#sec-getsubstitution
2599 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
2600 var tailPos = position + matched.length;
2601 var m = captures.length;
2602 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
2603 if (namedCaptures !== undefined) {
2604 namedCaptures = toObject(namedCaptures);
2605 symbols = SUBSTITUTION_SYMBOLS;
2606 }
2607 return nativeReplace.call(replacement, symbols, function (match, ch) {
2608 var capture;
2609 switch (ch.charAt(0)) {
2610 case '$': return '$';
2611 case '&': return matched;
2612 case '`': return str.slice(0, position);
2613 case "'": return str.slice(tailPos);
2614 case '<':
2615 capture = namedCaptures[ch.slice(1, -1)];
2616 break;
2617 default: // \d\d?
2618 var n = +ch;
2619 if (n === 0) return match;
2620 if (n > m) {
2621 var f = floor$1(n / 10);
2622 if (f === 0) return match;
2623 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
2624 return match;
2625 }
2626 capture = captures[n - 1];
2627 }
2628 return capture === undefined ? '' : capture;
2629 });
2630 }
2631});
2632
2633var compareObjects = function compareObjects(objectA, objectB, compareLength) {
2634 var aKeys = Object.keys(objectA);
2635 var bKeys = Object.keys(objectB);
2636
2637 if (compareLength && aKeys.length !== bKeys.length) {
2638 return false;
2639 }
2640
2641 for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
2642 var key = _aKeys[_i];
2643
2644 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
2645 return false;
2646 }
2647 }
2648
2649 return true;
2650};
2651
2652var removeDiacritics = function removeDiacritics(str) {
2653 if (str.normalize) {
2654 return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '');
2655 }
2656
2657 var defaultDiacriticsRemovalMap = [{
2658 'base': 'A',
2659 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
2660 }, {
2661 'base': 'AA',
2662 'letters': /[\uA732]/g
2663 }, {
2664 'base': 'AE',
2665 'letters': /[\u00C6\u01FC\u01E2]/g
2666 }, {
2667 'base': 'AO',
2668 'letters': /[\uA734]/g
2669 }, {
2670 'base': 'AU',
2671 'letters': /[\uA736]/g
2672 }, {
2673 'base': 'AV',
2674 'letters': /[\uA738\uA73A]/g
2675 }, {
2676 'base': 'AY',
2677 'letters': /[\uA73C]/g
2678 }, {
2679 'base': 'B',
2680 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
2681 }, {
2682 'base': 'C',
2683 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
2684 }, {
2685 'base': 'D',
2686 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
2687 }, {
2688 'base': 'DZ',
2689 'letters': /[\u01F1\u01C4]/g
2690 }, {
2691 'base': 'Dz',
2692 'letters': /[\u01F2\u01C5]/g
2693 }, {
2694 'base': 'E',
2695 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
2696 }, {
2697 'base': 'F',
2698 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
2699 }, {
2700 'base': 'G',
2701 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
2702 }, {
2703 'base': 'H',
2704 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
2705 }, {
2706 'base': 'I',
2707 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
2708 }, {
2709 'base': 'J',
2710 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g
2711 }, {
2712 'base': 'K',
2713 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
2714 }, {
2715 'base': 'L',
2716 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
2717 }, {
2718 'base': 'LJ',
2719 'letters': /[\u01C7]/g
2720 }, {
2721 'base': 'Lj',
2722 'letters': /[\u01C8]/g
2723 }, {
2724 'base': 'M',
2725 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
2726 }, {
2727 'base': 'N',
2728 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
2729 }, {
2730 'base': 'NJ',
2731 'letters': /[\u01CA]/g
2732 }, {
2733 'base': 'Nj',
2734 'letters': /[\u01CB]/g
2735 }, {
2736 'base': 'O',
2737 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
2738 }, {
2739 'base': 'OI',
2740 'letters': /[\u01A2]/g
2741 }, {
2742 'base': 'OO',
2743 'letters': /[\uA74E]/g
2744 }, {
2745 'base': 'OU',
2746 'letters': /[\u0222]/g
2747 }, {
2748 'base': 'P',
2749 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
2750 }, {
2751 'base': 'Q',
2752 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
2753 }, {
2754 'base': 'R',
2755 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
2756 }, {
2757 'base': 'S',
2758 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
2759 }, {
2760 'base': 'T',
2761 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
2762 }, {
2763 'base': 'TZ',
2764 'letters': /[\uA728]/g
2765 }, {
2766 'base': 'U',
2767 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
2768 }, {
2769 'base': 'V',
2770 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
2771 }, {
2772 'base': 'VY',
2773 'letters': /[\uA760]/g
2774 }, {
2775 'base': 'W',
2776 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
2777 }, {
2778 'base': 'X',
2779 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
2780 }, {
2781 'base': 'Y',
2782 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
2783 }, {
2784 'base': 'Z',
2785 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
2786 }, {
2787 'base': 'a',
2788 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
2789 }, {
2790 'base': 'aa',
2791 'letters': /[\uA733]/g
2792 }, {
2793 'base': 'ae',
2794 'letters': /[\u00E6\u01FD\u01E3]/g
2795 }, {
2796 'base': 'ao',
2797 'letters': /[\uA735]/g
2798 }, {
2799 'base': 'au',
2800 'letters': /[\uA737]/g
2801 }, {
2802 'base': 'av',
2803 'letters': /[\uA739\uA73B]/g
2804 }, {
2805 'base': 'ay',
2806 'letters': /[\uA73D]/g
2807 }, {
2808 'base': 'b',
2809 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
2810 }, {
2811 'base': 'c',
2812 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
2813 }, {
2814 'base': 'd',
2815 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
2816 }, {
2817 'base': 'dz',
2818 'letters': /[\u01F3\u01C6]/g
2819 }, {
2820 'base': 'e',
2821 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
2822 }, {
2823 'base': 'f',
2824 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
2825 }, {
2826 'base': 'g',
2827 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
2828 }, {
2829 'base': 'h',
2830 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
2831 }, {
2832 'base': 'hv',
2833 'letters': /[\u0195]/g
2834 }, {
2835 'base': 'i',
2836 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
2837 }, {
2838 'base': 'j',
2839 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
2840 }, {
2841 'base': 'k',
2842 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
2843 }, {
2844 'base': 'l',
2845 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
2846 }, {
2847 'base': 'lj',
2848 'letters': /[\u01C9]/g
2849 }, {
2850 'base': 'm',
2851 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
2852 }, {
2853 'base': 'n',
2854 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
2855 }, {
2856 'base': 'nj',
2857 'letters': /[\u01CC]/g
2858 }, {
2859 'base': 'o',
2860 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
2861 }, {
2862 'base': 'oi',
2863 'letters': /[\u01A3]/g
2864 }, {
2865 'base': 'ou',
2866 'letters': /[\u0223]/g
2867 }, {
2868 'base': 'oo',
2869 'letters': /[\uA74F]/g
2870 }, {
2871 'base': 'p',
2872 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
2873 }, {
2874 'base': 'q',
2875 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
2876 }, {
2877 'base': 'r',
2878 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
2879 }, {
2880 'base': 's',
2881 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
2882 }, {
2883 'base': 't',
2884 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
2885 }, {
2886 'base': 'tz',
2887 'letters': /[\uA729]/g
2888 }, {
2889 'base': 'u',
2890 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
2891 }, {
2892 'base': 'v',
2893 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
2894 }, {
2895 'base': 'vy',
2896 'letters': /[\uA761]/g
2897 }, {
2898 'base': 'w',
2899 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
2900 }, {
2901 'base': 'x',
2902 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
2903 }, {
2904 'base': 'y',
2905 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
2906 }, {
2907 'base': 'z',
2908 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
2909 }];
2910 return defaultDiacriticsRemovalMap.reduce(function (string, _ref) {
2911 var letters = _ref.letters,
2912 base = _ref.base;
2913 return string.replace(letters, base);
2914 }, str);
2915};
2916
2917var setDataKeys = function setDataKeys(data) {
2918 var total = 0;
2919 data.forEach(function (row, i) {
2920 if (row.type === 'optgroup') {
2921 row._key = "group_".concat(i);
2922 row.visible = typeof row.visible === 'undefined' ? true : row.visible;
2923 row.children.forEach(function (child, j) {
2924 child._key = "option_".concat(i, "_").concat(j);
2925 child.visible = typeof child.visible === 'undefined' ? true : child.visible;
2926 });
2927 total += row.children.length;
2928 } else {
2929 row._key = "option_".concat(i);
2930 row.visible = typeof row.visible === 'undefined' ? true : row.visible;
2931 total += 1;
2932 }
2933 });
2934 return total;
2935};
2936
2937var findByParam = function findByParam(data, param, value) {
2938 var _iteratorNormalCompletion = true;
2939 var _didIteratorError = false;
2940 var _iteratorError = undefined;
2941
2942 try {
2943 for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2944 var row = _step.value;
2945
2946 if (row[param] === value || row[param] === +row[param] + '' && +row[param] === value) {
2947 return row;
2948 }
2949
2950 if (row.type === 'optgroup') {
2951 var _iteratorNormalCompletion2 = true;
2952 var _didIteratorError2 = false;
2953 var _iteratorError2 = undefined;
2954
2955 try {
2956 for (var _iterator2 = row.children[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
2957 var child = _step2.value;
2958
2959 if (child[param] === value || child[param] === +child[param] + '' && +child[param] === value) {
2960 return child;
2961 }
2962 }
2963 } catch (err) {
2964 _didIteratorError2 = true;
2965 _iteratorError2 = err;
2966 } finally {
2967 try {
2968 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
2969 _iterator2.return();
2970 }
2971 } finally {
2972 if (_didIteratorError2) {
2973 throw _iteratorError2;
2974 }
2975 }
2976 }
2977 }
2978 }
2979 } catch (err) {
2980 _didIteratorError = true;
2981 _iteratorError = err;
2982 } finally {
2983 try {
2984 if (!_iteratorNormalCompletion && _iterator.return != null) {
2985 _iterator.return();
2986 }
2987 } finally {
2988 if (_didIteratorError) {
2989 throw _iteratorError;
2990 }
2991 }
2992 }
2993};
2994
2995var removeUndefined = function removeUndefined(obj) {
2996 Object.keys(obj).forEach(function (key) {
2997 return obj[key] === undefined ? delete obj[key] : '';
2998 });
2999 return obj;
3000};
3001
3002var getDocumentClickEvent = function getDocumentClickEvent() {
3003 var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
3004 id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000));
3005 return "click.multiple-select-".concat(id);
3006};
3007
3008var MultipleSelect =
3009/*#__PURE__*/
3010function () {
3011 function MultipleSelect($el, options) {
3012 _classCallCheck(this, MultipleSelect);
3013
3014 this.$el = $el;
3015 this.options = $.extend({}, Constants.DEFAULTS, options);
3016 }
3017
3018 _createClass(MultipleSelect, [{
3019 key: "init",
3020 value: function init() {
3021 this.initLocale();
3022 this.initContainer();
3023 this.initData();
3024 this.initSelected(true);
3025 this.initFilter();
3026 this.initDrop();
3027 this.initView();
3028 this.options.onAfterCreate();
3029 }
3030 }, {
3031 key: "initLocale",
3032 value: function initLocale() {
3033 if (this.options.locale) {
3034 var locales = $.fn.multipleSelect.locales;
3035 var parts = this.options.locale.split(/-|_/);
3036 parts[0] = parts[0].toLowerCase();
3037
3038 if (parts[1]) {
3039 parts[1] = parts[1].toUpperCase();
3040 }
3041
3042 if (locales[this.options.locale]) {
3043 $.extend(this.options, locales[this.options.locale]);
3044 } else if (locales[parts.join('-')]) {
3045 $.extend(this.options, locales[parts.join('-')]);
3046 } else if (locales[parts[0]]) {
3047 $.extend(this.options, locales[parts[0]]);
3048 }
3049 }
3050 }
3051 }, {
3052 key: "initContainer",
3053 value: function initContainer() {
3054 var _this = this;
3055
3056 var el = this.$el[0];
3057 var name = el.getAttribute('name') || this.options.name || ''; // hide select element
3058
3059 this.$el.hide(); // label element
3060
3061 this.$label = this.$el.closest('label');
3062
3063 if (!this.$label.length && this.$el.attr('id')) {
3064 this.$label = $("label[for=\"".concat(this.$el.attr('id'), "\"]"));
3065 }
3066
3067 if (this.$label.find('>input').length) {
3068 this.$label = null;
3069 } // single or multiple
3070
3071
3072 if (typeof this.options.single === 'undefined') {
3073 this.options.single = el.getAttribute('multiple') === null;
3074 } // restore class and title from select element
3075
3076
3077 this.$parent = $("\n <div class=\"ms-parent ".concat(el.getAttribute('class') || '', "\"\n title=\"").concat(el.getAttribute('title') || '', "\" />\n ")); // add placeholder to choice button
3078
3079 this.options.placeholder = this.options.placeholder || el.getAttribute('placeholder') || '';
3080 this.tabIndex = el.getAttribute('tabindex');
3081 var tabIndex = '';
3082
3083 if (this.tabIndex !== null) {
3084 this.$el.attr('tabindex', -1);
3085 tabIndex = this.tabIndex && "tabindex=\"".concat(this.tabIndex, "\"");
3086 }
3087
3088 this.$choice = $("\n <button type=\"button\" class=\"ms-choice\"".concat(tabIndex, ">\n <span class=\"placeholder\">").concat(this.options.placeholder, "</span>\n ").concat(this.options.showClear ? '<div class="icon-close"></div>' : '', "\n <div class=\"icon-caret\"></div>\n </button>\n ")); // default position is bottom
3089
3090 this.$drop = $("<div class=\"ms-drop ".concat(this.options.position, "\" />"));
3091 this.$close = this.$choice.find('.icon-close');
3092
3093 if (this.options.dropWidth) {
3094 this.$drop.css('width', this.options.dropWidth);
3095 }
3096
3097 this.$el.after(this.$parent);
3098 this.$parent.append(this.$choice);
3099 this.$parent.append(this.$drop);
3100
3101 if (el.disabled) {
3102 this.$choice.addClass('disabled');
3103 }
3104
3105 this.selectAllName = "data-name=\"selectAll".concat(name, "\"");
3106 this.selectGroupName = "data-name=\"selectGroup".concat(name, "\"");
3107 this.selectItemName = "data-name=\"selectItem".concat(name, "\"");
3108
3109 if (!this.options.keepOpen) {
3110 var clickEvent = getDocumentClickEvent(this.$el.attr('id'));
3111 $(document).off(clickEvent).on(clickEvent, function (e) {
3112 if ($(e.target)[0] === _this.$choice[0] || $(e.target).parents('.ms-choice')[0] === _this.$choice[0]) {
3113 return;
3114 }
3115
3116 if (($(e.target)[0] === _this.$drop[0] || $(e.target).parents('.ms-drop')[0] !== _this.$drop[0] && e.target !== el) && _this.options.isOpen) {
3117 _this.close();
3118 }
3119 });
3120 }
3121 }
3122 }, {
3123 key: "initData",
3124 value: function initData() {
3125 var _this2 = this;
3126
3127 var data = [];
3128
3129 if (this.options.data) {
3130 if (Array.isArray(this.options.data)) {
3131 this.data = this.options.data.map(function (it) {
3132 if (typeof it === 'string' || typeof it === 'number') {
3133 return {
3134 text: it,
3135 value: it
3136 };
3137 }
3138
3139 return it;
3140 });
3141 } else if (_typeof(this.options.data) === 'object') {
3142 for (var _i = 0, _Object$entries = Object.entries(this.options.data); _i < _Object$entries.length; _i++) {
3143 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
3144 value = _Object$entries$_i[0],
3145 text = _Object$entries$_i[1];
3146
3147 data.push({
3148 value: value,
3149 text: text
3150 });
3151 }
3152
3153 this.data = data;
3154 }
3155 } else {
3156 $.each(this.$el.children(), function (i, elm) {
3157 var row = _this2.initRow(i, elm);
3158
3159 if (row) {
3160 data.push(_this2.initRow(i, elm));
3161 }
3162 });
3163 this.options.data = data;
3164 this.data = data;
3165 this.fromHtml = true;
3166 }
3167
3168 this.dataTotal = setDataKeys(this.data);
3169 }
3170 }, {
3171 key: "initRow",
3172 value: function initRow(i, elm, groupDisabled) {
3173 var _this3 = this;
3174
3175 var row = {};
3176 var $elm = $(elm);
3177
3178 if ($elm.is('option')) {
3179 row.type = 'option';
3180 row.text = this.options.textTemplate($elm);
3181 row.value = elm.value;
3182 row.visible = true;
3183 row.selected = !!elm.selected;
3184 row.disabled = groupDisabled || elm.disabled;
3185 row.classes = elm.getAttribute('class') || '';
3186 row.title = elm.getAttribute('title') || '';
3187
3188 if ($elm.data('value')) {
3189 row._value = $elm.data('value'); // value for object
3190 }
3191
3192 if (Object.keys($elm.data()).length) {
3193 row._data = $elm.data();
3194 }
3195
3196 return row;
3197 }
3198
3199 if ($elm.is('optgroup')) {
3200 row.type = 'optgroup';
3201 row.label = this.options.labelTemplate($elm);
3202 row.visible = true;
3203 row.selected = !!elm.selected;
3204 row.disabled = elm.disabled;
3205 row.children = [];
3206
3207 if (Object.keys($elm.data()).length) {
3208 row._data = $elm.data();
3209 }
3210
3211 $.each($elm.children(), function (j, elem) {
3212 row.children.push(_this3.initRow(j, elem, row.disabled));
3213 });
3214 return row;
3215 }
3216
3217 return null;
3218 }
3219 }, {
3220 key: "initSelected",
3221 value: function initSelected(ignoreTrigger) {
3222 var selectedTotal = 0;
3223 var _iteratorNormalCompletion = true;
3224 var _didIteratorError = false;
3225 var _iteratorError = undefined;
3226
3227 try {
3228 for (var _iterator = this.data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3229 var row = _step.value;
3230
3231 if (row.type === 'optgroup') {
3232 var selectedCount = row.children.filter(function (child) {
3233 return child.selected && !child.disabled && child.visible;
3234 }).length;
3235 row.selected = selectedCount && selectedCount === row.children.filter(function (child) {
3236 return !child.disabled && child.visible;
3237 }).length;
3238 selectedTotal += selectedCount;
3239 } else {
3240 selectedTotal += row.selected && !row.disabled && row.visible ? 1 : 0;
3241 }
3242 }
3243 } catch (err) {
3244 _didIteratorError = true;
3245 _iteratorError = err;
3246 } finally {
3247 try {
3248 if (!_iteratorNormalCompletion && _iterator.return != null) {
3249 _iterator.return();
3250 }
3251 } finally {
3252 if (_didIteratorError) {
3253 throw _iteratorError;
3254 }
3255 }
3256 }
3257
3258 this.allSelected = this.data.filter(function (row) {
3259 return row.selected && !row.disabled && row.visible;
3260 }).length === this.data.filter(function (row) {
3261 return !row.disabled && row.visible;
3262 }).length;
3263
3264 if (!ignoreTrigger) {
3265 if (this.allSelected) {
3266 this.options.onCheckAll();
3267 } else if (selectedTotal === 0) {
3268 this.options.onUncheckAll();
3269 }
3270 }
3271 }
3272 }, {
3273 key: "initFilter",
3274 value: function initFilter() {
3275 this.filterText = '';
3276
3277 if (this.options.filter || !this.options.filterByDataLength) {
3278 return;
3279 }
3280
3281 var length = 0;
3282 var _iteratorNormalCompletion2 = true;
3283 var _didIteratorError2 = false;
3284 var _iteratorError2 = undefined;
3285
3286 try {
3287 for (var _iterator2 = this.data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
3288 var option = _step2.value;
3289
3290 if (option.type === 'optgroup') {
3291 length += option.children.length;
3292 } else {
3293 length += 1;
3294 }
3295 }
3296 } catch (err) {
3297 _didIteratorError2 = true;
3298 _iteratorError2 = err;
3299 } finally {
3300 try {
3301 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
3302 _iterator2.return();
3303 }
3304 } finally {
3305 if (_didIteratorError2) {
3306 throw _iteratorError2;
3307 }
3308 }
3309 }
3310
3311 this.options.filter = length > this.options.filterByDataLength;
3312 }
3313 }, {
3314 key: "initDrop",
3315 value: function initDrop() {
3316 var _this4 = this;
3317
3318 this.initList();
3319 this.update(true);
3320
3321 if (this.options.isOpen) {
3322 setTimeout(function () {
3323 _this4.open();
3324 }, 50);
3325 }
3326
3327 if (this.options.openOnHover) {
3328 this.$parent.hover(function () {
3329 _this4.open();
3330 }, function () {
3331 _this4.close();
3332 });
3333 }
3334 }
3335 }, {
3336 key: "initList",
3337 value: function initList() {
3338 var html = [];
3339
3340 if (this.options.filter) {
3341 html.push("\n <div class=\"ms-search\">\n <input type=\"text\" autocomplete=\"off\" autocorrect=\"off\"\n autocapitalize=\"off\" spellcheck=\"false\"\n placeholder=\"".concat(this.options.filterPlaceholder, "\">\n </div>\n "));
3342 }
3343
3344 html.push('<ul></ul>');
3345 this.$drop.html(html.join(''));
3346 this.$ul = this.$drop.find('>ul');
3347 this.initListItems();
3348 }
3349 }, {
3350 key: "initListItems",
3351 value: function initListItems() {
3352 var _this5 = this;
3353
3354 var rows = this.getListRows();
3355 var offset = 0;
3356
3357 if (this.options.selectAll && !this.options.single) {
3358 offset = -1;
3359 }
3360
3361 if (rows.length > Constants.BLOCK_ROWS * Constants.CLUSTER_BLOCKS) {
3362 if (this.virtualScroll) {
3363 this.virtualScroll.destroy();
3364 }
3365
3366 var dropVisible = this.$drop.is(':visible');
3367
3368 if (!dropVisible) {
3369 this.$drop.css('left', -10000).show();
3370 }
3371
3372 var updateDataOffset = function updateDataOffset() {
3373 _this5.updateDataStart = _this5.virtualScroll.dataStart + offset;
3374 _this5.updateDataEnd = _this5.virtualScroll.dataEnd + offset;
3375
3376 if (_this5.updateDataStart < 0) {
3377 _this5.updateDataStart = 0;
3378 }
3379
3380 if (_this5.updateDataEnd > _this5.data.length) {
3381 _this5.updateDataEnd = _this5.data.length;
3382 }
3383 };
3384
3385 this.virtualScroll = new VirtualScroll({
3386 rows: rows,
3387 scrollEl: this.$ul[0],
3388 contentEl: this.$ul[0],
3389 callback: function callback() {
3390 updateDataOffset();
3391
3392 _this5.events();
3393 }
3394 });
3395 updateDataOffset();
3396
3397 if (!dropVisible) {
3398 this.$drop.css('left', 0).hide();
3399 }
3400 } else {
3401 this.$ul.html(rows.join(''));
3402 this.updateDataStart = 0;
3403 this.updateDataEnd = this.updateData.length;
3404 this.virtualScroll = null;
3405 }
3406
3407 this.events();
3408 }
3409 }, {
3410 key: "getListRows",
3411 value: function getListRows() {
3412 var _this6 = this;
3413
3414 var rows = [];
3415
3416 if (this.options.selectAll && !this.options.single) {
3417 rows.push("\n <li class=\"ms-select-all\">\n <label>\n <input type=\"checkbox\" ".concat(this.selectAllName).concat(this.allSelected ? ' checked="checked"' : '', " />\n <span>").concat(this.options.formatSelectAll(), "</span>\n </label>\n </li>\n "));
3418 }
3419
3420 this.updateData = [];
3421 this.data.forEach(function (row) {
3422 rows.push.apply(rows, _toConsumableArray(_this6.initListItem(row)));
3423 });
3424 rows.push("<li class=\"ms-no-results\">".concat(this.options.formatNoMatchesFound(), "</li>"));
3425 return rows;
3426 }
3427 }, {
3428 key: "initListItem",
3429 value: function initListItem(row) {
3430 var _this7 = this;
3431
3432 var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3433 var title = row.title ? "title=\"".concat(row.title, "\"") : '';
3434 var multiple = this.options.multiple ? 'multiple' : '';
3435 var type = this.options.single ? 'radio' : 'checkbox';
3436 var classes = '';
3437
3438 if (!row.visible) {
3439 return [];
3440 }
3441
3442 this.updateData.push(row);
3443
3444 if (this.options.single && !this.options.singleRadio) {
3445 classes = 'hide-radio ';
3446 }
3447
3448 if (row.selected) {
3449 classes += 'selected ';
3450 }
3451
3452 if (row.type === 'optgroup') {
3453 var _customStyle = this.options.styler(row);
3454
3455 var _style = _customStyle ? "style=\"".concat(_customStyle, "\"") : '';
3456
3457 var html = [];
3458 var group = this.options.hideOptgroupCheckboxes || this.options.single ? "<span ".concat(this.selectGroupName, " data-key=\"").concat(row._key, "\"></span>") : "<input type=\"checkbox\"\n ".concat(this.selectGroupName, "\n data-key=\"").concat(row._key, "\"\n ").concat(row.selected ? ' checked="checked"' : '', "\n ").concat(row.disabled ? ' disabled="disabled"' : '', "\n >");
3459
3460 if (!classes.includes('hide-radio') && (this.options.hideOptgroupCheckboxes || this.options.single)) {
3461 classes += 'hide-radio ';
3462 }
3463
3464 html.push("\n <li class=\"group ".concat(classes, "\" ").concat(_style, ">\n <label class=\"optgroup").concat(this.options.single || row.disabled ? ' disabled' : '', "\">\n ").concat(group).concat(row.label, "\n </label>\n </li>\n "));
3465 row.children.forEach(function (child) {
3466 html.push.apply(html, _toConsumableArray(_this7.initListItem(child, 1)));
3467 });
3468 return html;
3469 }
3470
3471 var customStyle = this.options.styler(row);
3472 var style = customStyle ? "style=\"".concat(customStyle, "\"") : '';
3473 classes += row.classes || '';
3474
3475 if (level && this.options.single) {
3476 classes += "option-level-".concat(level, " ");
3477 }
3478
3479 return ["\n <li class=\"".concat(multiple, " ").concat(classes, "\" ").concat(title, " ").concat(style, ">\n <label class=\"").concat(row.disabled ? 'disabled' : '', "\">\n <input type=\"").concat(type, "\"\n value=\"").concat(row.value, "\"\n data-key=\"").concat(row._key, "\"\n ").concat(this.selectItemName, "\n ").concat(row.selected ? ' checked="checked"' : '', "\n ").concat(row.disabled ? ' disabled="disabled"' : '', "\n >\n <span>").concat(row.text, "</span>\n </label>\n </li>\n ")];
3480 }
3481 }, {
3482 key: "events",
3483 value: function events() {
3484 var _this8 = this;
3485
3486 this.$searchInput = this.$drop.find('.ms-search input');
3487 this.$selectAll = this.$drop.find("input[".concat(this.selectAllName, "]"));
3488 this.$selectGroups = this.$drop.find("input[".concat(this.selectGroupName, "],span[").concat(this.selectGroupName, "]"));
3489 this.$selectItems = this.$drop.find("input[".concat(this.selectItemName, "]:enabled"));
3490 this.$disableItems = this.$drop.find("input[".concat(this.selectItemName, "]:disabled"));
3491 this.$noResults = this.$drop.find('.ms-no-results');
3492
3493 var toggleOpen = function toggleOpen(e) {
3494 e.preventDefault();
3495
3496 if ($(e.target).hasClass('icon-close')) {
3497 return;
3498 }
3499
3500 _this8[_this8.options.isOpen ? 'close' : 'open']();
3501 };
3502
3503 if (this.$label && this.$label.length) {
3504 this.$label.off('click').on('click', function (e) {
3505 if (e.target.nodeName.toLowerCase() !== 'label') {
3506 return;
3507 }
3508
3509 toggleOpen(e);
3510
3511 if (!_this8.options.filter || !_this8.options.isOpen) {
3512 _this8.focus();
3513 }
3514
3515 e.stopPropagation(); // Causes lost focus otherwise
3516 });
3517 }
3518
3519 this.$choice.off('click').on('click', toggleOpen).off('focus').on('focus', this.options.onFocus).off('blur').on('blur', this.options.onBlur);
3520 this.$parent.off('keydown').on('keydown', function (e) {
3521 // esc key
3522 if (e.which === 27 && !_this8.options.keepOpen) {
3523 _this8.close();
3524
3525 _this8.$choice.focus();
3526 }
3527 });
3528 this.$close.off('click').on('click', function (e) {
3529 e.preventDefault();
3530
3531 _this8._checkAll(false, true);
3532
3533 _this8.initSelected(false);
3534
3535 _this8.updateSelected();
3536
3537 _this8.update();
3538
3539 _this8.options.onClear();
3540 });
3541 this.$searchInput.off('keydown').on('keydown', function (e) {
3542 // Ensure shift-tab causes lost focus from filter as with clicking away
3543 if (e.keyCode === 9 && e.shiftKey) {
3544 _this8.close();
3545 }
3546 }).off('keyup').on('keyup', function (e) {
3547 // enter or space
3548 // Avoid selecting/deselecting if no choices made
3549 if (_this8.options.filterAcceptOnEnter && [13, 32].includes(e.which) && _this8.$searchInput.val()) {
3550 if (_this8.options.single) {
3551 var $items = _this8.$selectItems.closest('li').filter(':visible');
3552
3553 if ($items.length) {
3554 _this8.setSelects([$items.first().find("input[".concat(_this8.selectItemName, "]")).val()]);
3555 }
3556 } else {
3557 _this8.$selectAll.click();
3558 }
3559
3560 _this8.close();
3561
3562 _this8.focus();
3563
3564 return;
3565 }
3566
3567 _this8.filter();
3568 });
3569 this.$selectAll.off('click').on('click', function (e) {
3570 _this8._checkAll($(e.currentTarget).prop('checked'));
3571 });
3572 this.$selectGroups.off('click').on('click', function (e) {
3573 var $this = $(e.currentTarget);
3574 var checked = $this.prop('checked');
3575 var group = findByParam(_this8.data, '_key', $this.data('key'));
3576
3577 _this8._checkGroup(group, checked);
3578
3579 _this8.options.onOptgroupClick(removeUndefined({
3580 label: group.label,
3581 selected: group.selected,
3582 data: group._data,
3583 children: group.children.map(function (child) {
3584 return removeUndefined({
3585 text: child.text,
3586 value: child.value,
3587 selected: child.selected,
3588 disabled: child.disabled,
3589 data: child._data
3590 });
3591 })
3592 }));
3593 });
3594 this.$selectItems.off('click').on('click', function (e) {
3595 var $this = $(e.currentTarget);
3596 var checked = $this.prop('checked');
3597 var option = findByParam(_this8.data, '_key', $this.data('key'));
3598
3599 _this8._check(option, checked);
3600
3601 _this8.options.onClick(removeUndefined({
3602 text: option.text,
3603 value: option.value,
3604 selected: option.selected,
3605 data: option._data
3606 }));
3607
3608 if (_this8.options.single && _this8.options.isOpen && !_this8.options.keepOpen) {
3609 _this8.close();
3610 }
3611 });
3612 }
3613 }, {
3614 key: "initView",
3615 value: function initView() {
3616 var computedWidth;
3617
3618 if (window.getComputedStyle) {
3619 computedWidth = window.getComputedStyle(this.$el[0]).width;
3620
3621 if (computedWidth === 'auto') {
3622 computedWidth = this.$drop.outerWidth() + 20;
3623 }
3624 } else {
3625 computedWidth = this.$el.outerWidth() + 20;
3626 }
3627
3628 this.$parent.css('width', this.options.width || computedWidth);
3629 this.$el.show().addClass('ms-offscreen');
3630 }
3631 }, {
3632 key: "open",
3633 value: function open() {
3634 if (this.$choice.hasClass('disabled')) {
3635 return;
3636 }
3637
3638 this.options.isOpen = true;
3639 this.$choice.find('>div').addClass('open');
3640 this.$drop[this.animateMethod('show')](); // fix filter bug: no results show
3641
3642 this.$selectAll.parent().show();
3643 this.$noResults.hide(); // Fix #77: 'All selected' when no options
3644
3645 if (!this.data.length) {
3646 this.$selectAll.parent().hide();
3647 this.$noResults.show();
3648 }
3649
3650 if (this.options.container) {
3651 var offset = this.$drop.offset();
3652 this.$drop.appendTo($(this.options.container));
3653 this.$drop.offset({
3654 top: offset.top,
3655 left: offset.left
3656 }).css('min-width', 'auto').outerWidth(this.$parent.outerWidth());
3657 }
3658
3659 var maxHeight = this.options.maxHeight;
3660
3661 if (this.options.maxHeightUnit === 'row') {
3662 maxHeight = this.$drop.find('>ul>li').first().outerHeight() * this.options.maxHeight;
3663 }
3664
3665 this.$drop.find('>ul').css('max-height', "".concat(maxHeight, "px"));
3666 this.$drop.find('.multiple').css('width', "".concat(this.options.multipleWidth, "px"));
3667
3668 if (this.data.length && this.options.filter) {
3669 this.$searchInput.val('');
3670 this.$searchInput.focus();
3671 this.filter(true);
3672 }
3673
3674 this.options.onOpen();
3675 }
3676 }, {
3677 key: "close",
3678 value: function close() {
3679 this.options.isOpen = false;
3680 this.$choice.find('>div').removeClass('open');
3681 this.$drop[this.animateMethod('hide')]();
3682
3683 if (this.options.container) {
3684 this.$parent.append(this.$drop);
3685 this.$drop.css({
3686 'top': 'auto',
3687 'left': 'auto'
3688 });
3689 }
3690
3691 this.options.onClose();
3692 }
3693 }, {
3694 key: "animateMethod",
3695 value: function animateMethod(method) {
3696 var methods = {
3697 show: {
3698 fade: 'fadeIn',
3699 slide: 'slideDown'
3700 },
3701 hide: {
3702 fade: 'fadeOut',
3703 slide: 'slideUp'
3704 }
3705 };
3706 return methods[method][this.options.animate] || method;
3707 }
3708 }, {
3709 key: "update",
3710 value: function update(ignoreTrigger) {
3711 var valueSelects = this.getSelects();
3712 var textSelects = this.getSelects('text');
3713
3714 if (this.options.displayValues) {
3715 textSelects = valueSelects;
3716 }
3717
3718 var $span = this.$choice.find('>span');
3719 var sl = valueSelects.length;
3720 var html = '';
3721
3722 if (sl === 0) {
3723 $span.addClass('placeholder').html(this.options.placeholder);
3724 } else if (sl < this.options.minimumCountSelected) {
3725 html = textSelects.join(this.options.displayDelimiter);
3726 } else if (this.options.formatAllSelected() && sl === this.dataTotal) {
3727 html = this.options.formatAllSelected();
3728 } else if (this.options.ellipsis && sl > this.options.minimumCountSelected) {
3729 html = "".concat(textSelects.slice(0, this.options.minimumCountSelected).join(this.options.displayDelimiter), "...");
3730 } else if (this.options.formatCountSelected() && sl > this.options.minimumCountSelected) {
3731 html = this.options.formatCountSelected(sl, this.dataTotal);
3732 } else {
3733 html = textSelects.join(this.options.displayDelimiter);
3734 }
3735
3736 if (html) {
3737 $span.removeClass('placeholder').html(html);
3738 }
3739
3740 if (this.options.displayTitle) {
3741 $span.prop('title', this.getSelects('text'));
3742 } // set selects to select
3743
3744
3745 this.$el.val(this.getSelects()); // trigger <select> change event
3746
3747 if (!ignoreTrigger) {
3748 this.$el.trigger('change');
3749 }
3750 }
3751 }, {
3752 key: "updateSelected",
3753 value: function updateSelected() {
3754 for (var i = this.updateDataStart; i < this.updateDataEnd; i++) {
3755 var row = this.updateData[i];
3756 this.$drop.find("input[data-key=".concat(row._key, "]")).prop('checked', row.selected).closest('li').toggleClass('selected', row.selected);
3757 }
3758
3759 var noResult = this.data.filter(function (row) {
3760 return row.visible;
3761 }).length === 0;
3762
3763 if (this.$selectAll.length) {
3764 this.$selectAll.prop('checked', this.allSelected).closest('li').toggle(!noResult);
3765 }
3766
3767 this.$noResults.toggle(noResult);
3768
3769 if (this.virtualScroll) {
3770 this.virtualScroll.rows = this.getListRows();
3771 }
3772 }
3773 }, {
3774 key: "getOptions",
3775 value: function getOptions() {
3776 // deep copy and remove data
3777 var options = $.extend({}, this.options);
3778 delete options.data;
3779 return $.extend(true, {}, options);
3780 }
3781 }, {
3782 key: "refreshOptions",
3783 value: function refreshOptions(options) {
3784 // If the objects are equivalent then avoid the call of destroy / init methods
3785 if (compareObjects(this.options, options, true)) {
3786 return;
3787 }
3788
3789 this.options = $.extend(this.options, options);
3790 this.destroy();
3791 this.init();
3792 } // value html, or text, default: 'value'
3793
3794 }, {
3795 key: "getSelects",
3796 value: function getSelects() {
3797 var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'value';
3798 var values = [];
3799 var _iteratorNormalCompletion3 = true;
3800 var _didIteratorError3 = false;
3801 var _iteratorError3 = undefined;
3802
3803 try {
3804 for (var _iterator3 = this.data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
3805 var row = _step3.value;
3806
3807 if (row.type === 'optgroup') {
3808 var selectedChildren = row.children.filter(function (child) {
3809 return child.selected;
3810 });
3811
3812 if (!selectedChildren.length) {
3813 continue;
3814 }
3815
3816 if (type === 'value' || this.options.single) {
3817 values.push.apply(values, _toConsumableArray(selectedChildren.map(function (child) {
3818 return type === 'value' ? child._value || child[type] : child[type];
3819 })));
3820 } else {
3821 var value = [];
3822 value.push('[');
3823 value.push(row.label);
3824 value.push(": ".concat(selectedChildren.map(function (child) {
3825 return child[type];
3826 }).join(', ')));
3827 value.push(']');
3828 values.push(value.join(''));
3829 }
3830 } else if (row.selected) {
3831 values.push(type === 'value' ? row._value || row[type] : row[type]);
3832 }
3833 }
3834 } catch (err) {
3835 _didIteratorError3 = true;
3836 _iteratorError3 = err;
3837 } finally {
3838 try {
3839 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
3840 _iterator3.return();
3841 }
3842 } finally {
3843 if (_didIteratorError3) {
3844 throw _iteratorError3;
3845 }
3846 }
3847 }
3848
3849 return values;
3850 }
3851 }, {
3852 key: "setSelects",
3853 value: function setSelects(values, ignoreTrigger) {
3854 var hasChanged = false;
3855
3856 var _setSelects = function _setSelects(rows) {
3857 var _iteratorNormalCompletion4 = true;
3858 var _didIteratorError4 = false;
3859 var _iteratorError4 = undefined;
3860
3861 try {
3862 for (var _iterator4 = rows[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
3863 var row = _step4.value;
3864 var selected = values.includes(row._value || row.value);
3865
3866 if (!selected && row.value === +row.value + '') {
3867 selected = values.includes(+row.value);
3868 }
3869
3870 if (row.selected !== selected) {
3871 hasChanged = true;
3872 }
3873
3874 row.selected = selected;
3875 }
3876 } catch (err) {
3877 _didIteratorError4 = true;
3878 _iteratorError4 = err;
3879 } finally {
3880 try {
3881 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
3882 _iterator4.return();
3883 }
3884 } finally {
3885 if (_didIteratorError4) {
3886 throw _iteratorError4;
3887 }
3888 }
3889 }
3890 };
3891
3892 var _iteratorNormalCompletion5 = true;
3893 var _didIteratorError5 = false;
3894 var _iteratorError5 = undefined;
3895
3896 try {
3897 for (var _iterator5 = this.data[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
3898 var row = _step5.value;
3899
3900 if (row.type === 'optgroup') {
3901 _setSelects(row.children);
3902 } else {
3903 _setSelects([row]);
3904 }
3905 }
3906 } catch (err) {
3907 _didIteratorError5 = true;
3908 _iteratorError5 = err;
3909 } finally {
3910 try {
3911 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
3912 _iterator5.return();
3913 }
3914 } finally {
3915 if (_didIteratorError5) {
3916 throw _iteratorError5;
3917 }
3918 }
3919 }
3920
3921 if (hasChanged) {
3922 this.initSelected(ignoreTrigger);
3923 this.updateSelected();
3924 this.update(ignoreTrigger);
3925 }
3926 }
3927 }, {
3928 key: "enable",
3929 value: function enable() {
3930 this.$choice.removeClass('disabled');
3931 }
3932 }, {
3933 key: "disable",
3934 value: function disable() {
3935 this.$choice.addClass('disabled');
3936 }
3937 }, {
3938 key: "check",
3939 value: function check(value) {
3940 var option = findByParam(this.data, 'value', value);
3941
3942 if (!option) {
3943 return;
3944 }
3945
3946 this._check(option, true);
3947 }
3948 }, {
3949 key: "uncheck",
3950 value: function uncheck(value) {
3951 var option = findByParam(this.data, 'value', value);
3952
3953 if (!option) {
3954 return;
3955 }
3956
3957 this._check(option, false);
3958 }
3959 }, {
3960 key: "_check",
3961 value: function _check(option, checked) {
3962 if (this.options.single) {
3963 this._checkAll(false, true);
3964 }
3965
3966 option.selected = checked;
3967 this.initSelected();
3968 this.updateSelected();
3969 this.update();
3970 }
3971 }, {
3972 key: "checkAll",
3973 value: function checkAll() {
3974 this._checkAll(true);
3975 }
3976 }, {
3977 key: "uncheckAll",
3978 value: function uncheckAll() {
3979 this._checkAll(false);
3980 }
3981 }, {
3982 key: "_checkAll",
3983 value: function _checkAll(checked, ignoreUpdate) {
3984 var _iteratorNormalCompletion6 = true;
3985 var _didIteratorError6 = false;
3986 var _iteratorError6 = undefined;
3987
3988 try {
3989 for (var _iterator6 = this.data[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
3990 var row = _step6.value;
3991
3992 if (row.type === 'optgroup') {
3993 this._checkGroup(row, checked, true);
3994 } else if (!row.disabled && (ignoreUpdate || row.visible)) {
3995 row.selected = checked;
3996 }
3997 }
3998 } catch (err) {
3999 _didIteratorError6 = true;
4000 _iteratorError6 = err;
4001 } finally {
4002 try {
4003 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
4004 _iterator6.return();
4005 }
4006 } finally {
4007 if (_didIteratorError6) {
4008 throw _iteratorError6;
4009 }
4010 }
4011 }
4012
4013 if (!ignoreUpdate) {
4014 this.initSelected();
4015 this.updateSelected();
4016 this.update();
4017 }
4018 }
4019 }, {
4020 key: "_checkGroup",
4021 value: function _checkGroup(group, checked, ignoreUpdate) {
4022 group.selected = checked;
4023 group.children.forEach(function (row) {
4024 if (!row.disabled && (ignoreUpdate || row.visible)) {
4025 row.selected = checked;
4026 }
4027 });
4028
4029 if (!ignoreUpdate) {
4030 this.initSelected();
4031 this.updateSelected();
4032 this.update();
4033 }
4034 }
4035 }, {
4036 key: "checkInvert",
4037 value: function checkInvert() {
4038 if (this.options.single) {
4039 return;
4040 }
4041
4042 var _iteratorNormalCompletion7 = true;
4043 var _didIteratorError7 = false;
4044 var _iteratorError7 = undefined;
4045
4046 try {
4047 for (var _iterator7 = this.data[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
4048 var row = _step7.value;
4049
4050 if (row.type === 'optgroup') {
4051 var _iteratorNormalCompletion8 = true;
4052 var _didIteratorError8 = false;
4053 var _iteratorError8 = undefined;
4054
4055 try {
4056 for (var _iterator8 = row.children[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
4057 var child = _step8.value;
4058 child.selected = !child.selected;
4059 }
4060 } catch (err) {
4061 _didIteratorError8 = true;
4062 _iteratorError8 = err;
4063 } finally {
4064 try {
4065 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
4066 _iterator8.return();
4067 }
4068 } finally {
4069 if (_didIteratorError8) {
4070 throw _iteratorError8;
4071 }
4072 }
4073 }
4074 } else {
4075 row.selected = !row.selected;
4076 }
4077 }
4078 } catch (err) {
4079 _didIteratorError7 = true;
4080 _iteratorError7 = err;
4081 } finally {
4082 try {
4083 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
4084 _iterator7.return();
4085 }
4086 } finally {
4087 if (_didIteratorError7) {
4088 throw _iteratorError7;
4089 }
4090 }
4091 }
4092
4093 this.initSelected();
4094 this.updateSelected();
4095 this.update();
4096 }
4097 }, {
4098 key: "focus",
4099 value: function focus() {
4100 this.$choice.focus();
4101 this.options.onFocus();
4102 }
4103 }, {
4104 key: "blur",
4105 value: function blur() {
4106 this.$choice.blur();
4107 this.options.onBlur();
4108 }
4109 }, {
4110 key: "refresh",
4111 value: function refresh() {
4112 this.destroy();
4113 this.init();
4114 }
4115 }, {
4116 key: "filter",
4117 value: function filter(ignoreTrigger) {
4118 var originalText = $.trim(this.$searchInput.val());
4119 var text = originalText.toLowerCase();
4120
4121 if (this.filterText === text) {
4122 return;
4123 }
4124
4125 this.filterText = text;
4126 var _iteratorNormalCompletion9 = true;
4127 var _didIteratorError9 = false;
4128 var _iteratorError9 = undefined;
4129
4130 try {
4131 for (var _iterator9 = this.data[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
4132 var row = _step9.value;
4133
4134 if (row.type === 'optgroup') {
4135 if (this.options.filterGroup) {
4136 var visible = this.options.customFilter(removeDiacritics(row.label.toLowerCase()), removeDiacritics(text), row.label, originalText);
4137 row.visible = visible;
4138 var _iteratorNormalCompletion10 = true;
4139 var _didIteratorError10 = false;
4140 var _iteratorError10 = undefined;
4141
4142 try {
4143 for (var _iterator10 = row.children[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
4144 var child = _step10.value;
4145 child.visible = visible;
4146 }
4147 } catch (err) {
4148 _didIteratorError10 = true;
4149 _iteratorError10 = err;
4150 } finally {
4151 try {
4152 if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
4153 _iterator10.return();
4154 }
4155 } finally {
4156 if (_didIteratorError10) {
4157 throw _iteratorError10;
4158 }
4159 }
4160 }
4161 } else {
4162 var _iteratorNormalCompletion11 = true;
4163 var _didIteratorError11 = false;
4164 var _iteratorError11 = undefined;
4165
4166 try {
4167 for (var _iterator11 = row.children[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
4168 var _child = _step11.value;
4169 _child.visible = this.options.customFilter(removeDiacritics(_child.text.toLowerCase()), removeDiacritics(text), _child.text, originalText);
4170 }
4171 } catch (err) {
4172 _didIteratorError11 = true;
4173 _iteratorError11 = err;
4174 } finally {
4175 try {
4176 if (!_iteratorNormalCompletion11 && _iterator11.return != null) {
4177 _iterator11.return();
4178 }
4179 } finally {
4180 if (_didIteratorError11) {
4181 throw _iteratorError11;
4182 }
4183 }
4184 }
4185
4186 row.visible = row.children.filter(function (child) {
4187 return child.visible;
4188 }).length > 0;
4189 }
4190 } else {
4191 row.visible = this.options.customFilter(removeDiacritics(row.text.toLowerCase()), removeDiacritics(text), row.text, originalText);
4192 }
4193 }
4194 } catch (err) {
4195 _didIteratorError9 = true;
4196 _iteratorError9 = err;
4197 } finally {
4198 try {
4199 if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
4200 _iterator9.return();
4201 }
4202 } finally {
4203 if (_didIteratorError9) {
4204 throw _iteratorError9;
4205 }
4206 }
4207 }
4208
4209 this.initListItems();
4210 this.initSelected(ignoreTrigger);
4211 this.updateSelected();
4212
4213 if (!ignoreTrigger) {
4214 this.options.onFilter(text);
4215 }
4216 }
4217 }, {
4218 key: "destroy",
4219 value: function destroy() {
4220 if (!this.$parent) {
4221 return;
4222 }
4223
4224 this.$el.before(this.$parent).removeClass('ms-offscreen');
4225
4226 if (this.tabIndex !== null) {
4227 this.$el.attr('tabindex', this.tabIndex);
4228 }
4229
4230 this.$parent.remove();
4231
4232 if (this.fromHtml) {
4233 delete this.options.data;
4234 this.fromHtml = false;
4235 }
4236 }
4237 }]);
4238
4239 return MultipleSelect;
4240}();
4241
4242$.fn.multipleSelect = function (option) {
4243 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4244 args[_key - 1] = arguments[_key];
4245 }
4246
4247 var value;
4248 this.each(function (i, el) {
4249 var $this = $(el);
4250 var data = $this.data('multipleSelect');
4251 var options = $.extend({}, $this.data(), _typeof(option) === 'object' && option);
4252
4253 if (!data) {
4254 data = new MultipleSelect($this, options);
4255 $this.data('multipleSelect', data);
4256 }
4257
4258 if (typeof option === 'string') {
4259 var _data;
4260
4261 if ($.inArray(option, Constants.METHODS) < 0) {
4262 throw new Error("Unknown method: ".concat(option));
4263 }
4264
4265 value = (_data = data)[option].apply(_data, args);
4266
4267 if (option === 'destroy') {
4268 $this.removeData('multipleSelect');
4269 }
4270 } else {
4271 data.init();
4272 }
4273 });
4274 return typeof value !== 'undefined' ? value : this;
4275};
4276
4277$.fn.multipleSelect.defaults = Constants.DEFAULTS;
4278$.fn.multipleSelect.locales = Constants.LOCALES;
4279$.fn.multipleSelect.methods = Constants.METHODS;