UNPKG

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