@pie-element/match-list 6.0.0-beta.0 → 6.0.0-next.42

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