@pie-element/hotspot 9.0.0 → 9.0.1-esmbeta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3559 @@
1
+ import { partialScoring } from '@pie-lib/controller-utils';
2
+
3
+ function _extends() {
4
+ _extends = Object.assign || function (target) {
5
+ for (var i = 1; i < arguments.length; i++) {
6
+ var source = arguments[i];
7
+
8
+ for (var key in source) {
9
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10
+ target[key] = source[key];
11
+ }
12
+ }
13
+ }
14
+
15
+ return target;
16
+ };
17
+
18
+ return _extends.apply(this, arguments);
19
+ }
20
+
21
+ function _objectWithoutPropertiesLoose(source, excluded) {
22
+ if (source == null) return {};
23
+ var target = {};
24
+ var sourceKeys = Object.keys(source);
25
+ var key, i;
26
+
27
+ for (i = 0; i < sourceKeys.length; i++) {
28
+ key = sourceKeys[i];
29
+ if (excluded.indexOf(key) >= 0) continue;
30
+ target[key] = source[key];
31
+ }
32
+
33
+ return target;
34
+ }
35
+
36
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
37
+
38
+ var browser = {exports: {}};
39
+
40
+ /**
41
+ * Helpers.
42
+ */
43
+
44
+ var s = 1000;
45
+ var m = s * 60;
46
+ var h = m * 60;
47
+ var d = h * 24;
48
+ var w = d * 7;
49
+ var y = d * 365.25;
50
+
51
+ /**
52
+ * Parse or format the given `val`.
53
+ *
54
+ * Options:
55
+ *
56
+ * - `long` verbose formatting [false]
57
+ *
58
+ * @param {String|Number} val
59
+ * @param {Object} [options]
60
+ * @throws {Error} throw an error if val is not a non-empty string or a number
61
+ * @return {String|Number}
62
+ * @api public
63
+ */
64
+
65
+ var ms = function(val, options) {
66
+ options = options || {};
67
+ var type = typeof val;
68
+ if (type === 'string' && val.length > 0) {
69
+ return parse(val);
70
+ } else if (type === 'number' && isFinite(val)) {
71
+ return options.long ? fmtLong(val) : fmtShort(val);
72
+ }
73
+ throw new Error(
74
+ 'val is not a non-empty string or a valid number. val=' +
75
+ JSON.stringify(val)
76
+ );
77
+ };
78
+
79
+ /**
80
+ * Parse the given `str` and return milliseconds.
81
+ *
82
+ * @param {String} str
83
+ * @return {Number}
84
+ * @api private
85
+ */
86
+
87
+ function parse(str) {
88
+ str = String(str);
89
+ if (str.length > 100) {
90
+ return;
91
+ }
92
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
93
+ str
94
+ );
95
+ if (!match) {
96
+ return;
97
+ }
98
+ var n = parseFloat(match[1]);
99
+ var type = (match[2] || 'ms').toLowerCase();
100
+ switch (type) {
101
+ case 'years':
102
+ case 'year':
103
+ case 'yrs':
104
+ case 'yr':
105
+ case 'y':
106
+ return n * y;
107
+ case 'weeks':
108
+ case 'week':
109
+ case 'w':
110
+ return n * w;
111
+ case 'days':
112
+ case 'day':
113
+ case 'd':
114
+ return n * d;
115
+ case 'hours':
116
+ case 'hour':
117
+ case 'hrs':
118
+ case 'hr':
119
+ case 'h':
120
+ return n * h;
121
+ case 'minutes':
122
+ case 'minute':
123
+ case 'mins':
124
+ case 'min':
125
+ case 'm':
126
+ return n * m;
127
+ case 'seconds':
128
+ case 'second':
129
+ case 'secs':
130
+ case 'sec':
131
+ case 's':
132
+ return n * s;
133
+ case 'milliseconds':
134
+ case 'millisecond':
135
+ case 'msecs':
136
+ case 'msec':
137
+ case 'ms':
138
+ return n;
139
+ default:
140
+ return undefined;
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Short format for `ms`.
146
+ *
147
+ * @param {Number} ms
148
+ * @return {String}
149
+ * @api private
150
+ */
151
+
152
+ function fmtShort(ms) {
153
+ var msAbs = Math.abs(ms);
154
+ if (msAbs >= d) {
155
+ return Math.round(ms / d) + 'd';
156
+ }
157
+ if (msAbs >= h) {
158
+ return Math.round(ms / h) + 'h';
159
+ }
160
+ if (msAbs >= m) {
161
+ return Math.round(ms / m) + 'm';
162
+ }
163
+ if (msAbs >= s) {
164
+ return Math.round(ms / s) + 's';
165
+ }
166
+ return ms + 'ms';
167
+ }
168
+
169
+ /**
170
+ * Long format for `ms`.
171
+ *
172
+ * @param {Number} ms
173
+ * @return {String}
174
+ * @api private
175
+ */
176
+
177
+ function fmtLong(ms) {
178
+ var msAbs = Math.abs(ms);
179
+ if (msAbs >= d) {
180
+ return plural(ms, msAbs, d, 'day');
181
+ }
182
+ if (msAbs >= h) {
183
+ return plural(ms, msAbs, h, 'hour');
184
+ }
185
+ if (msAbs >= m) {
186
+ return plural(ms, msAbs, m, 'minute');
187
+ }
188
+ if (msAbs >= s) {
189
+ return plural(ms, msAbs, s, 'second');
190
+ }
191
+ return ms + ' ms';
192
+ }
193
+
194
+ /**
195
+ * Pluralization helper.
196
+ */
197
+
198
+ function plural(ms, msAbs, n, name) {
199
+ var isPlural = msAbs >= n * 1.5;
200
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
201
+ }
202
+
203
+ /**
204
+ * This is the common logic for both the Node.js and web browser
205
+ * implementations of `debug()`.
206
+ */
207
+
208
+ function setup(env) {
209
+ createDebug.debug = createDebug;
210
+ createDebug.default = createDebug;
211
+ createDebug.coerce = coerce;
212
+ createDebug.disable = disable;
213
+ createDebug.enable = enable;
214
+ createDebug.enabled = enabled;
215
+ createDebug.humanize = ms;
216
+ createDebug.destroy = destroy;
217
+
218
+ Object.keys(env).forEach(key => {
219
+ createDebug[key] = env[key];
220
+ });
221
+
222
+ /**
223
+ * The currently active debug mode names, and names to skip.
224
+ */
225
+
226
+ createDebug.names = [];
227
+ createDebug.skips = [];
228
+
229
+ /**
230
+ * Map of special "%n" handling functions, for the debug "format" argument.
231
+ *
232
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
233
+ */
234
+ createDebug.formatters = {};
235
+
236
+ /**
237
+ * Selects a color for a debug namespace
238
+ * @param {String} namespace The namespace string for the debug instance to be colored
239
+ * @return {Number|String} An ANSI color code for the given namespace
240
+ * @api private
241
+ */
242
+ function selectColor(namespace) {
243
+ let hash = 0;
244
+
245
+ for (let i = 0; i < namespace.length; i++) {
246
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
247
+ hash |= 0; // Convert to 32bit integer
248
+ }
249
+
250
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
251
+ }
252
+ createDebug.selectColor = selectColor;
253
+
254
+ /**
255
+ * Create a debugger with the given `namespace`.
256
+ *
257
+ * @param {String} namespace
258
+ * @return {Function}
259
+ * @api public
260
+ */
261
+ function createDebug(namespace) {
262
+ let prevTime;
263
+ let enableOverride = null;
264
+ let namespacesCache;
265
+ let enabledCache;
266
+
267
+ function debug(...args) {
268
+ // Disabled?
269
+ if (!debug.enabled) {
270
+ return;
271
+ }
272
+
273
+ const self = debug;
274
+
275
+ // Set `diff` timestamp
276
+ const curr = Number(new Date());
277
+ const ms = curr - (prevTime || curr);
278
+ self.diff = ms;
279
+ self.prev = prevTime;
280
+ self.curr = curr;
281
+ prevTime = curr;
282
+
283
+ args[0] = createDebug.coerce(args[0]);
284
+
285
+ if (typeof args[0] !== 'string') {
286
+ // Anything else let's inspect with %O
287
+ args.unshift('%O');
288
+ }
289
+
290
+ // Apply any `formatters` transformations
291
+ let index = 0;
292
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
293
+ // If we encounter an escaped % then don't increase the array index
294
+ if (match === '%%') {
295
+ return '%';
296
+ }
297
+ index++;
298
+ const formatter = createDebug.formatters[format];
299
+ if (typeof formatter === 'function') {
300
+ const val = args[index];
301
+ match = formatter.call(self, val);
302
+
303
+ // Now we need to remove `args[index]` since it's inlined in the `format`
304
+ args.splice(index, 1);
305
+ index--;
306
+ }
307
+ return match;
308
+ });
309
+
310
+ // Apply env-specific formatting (colors, etc.)
311
+ createDebug.formatArgs.call(self, args);
312
+
313
+ const logFn = self.log || createDebug.log;
314
+ logFn.apply(self, args);
315
+ }
316
+
317
+ debug.namespace = namespace;
318
+ debug.useColors = createDebug.useColors();
319
+ debug.color = createDebug.selectColor(namespace);
320
+ debug.extend = extend;
321
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
322
+
323
+ Object.defineProperty(debug, 'enabled', {
324
+ enumerable: true,
325
+ configurable: false,
326
+ get: () => {
327
+ if (enableOverride !== null) {
328
+ return enableOverride;
329
+ }
330
+ if (namespacesCache !== createDebug.namespaces) {
331
+ namespacesCache = createDebug.namespaces;
332
+ enabledCache = createDebug.enabled(namespace);
333
+ }
334
+
335
+ return enabledCache;
336
+ },
337
+ set: v => {
338
+ enableOverride = v;
339
+ }
340
+ });
341
+
342
+ // Env-specific initialization logic for debug instances
343
+ if (typeof createDebug.init === 'function') {
344
+ createDebug.init(debug);
345
+ }
346
+
347
+ return debug;
348
+ }
349
+
350
+ function extend(namespace, delimiter) {
351
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
352
+ newDebug.log = this.log;
353
+ return newDebug;
354
+ }
355
+
356
+ /**
357
+ * Enables a debug mode by namespaces. This can include modes
358
+ * separated by a colon and wildcards.
359
+ *
360
+ * @param {String} namespaces
361
+ * @api public
362
+ */
363
+ function enable(namespaces) {
364
+ createDebug.save(namespaces);
365
+ createDebug.namespaces = namespaces;
366
+
367
+ createDebug.names = [];
368
+ createDebug.skips = [];
369
+
370
+ let i;
371
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
372
+ const len = split.length;
373
+
374
+ for (i = 0; i < len; i++) {
375
+ if (!split[i]) {
376
+ // ignore empty strings
377
+ continue;
378
+ }
379
+
380
+ namespaces = split[i].replace(/\*/g, '.*?');
381
+
382
+ if (namespaces[0] === '-') {
383
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
384
+ } else {
385
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
386
+ }
387
+ }
388
+ }
389
+
390
+ /**
391
+ * Disable debug output.
392
+ *
393
+ * @return {String} namespaces
394
+ * @api public
395
+ */
396
+ function disable() {
397
+ const namespaces = [
398
+ ...createDebug.names.map(toNamespace),
399
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
400
+ ].join(',');
401
+ createDebug.enable('');
402
+ return namespaces;
403
+ }
404
+
405
+ /**
406
+ * Returns true if the given mode name is enabled, false otherwise.
407
+ *
408
+ * @param {String} name
409
+ * @return {Boolean}
410
+ * @api public
411
+ */
412
+ function enabled(name) {
413
+ if (name[name.length - 1] === '*') {
414
+ return true;
415
+ }
416
+
417
+ let i;
418
+ let len;
419
+
420
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
421
+ if (createDebug.skips[i].test(name)) {
422
+ return false;
423
+ }
424
+ }
425
+
426
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
427
+ if (createDebug.names[i].test(name)) {
428
+ return true;
429
+ }
430
+ }
431
+
432
+ return false;
433
+ }
434
+
435
+ /**
436
+ * Convert regexp to namespace
437
+ *
438
+ * @param {RegExp} regxep
439
+ * @return {String} namespace
440
+ * @api private
441
+ */
442
+ function toNamespace(regexp) {
443
+ return regexp.toString()
444
+ .substring(2, regexp.toString().length - 2)
445
+ .replace(/\.\*\?$/, '*');
446
+ }
447
+
448
+ /**
449
+ * Coerce `val`.
450
+ *
451
+ * @param {Mixed} val
452
+ * @return {Mixed}
453
+ * @api private
454
+ */
455
+ function coerce(val) {
456
+ if (val instanceof Error) {
457
+ return val.stack || val.message;
458
+ }
459
+ return val;
460
+ }
461
+
462
+ /**
463
+ * XXX DO NOT USE. This is a temporary stub function.
464
+ * XXX It WILL be removed in the next major release.
465
+ */
466
+ function destroy() {
467
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
468
+ }
469
+
470
+ createDebug.enable(createDebug.load());
471
+
472
+ return createDebug;
473
+ }
474
+
475
+ var common = setup;
476
+
477
+ /* eslint-env browser */
478
+
479
+ (function (module, exports) {
480
+ /**
481
+ * This is the web browser implementation of `debug()`.
482
+ */
483
+
484
+ exports.formatArgs = formatArgs;
485
+ exports.save = save;
486
+ exports.load = load;
487
+ exports.useColors = useColors;
488
+ exports.storage = localstorage();
489
+ exports.destroy = (() => {
490
+ let warned = false;
491
+
492
+ return () => {
493
+ if (!warned) {
494
+ warned = true;
495
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
496
+ }
497
+ };
498
+ })();
499
+
500
+ /**
501
+ * Colors.
502
+ */
503
+
504
+ exports.colors = [
505
+ '#0000CC',
506
+ '#0000FF',
507
+ '#0033CC',
508
+ '#0033FF',
509
+ '#0066CC',
510
+ '#0066FF',
511
+ '#0099CC',
512
+ '#0099FF',
513
+ '#00CC00',
514
+ '#00CC33',
515
+ '#00CC66',
516
+ '#00CC99',
517
+ '#00CCCC',
518
+ '#00CCFF',
519
+ '#3300CC',
520
+ '#3300FF',
521
+ '#3333CC',
522
+ '#3333FF',
523
+ '#3366CC',
524
+ '#3366FF',
525
+ '#3399CC',
526
+ '#3399FF',
527
+ '#33CC00',
528
+ '#33CC33',
529
+ '#33CC66',
530
+ '#33CC99',
531
+ '#33CCCC',
532
+ '#33CCFF',
533
+ '#6600CC',
534
+ '#6600FF',
535
+ '#6633CC',
536
+ '#6633FF',
537
+ '#66CC00',
538
+ '#66CC33',
539
+ '#9900CC',
540
+ '#9900FF',
541
+ '#9933CC',
542
+ '#9933FF',
543
+ '#99CC00',
544
+ '#99CC33',
545
+ '#CC0000',
546
+ '#CC0033',
547
+ '#CC0066',
548
+ '#CC0099',
549
+ '#CC00CC',
550
+ '#CC00FF',
551
+ '#CC3300',
552
+ '#CC3333',
553
+ '#CC3366',
554
+ '#CC3399',
555
+ '#CC33CC',
556
+ '#CC33FF',
557
+ '#CC6600',
558
+ '#CC6633',
559
+ '#CC9900',
560
+ '#CC9933',
561
+ '#CCCC00',
562
+ '#CCCC33',
563
+ '#FF0000',
564
+ '#FF0033',
565
+ '#FF0066',
566
+ '#FF0099',
567
+ '#FF00CC',
568
+ '#FF00FF',
569
+ '#FF3300',
570
+ '#FF3333',
571
+ '#FF3366',
572
+ '#FF3399',
573
+ '#FF33CC',
574
+ '#FF33FF',
575
+ '#FF6600',
576
+ '#FF6633',
577
+ '#FF9900',
578
+ '#FF9933',
579
+ '#FFCC00',
580
+ '#FFCC33'
581
+ ];
582
+
583
+ /**
584
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
585
+ * and the Firebug extension (any Firefox version) are known
586
+ * to support "%c" CSS customizations.
587
+ *
588
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
589
+ */
590
+
591
+ // eslint-disable-next-line complexity
592
+ function useColors() {
593
+ // NB: In an Electron preload script, document will be defined but not fully
594
+ // initialized. Since we know we're in Chrome, we'll just detect this case
595
+ // explicitly
596
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
597
+ return true;
598
+ }
599
+
600
+ // Internet Explorer and Edge do not support colors.
601
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
602
+ return false;
603
+ }
604
+
605
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
606
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
607
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
608
+ // Is firebug? http://stackoverflow.com/a/398120/376773
609
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
610
+ // Is firefox >= v31?
611
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
612
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
613
+ // Double check webkit in userAgent just in case we are in a worker
614
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
615
+ }
616
+
617
+ /**
618
+ * Colorize log arguments if enabled.
619
+ *
620
+ * @api public
621
+ */
622
+
623
+ function formatArgs(args) {
624
+ args[0] = (this.useColors ? '%c' : '') +
625
+ this.namespace +
626
+ (this.useColors ? ' %c' : ' ') +
627
+ args[0] +
628
+ (this.useColors ? '%c ' : ' ') +
629
+ '+' + module.exports.humanize(this.diff);
630
+
631
+ if (!this.useColors) {
632
+ return;
633
+ }
634
+
635
+ const c = 'color: ' + this.color;
636
+ args.splice(1, 0, c, 'color: inherit');
637
+
638
+ // The final "%c" is somewhat tricky, because there could be other
639
+ // arguments passed either before or after the %c, so we need to
640
+ // figure out the correct index to insert the CSS into
641
+ let index = 0;
642
+ let lastC = 0;
643
+ args[0].replace(/%[a-zA-Z%]/g, match => {
644
+ if (match === '%%') {
645
+ return;
646
+ }
647
+ index++;
648
+ if (match === '%c') {
649
+ // We only are interested in the *last* %c
650
+ // (the user may have provided their own)
651
+ lastC = index;
652
+ }
653
+ });
654
+
655
+ args.splice(lastC, 0, c);
656
+ }
657
+
658
+ /**
659
+ * Invokes `console.debug()` when available.
660
+ * No-op when `console.debug` is not a "function".
661
+ * If `console.debug` is not available, falls back
662
+ * to `console.log`.
663
+ *
664
+ * @api public
665
+ */
666
+ exports.log = console.debug || console.log || (() => {});
667
+
668
+ /**
669
+ * Save `namespaces`.
670
+ *
671
+ * @param {String} namespaces
672
+ * @api private
673
+ */
674
+ function save(namespaces) {
675
+ try {
676
+ if (namespaces) {
677
+ exports.storage.setItem('debug', namespaces);
678
+ } else {
679
+ exports.storage.removeItem('debug');
680
+ }
681
+ } catch (error) {
682
+ // Swallow
683
+ // XXX (@Qix-) should we be logging these?
684
+ }
685
+ }
686
+
687
+ /**
688
+ * Load `namespaces`.
689
+ *
690
+ * @return {String} returns the previously persisted debug modes
691
+ * @api private
692
+ */
693
+ function load() {
694
+ let r;
695
+ try {
696
+ r = exports.storage.getItem('debug');
697
+ } catch (error) {
698
+ // Swallow
699
+ // XXX (@Qix-) should we be logging these?
700
+ }
701
+
702
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
703
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
704
+ r = process.env.DEBUG;
705
+ }
706
+
707
+ return r;
708
+ }
709
+
710
+ /**
711
+ * Localstorage attempts to return the localstorage.
712
+ *
713
+ * This is necessary because safari throws
714
+ * when a user disables cookies/localstorage
715
+ * and you attempt to access it.
716
+ *
717
+ * @return {LocalStorage}
718
+ * @api private
719
+ */
720
+
721
+ function localstorage() {
722
+ try {
723
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
724
+ // The Browser also has localStorage in the global context.
725
+ return localStorage;
726
+ } catch (error) {
727
+ // Swallow
728
+ // XXX (@Qix-) should we be logging these?
729
+ }
730
+ }
731
+
732
+ module.exports = common(exports);
733
+
734
+ const {formatters} = module.exports;
735
+
736
+ /**
737
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
738
+ */
739
+
740
+ formatters.j = function (v) {
741
+ try {
742
+ return JSON.stringify(v);
743
+ } catch (error) {
744
+ return '[UnexpectedJSONParseError]: ' + error.message;
745
+ }
746
+ };
747
+ }(browser, browser.exports));
748
+
749
+ var debug = browser.exports;
750
+
751
+ /** Used for built-in method references. */
752
+
753
+ var objectProto$c = Object.prototype;
754
+
755
+ /**
756
+ * Checks if `value` is likely a prototype object.
757
+ *
758
+ * @private
759
+ * @param {*} value The value to check.
760
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
761
+ */
762
+ function isPrototype$2(value) {
763
+ var Ctor = value && value.constructor,
764
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$c;
765
+
766
+ return value === proto;
767
+ }
768
+
769
+ var _isPrototype = isPrototype$2;
770
+
771
+ /**
772
+ * Creates a unary function that invokes `func` with its argument transformed.
773
+ *
774
+ * @private
775
+ * @param {Function} func The function to wrap.
776
+ * @param {Function} transform The argument transform.
777
+ * @returns {Function} Returns the new function.
778
+ */
779
+
780
+ function overArg$1(func, transform) {
781
+ return function(arg) {
782
+ return func(transform(arg));
783
+ };
784
+ }
785
+
786
+ var _overArg = overArg$1;
787
+
788
+ var overArg = _overArg;
789
+
790
+ /* Built-in method references for those with the same name as other `lodash` methods. */
791
+ var nativeKeys$1 = overArg(Object.keys, Object);
792
+
793
+ var _nativeKeys = nativeKeys$1;
794
+
795
+ var isPrototype$1 = _isPrototype,
796
+ nativeKeys = _nativeKeys;
797
+
798
+ /** Used for built-in method references. */
799
+ var objectProto$b = Object.prototype;
800
+
801
+ /** Used to check objects for own properties. */
802
+ var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
803
+
804
+ /**
805
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
806
+ *
807
+ * @private
808
+ * @param {Object} object The object to query.
809
+ * @returns {Array} Returns the array of property names.
810
+ */
811
+ function baseKeys$2(object) {
812
+ if (!isPrototype$1(object)) {
813
+ return nativeKeys(object);
814
+ }
815
+ var result = [];
816
+ for (var key in Object(object)) {
817
+ if (hasOwnProperty$9.call(object, key) && key != 'constructor') {
818
+ result.push(key);
819
+ }
820
+ }
821
+ return result;
822
+ }
823
+
824
+ var _baseKeys = baseKeys$2;
825
+
826
+ /** Detect free variable `global` from Node.js. */
827
+
828
+ var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
829
+
830
+ var _freeGlobal = freeGlobal$1;
831
+
832
+ var freeGlobal = _freeGlobal;
833
+
834
+ /** Detect free variable `self`. */
835
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
836
+
837
+ /** Used as a reference to the global object. */
838
+ var root$8 = freeGlobal || freeSelf || Function('return this')();
839
+
840
+ var _root = root$8;
841
+
842
+ var root$7 = _root;
843
+
844
+ /** Built-in value references. */
845
+ var Symbol$3 = root$7.Symbol;
846
+
847
+ var _Symbol = Symbol$3;
848
+
849
+ var Symbol$2 = _Symbol;
850
+
851
+ /** Used for built-in method references. */
852
+ var objectProto$a = Object.prototype;
853
+
854
+ /** Used to check objects for own properties. */
855
+ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
856
+
857
+ /**
858
+ * Used to resolve the
859
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
860
+ * of values.
861
+ */
862
+ var nativeObjectToString$1 = objectProto$a.toString;
863
+
864
+ /** Built-in value references. */
865
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
866
+
867
+ /**
868
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
869
+ *
870
+ * @private
871
+ * @param {*} value The value to query.
872
+ * @returns {string} Returns the raw `toStringTag`.
873
+ */
874
+ function getRawTag$1(value) {
875
+ var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
876
+ tag = value[symToStringTag$1];
877
+
878
+ try {
879
+ value[symToStringTag$1] = undefined;
880
+ var unmasked = true;
881
+ } catch (e) {}
882
+
883
+ var result = nativeObjectToString$1.call(value);
884
+ if (unmasked) {
885
+ if (isOwn) {
886
+ value[symToStringTag$1] = tag;
887
+ } else {
888
+ delete value[symToStringTag$1];
889
+ }
890
+ }
891
+ return result;
892
+ }
893
+
894
+ var _getRawTag = getRawTag$1;
895
+
896
+ /** Used for built-in method references. */
897
+
898
+ var objectProto$9 = Object.prototype;
899
+
900
+ /**
901
+ * Used to resolve the
902
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
903
+ * of values.
904
+ */
905
+ var nativeObjectToString = objectProto$9.toString;
906
+
907
+ /**
908
+ * Converts `value` to a string using `Object.prototype.toString`.
909
+ *
910
+ * @private
911
+ * @param {*} value The value to convert.
912
+ * @returns {string} Returns the converted string.
913
+ */
914
+ function objectToString$1(value) {
915
+ return nativeObjectToString.call(value);
916
+ }
917
+
918
+ var _objectToString = objectToString$1;
919
+
920
+ var Symbol$1 = _Symbol,
921
+ getRawTag = _getRawTag,
922
+ objectToString = _objectToString;
923
+
924
+ /** `Object#toString` result references. */
925
+ var nullTag = '[object Null]',
926
+ undefinedTag = '[object Undefined]';
927
+
928
+ /** Built-in value references. */
929
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
930
+
931
+ /**
932
+ * The base implementation of `getTag` without fallbacks for buggy environments.
933
+ *
934
+ * @private
935
+ * @param {*} value The value to query.
936
+ * @returns {string} Returns the `toStringTag`.
937
+ */
938
+ function baseGetTag$4(value) {
939
+ if (value == null) {
940
+ return value === undefined ? undefinedTag : nullTag;
941
+ }
942
+ return (symToStringTag && symToStringTag in Object(value))
943
+ ? getRawTag(value)
944
+ : objectToString(value);
945
+ }
946
+
947
+ var _baseGetTag = baseGetTag$4;
948
+
949
+ /**
950
+ * Checks if `value` is the
951
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
952
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
953
+ *
954
+ * @static
955
+ * @memberOf _
956
+ * @since 0.1.0
957
+ * @category Lang
958
+ * @param {*} value The value to check.
959
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
960
+ * @example
961
+ *
962
+ * _.isObject({});
963
+ * // => true
964
+ *
965
+ * _.isObject([1, 2, 3]);
966
+ * // => true
967
+ *
968
+ * _.isObject(_.noop);
969
+ * // => true
970
+ *
971
+ * _.isObject(null);
972
+ * // => false
973
+ */
974
+
975
+ function isObject$2(value) {
976
+ var type = typeof value;
977
+ return value != null && (type == 'object' || type == 'function');
978
+ }
979
+
980
+ var isObject_1 = isObject$2;
981
+
982
+ var baseGetTag$3 = _baseGetTag,
983
+ isObject$1 = isObject_1;
984
+
985
+ /** `Object#toString` result references. */
986
+ var asyncTag = '[object AsyncFunction]',
987
+ funcTag$1 = '[object Function]',
988
+ genTag = '[object GeneratorFunction]',
989
+ proxyTag = '[object Proxy]';
990
+
991
+ /**
992
+ * Checks if `value` is classified as a `Function` object.
993
+ *
994
+ * @static
995
+ * @memberOf _
996
+ * @since 0.1.0
997
+ * @category Lang
998
+ * @param {*} value The value to check.
999
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1000
+ * @example
1001
+ *
1002
+ * _.isFunction(_);
1003
+ * // => true
1004
+ *
1005
+ * _.isFunction(/abc/);
1006
+ * // => false
1007
+ */
1008
+ function isFunction$2(value) {
1009
+ if (!isObject$1(value)) {
1010
+ return false;
1011
+ }
1012
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1013
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
1014
+ var tag = baseGetTag$3(value);
1015
+ return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
1016
+ }
1017
+
1018
+ var isFunction_1 = isFunction$2;
1019
+
1020
+ var root$6 = _root;
1021
+
1022
+ /** Used to detect overreaching core-js shims. */
1023
+ var coreJsData$1 = root$6['__core-js_shared__'];
1024
+
1025
+ var _coreJsData = coreJsData$1;
1026
+
1027
+ var coreJsData = _coreJsData;
1028
+
1029
+ /** Used to detect methods masquerading as native. */
1030
+ var maskSrcKey = (function() {
1031
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1032
+ return uid ? ('Symbol(src)_1.' + uid) : '';
1033
+ }());
1034
+
1035
+ /**
1036
+ * Checks if `func` has its source masked.
1037
+ *
1038
+ * @private
1039
+ * @param {Function} func The function to check.
1040
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1041
+ */
1042
+ function isMasked$1(func) {
1043
+ return !!maskSrcKey && (maskSrcKey in func);
1044
+ }
1045
+
1046
+ var _isMasked = isMasked$1;
1047
+
1048
+ /** Used for built-in method references. */
1049
+
1050
+ var funcProto$1 = Function.prototype;
1051
+
1052
+ /** Used to resolve the decompiled source of functions. */
1053
+ var funcToString$1 = funcProto$1.toString;
1054
+
1055
+ /**
1056
+ * Converts `func` to its source code.
1057
+ *
1058
+ * @private
1059
+ * @param {Function} func The function to convert.
1060
+ * @returns {string} Returns the source code.
1061
+ */
1062
+ function toSource$2(func) {
1063
+ if (func != null) {
1064
+ try {
1065
+ return funcToString$1.call(func);
1066
+ } catch (e) {}
1067
+ try {
1068
+ return (func + '');
1069
+ } catch (e) {}
1070
+ }
1071
+ return '';
1072
+ }
1073
+
1074
+ var _toSource = toSource$2;
1075
+
1076
+ var isFunction$1 = isFunction_1,
1077
+ isMasked = _isMasked,
1078
+ isObject = isObject_1,
1079
+ toSource$1 = _toSource;
1080
+
1081
+ /**
1082
+ * Used to match `RegExp`
1083
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1084
+ */
1085
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1086
+
1087
+ /** Used to detect host constructors (Safari). */
1088
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
1089
+
1090
+ /** Used for built-in method references. */
1091
+ var funcProto = Function.prototype,
1092
+ objectProto$8 = Object.prototype;
1093
+
1094
+ /** Used to resolve the decompiled source of functions. */
1095
+ var funcToString = funcProto.toString;
1096
+
1097
+ /** Used to check objects for own properties. */
1098
+ var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
1099
+
1100
+ /** Used to detect if a method is native. */
1101
+ var reIsNative = RegExp('^' +
1102
+ funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
1103
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1104
+ );
1105
+
1106
+ /**
1107
+ * The base implementation of `_.isNative` without bad shim checks.
1108
+ *
1109
+ * @private
1110
+ * @param {*} value The value to check.
1111
+ * @returns {boolean} Returns `true` if `value` is a native function,
1112
+ * else `false`.
1113
+ */
1114
+ function baseIsNative$1(value) {
1115
+ if (!isObject(value) || isMasked(value)) {
1116
+ return false;
1117
+ }
1118
+ var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
1119
+ return pattern.test(toSource$1(value));
1120
+ }
1121
+
1122
+ var _baseIsNative = baseIsNative$1;
1123
+
1124
+ /**
1125
+ * Gets the value at `key` of `object`.
1126
+ *
1127
+ * @private
1128
+ * @param {Object} [object] The object to query.
1129
+ * @param {string} key The key of the property to get.
1130
+ * @returns {*} Returns the property value.
1131
+ */
1132
+
1133
+ function getValue$1(object, key) {
1134
+ return object == null ? undefined : object[key];
1135
+ }
1136
+
1137
+ var _getValue = getValue$1;
1138
+
1139
+ var baseIsNative = _baseIsNative,
1140
+ getValue = _getValue;
1141
+
1142
+ /**
1143
+ * Gets the native function at `key` of `object`.
1144
+ *
1145
+ * @private
1146
+ * @param {Object} object The object to query.
1147
+ * @param {string} key The key of the method to get.
1148
+ * @returns {*} Returns the function if it's native, else `undefined`.
1149
+ */
1150
+ function getNative$6(object, key) {
1151
+ var value = getValue(object, key);
1152
+ return baseIsNative(value) ? value : undefined;
1153
+ }
1154
+
1155
+ var _getNative = getNative$6;
1156
+
1157
+ var getNative$5 = _getNative,
1158
+ root$5 = _root;
1159
+
1160
+ /* Built-in method references that are verified to be native. */
1161
+ var DataView$1 = getNative$5(root$5, 'DataView');
1162
+
1163
+ var _DataView = DataView$1;
1164
+
1165
+ var getNative$4 = _getNative,
1166
+ root$4 = _root;
1167
+
1168
+ /* Built-in method references that are verified to be native. */
1169
+ var Map$3 = getNative$4(root$4, 'Map');
1170
+
1171
+ var _Map = Map$3;
1172
+
1173
+ var getNative$3 = _getNative,
1174
+ root$3 = _root;
1175
+
1176
+ /* Built-in method references that are verified to be native. */
1177
+ var Promise$2 = getNative$3(root$3, 'Promise');
1178
+
1179
+ var _Promise = Promise$2;
1180
+
1181
+ var getNative$2 = _getNative,
1182
+ root$2 = _root;
1183
+
1184
+ /* Built-in method references that are verified to be native. */
1185
+ var Set$1 = getNative$2(root$2, 'Set');
1186
+
1187
+ var _Set = Set$1;
1188
+
1189
+ var getNative$1 = _getNative,
1190
+ root$1 = _root;
1191
+
1192
+ /* Built-in method references that are verified to be native. */
1193
+ var WeakMap$1 = getNative$1(root$1, 'WeakMap');
1194
+
1195
+ var _WeakMap = WeakMap$1;
1196
+
1197
+ var DataView = _DataView,
1198
+ Map$2 = _Map,
1199
+ Promise$1 = _Promise,
1200
+ Set = _Set,
1201
+ WeakMap = _WeakMap,
1202
+ baseGetTag$2 = _baseGetTag,
1203
+ toSource = _toSource;
1204
+
1205
+ /** `Object#toString` result references. */
1206
+ var mapTag$3 = '[object Map]',
1207
+ objectTag$2 = '[object Object]',
1208
+ promiseTag = '[object Promise]',
1209
+ setTag$3 = '[object Set]',
1210
+ weakMapTag$1 = '[object WeakMap]';
1211
+
1212
+ var dataViewTag$2 = '[object DataView]';
1213
+
1214
+ /** Used to detect maps, sets, and weakmaps. */
1215
+ var dataViewCtorString = toSource(DataView),
1216
+ mapCtorString = toSource(Map$2),
1217
+ promiseCtorString = toSource(Promise$1),
1218
+ setCtorString = toSource(Set),
1219
+ weakMapCtorString = toSource(WeakMap);
1220
+
1221
+ /**
1222
+ * Gets the `toStringTag` of `value`.
1223
+ *
1224
+ * @private
1225
+ * @param {*} value The value to query.
1226
+ * @returns {string} Returns the `toStringTag`.
1227
+ */
1228
+ var getTag$2 = baseGetTag$2;
1229
+
1230
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1231
+ if ((DataView && getTag$2(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
1232
+ (Map$2 && getTag$2(new Map$2) != mapTag$3) ||
1233
+ (Promise$1 && getTag$2(Promise$1.resolve()) != promiseTag) ||
1234
+ (Set && getTag$2(new Set) != setTag$3) ||
1235
+ (WeakMap && getTag$2(new WeakMap) != weakMapTag$1)) {
1236
+ getTag$2 = function(value) {
1237
+ var result = baseGetTag$2(value),
1238
+ Ctor = result == objectTag$2 ? value.constructor : undefined,
1239
+ ctorString = Ctor ? toSource(Ctor) : '';
1240
+
1241
+ if (ctorString) {
1242
+ switch (ctorString) {
1243
+ case dataViewCtorString: return dataViewTag$2;
1244
+ case mapCtorString: return mapTag$3;
1245
+ case promiseCtorString: return promiseTag;
1246
+ case setCtorString: return setTag$3;
1247
+ case weakMapCtorString: return weakMapTag$1;
1248
+ }
1249
+ }
1250
+ return result;
1251
+ };
1252
+ }
1253
+
1254
+ var _getTag = getTag$2;
1255
+
1256
+ /**
1257
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1258
+ * and has a `typeof` result of "object".
1259
+ *
1260
+ * @static
1261
+ * @memberOf _
1262
+ * @since 4.0.0
1263
+ * @category Lang
1264
+ * @param {*} value The value to check.
1265
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1266
+ * @example
1267
+ *
1268
+ * _.isObjectLike({});
1269
+ * // => true
1270
+ *
1271
+ * _.isObjectLike([1, 2, 3]);
1272
+ * // => true
1273
+ *
1274
+ * _.isObjectLike(_.noop);
1275
+ * // => false
1276
+ *
1277
+ * _.isObjectLike(null);
1278
+ * // => false
1279
+ */
1280
+
1281
+ function isObjectLike$4(value) {
1282
+ return value != null && typeof value == 'object';
1283
+ }
1284
+
1285
+ var isObjectLike_1 = isObjectLike$4;
1286
+
1287
+ var baseGetTag$1 = _baseGetTag,
1288
+ isObjectLike$3 = isObjectLike_1;
1289
+
1290
+ /** `Object#toString` result references. */
1291
+ var argsTag$2 = '[object Arguments]';
1292
+
1293
+ /**
1294
+ * The base implementation of `_.isArguments`.
1295
+ *
1296
+ * @private
1297
+ * @param {*} value The value to check.
1298
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1299
+ */
1300
+ function baseIsArguments$1(value) {
1301
+ return isObjectLike$3(value) && baseGetTag$1(value) == argsTag$2;
1302
+ }
1303
+
1304
+ var _baseIsArguments = baseIsArguments$1;
1305
+
1306
+ var baseIsArguments = _baseIsArguments,
1307
+ isObjectLike$2 = isObjectLike_1;
1308
+
1309
+ /** Used for built-in method references. */
1310
+ var objectProto$7 = Object.prototype;
1311
+
1312
+ /** Used to check objects for own properties. */
1313
+ var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
1314
+
1315
+ /** Built-in value references. */
1316
+ var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
1317
+
1318
+ /**
1319
+ * Checks if `value` is likely an `arguments` object.
1320
+ *
1321
+ * @static
1322
+ * @memberOf _
1323
+ * @since 0.1.0
1324
+ * @category Lang
1325
+ * @param {*} value The value to check.
1326
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1327
+ * else `false`.
1328
+ * @example
1329
+ *
1330
+ * _.isArguments(function() { return arguments; }());
1331
+ * // => true
1332
+ *
1333
+ * _.isArguments([1, 2, 3]);
1334
+ * // => false
1335
+ */
1336
+ var isArguments$2 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1337
+ return isObjectLike$2(value) && hasOwnProperty$6.call(value, 'callee') &&
1338
+ !propertyIsEnumerable$1.call(value, 'callee');
1339
+ };
1340
+
1341
+ var isArguments_1 = isArguments$2;
1342
+
1343
+ /**
1344
+ * Checks if `value` is classified as an `Array` object.
1345
+ *
1346
+ * @static
1347
+ * @memberOf _
1348
+ * @since 0.1.0
1349
+ * @category Lang
1350
+ * @param {*} value The value to check.
1351
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1352
+ * @example
1353
+ *
1354
+ * _.isArray([1, 2, 3]);
1355
+ * // => true
1356
+ *
1357
+ * _.isArray(document.body.children);
1358
+ * // => false
1359
+ *
1360
+ * _.isArray('abc');
1361
+ * // => false
1362
+ *
1363
+ * _.isArray(_.noop);
1364
+ * // => false
1365
+ */
1366
+
1367
+ var isArray$4 = Array.isArray;
1368
+
1369
+ var isArray_1 = isArray$4;
1370
+
1371
+ /** Used as references for various `Number` constants. */
1372
+
1373
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
1374
+
1375
+ /**
1376
+ * Checks if `value` is a valid array-like length.
1377
+ *
1378
+ * **Note:** This method is loosely based on
1379
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1380
+ *
1381
+ * @static
1382
+ * @memberOf _
1383
+ * @since 4.0.0
1384
+ * @category Lang
1385
+ * @param {*} value The value to check.
1386
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1387
+ * @example
1388
+ *
1389
+ * _.isLength(3);
1390
+ * // => true
1391
+ *
1392
+ * _.isLength(Number.MIN_VALUE);
1393
+ * // => false
1394
+ *
1395
+ * _.isLength(Infinity);
1396
+ * // => false
1397
+ *
1398
+ * _.isLength('3');
1399
+ * // => false
1400
+ */
1401
+ function isLength$2(value) {
1402
+ return typeof value == 'number' &&
1403
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
1404
+ }
1405
+
1406
+ var isLength_1 = isLength$2;
1407
+
1408
+ var isFunction = isFunction_1,
1409
+ isLength$1 = isLength_1;
1410
+
1411
+ /**
1412
+ * Checks if `value` is array-like. A value is considered array-like if it's
1413
+ * not a function and has a `value.length` that's an integer greater than or
1414
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1415
+ *
1416
+ * @static
1417
+ * @memberOf _
1418
+ * @since 4.0.0
1419
+ * @category Lang
1420
+ * @param {*} value The value to check.
1421
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1422
+ * @example
1423
+ *
1424
+ * _.isArrayLike([1, 2, 3]);
1425
+ * // => true
1426
+ *
1427
+ * _.isArrayLike(document.body.children);
1428
+ * // => true
1429
+ *
1430
+ * _.isArrayLike('abc');
1431
+ * // => true
1432
+ *
1433
+ * _.isArrayLike(_.noop);
1434
+ * // => false
1435
+ */
1436
+ function isArrayLike$2(value) {
1437
+ return value != null && isLength$1(value.length) && !isFunction(value);
1438
+ }
1439
+
1440
+ var isArrayLike_1 = isArrayLike$2;
1441
+
1442
+ var isBuffer$3 = {exports: {}};
1443
+
1444
+ /**
1445
+ * This method returns `false`.
1446
+ *
1447
+ * @static
1448
+ * @memberOf _
1449
+ * @since 4.13.0
1450
+ * @category Util
1451
+ * @returns {boolean} Returns `false`.
1452
+ * @example
1453
+ *
1454
+ * _.times(2, _.stubFalse);
1455
+ * // => [false, false]
1456
+ */
1457
+
1458
+ function stubFalse() {
1459
+ return false;
1460
+ }
1461
+
1462
+ var stubFalse_1 = stubFalse;
1463
+
1464
+ (function (module, exports) {
1465
+ var root = _root,
1466
+ stubFalse = stubFalse_1;
1467
+
1468
+ /** Detect free variable `exports`. */
1469
+ var freeExports = exports && !exports.nodeType && exports;
1470
+
1471
+ /** Detect free variable `module`. */
1472
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1473
+
1474
+ /** Detect the popular CommonJS extension `module.exports`. */
1475
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1476
+
1477
+ /** Built-in value references. */
1478
+ var Buffer = moduleExports ? root.Buffer : undefined;
1479
+
1480
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1481
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1482
+
1483
+ /**
1484
+ * Checks if `value` is a buffer.
1485
+ *
1486
+ * @static
1487
+ * @memberOf _
1488
+ * @since 4.3.0
1489
+ * @category Lang
1490
+ * @param {*} value The value to check.
1491
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1492
+ * @example
1493
+ *
1494
+ * _.isBuffer(new Buffer(2));
1495
+ * // => true
1496
+ *
1497
+ * _.isBuffer(new Uint8Array(2));
1498
+ * // => false
1499
+ */
1500
+ var isBuffer = nativeIsBuffer || stubFalse;
1501
+
1502
+ module.exports = isBuffer;
1503
+ }(isBuffer$3, isBuffer$3.exports));
1504
+
1505
+ var baseGetTag = _baseGetTag,
1506
+ isLength = isLength_1,
1507
+ isObjectLike$1 = isObjectLike_1;
1508
+
1509
+ /** `Object#toString` result references. */
1510
+ var argsTag$1 = '[object Arguments]',
1511
+ arrayTag$1 = '[object Array]',
1512
+ boolTag$1 = '[object Boolean]',
1513
+ dateTag$1 = '[object Date]',
1514
+ errorTag$1 = '[object Error]',
1515
+ funcTag = '[object Function]',
1516
+ mapTag$2 = '[object Map]',
1517
+ numberTag$1 = '[object Number]',
1518
+ objectTag$1 = '[object Object]',
1519
+ regexpTag$1 = '[object RegExp]',
1520
+ setTag$2 = '[object Set]',
1521
+ stringTag$1 = '[object String]',
1522
+ weakMapTag = '[object WeakMap]';
1523
+
1524
+ var arrayBufferTag$1 = '[object ArrayBuffer]',
1525
+ dataViewTag$1 = '[object DataView]',
1526
+ float32Tag = '[object Float32Array]',
1527
+ float64Tag = '[object Float64Array]',
1528
+ int8Tag = '[object Int8Array]',
1529
+ int16Tag = '[object Int16Array]',
1530
+ int32Tag = '[object Int32Array]',
1531
+ uint8Tag = '[object Uint8Array]',
1532
+ uint8ClampedTag = '[object Uint8ClampedArray]',
1533
+ uint16Tag = '[object Uint16Array]',
1534
+ uint32Tag = '[object Uint32Array]';
1535
+
1536
+ /** Used to identify `toStringTag` values of typed arrays. */
1537
+ var typedArrayTags = {};
1538
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1539
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1540
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1541
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1542
+ typedArrayTags[uint32Tag] = true;
1543
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1544
+ typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] =
1545
+ typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag$1] =
1546
+ typedArrayTags[errorTag$1] = typedArrayTags[funcTag] =
1547
+ typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] =
1548
+ typedArrayTags[objectTag$1] = typedArrayTags[regexpTag$1] =
1549
+ typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] =
1550
+ typedArrayTags[weakMapTag] = false;
1551
+
1552
+ /**
1553
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
1554
+ *
1555
+ * @private
1556
+ * @param {*} value The value to check.
1557
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1558
+ */
1559
+ function baseIsTypedArray$1(value) {
1560
+ return isObjectLike$1(value) &&
1561
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1562
+ }
1563
+
1564
+ var _baseIsTypedArray = baseIsTypedArray$1;
1565
+
1566
+ /**
1567
+ * The base implementation of `_.unary` without support for storing metadata.
1568
+ *
1569
+ * @private
1570
+ * @param {Function} func The function to cap arguments for.
1571
+ * @returns {Function} Returns the new capped function.
1572
+ */
1573
+
1574
+ function baseUnary$1(func) {
1575
+ return function(value) {
1576
+ return func(value);
1577
+ };
1578
+ }
1579
+
1580
+ var _baseUnary = baseUnary$1;
1581
+
1582
+ var _nodeUtil = {exports: {}};
1583
+
1584
+ (function (module, exports) {
1585
+ var freeGlobal = _freeGlobal;
1586
+
1587
+ /** Detect free variable `exports`. */
1588
+ var freeExports = exports && !exports.nodeType && exports;
1589
+
1590
+ /** Detect free variable `module`. */
1591
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1592
+
1593
+ /** Detect the popular CommonJS extension `module.exports`. */
1594
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1595
+
1596
+ /** Detect free variable `process` from Node.js. */
1597
+ var freeProcess = moduleExports && freeGlobal.process;
1598
+
1599
+ /** Used to access faster Node.js helpers. */
1600
+ var nodeUtil = (function() {
1601
+ try {
1602
+ // Use `util.types` for Node.js 10+.
1603
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
1604
+
1605
+ if (types) {
1606
+ return types;
1607
+ }
1608
+
1609
+ // Legacy `process.binding('util')` for Node.js < 10.
1610
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
1611
+ } catch (e) {}
1612
+ }());
1613
+
1614
+ module.exports = nodeUtil;
1615
+ }(_nodeUtil, _nodeUtil.exports));
1616
+
1617
+ var baseIsTypedArray = _baseIsTypedArray,
1618
+ baseUnary = _baseUnary,
1619
+ nodeUtil = _nodeUtil.exports;
1620
+
1621
+ /* Node.js helper references. */
1622
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1623
+
1624
+ /**
1625
+ * Checks if `value` is classified as a typed array.
1626
+ *
1627
+ * @static
1628
+ * @memberOf _
1629
+ * @since 3.0.0
1630
+ * @category Lang
1631
+ * @param {*} value The value to check.
1632
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1633
+ * @example
1634
+ *
1635
+ * _.isTypedArray(new Uint8Array);
1636
+ * // => true
1637
+ *
1638
+ * _.isTypedArray([]);
1639
+ * // => false
1640
+ */
1641
+ var isTypedArray$3 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1642
+
1643
+ var isTypedArray_1 = isTypedArray$3;
1644
+
1645
+ var baseKeys$1 = _baseKeys,
1646
+ getTag$1 = _getTag,
1647
+ isArguments$1 = isArguments_1,
1648
+ isArray$3 = isArray_1,
1649
+ isArrayLike$1 = isArrayLike_1,
1650
+ isBuffer$2 = isBuffer$3.exports,
1651
+ isPrototype = _isPrototype,
1652
+ isTypedArray$2 = isTypedArray_1;
1653
+
1654
+ /** `Object#toString` result references. */
1655
+ var mapTag$1 = '[object Map]',
1656
+ setTag$1 = '[object Set]';
1657
+
1658
+ /** Used for built-in method references. */
1659
+ var objectProto$6 = Object.prototype;
1660
+
1661
+ /** Used to check objects for own properties. */
1662
+ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
1663
+
1664
+ /**
1665
+ * Checks if `value` is an empty object, collection, map, or set.
1666
+ *
1667
+ * Objects are considered empty if they have no own enumerable string keyed
1668
+ * properties.
1669
+ *
1670
+ * Array-like values such as `arguments` objects, arrays, buffers, strings, or
1671
+ * jQuery-like collections are considered empty if they have a `length` of `0`.
1672
+ * Similarly, maps and sets are considered empty if they have a `size` of `0`.
1673
+ *
1674
+ * @static
1675
+ * @memberOf _
1676
+ * @since 0.1.0
1677
+ * @category Lang
1678
+ * @param {*} value The value to check.
1679
+ * @returns {boolean} Returns `true` if `value` is empty, else `false`.
1680
+ * @example
1681
+ *
1682
+ * _.isEmpty(null);
1683
+ * // => true
1684
+ *
1685
+ * _.isEmpty(true);
1686
+ * // => true
1687
+ *
1688
+ * _.isEmpty(1);
1689
+ * // => true
1690
+ *
1691
+ * _.isEmpty([1, 2, 3]);
1692
+ * // => false
1693
+ *
1694
+ * _.isEmpty({ 'a': 1 });
1695
+ * // => false
1696
+ */
1697
+ function isEmpty(value) {
1698
+ if (value == null) {
1699
+ return true;
1700
+ }
1701
+ if (isArrayLike$1(value) &&
1702
+ (isArray$3(value) || typeof value == 'string' || typeof value.splice == 'function' ||
1703
+ isBuffer$2(value) || isTypedArray$2(value) || isArguments$1(value))) {
1704
+ return !value.length;
1705
+ }
1706
+ var tag = getTag$1(value);
1707
+ if (tag == mapTag$1 || tag == setTag$1) {
1708
+ return !value.size;
1709
+ }
1710
+ if (isPrototype(value)) {
1711
+ return !baseKeys$1(value).length;
1712
+ }
1713
+ for (var key in value) {
1714
+ if (hasOwnProperty$5.call(value, key)) {
1715
+ return false;
1716
+ }
1717
+ }
1718
+ return true;
1719
+ }
1720
+
1721
+ var isEmpty_1 = isEmpty;
1722
+
1723
+ /**
1724
+ * Removes all key-value entries from the list cache.
1725
+ *
1726
+ * @private
1727
+ * @name clear
1728
+ * @memberOf ListCache
1729
+ */
1730
+
1731
+ function listCacheClear$1() {
1732
+ this.__data__ = [];
1733
+ this.size = 0;
1734
+ }
1735
+
1736
+ var _listCacheClear = listCacheClear$1;
1737
+
1738
+ /**
1739
+ * Performs a
1740
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1741
+ * comparison between two values to determine if they are equivalent.
1742
+ *
1743
+ * @static
1744
+ * @memberOf _
1745
+ * @since 4.0.0
1746
+ * @category Lang
1747
+ * @param {*} value The value to compare.
1748
+ * @param {*} other The other value to compare.
1749
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1750
+ * @example
1751
+ *
1752
+ * var object = { 'a': 1 };
1753
+ * var other = { 'a': 1 };
1754
+ *
1755
+ * _.eq(object, object);
1756
+ * // => true
1757
+ *
1758
+ * _.eq(object, other);
1759
+ * // => false
1760
+ *
1761
+ * _.eq('a', 'a');
1762
+ * // => true
1763
+ *
1764
+ * _.eq('a', Object('a'));
1765
+ * // => false
1766
+ *
1767
+ * _.eq(NaN, NaN);
1768
+ * // => true
1769
+ */
1770
+
1771
+ function eq$2(value, other) {
1772
+ return value === other || (value !== value && other !== other);
1773
+ }
1774
+
1775
+ var eq_1 = eq$2;
1776
+
1777
+ var eq$1 = eq_1;
1778
+
1779
+ /**
1780
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
1781
+ *
1782
+ * @private
1783
+ * @param {Array} array The array to inspect.
1784
+ * @param {*} key The key to search for.
1785
+ * @returns {number} Returns the index of the matched value, else `-1`.
1786
+ */
1787
+ function assocIndexOf$4(array, key) {
1788
+ var length = array.length;
1789
+ while (length--) {
1790
+ if (eq$1(array[length][0], key)) {
1791
+ return length;
1792
+ }
1793
+ }
1794
+ return -1;
1795
+ }
1796
+
1797
+ var _assocIndexOf = assocIndexOf$4;
1798
+
1799
+ var assocIndexOf$3 = _assocIndexOf;
1800
+
1801
+ /** Used for built-in method references. */
1802
+ var arrayProto = Array.prototype;
1803
+
1804
+ /** Built-in value references. */
1805
+ var splice = arrayProto.splice;
1806
+
1807
+ /**
1808
+ * Removes `key` and its value from the list cache.
1809
+ *
1810
+ * @private
1811
+ * @name delete
1812
+ * @memberOf ListCache
1813
+ * @param {string} key The key of the value to remove.
1814
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1815
+ */
1816
+ function listCacheDelete$1(key) {
1817
+ var data = this.__data__,
1818
+ index = assocIndexOf$3(data, key);
1819
+
1820
+ if (index < 0) {
1821
+ return false;
1822
+ }
1823
+ var lastIndex = data.length - 1;
1824
+ if (index == lastIndex) {
1825
+ data.pop();
1826
+ } else {
1827
+ splice.call(data, index, 1);
1828
+ }
1829
+ --this.size;
1830
+ return true;
1831
+ }
1832
+
1833
+ var _listCacheDelete = listCacheDelete$1;
1834
+
1835
+ var assocIndexOf$2 = _assocIndexOf;
1836
+
1837
+ /**
1838
+ * Gets the list cache value for `key`.
1839
+ *
1840
+ * @private
1841
+ * @name get
1842
+ * @memberOf ListCache
1843
+ * @param {string} key The key of the value to get.
1844
+ * @returns {*} Returns the entry value.
1845
+ */
1846
+ function listCacheGet$1(key) {
1847
+ var data = this.__data__,
1848
+ index = assocIndexOf$2(data, key);
1849
+
1850
+ return index < 0 ? undefined : data[index][1];
1851
+ }
1852
+
1853
+ var _listCacheGet = listCacheGet$1;
1854
+
1855
+ var assocIndexOf$1 = _assocIndexOf;
1856
+
1857
+ /**
1858
+ * Checks if a list cache value for `key` exists.
1859
+ *
1860
+ * @private
1861
+ * @name has
1862
+ * @memberOf ListCache
1863
+ * @param {string} key The key of the entry to check.
1864
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1865
+ */
1866
+ function listCacheHas$1(key) {
1867
+ return assocIndexOf$1(this.__data__, key) > -1;
1868
+ }
1869
+
1870
+ var _listCacheHas = listCacheHas$1;
1871
+
1872
+ var assocIndexOf = _assocIndexOf;
1873
+
1874
+ /**
1875
+ * Sets the list cache `key` to `value`.
1876
+ *
1877
+ * @private
1878
+ * @name set
1879
+ * @memberOf ListCache
1880
+ * @param {string} key The key of the value to set.
1881
+ * @param {*} value The value to set.
1882
+ * @returns {Object} Returns the list cache instance.
1883
+ */
1884
+ function listCacheSet$1(key, value) {
1885
+ var data = this.__data__,
1886
+ index = assocIndexOf(data, key);
1887
+
1888
+ if (index < 0) {
1889
+ ++this.size;
1890
+ data.push([key, value]);
1891
+ } else {
1892
+ data[index][1] = value;
1893
+ }
1894
+ return this;
1895
+ }
1896
+
1897
+ var _listCacheSet = listCacheSet$1;
1898
+
1899
+ var listCacheClear = _listCacheClear,
1900
+ listCacheDelete = _listCacheDelete,
1901
+ listCacheGet = _listCacheGet,
1902
+ listCacheHas = _listCacheHas,
1903
+ listCacheSet = _listCacheSet;
1904
+
1905
+ /**
1906
+ * Creates an list cache object.
1907
+ *
1908
+ * @private
1909
+ * @constructor
1910
+ * @param {Array} [entries] The key-value pairs to cache.
1911
+ */
1912
+ function ListCache$4(entries) {
1913
+ var index = -1,
1914
+ length = entries == null ? 0 : entries.length;
1915
+
1916
+ this.clear();
1917
+ while (++index < length) {
1918
+ var entry = entries[index];
1919
+ this.set(entry[0], entry[1]);
1920
+ }
1921
+ }
1922
+
1923
+ // Add methods to `ListCache`.
1924
+ ListCache$4.prototype.clear = listCacheClear;
1925
+ ListCache$4.prototype['delete'] = listCacheDelete;
1926
+ ListCache$4.prototype.get = listCacheGet;
1927
+ ListCache$4.prototype.has = listCacheHas;
1928
+ ListCache$4.prototype.set = listCacheSet;
1929
+
1930
+ var _ListCache = ListCache$4;
1931
+
1932
+ var ListCache$3 = _ListCache;
1933
+
1934
+ /**
1935
+ * Removes all key-value entries from the stack.
1936
+ *
1937
+ * @private
1938
+ * @name clear
1939
+ * @memberOf Stack
1940
+ */
1941
+ function stackClear$1() {
1942
+ this.__data__ = new ListCache$3;
1943
+ this.size = 0;
1944
+ }
1945
+
1946
+ var _stackClear = stackClear$1;
1947
+
1948
+ /**
1949
+ * Removes `key` and its value from the stack.
1950
+ *
1951
+ * @private
1952
+ * @name delete
1953
+ * @memberOf Stack
1954
+ * @param {string} key The key of the value to remove.
1955
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1956
+ */
1957
+
1958
+ function stackDelete$1(key) {
1959
+ var data = this.__data__,
1960
+ result = data['delete'](key);
1961
+
1962
+ this.size = data.size;
1963
+ return result;
1964
+ }
1965
+
1966
+ var _stackDelete = stackDelete$1;
1967
+
1968
+ /**
1969
+ * Gets the stack value for `key`.
1970
+ *
1971
+ * @private
1972
+ * @name get
1973
+ * @memberOf Stack
1974
+ * @param {string} key The key of the value to get.
1975
+ * @returns {*} Returns the entry value.
1976
+ */
1977
+
1978
+ function stackGet$1(key) {
1979
+ return this.__data__.get(key);
1980
+ }
1981
+
1982
+ var _stackGet = stackGet$1;
1983
+
1984
+ /**
1985
+ * Checks if a stack value for `key` exists.
1986
+ *
1987
+ * @private
1988
+ * @name has
1989
+ * @memberOf Stack
1990
+ * @param {string} key The key of the entry to check.
1991
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1992
+ */
1993
+
1994
+ function stackHas$1(key) {
1995
+ return this.__data__.has(key);
1996
+ }
1997
+
1998
+ var _stackHas = stackHas$1;
1999
+
2000
+ var getNative = _getNative;
2001
+
2002
+ /* Built-in method references that are verified to be native. */
2003
+ var nativeCreate$4 = getNative(Object, 'create');
2004
+
2005
+ var _nativeCreate = nativeCreate$4;
2006
+
2007
+ var nativeCreate$3 = _nativeCreate;
2008
+
2009
+ /**
2010
+ * Removes all key-value entries from the hash.
2011
+ *
2012
+ * @private
2013
+ * @name clear
2014
+ * @memberOf Hash
2015
+ */
2016
+ function hashClear$1() {
2017
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
2018
+ this.size = 0;
2019
+ }
2020
+
2021
+ var _hashClear = hashClear$1;
2022
+
2023
+ /**
2024
+ * Removes `key` and its value from the hash.
2025
+ *
2026
+ * @private
2027
+ * @name delete
2028
+ * @memberOf Hash
2029
+ * @param {Object} hash The hash to modify.
2030
+ * @param {string} key The key of the value to remove.
2031
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2032
+ */
2033
+
2034
+ function hashDelete$1(key) {
2035
+ var result = this.has(key) && delete this.__data__[key];
2036
+ this.size -= result ? 1 : 0;
2037
+ return result;
2038
+ }
2039
+
2040
+ var _hashDelete = hashDelete$1;
2041
+
2042
+ var nativeCreate$2 = _nativeCreate;
2043
+
2044
+ /** Used to stand-in for `undefined` hash values. */
2045
+ var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
2046
+
2047
+ /** Used for built-in method references. */
2048
+ var objectProto$5 = Object.prototype;
2049
+
2050
+ /** Used to check objects for own properties. */
2051
+ var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
2052
+
2053
+ /**
2054
+ * Gets the hash value for `key`.
2055
+ *
2056
+ * @private
2057
+ * @name get
2058
+ * @memberOf Hash
2059
+ * @param {string} key The key of the value to get.
2060
+ * @returns {*} Returns the entry value.
2061
+ */
2062
+ function hashGet$1(key) {
2063
+ var data = this.__data__;
2064
+ if (nativeCreate$2) {
2065
+ var result = data[key];
2066
+ return result === HASH_UNDEFINED$2 ? undefined : result;
2067
+ }
2068
+ return hasOwnProperty$4.call(data, key) ? data[key] : undefined;
2069
+ }
2070
+
2071
+ var _hashGet = hashGet$1;
2072
+
2073
+ var nativeCreate$1 = _nativeCreate;
2074
+
2075
+ /** Used for built-in method references. */
2076
+ var objectProto$4 = Object.prototype;
2077
+
2078
+ /** Used to check objects for own properties. */
2079
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
2080
+
2081
+ /**
2082
+ * Checks if a hash value for `key` exists.
2083
+ *
2084
+ * @private
2085
+ * @name has
2086
+ * @memberOf Hash
2087
+ * @param {string} key The key of the entry to check.
2088
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2089
+ */
2090
+ function hashHas$1(key) {
2091
+ var data = this.__data__;
2092
+ return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
2093
+ }
2094
+
2095
+ var _hashHas = hashHas$1;
2096
+
2097
+ var nativeCreate = _nativeCreate;
2098
+
2099
+ /** Used to stand-in for `undefined` hash values. */
2100
+ var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
2101
+
2102
+ /**
2103
+ * Sets the hash `key` to `value`.
2104
+ *
2105
+ * @private
2106
+ * @name set
2107
+ * @memberOf Hash
2108
+ * @param {string} key The key of the value to set.
2109
+ * @param {*} value The value to set.
2110
+ * @returns {Object} Returns the hash instance.
2111
+ */
2112
+ function hashSet$1(key, value) {
2113
+ var data = this.__data__;
2114
+ this.size += this.has(key) ? 0 : 1;
2115
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
2116
+ return this;
2117
+ }
2118
+
2119
+ var _hashSet = hashSet$1;
2120
+
2121
+ var hashClear = _hashClear,
2122
+ hashDelete = _hashDelete,
2123
+ hashGet = _hashGet,
2124
+ hashHas = _hashHas,
2125
+ hashSet = _hashSet;
2126
+
2127
+ /**
2128
+ * Creates a hash object.
2129
+ *
2130
+ * @private
2131
+ * @constructor
2132
+ * @param {Array} [entries] The key-value pairs to cache.
2133
+ */
2134
+ function Hash$1(entries) {
2135
+ var index = -1,
2136
+ length = entries == null ? 0 : entries.length;
2137
+
2138
+ this.clear();
2139
+ while (++index < length) {
2140
+ var entry = entries[index];
2141
+ this.set(entry[0], entry[1]);
2142
+ }
2143
+ }
2144
+
2145
+ // Add methods to `Hash`.
2146
+ Hash$1.prototype.clear = hashClear;
2147
+ Hash$1.prototype['delete'] = hashDelete;
2148
+ Hash$1.prototype.get = hashGet;
2149
+ Hash$1.prototype.has = hashHas;
2150
+ Hash$1.prototype.set = hashSet;
2151
+
2152
+ var _Hash = Hash$1;
2153
+
2154
+ var Hash = _Hash,
2155
+ ListCache$2 = _ListCache,
2156
+ Map$1 = _Map;
2157
+
2158
+ /**
2159
+ * Removes all key-value entries from the map.
2160
+ *
2161
+ * @private
2162
+ * @name clear
2163
+ * @memberOf MapCache
2164
+ */
2165
+ function mapCacheClear$1() {
2166
+ this.size = 0;
2167
+ this.__data__ = {
2168
+ 'hash': new Hash,
2169
+ 'map': new (Map$1 || ListCache$2),
2170
+ 'string': new Hash
2171
+ };
2172
+ }
2173
+
2174
+ var _mapCacheClear = mapCacheClear$1;
2175
+
2176
+ /**
2177
+ * Checks if `value` is suitable for use as unique object key.
2178
+ *
2179
+ * @private
2180
+ * @param {*} value The value to check.
2181
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
2182
+ */
2183
+
2184
+ function isKeyable$1(value) {
2185
+ var type = typeof value;
2186
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
2187
+ ? (value !== '__proto__')
2188
+ : (value === null);
2189
+ }
2190
+
2191
+ var _isKeyable = isKeyable$1;
2192
+
2193
+ var isKeyable = _isKeyable;
2194
+
2195
+ /**
2196
+ * Gets the data for `map`.
2197
+ *
2198
+ * @private
2199
+ * @param {Object} map The map to query.
2200
+ * @param {string} key The reference key.
2201
+ * @returns {*} Returns the map data.
2202
+ */
2203
+ function getMapData$4(map, key) {
2204
+ var data = map.__data__;
2205
+ return isKeyable(key)
2206
+ ? data[typeof key == 'string' ? 'string' : 'hash']
2207
+ : data.map;
2208
+ }
2209
+
2210
+ var _getMapData = getMapData$4;
2211
+
2212
+ var getMapData$3 = _getMapData;
2213
+
2214
+ /**
2215
+ * Removes `key` and its value from the map.
2216
+ *
2217
+ * @private
2218
+ * @name delete
2219
+ * @memberOf MapCache
2220
+ * @param {string} key The key of the value to remove.
2221
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2222
+ */
2223
+ function mapCacheDelete$1(key) {
2224
+ var result = getMapData$3(this, key)['delete'](key);
2225
+ this.size -= result ? 1 : 0;
2226
+ return result;
2227
+ }
2228
+
2229
+ var _mapCacheDelete = mapCacheDelete$1;
2230
+
2231
+ var getMapData$2 = _getMapData;
2232
+
2233
+ /**
2234
+ * Gets the map value for `key`.
2235
+ *
2236
+ * @private
2237
+ * @name get
2238
+ * @memberOf MapCache
2239
+ * @param {string} key The key of the value to get.
2240
+ * @returns {*} Returns the entry value.
2241
+ */
2242
+ function mapCacheGet$1(key) {
2243
+ return getMapData$2(this, key).get(key);
2244
+ }
2245
+
2246
+ var _mapCacheGet = mapCacheGet$1;
2247
+
2248
+ var getMapData$1 = _getMapData;
2249
+
2250
+ /**
2251
+ * Checks if a map value for `key` exists.
2252
+ *
2253
+ * @private
2254
+ * @name has
2255
+ * @memberOf MapCache
2256
+ * @param {string} key The key of the entry to check.
2257
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2258
+ */
2259
+ function mapCacheHas$1(key) {
2260
+ return getMapData$1(this, key).has(key);
2261
+ }
2262
+
2263
+ var _mapCacheHas = mapCacheHas$1;
2264
+
2265
+ var getMapData = _getMapData;
2266
+
2267
+ /**
2268
+ * Sets the map `key` to `value`.
2269
+ *
2270
+ * @private
2271
+ * @name set
2272
+ * @memberOf MapCache
2273
+ * @param {string} key The key of the value to set.
2274
+ * @param {*} value The value to set.
2275
+ * @returns {Object} Returns the map cache instance.
2276
+ */
2277
+ function mapCacheSet$1(key, value) {
2278
+ var data = getMapData(this, key),
2279
+ size = data.size;
2280
+
2281
+ data.set(key, value);
2282
+ this.size += data.size == size ? 0 : 1;
2283
+ return this;
2284
+ }
2285
+
2286
+ var _mapCacheSet = mapCacheSet$1;
2287
+
2288
+ var mapCacheClear = _mapCacheClear,
2289
+ mapCacheDelete = _mapCacheDelete,
2290
+ mapCacheGet = _mapCacheGet,
2291
+ mapCacheHas = _mapCacheHas,
2292
+ mapCacheSet = _mapCacheSet;
2293
+
2294
+ /**
2295
+ * Creates a map cache object to store key-value pairs.
2296
+ *
2297
+ * @private
2298
+ * @constructor
2299
+ * @param {Array} [entries] The key-value pairs to cache.
2300
+ */
2301
+ function MapCache$2(entries) {
2302
+ var index = -1,
2303
+ length = entries == null ? 0 : entries.length;
2304
+
2305
+ this.clear();
2306
+ while (++index < length) {
2307
+ var entry = entries[index];
2308
+ this.set(entry[0], entry[1]);
2309
+ }
2310
+ }
2311
+
2312
+ // Add methods to `MapCache`.
2313
+ MapCache$2.prototype.clear = mapCacheClear;
2314
+ MapCache$2.prototype['delete'] = mapCacheDelete;
2315
+ MapCache$2.prototype.get = mapCacheGet;
2316
+ MapCache$2.prototype.has = mapCacheHas;
2317
+ MapCache$2.prototype.set = mapCacheSet;
2318
+
2319
+ var _MapCache = MapCache$2;
2320
+
2321
+ var ListCache$1 = _ListCache,
2322
+ Map = _Map,
2323
+ MapCache$1 = _MapCache;
2324
+
2325
+ /** Used as the size to enable large array optimizations. */
2326
+ var LARGE_ARRAY_SIZE = 200;
2327
+
2328
+ /**
2329
+ * Sets the stack `key` to `value`.
2330
+ *
2331
+ * @private
2332
+ * @name set
2333
+ * @memberOf Stack
2334
+ * @param {string} key The key of the value to set.
2335
+ * @param {*} value The value to set.
2336
+ * @returns {Object} Returns the stack cache instance.
2337
+ */
2338
+ function stackSet$1(key, value) {
2339
+ var data = this.__data__;
2340
+ if (data instanceof ListCache$1) {
2341
+ var pairs = data.__data__;
2342
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2343
+ pairs.push([key, value]);
2344
+ this.size = ++data.size;
2345
+ return this;
2346
+ }
2347
+ data = this.__data__ = new MapCache$1(pairs);
2348
+ }
2349
+ data.set(key, value);
2350
+ this.size = data.size;
2351
+ return this;
2352
+ }
2353
+
2354
+ var _stackSet = stackSet$1;
2355
+
2356
+ var ListCache = _ListCache,
2357
+ stackClear = _stackClear,
2358
+ stackDelete = _stackDelete,
2359
+ stackGet = _stackGet,
2360
+ stackHas = _stackHas,
2361
+ stackSet = _stackSet;
2362
+
2363
+ /**
2364
+ * Creates a stack cache object to store key-value pairs.
2365
+ *
2366
+ * @private
2367
+ * @constructor
2368
+ * @param {Array} [entries] The key-value pairs to cache.
2369
+ */
2370
+ function Stack$1(entries) {
2371
+ var data = this.__data__ = new ListCache(entries);
2372
+ this.size = data.size;
2373
+ }
2374
+
2375
+ // Add methods to `Stack`.
2376
+ Stack$1.prototype.clear = stackClear;
2377
+ Stack$1.prototype['delete'] = stackDelete;
2378
+ Stack$1.prototype.get = stackGet;
2379
+ Stack$1.prototype.has = stackHas;
2380
+ Stack$1.prototype.set = stackSet;
2381
+
2382
+ var _Stack = Stack$1;
2383
+
2384
+ /** Used to stand-in for `undefined` hash values. */
2385
+
2386
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
2387
+
2388
+ /**
2389
+ * Adds `value` to the array cache.
2390
+ *
2391
+ * @private
2392
+ * @name add
2393
+ * @memberOf SetCache
2394
+ * @alias push
2395
+ * @param {*} value The value to cache.
2396
+ * @returns {Object} Returns the cache instance.
2397
+ */
2398
+ function setCacheAdd$1(value) {
2399
+ this.__data__.set(value, HASH_UNDEFINED);
2400
+ return this;
2401
+ }
2402
+
2403
+ var _setCacheAdd = setCacheAdd$1;
2404
+
2405
+ /**
2406
+ * Checks if `value` is in the array cache.
2407
+ *
2408
+ * @private
2409
+ * @name has
2410
+ * @memberOf SetCache
2411
+ * @param {*} value The value to search for.
2412
+ * @returns {number} Returns `true` if `value` is found, else `false`.
2413
+ */
2414
+
2415
+ function setCacheHas$1(value) {
2416
+ return this.__data__.has(value);
2417
+ }
2418
+
2419
+ var _setCacheHas = setCacheHas$1;
2420
+
2421
+ var MapCache = _MapCache,
2422
+ setCacheAdd = _setCacheAdd,
2423
+ setCacheHas = _setCacheHas;
2424
+
2425
+ /**
2426
+ *
2427
+ * Creates an array cache object to store unique values.
2428
+ *
2429
+ * @private
2430
+ * @constructor
2431
+ * @param {Array} [values] The values to cache.
2432
+ */
2433
+ function SetCache$1(values) {
2434
+ var index = -1,
2435
+ length = values == null ? 0 : values.length;
2436
+
2437
+ this.__data__ = new MapCache;
2438
+ while (++index < length) {
2439
+ this.add(values[index]);
2440
+ }
2441
+ }
2442
+
2443
+ // Add methods to `SetCache`.
2444
+ SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
2445
+ SetCache$1.prototype.has = setCacheHas;
2446
+
2447
+ var _SetCache = SetCache$1;
2448
+
2449
+ /**
2450
+ * A specialized version of `_.some` for arrays without support for iteratee
2451
+ * shorthands.
2452
+ *
2453
+ * @private
2454
+ * @param {Array} [array] The array to iterate over.
2455
+ * @param {Function} predicate The function invoked per iteration.
2456
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
2457
+ * else `false`.
2458
+ */
2459
+
2460
+ function arraySome$1(array, predicate) {
2461
+ var index = -1,
2462
+ length = array == null ? 0 : array.length;
2463
+
2464
+ while (++index < length) {
2465
+ if (predicate(array[index], index, array)) {
2466
+ return true;
2467
+ }
2468
+ }
2469
+ return false;
2470
+ }
2471
+
2472
+ var _arraySome = arraySome$1;
2473
+
2474
+ /**
2475
+ * Checks if a `cache` value for `key` exists.
2476
+ *
2477
+ * @private
2478
+ * @param {Object} cache The cache to query.
2479
+ * @param {string} key The key of the entry to check.
2480
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2481
+ */
2482
+
2483
+ function cacheHas$1(cache, key) {
2484
+ return cache.has(key);
2485
+ }
2486
+
2487
+ var _cacheHas = cacheHas$1;
2488
+
2489
+ var SetCache = _SetCache,
2490
+ arraySome = _arraySome,
2491
+ cacheHas = _cacheHas;
2492
+
2493
+ /** Used to compose bitmasks for value comparisons. */
2494
+ var COMPARE_PARTIAL_FLAG$3 = 1,
2495
+ COMPARE_UNORDERED_FLAG$1 = 2;
2496
+
2497
+ /**
2498
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
2499
+ * partial deep comparisons.
2500
+ *
2501
+ * @private
2502
+ * @param {Array} array The array to compare.
2503
+ * @param {Array} other The other array to compare.
2504
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2505
+ * @param {Function} customizer The function to customize comparisons.
2506
+ * @param {Function} equalFunc The function to determine equivalents of values.
2507
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
2508
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
2509
+ */
2510
+ function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
2511
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
2512
+ arrLength = array.length,
2513
+ othLength = other.length;
2514
+
2515
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
2516
+ return false;
2517
+ }
2518
+ // Check that cyclic values are equal.
2519
+ var arrStacked = stack.get(array);
2520
+ var othStacked = stack.get(other);
2521
+ if (arrStacked && othStacked) {
2522
+ return arrStacked == other && othStacked == array;
2523
+ }
2524
+ var index = -1,
2525
+ result = true,
2526
+ seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
2527
+
2528
+ stack.set(array, other);
2529
+ stack.set(other, array);
2530
+
2531
+ // Ignore non-index properties.
2532
+ while (++index < arrLength) {
2533
+ var arrValue = array[index],
2534
+ othValue = other[index];
2535
+
2536
+ if (customizer) {
2537
+ var compared = isPartial
2538
+ ? customizer(othValue, arrValue, index, other, array, stack)
2539
+ : customizer(arrValue, othValue, index, array, other, stack);
2540
+ }
2541
+ if (compared !== undefined) {
2542
+ if (compared) {
2543
+ continue;
2544
+ }
2545
+ result = false;
2546
+ break;
2547
+ }
2548
+ // Recursively compare arrays (susceptible to call stack limits).
2549
+ if (seen) {
2550
+ if (!arraySome(other, function(othValue, othIndex) {
2551
+ if (!cacheHas(seen, othIndex) &&
2552
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
2553
+ return seen.push(othIndex);
2554
+ }
2555
+ })) {
2556
+ result = false;
2557
+ break;
2558
+ }
2559
+ } else if (!(
2560
+ arrValue === othValue ||
2561
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
2562
+ )) {
2563
+ result = false;
2564
+ break;
2565
+ }
2566
+ }
2567
+ stack['delete'](array);
2568
+ stack['delete'](other);
2569
+ return result;
2570
+ }
2571
+
2572
+ var _equalArrays = equalArrays$2;
2573
+
2574
+ var root = _root;
2575
+
2576
+ /** Built-in value references. */
2577
+ var Uint8Array$1 = root.Uint8Array;
2578
+
2579
+ var _Uint8Array = Uint8Array$1;
2580
+
2581
+ /**
2582
+ * Converts `map` to its key-value pairs.
2583
+ *
2584
+ * @private
2585
+ * @param {Object} map The map to convert.
2586
+ * @returns {Array} Returns the key-value pairs.
2587
+ */
2588
+
2589
+ function mapToArray$1(map) {
2590
+ var index = -1,
2591
+ result = Array(map.size);
2592
+
2593
+ map.forEach(function(value, key) {
2594
+ result[++index] = [key, value];
2595
+ });
2596
+ return result;
2597
+ }
2598
+
2599
+ var _mapToArray = mapToArray$1;
2600
+
2601
+ /**
2602
+ * Converts `set` to an array of its values.
2603
+ *
2604
+ * @private
2605
+ * @param {Object} set The set to convert.
2606
+ * @returns {Array} Returns the values.
2607
+ */
2608
+
2609
+ function setToArray$1(set) {
2610
+ var index = -1,
2611
+ result = Array(set.size);
2612
+
2613
+ set.forEach(function(value) {
2614
+ result[++index] = value;
2615
+ });
2616
+ return result;
2617
+ }
2618
+
2619
+ var _setToArray = setToArray$1;
2620
+
2621
+ var Symbol = _Symbol,
2622
+ Uint8Array = _Uint8Array,
2623
+ eq = eq_1,
2624
+ equalArrays$1 = _equalArrays,
2625
+ mapToArray = _mapToArray,
2626
+ setToArray = _setToArray;
2627
+
2628
+ /** Used to compose bitmasks for value comparisons. */
2629
+ var COMPARE_PARTIAL_FLAG$2 = 1,
2630
+ COMPARE_UNORDERED_FLAG = 2;
2631
+
2632
+ /** `Object#toString` result references. */
2633
+ var boolTag = '[object Boolean]',
2634
+ dateTag = '[object Date]',
2635
+ errorTag = '[object Error]',
2636
+ mapTag = '[object Map]',
2637
+ numberTag = '[object Number]',
2638
+ regexpTag = '[object RegExp]',
2639
+ setTag = '[object Set]',
2640
+ stringTag = '[object String]',
2641
+ symbolTag = '[object Symbol]';
2642
+
2643
+ var arrayBufferTag = '[object ArrayBuffer]',
2644
+ dataViewTag = '[object DataView]';
2645
+
2646
+ /** Used to convert symbols to primitives and strings. */
2647
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
2648
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
2649
+
2650
+ /**
2651
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
2652
+ * the same `toStringTag`.
2653
+ *
2654
+ * **Note:** This function only supports comparing values with tags of
2655
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
2656
+ *
2657
+ * @private
2658
+ * @param {Object} object The object to compare.
2659
+ * @param {Object} other The other object to compare.
2660
+ * @param {string} tag The `toStringTag` of the objects to compare.
2661
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2662
+ * @param {Function} customizer The function to customize comparisons.
2663
+ * @param {Function} equalFunc The function to determine equivalents of values.
2664
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
2665
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2666
+ */
2667
+ function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack) {
2668
+ switch (tag) {
2669
+ case dataViewTag:
2670
+ if ((object.byteLength != other.byteLength) ||
2671
+ (object.byteOffset != other.byteOffset)) {
2672
+ return false;
2673
+ }
2674
+ object = object.buffer;
2675
+ other = other.buffer;
2676
+
2677
+ case arrayBufferTag:
2678
+ if ((object.byteLength != other.byteLength) ||
2679
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
2680
+ return false;
2681
+ }
2682
+ return true;
2683
+
2684
+ case boolTag:
2685
+ case dateTag:
2686
+ case numberTag:
2687
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
2688
+ // Invalid dates are coerced to `NaN`.
2689
+ return eq(+object, +other);
2690
+
2691
+ case errorTag:
2692
+ return object.name == other.name && object.message == other.message;
2693
+
2694
+ case regexpTag:
2695
+ case stringTag:
2696
+ // Coerce regexes to strings and treat strings, primitives and objects,
2697
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
2698
+ // for more details.
2699
+ return object == (other + '');
2700
+
2701
+ case mapTag:
2702
+ var convert = mapToArray;
2703
+
2704
+ case setTag:
2705
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
2706
+ convert || (convert = setToArray);
2707
+
2708
+ if (object.size != other.size && !isPartial) {
2709
+ return false;
2710
+ }
2711
+ // Assume cyclic values are equal.
2712
+ var stacked = stack.get(object);
2713
+ if (stacked) {
2714
+ return stacked == other;
2715
+ }
2716
+ bitmask |= COMPARE_UNORDERED_FLAG;
2717
+
2718
+ // Recursively compare objects (susceptible to call stack limits).
2719
+ stack.set(object, other);
2720
+ var result = equalArrays$1(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
2721
+ stack['delete'](object);
2722
+ return result;
2723
+
2724
+ case symbolTag:
2725
+ if (symbolValueOf) {
2726
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
2727
+ }
2728
+ }
2729
+ return false;
2730
+ }
2731
+
2732
+ var _equalByTag = equalByTag$1;
2733
+
2734
+ /**
2735
+ * Appends the elements of `values` to `array`.
2736
+ *
2737
+ * @private
2738
+ * @param {Array} array The array to modify.
2739
+ * @param {Array} values The values to append.
2740
+ * @returns {Array} Returns `array`.
2741
+ */
2742
+
2743
+ function arrayPush$1(array, values) {
2744
+ var index = -1,
2745
+ length = values.length,
2746
+ offset = array.length;
2747
+
2748
+ while (++index < length) {
2749
+ array[offset + index] = values[index];
2750
+ }
2751
+ return array;
2752
+ }
2753
+
2754
+ var _arrayPush = arrayPush$1;
2755
+
2756
+ var arrayPush = _arrayPush,
2757
+ isArray$2 = isArray_1;
2758
+
2759
+ /**
2760
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2761
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
2762
+ * symbols of `object`.
2763
+ *
2764
+ * @private
2765
+ * @param {Object} object The object to query.
2766
+ * @param {Function} keysFunc The function to get the keys of `object`.
2767
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
2768
+ * @returns {Array} Returns the array of property names and symbols.
2769
+ */
2770
+ function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
2771
+ var result = keysFunc(object);
2772
+ return isArray$2(object) ? result : arrayPush(result, symbolsFunc(object));
2773
+ }
2774
+
2775
+ var _baseGetAllKeys = baseGetAllKeys$1;
2776
+
2777
+ /**
2778
+ * A specialized version of `_.filter` for arrays without support for
2779
+ * iteratee shorthands.
2780
+ *
2781
+ * @private
2782
+ * @param {Array} [array] The array to iterate over.
2783
+ * @param {Function} predicate The function invoked per iteration.
2784
+ * @returns {Array} Returns the new filtered array.
2785
+ */
2786
+
2787
+ function arrayFilter$1(array, predicate) {
2788
+ var index = -1,
2789
+ length = array == null ? 0 : array.length,
2790
+ resIndex = 0,
2791
+ result = [];
2792
+
2793
+ while (++index < length) {
2794
+ var value = array[index];
2795
+ if (predicate(value, index, array)) {
2796
+ result[resIndex++] = value;
2797
+ }
2798
+ }
2799
+ return result;
2800
+ }
2801
+
2802
+ var _arrayFilter = arrayFilter$1;
2803
+
2804
+ /**
2805
+ * This method returns a new empty array.
2806
+ *
2807
+ * @static
2808
+ * @memberOf _
2809
+ * @since 4.13.0
2810
+ * @category Util
2811
+ * @returns {Array} Returns the new empty array.
2812
+ * @example
2813
+ *
2814
+ * var arrays = _.times(2, _.stubArray);
2815
+ *
2816
+ * console.log(arrays);
2817
+ * // => [[], []]
2818
+ *
2819
+ * console.log(arrays[0] === arrays[1]);
2820
+ * // => false
2821
+ */
2822
+
2823
+ function stubArray$1() {
2824
+ return [];
2825
+ }
2826
+
2827
+ var stubArray_1 = stubArray$1;
2828
+
2829
+ var arrayFilter = _arrayFilter,
2830
+ stubArray = stubArray_1;
2831
+
2832
+ /** Used for built-in method references. */
2833
+ var objectProto$3 = Object.prototype;
2834
+
2835
+ /** Built-in value references. */
2836
+ var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
2837
+
2838
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2839
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
2840
+
2841
+ /**
2842
+ * Creates an array of the own enumerable symbols of `object`.
2843
+ *
2844
+ * @private
2845
+ * @param {Object} object The object to query.
2846
+ * @returns {Array} Returns the array of symbols.
2847
+ */
2848
+ var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object) {
2849
+ if (object == null) {
2850
+ return [];
2851
+ }
2852
+ object = Object(object);
2853
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
2854
+ return propertyIsEnumerable.call(object, symbol);
2855
+ });
2856
+ };
2857
+
2858
+ var _getSymbols = getSymbols$1;
2859
+
2860
+ /**
2861
+ * The base implementation of `_.times` without support for iteratee shorthands
2862
+ * or max array length checks.
2863
+ *
2864
+ * @private
2865
+ * @param {number} n The number of times to invoke `iteratee`.
2866
+ * @param {Function} iteratee The function invoked per iteration.
2867
+ * @returns {Array} Returns the array of results.
2868
+ */
2869
+
2870
+ function baseTimes$1(n, iteratee) {
2871
+ var index = -1,
2872
+ result = Array(n);
2873
+
2874
+ while (++index < n) {
2875
+ result[index] = iteratee(index);
2876
+ }
2877
+ return result;
2878
+ }
2879
+
2880
+ var _baseTimes = baseTimes$1;
2881
+
2882
+ /** Used as references for various `Number` constants. */
2883
+
2884
+ var MAX_SAFE_INTEGER = 9007199254740991;
2885
+
2886
+ /** Used to detect unsigned integer values. */
2887
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
2888
+
2889
+ /**
2890
+ * Checks if `value` is a valid array-like index.
2891
+ *
2892
+ * @private
2893
+ * @param {*} value The value to check.
2894
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
2895
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
2896
+ */
2897
+ function isIndex$1(value, length) {
2898
+ var type = typeof value;
2899
+ length = length == null ? MAX_SAFE_INTEGER : length;
2900
+
2901
+ return !!length &&
2902
+ (type == 'number' ||
2903
+ (type != 'symbol' && reIsUint.test(value))) &&
2904
+ (value > -1 && value % 1 == 0 && value < length);
2905
+ }
2906
+
2907
+ var _isIndex = isIndex$1;
2908
+
2909
+ var baseTimes = _baseTimes,
2910
+ isArguments = isArguments_1,
2911
+ isArray$1 = isArray_1,
2912
+ isBuffer$1 = isBuffer$3.exports,
2913
+ isIndex = _isIndex,
2914
+ isTypedArray$1 = isTypedArray_1;
2915
+
2916
+ /** Used for built-in method references. */
2917
+ var objectProto$2 = Object.prototype;
2918
+
2919
+ /** Used to check objects for own properties. */
2920
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
2921
+
2922
+ /**
2923
+ * Creates an array of the enumerable property names of the array-like `value`.
2924
+ *
2925
+ * @private
2926
+ * @param {*} value The value to query.
2927
+ * @param {boolean} inherited Specify returning inherited property names.
2928
+ * @returns {Array} Returns the array of property names.
2929
+ */
2930
+ function arrayLikeKeys$1(value, inherited) {
2931
+ var isArr = isArray$1(value),
2932
+ isArg = !isArr && isArguments(value),
2933
+ isBuff = !isArr && !isArg && isBuffer$1(value),
2934
+ isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
2935
+ skipIndexes = isArr || isArg || isBuff || isType,
2936
+ result = skipIndexes ? baseTimes(value.length, String) : [],
2937
+ length = result.length;
2938
+
2939
+ for (var key in value) {
2940
+ if ((inherited || hasOwnProperty$2.call(value, key)) &&
2941
+ !(skipIndexes && (
2942
+ // Safari 9 has enumerable `arguments.length` in strict mode.
2943
+ key == 'length' ||
2944
+ // Node.js 0.10 has enumerable non-index properties on buffers.
2945
+ (isBuff && (key == 'offset' || key == 'parent')) ||
2946
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
2947
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2948
+ // Skip index properties.
2949
+ isIndex(key, length)
2950
+ ))) {
2951
+ result.push(key);
2952
+ }
2953
+ }
2954
+ return result;
2955
+ }
2956
+
2957
+ var _arrayLikeKeys = arrayLikeKeys$1;
2958
+
2959
+ var arrayLikeKeys = _arrayLikeKeys,
2960
+ baseKeys = _baseKeys,
2961
+ isArrayLike = isArrayLike_1;
2962
+
2963
+ /**
2964
+ * Creates an array of the own enumerable property names of `object`.
2965
+ *
2966
+ * **Note:** Non-object values are coerced to objects. See the
2967
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2968
+ * for more details.
2969
+ *
2970
+ * @static
2971
+ * @since 0.1.0
2972
+ * @memberOf _
2973
+ * @category Object
2974
+ * @param {Object} object The object to query.
2975
+ * @returns {Array} Returns the array of property names.
2976
+ * @example
2977
+ *
2978
+ * function Foo() {
2979
+ * this.a = 1;
2980
+ * this.b = 2;
2981
+ * }
2982
+ *
2983
+ * Foo.prototype.c = 3;
2984
+ *
2985
+ * _.keys(new Foo);
2986
+ * // => ['a', 'b'] (iteration order is not guaranteed)
2987
+ *
2988
+ * _.keys('hi');
2989
+ * // => ['0', '1']
2990
+ */
2991
+ function keys$1(object) {
2992
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
2993
+ }
2994
+
2995
+ var keys_1 = keys$1;
2996
+
2997
+ var baseGetAllKeys = _baseGetAllKeys,
2998
+ getSymbols = _getSymbols,
2999
+ keys = keys_1;
3000
+
3001
+ /**
3002
+ * Creates an array of own enumerable property names and symbols of `object`.
3003
+ *
3004
+ * @private
3005
+ * @param {Object} object The object to query.
3006
+ * @returns {Array} Returns the array of property names and symbols.
3007
+ */
3008
+ function getAllKeys$1(object) {
3009
+ return baseGetAllKeys(object, keys, getSymbols);
3010
+ }
3011
+
3012
+ var _getAllKeys = getAllKeys$1;
3013
+
3014
+ var getAllKeys = _getAllKeys;
3015
+
3016
+ /** Used to compose bitmasks for value comparisons. */
3017
+ var COMPARE_PARTIAL_FLAG$1 = 1;
3018
+
3019
+ /** Used for built-in method references. */
3020
+ var objectProto$1 = Object.prototype;
3021
+
3022
+ /** Used to check objects for own properties. */
3023
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
3024
+
3025
+ /**
3026
+ * A specialized version of `baseIsEqualDeep` for objects with support for
3027
+ * partial deep comparisons.
3028
+ *
3029
+ * @private
3030
+ * @param {Object} object The object to compare.
3031
+ * @param {Object} other The other object to compare.
3032
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3033
+ * @param {Function} customizer The function to customize comparisons.
3034
+ * @param {Function} equalFunc The function to determine equivalents of values.
3035
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
3036
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3037
+ */
3038
+ function equalObjects$1(object, other, bitmask, customizer, equalFunc, stack) {
3039
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
3040
+ objProps = getAllKeys(object),
3041
+ objLength = objProps.length,
3042
+ othProps = getAllKeys(other),
3043
+ othLength = othProps.length;
3044
+
3045
+ if (objLength != othLength && !isPartial) {
3046
+ return false;
3047
+ }
3048
+ var index = objLength;
3049
+ while (index--) {
3050
+ var key = objProps[index];
3051
+ if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
3052
+ return false;
3053
+ }
3054
+ }
3055
+ // Check that cyclic values are equal.
3056
+ var objStacked = stack.get(object);
3057
+ var othStacked = stack.get(other);
3058
+ if (objStacked && othStacked) {
3059
+ return objStacked == other && othStacked == object;
3060
+ }
3061
+ var result = true;
3062
+ stack.set(object, other);
3063
+ stack.set(other, object);
3064
+
3065
+ var skipCtor = isPartial;
3066
+ while (++index < objLength) {
3067
+ key = objProps[index];
3068
+ var objValue = object[key],
3069
+ othValue = other[key];
3070
+
3071
+ if (customizer) {
3072
+ var compared = isPartial
3073
+ ? customizer(othValue, objValue, key, other, object, stack)
3074
+ : customizer(objValue, othValue, key, object, other, stack);
3075
+ }
3076
+ // Recursively compare objects (susceptible to call stack limits).
3077
+ if (!(compared === undefined
3078
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
3079
+ : compared
3080
+ )) {
3081
+ result = false;
3082
+ break;
3083
+ }
3084
+ skipCtor || (skipCtor = key == 'constructor');
3085
+ }
3086
+ if (result && !skipCtor) {
3087
+ var objCtor = object.constructor,
3088
+ othCtor = other.constructor;
3089
+
3090
+ // Non `Object` object instances with different constructors are not equal.
3091
+ if (objCtor != othCtor &&
3092
+ ('constructor' in object && 'constructor' in other) &&
3093
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
3094
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
3095
+ result = false;
3096
+ }
3097
+ }
3098
+ stack['delete'](object);
3099
+ stack['delete'](other);
3100
+ return result;
3101
+ }
3102
+
3103
+ var _equalObjects = equalObjects$1;
3104
+
3105
+ var Stack = _Stack,
3106
+ equalArrays = _equalArrays,
3107
+ equalByTag = _equalByTag,
3108
+ equalObjects = _equalObjects,
3109
+ getTag = _getTag,
3110
+ isArray = isArray_1,
3111
+ isBuffer = isBuffer$3.exports,
3112
+ isTypedArray = isTypedArray_1;
3113
+
3114
+ /** Used to compose bitmasks for value comparisons. */
3115
+ var COMPARE_PARTIAL_FLAG = 1;
3116
+
3117
+ /** `Object#toString` result references. */
3118
+ var argsTag = '[object Arguments]',
3119
+ arrayTag = '[object Array]',
3120
+ objectTag = '[object Object]';
3121
+
3122
+ /** Used for built-in method references. */
3123
+ var objectProto = Object.prototype;
3124
+
3125
+ /** Used to check objects for own properties. */
3126
+ var hasOwnProperty = objectProto.hasOwnProperty;
3127
+
3128
+ /**
3129
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
3130
+ * deep comparisons and tracks traversed objects enabling objects with circular
3131
+ * references to be compared.
3132
+ *
3133
+ * @private
3134
+ * @param {Object} object The object to compare.
3135
+ * @param {Object} other The other object to compare.
3136
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3137
+ * @param {Function} customizer The function to customize comparisons.
3138
+ * @param {Function} equalFunc The function to determine equivalents of values.
3139
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
3140
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3141
+ */
3142
+ function baseIsEqualDeep$1(object, other, bitmask, customizer, equalFunc, stack) {
3143
+ var objIsArr = isArray(object),
3144
+ othIsArr = isArray(other),
3145
+ objTag = objIsArr ? arrayTag : getTag(object),
3146
+ othTag = othIsArr ? arrayTag : getTag(other);
3147
+
3148
+ objTag = objTag == argsTag ? objectTag : objTag;
3149
+ othTag = othTag == argsTag ? objectTag : othTag;
3150
+
3151
+ var objIsObj = objTag == objectTag,
3152
+ othIsObj = othTag == objectTag,
3153
+ isSameTag = objTag == othTag;
3154
+
3155
+ if (isSameTag && isBuffer(object)) {
3156
+ if (!isBuffer(other)) {
3157
+ return false;
3158
+ }
3159
+ objIsArr = true;
3160
+ objIsObj = false;
3161
+ }
3162
+ if (isSameTag && !objIsObj) {
3163
+ stack || (stack = new Stack);
3164
+ return (objIsArr || isTypedArray(object))
3165
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
3166
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
3167
+ }
3168
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
3169
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
3170
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
3171
+
3172
+ if (objIsWrapped || othIsWrapped) {
3173
+ var objUnwrapped = objIsWrapped ? object.value() : object,
3174
+ othUnwrapped = othIsWrapped ? other.value() : other;
3175
+
3176
+ stack || (stack = new Stack);
3177
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
3178
+ }
3179
+ }
3180
+ if (!isSameTag) {
3181
+ return false;
3182
+ }
3183
+ stack || (stack = new Stack);
3184
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
3185
+ }
3186
+
3187
+ var _baseIsEqualDeep = baseIsEqualDeep$1;
3188
+
3189
+ var baseIsEqualDeep = _baseIsEqualDeep,
3190
+ isObjectLike = isObjectLike_1;
3191
+
3192
+ /**
3193
+ * The base implementation of `_.isEqual` which supports partial comparisons
3194
+ * and tracks traversed objects.
3195
+ *
3196
+ * @private
3197
+ * @param {*} value The value to compare.
3198
+ * @param {*} other The other value to compare.
3199
+ * @param {boolean} bitmask The bitmask flags.
3200
+ * 1 - Unordered comparison
3201
+ * 2 - Partial comparison
3202
+ * @param {Function} [customizer] The function to customize comparisons.
3203
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
3204
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3205
+ */
3206
+ function baseIsEqual$1(value, other, bitmask, customizer, stack) {
3207
+ if (value === other) {
3208
+ return true;
3209
+ }
3210
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
3211
+ return value !== value && other !== other;
3212
+ }
3213
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$1, stack);
3214
+ }
3215
+
3216
+ var _baseIsEqual = baseIsEqual$1;
3217
+
3218
+ var baseIsEqual = _baseIsEqual;
3219
+
3220
+ /**
3221
+ * Performs a deep comparison between two values to determine if they are
3222
+ * equivalent.
3223
+ *
3224
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
3225
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
3226
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
3227
+ * by their own, not inherited, enumerable properties. Functions and DOM
3228
+ * nodes are compared by strict equality, i.e. `===`.
3229
+ *
3230
+ * @static
3231
+ * @memberOf _
3232
+ * @since 0.1.0
3233
+ * @category Lang
3234
+ * @param {*} value The value to compare.
3235
+ * @param {*} other The other value to compare.
3236
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3237
+ * @example
3238
+ *
3239
+ * var object = { 'a': 1 };
3240
+ * var other = { 'a': 1 };
3241
+ *
3242
+ * _.isEqual(object, other);
3243
+ * // => true
3244
+ *
3245
+ * object === other;
3246
+ * // => false
3247
+ */
3248
+ function isEqual(value, other) {
3249
+ return baseIsEqual(value, other);
3250
+ }
3251
+
3252
+ var isEqual_1 = isEqual;
3253
+
3254
+ const getCorrectResponse = choices => choices.filter(c => c.correct).map(c => c.id).sort();
3255
+ const isResponseCorrect = (question, session) => {
3256
+ const {
3257
+ shapes: {
3258
+ rectangles = [],
3259
+ polygons = [],
3260
+ circles = []
3261
+ }
3262
+ } = question;
3263
+ const choices = [...rectangles, ...polygons, ...circles];
3264
+ let correctResponseIds = getCorrectResponse(choices);
3265
+
3266
+ if (!session || isEmpty_1(session)) {
3267
+ return false;
3268
+ }
3269
+
3270
+ if (session.answers && session.answers.length) {
3271
+ let answerIds = (session.answers || []).map(a => a.id);
3272
+ return isEqual_1(answerIds.sort(), correctResponseIds);
3273
+ } else if (!(correctResponseIds && correctResponseIds.length)) {
3274
+ return true;
3275
+ }
3276
+
3277
+ return false;
3278
+ };
3279
+
3280
+ var defaults = {
3281
+ dimensions: {
3282
+ height: 0,
3283
+ width: 0
3284
+ },
3285
+ hotspotColor: 'rgba(137, 183, 244, 0.25)',
3286
+ hotspotList: ['rgba(137, 183, 244, 0.25)'],
3287
+ imageUrl: '',
3288
+ multipleCorrect: true,
3289
+ outlineColor: 'blue',
3290
+ outlineList: ['blue'],
3291
+ partialScoring: false,
3292
+ prompt: '',
3293
+ promptEnabled: true,
3294
+ rationaleEnabled: true,
3295
+ shapes: {
3296
+ rectangles: [],
3297
+ polygons: [],
3298
+ circles: []
3299
+ },
3300
+ strokeWidth: 5,
3301
+ studentInstructionsEnabled: true,
3302
+ teacherInstructions: '',
3303
+ teacherInstructionsEnabled: true,
3304
+ toolbarEditorPosition: 'bottom'
3305
+ };
3306
+
3307
+ const _excluded = ["index", "correct"],
3308
+ _excluded2 = ["index", "correct"],
3309
+ _excluded3 = ["index", "correct"];
3310
+ const log = debug('pie-elements:hotspot:controller');
3311
+ const normalize = question => _extends({}, defaults, question);
3312
+ function model(question, session, env) {
3313
+ const normalizedQuestion = normalize(question);
3314
+ const {
3315
+ imageUrl,
3316
+ dimensions,
3317
+ hotspotColor,
3318
+ hoverOutlineColor,
3319
+ selectedHotspotColor,
3320
+ multipleCorrect,
3321
+ outlineColor,
3322
+ partialScoring,
3323
+ prompt,
3324
+ shapes,
3325
+ language,
3326
+ fontSizeFactor,
3327
+ autoplayAudioEnabled,
3328
+ completeAudioEnabled,
3329
+ customAudioButton
3330
+ } = normalizedQuestion;
3331
+ const {
3332
+ rectangles,
3333
+ polygons,
3334
+ circles
3335
+ } = shapes || {};
3336
+ const shouldIncludeCorrectResponse = env.mode === 'evaluate' || env.role === 'instructor' && env.mode === 'view';
3337
+ return new Promise(resolve => {
3338
+ const out = {
3339
+ disabled: env.mode !== 'gather',
3340
+ mode: env.mode,
3341
+ dimensions,
3342
+ imageUrl,
3343
+ outlineColor,
3344
+ hotspotColor,
3345
+ hoverOutlineColor,
3346
+ selectedHotspotColor,
3347
+ multipleCorrect,
3348
+ partialScoring,
3349
+ language,
3350
+ fontSizeFactor,
3351
+ autoplayAudioEnabled,
3352
+ completeAudioEnabled,
3353
+ customAudioButton,
3354
+ shapes: _extends({}, shapes, {
3355
+ // eslint-disable-next-line no-unused-vars
3356
+ rectangles: (rectangles || []).map(_ref => {
3357
+ let {
3358
+ correct
3359
+ } = _ref,
3360
+ rectProps = _objectWithoutPropertiesLoose(_ref, _excluded);
3361
+
3362
+ return shouldIncludeCorrectResponse ? _extends({
3363
+ correct
3364
+ }, rectProps) : _extends({}, rectProps);
3365
+ }),
3366
+ // eslint-disable-next-line no-unused-vars
3367
+ polygons: (polygons || []).map(_ref2 => {
3368
+ let {
3369
+ correct
3370
+ } = _ref2,
3371
+ polyProps = _objectWithoutPropertiesLoose(_ref2, _excluded2);
3372
+
3373
+ return shouldIncludeCorrectResponse ? _extends({
3374
+ correct
3375
+ }, polyProps) : _extends({}, polyProps);
3376
+ }),
3377
+ // eslint-disable-next-line no-unused-vars
3378
+ circles: (circles || []).map(_ref3 => {
3379
+ let {
3380
+ correct
3381
+ } = _ref3,
3382
+ circleProps = _objectWithoutPropertiesLoose(_ref3, _excluded3);
3383
+
3384
+ return shouldIncludeCorrectResponse ? _extends({
3385
+ correct
3386
+ }, circleProps) : _extends({}, circleProps);
3387
+ })
3388
+ }),
3389
+ responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,
3390
+ extraCSSRules: normalizedQuestion.extraCSSRules
3391
+ };
3392
+
3393
+ if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
3394
+ out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
3395
+ out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
3396
+ } else {
3397
+ out.rationale = null;
3398
+ out.teacherInstructions = null;
3399
+ }
3400
+
3401
+ out.prompt = normalizedQuestion.promptEnabled ? prompt : null;
3402
+ out.strokeWidth = normalizedQuestion.strokeWidth;
3403
+ resolve(out);
3404
+ });
3405
+ }
3406
+ const createDefaultModel = (model = {}) => new Promise(resolve => {
3407
+ resolve(_extends({}, defaults, model));
3408
+ });
3409
+
3410
+ const getScore = (config, session, env = {}) => {
3411
+ const {
3412
+ answers
3413
+ } = session || {};
3414
+
3415
+ if (!config.shapes || !config.shapes.rectangles && !config.shapes.polygons && !config.shapes.circles) {
3416
+ return 0;
3417
+ }
3418
+
3419
+ const {
3420
+ shapes: {
3421
+ rectangles = [],
3422
+ polygons = [],
3423
+ circles = []
3424
+ } = {}
3425
+ } = config;
3426
+ const partialScoringEnabled = partialScoring.enabled(config, env);
3427
+
3428
+ if (!partialScoringEnabled) {
3429
+ return isResponseCorrect(config, session) ? 1 : 0;
3430
+ }
3431
+
3432
+ let correctAnswers = 0;
3433
+ let selectedChoices = 0;
3434
+ const choices = [...rectangles, ...polygons, ...circles];
3435
+ const correctChoices = choices.filter(choice => choice.correct);
3436
+ choices.forEach(shape => {
3437
+ const selected = answers && answers.filter(answer => answer.id === shape.id)[0];
3438
+ const correctlySelected = shape.correct && selected;
3439
+
3440
+ if (selected) {
3441
+ selectedChoices += 1;
3442
+ }
3443
+
3444
+ if (correctlySelected) {
3445
+ correctAnswers += 1;
3446
+ }
3447
+ });
3448
+ const extraAnswers = selectedChoices > correctChoices.length ? selectedChoices - correctChoices.length : 0;
3449
+ const total = correctChoices.length === 0 ? 1 : correctChoices.length;
3450
+ const str = ((correctAnswers - extraAnswers) / total).toFixed(2);
3451
+ return str < 0 ? 0 : parseFloat(str);
3452
+ };
3453
+
3454
+ function outcome(config, session, env = {}) {
3455
+ return new Promise(resolve => {
3456
+ log('outcome...');
3457
+
3458
+ if (!session || isEmpty_1(session)) {
3459
+ resolve({
3460
+ score: 0,
3461
+ empty: true
3462
+ });
3463
+ }
3464
+
3465
+ if (session.answers) {
3466
+ const score = getScore(config, session, env);
3467
+ resolve({
3468
+ score
3469
+ });
3470
+ } else {
3471
+ resolve({
3472
+ score: 0,
3473
+ empty: true
3474
+ });
3475
+ }
3476
+ });
3477
+ }
3478
+
3479
+ const returnShapesCorrect = shapes => {
3480
+ let answers = [];
3481
+ shapes.forEach(i => {
3482
+ const {
3483
+ correct,
3484
+ id
3485
+ } = i;
3486
+
3487
+ if (correct) {
3488
+ answers.push({
3489
+ id
3490
+ });
3491
+ }
3492
+ });
3493
+ return answers;
3494
+ };
3495
+
3496
+ const createCorrectResponseSession = (question, env) => {
3497
+ return new Promise(resolve => {
3498
+ if (env.mode !== 'evaluate' && env.role === 'instructor') {
3499
+ const {
3500
+ shapes: {
3501
+ rectangles = [],
3502
+ circles = [],
3503
+ polygons = {}
3504
+ } = {}
3505
+ } = question;
3506
+ const rectangleCorrect = returnShapesCorrect(rectangles);
3507
+ const polygonsCorrect = returnShapesCorrect(polygons);
3508
+ const circlesCorrect = returnShapesCorrect(circles);
3509
+ resolve({
3510
+ answers: [...rectangleCorrect, ...polygonsCorrect, ...circlesCorrect],
3511
+ id: '1'
3512
+ });
3513
+ } else {
3514
+ resolve(null);
3515
+ }
3516
+ });
3517
+ }; // remove all html tags
3518
+
3519
+
3520
+ const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
3521
+
3522
+ const validate = (model = {}, config = {}) => {
3523
+ const {
3524
+ shapes
3525
+ } = model;
3526
+ const {
3527
+ minShapes = 2,
3528
+ maxShapes,
3529
+ maxSelections
3530
+ } = config;
3531
+ const errors = {};
3532
+ ['teacherInstructions', 'prompt', 'rationale'].forEach(field => {
3533
+ var _config$field;
3534
+
3535
+ if ((_config$field = config[field]) != null && _config$field.required && !getContent(model[field])) {
3536
+ errors[field] = 'This field is required.';
3537
+ }
3538
+ });
3539
+ const allShapes = Object.values(shapes || {}).reduce((acc, shape) => [...acc, ...shape], []);
3540
+ const nbOfSelections = (allShapes || []).reduce((acc, shape) => shape.correct ? acc + 1 : acc, 0);
3541
+ const nbOfShapes = (allShapes || []).length;
3542
+
3543
+ if (nbOfShapes < minShapes) {
3544
+ errors.shapes = `There should be at least ${minShapes} shapes defined.`;
3545
+ } else if (nbOfShapes > maxShapes) {
3546
+ errors.shapes = `No more than ${maxShapes} shapes should be defined.`;
3547
+ }
3548
+
3549
+ if (nbOfSelections < 1) {
3550
+ errors.selections = 'There should be at least 1 shape selected.';
3551
+ } else if (nbOfSelections > maxSelections) {
3552
+ errors.selections = `No more than ${maxSelections} shapes should be selected.`;
3553
+ }
3554
+
3555
+ return errors;
3556
+ };
3557
+
3558
+ export { createCorrectResponseSession, createDefaultModel, model, normalize, outcome, validate };
3559
+ //# sourceMappingURL=controller.js.map