@pie-element/fraction-model 4.3.4-next.3 → 5.0.0-beta.1

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.
package/esm/controller.js DELETED
@@ -1,1224 +0,0 @@
1
- function _extends() {
2
- _extends = Object.assign || function (target) {
3
- for (var i = 1; i < arguments.length; i++) {
4
- var source = arguments[i];
5
-
6
- for (var key in source) {
7
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8
- target[key] = source[key];
9
- }
10
- }
11
- }
12
-
13
- return target;
14
- };
15
-
16
- return _extends.apply(this, arguments);
17
- }
18
-
19
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
20
-
21
- /** Used for built-in method references. */
22
-
23
- var objectProto$6 = Object.prototype;
24
-
25
- /**
26
- * Checks if `value` is likely a prototype object.
27
- *
28
- * @private
29
- * @param {*} value The value to check.
30
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
31
- */
32
- function isPrototype$2(value) {
33
- var Ctor = value && value.constructor,
34
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
35
-
36
- return value === proto;
37
- }
38
-
39
- var _isPrototype = isPrototype$2;
40
-
41
- /**
42
- * Creates a unary function that invokes `func` with its argument transformed.
43
- *
44
- * @private
45
- * @param {Function} func The function to wrap.
46
- * @param {Function} transform The argument transform.
47
- * @returns {Function} Returns the new function.
48
- */
49
-
50
- function overArg$1(func, transform) {
51
- return function(arg) {
52
- return func(transform(arg));
53
- };
54
- }
55
-
56
- var _overArg = overArg$1;
57
-
58
- var overArg = _overArg;
59
-
60
- /* Built-in method references for those with the same name as other `lodash` methods. */
61
- var nativeKeys$1 = overArg(Object.keys, Object);
62
-
63
- var _nativeKeys = nativeKeys$1;
64
-
65
- var isPrototype$1 = _isPrototype,
66
- nativeKeys = _nativeKeys;
67
-
68
- /** Used for built-in method references. */
69
- var objectProto$5 = Object.prototype;
70
-
71
- /** Used to check objects for own properties. */
72
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
73
-
74
- /**
75
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
76
- *
77
- * @private
78
- * @param {Object} object The object to query.
79
- * @returns {Array} Returns the array of property names.
80
- */
81
- function baseKeys$1(object) {
82
- if (!isPrototype$1(object)) {
83
- return nativeKeys(object);
84
- }
85
- var result = [];
86
- for (var key in Object(object)) {
87
- if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
88
- result.push(key);
89
- }
90
- }
91
- return result;
92
- }
93
-
94
- var _baseKeys = baseKeys$1;
95
-
96
- /** Detect free variable `global` from Node.js. */
97
-
98
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
99
-
100
- var _freeGlobal = freeGlobal$1;
101
-
102
- var freeGlobal = _freeGlobal;
103
-
104
- /** Detect free variable `self`. */
105
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
106
-
107
- /** Used as a reference to the global object. */
108
- var root$7 = freeGlobal || freeSelf || Function('return this')();
109
-
110
- var _root = root$7;
111
-
112
- var root$6 = _root;
113
-
114
- /** Built-in value references. */
115
- var Symbol$2 = root$6.Symbol;
116
-
117
- var _Symbol = Symbol$2;
118
-
119
- var Symbol$1 = _Symbol;
120
-
121
- /** Used for built-in method references. */
122
- var objectProto$4 = Object.prototype;
123
-
124
- /** Used to check objects for own properties. */
125
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
126
-
127
- /**
128
- * Used to resolve the
129
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
130
- * of values.
131
- */
132
- var nativeObjectToString$1 = objectProto$4.toString;
133
-
134
- /** Built-in value references. */
135
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
136
-
137
- /**
138
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
139
- *
140
- * @private
141
- * @param {*} value The value to query.
142
- * @returns {string} Returns the raw `toStringTag`.
143
- */
144
- function getRawTag$1(value) {
145
- var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
146
- tag = value[symToStringTag$1];
147
-
148
- try {
149
- value[symToStringTag$1] = undefined;
150
- var unmasked = true;
151
- } catch (e) {}
152
-
153
- var result = nativeObjectToString$1.call(value);
154
- if (unmasked) {
155
- if (isOwn) {
156
- value[symToStringTag$1] = tag;
157
- } else {
158
- delete value[symToStringTag$1];
159
- }
160
- }
161
- return result;
162
- }
163
-
164
- var _getRawTag = getRawTag$1;
165
-
166
- /** Used for built-in method references. */
167
-
168
- var objectProto$3 = Object.prototype;
169
-
170
- /**
171
- * Used to resolve the
172
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
173
- * of values.
174
- */
175
- var nativeObjectToString = objectProto$3.toString;
176
-
177
- /**
178
- * Converts `value` to a string using `Object.prototype.toString`.
179
- *
180
- * @private
181
- * @param {*} value The value to convert.
182
- * @returns {string} Returns the converted string.
183
- */
184
- function objectToString$1(value) {
185
- return nativeObjectToString.call(value);
186
- }
187
-
188
- var _objectToString = objectToString$1;
189
-
190
- var Symbol = _Symbol,
191
- getRawTag = _getRawTag,
192
- objectToString = _objectToString;
193
-
194
- /** `Object#toString` result references. */
195
- var nullTag = '[object Null]',
196
- undefinedTag = '[object Undefined]';
197
-
198
- /** Built-in value references. */
199
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
200
-
201
- /**
202
- * The base implementation of `getTag` without fallbacks for buggy environments.
203
- *
204
- * @private
205
- * @param {*} value The value to query.
206
- * @returns {string} Returns the `toStringTag`.
207
- */
208
- function baseGetTag$4(value) {
209
- if (value == null) {
210
- return value === undefined ? undefinedTag : nullTag;
211
- }
212
- return (symToStringTag && symToStringTag in Object(value))
213
- ? getRawTag(value)
214
- : objectToString(value);
215
- }
216
-
217
- var _baseGetTag = baseGetTag$4;
218
-
219
- /**
220
- * Checks if `value` is the
221
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
222
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
223
- *
224
- * @static
225
- * @memberOf _
226
- * @since 0.1.0
227
- * @category Lang
228
- * @param {*} value The value to check.
229
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
230
- * @example
231
- *
232
- * _.isObject({});
233
- * // => true
234
- *
235
- * _.isObject([1, 2, 3]);
236
- * // => true
237
- *
238
- * _.isObject(_.noop);
239
- * // => true
240
- *
241
- * _.isObject(null);
242
- * // => false
243
- */
244
-
245
- function isObject$2(value) {
246
- var type = typeof value;
247
- return value != null && (type == 'object' || type == 'function');
248
- }
249
-
250
- var isObject_1 = isObject$2;
251
-
252
- var baseGetTag$3 = _baseGetTag,
253
- isObject$1 = isObject_1;
254
-
255
- /** `Object#toString` result references. */
256
- var asyncTag = '[object AsyncFunction]',
257
- funcTag$1 = '[object Function]',
258
- genTag = '[object GeneratorFunction]',
259
- proxyTag = '[object Proxy]';
260
-
261
- /**
262
- * Checks if `value` is classified as a `Function` object.
263
- *
264
- * @static
265
- * @memberOf _
266
- * @since 0.1.0
267
- * @category Lang
268
- * @param {*} value The value to check.
269
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
270
- * @example
271
- *
272
- * _.isFunction(_);
273
- * // => true
274
- *
275
- * _.isFunction(/abc/);
276
- * // => false
277
- */
278
- function isFunction$2(value) {
279
- if (!isObject$1(value)) {
280
- return false;
281
- }
282
- // The use of `Object#toString` avoids issues with the `typeof` operator
283
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
284
- var tag = baseGetTag$3(value);
285
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
286
- }
287
-
288
- var isFunction_1 = isFunction$2;
289
-
290
- var root$5 = _root;
291
-
292
- /** Used to detect overreaching core-js shims. */
293
- var coreJsData$1 = root$5['__core-js_shared__'];
294
-
295
- var _coreJsData = coreJsData$1;
296
-
297
- var coreJsData = _coreJsData;
298
-
299
- /** Used to detect methods masquerading as native. */
300
- var maskSrcKey = (function() {
301
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
302
- return uid ? ('Symbol(src)_1.' + uid) : '';
303
- }());
304
-
305
- /**
306
- * Checks if `func` has its source masked.
307
- *
308
- * @private
309
- * @param {Function} func The function to check.
310
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
311
- */
312
- function isMasked$1(func) {
313
- return !!maskSrcKey && (maskSrcKey in func);
314
- }
315
-
316
- var _isMasked = isMasked$1;
317
-
318
- /** Used for built-in method references. */
319
-
320
- var funcProto$1 = Function.prototype;
321
-
322
- /** Used to resolve the decompiled source of functions. */
323
- var funcToString$1 = funcProto$1.toString;
324
-
325
- /**
326
- * Converts `func` to its source code.
327
- *
328
- * @private
329
- * @param {Function} func The function to convert.
330
- * @returns {string} Returns the source code.
331
- */
332
- function toSource$2(func) {
333
- if (func != null) {
334
- try {
335
- return funcToString$1.call(func);
336
- } catch (e) {}
337
- try {
338
- return (func + '');
339
- } catch (e) {}
340
- }
341
- return '';
342
- }
343
-
344
- var _toSource = toSource$2;
345
-
346
- var isFunction$1 = isFunction_1,
347
- isMasked = _isMasked,
348
- isObject = isObject_1,
349
- toSource$1 = _toSource;
350
-
351
- /**
352
- * Used to match `RegExp`
353
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
354
- */
355
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
356
-
357
- /** Used to detect host constructors (Safari). */
358
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
359
-
360
- /** Used for built-in method references. */
361
- var funcProto = Function.prototype,
362
- objectProto$2 = Object.prototype;
363
-
364
- /** Used to resolve the decompiled source of functions. */
365
- var funcToString = funcProto.toString;
366
-
367
- /** Used to check objects for own properties. */
368
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
369
-
370
- /** Used to detect if a method is native. */
371
- var reIsNative = RegExp('^' +
372
- funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
373
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
374
- );
375
-
376
- /**
377
- * The base implementation of `_.isNative` without bad shim checks.
378
- *
379
- * @private
380
- * @param {*} value The value to check.
381
- * @returns {boolean} Returns `true` if `value` is a native function,
382
- * else `false`.
383
- */
384
- function baseIsNative$1(value) {
385
- if (!isObject(value) || isMasked(value)) {
386
- return false;
387
- }
388
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
389
- return pattern.test(toSource$1(value));
390
- }
391
-
392
- var _baseIsNative = baseIsNative$1;
393
-
394
- /**
395
- * Gets the value at `key` of `object`.
396
- *
397
- * @private
398
- * @param {Object} [object] The object to query.
399
- * @param {string} key The key of the property to get.
400
- * @returns {*} Returns the property value.
401
- */
402
-
403
- function getValue$1(object, key) {
404
- return object == null ? undefined : object[key];
405
- }
406
-
407
- var _getValue = getValue$1;
408
-
409
- var baseIsNative = _baseIsNative,
410
- getValue = _getValue;
411
-
412
- /**
413
- * Gets the native function at `key` of `object`.
414
- *
415
- * @private
416
- * @param {Object} object The object to query.
417
- * @param {string} key The key of the method to get.
418
- * @returns {*} Returns the function if it's native, else `undefined`.
419
- */
420
- function getNative$5(object, key) {
421
- var value = getValue(object, key);
422
- return baseIsNative(value) ? value : undefined;
423
- }
424
-
425
- var _getNative = getNative$5;
426
-
427
- var getNative$4 = _getNative,
428
- root$4 = _root;
429
-
430
- /* Built-in method references that are verified to be native. */
431
- var DataView$1 = getNative$4(root$4, 'DataView');
432
-
433
- var _DataView = DataView$1;
434
-
435
- var getNative$3 = _getNative,
436
- root$3 = _root;
437
-
438
- /* Built-in method references that are verified to be native. */
439
- var Map$1 = getNative$3(root$3, 'Map');
440
-
441
- var _Map = Map$1;
442
-
443
- var getNative$2 = _getNative,
444
- root$2 = _root;
445
-
446
- /* Built-in method references that are verified to be native. */
447
- var Promise$2 = getNative$2(root$2, 'Promise');
448
-
449
- var _Promise = Promise$2;
450
-
451
- var getNative$1 = _getNative,
452
- root$1 = _root;
453
-
454
- /* Built-in method references that are verified to be native. */
455
- var Set$1 = getNative$1(root$1, 'Set');
456
-
457
- var _Set = Set$1;
458
-
459
- var getNative = _getNative,
460
- root = _root;
461
-
462
- /* Built-in method references that are verified to be native. */
463
- var WeakMap$1 = getNative(root, 'WeakMap');
464
-
465
- var _WeakMap = WeakMap$1;
466
-
467
- var DataView = _DataView,
468
- Map = _Map,
469
- Promise$1 = _Promise,
470
- Set = _Set,
471
- WeakMap = _WeakMap,
472
- baseGetTag$2 = _baseGetTag,
473
- toSource = _toSource;
474
-
475
- /** `Object#toString` result references. */
476
- var mapTag$2 = '[object Map]',
477
- objectTag$1 = '[object Object]',
478
- promiseTag = '[object Promise]',
479
- setTag$2 = '[object Set]',
480
- weakMapTag$1 = '[object WeakMap]';
481
-
482
- var dataViewTag$1 = '[object DataView]';
483
-
484
- /** Used to detect maps, sets, and weakmaps. */
485
- var dataViewCtorString = toSource(DataView),
486
- mapCtorString = toSource(Map),
487
- promiseCtorString = toSource(Promise$1),
488
- setCtorString = toSource(Set),
489
- weakMapCtorString = toSource(WeakMap);
490
-
491
- /**
492
- * Gets the `toStringTag` of `value`.
493
- *
494
- * @private
495
- * @param {*} value The value to query.
496
- * @returns {string} Returns the `toStringTag`.
497
- */
498
- var getTag$1 = baseGetTag$2;
499
-
500
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
501
- if ((DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
502
- (Map && getTag$1(new Map) != mapTag$2) ||
503
- (Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag) ||
504
- (Set && getTag$1(new Set) != setTag$2) ||
505
- (WeakMap && getTag$1(new WeakMap) != weakMapTag$1)) {
506
- getTag$1 = function(value) {
507
- var result = baseGetTag$2(value),
508
- Ctor = result == objectTag$1 ? value.constructor : undefined,
509
- ctorString = Ctor ? toSource(Ctor) : '';
510
-
511
- if (ctorString) {
512
- switch (ctorString) {
513
- case dataViewCtorString: return dataViewTag$1;
514
- case mapCtorString: return mapTag$2;
515
- case promiseCtorString: return promiseTag;
516
- case setCtorString: return setTag$2;
517
- case weakMapCtorString: return weakMapTag$1;
518
- }
519
- }
520
- return result;
521
- };
522
- }
523
-
524
- var _getTag = getTag$1;
525
-
526
- /**
527
- * Checks if `value` is object-like. A value is object-like if it's not `null`
528
- * and has a `typeof` result of "object".
529
- *
530
- * @static
531
- * @memberOf _
532
- * @since 4.0.0
533
- * @category Lang
534
- * @param {*} value The value to check.
535
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
536
- * @example
537
- *
538
- * _.isObjectLike({});
539
- * // => true
540
- *
541
- * _.isObjectLike([1, 2, 3]);
542
- * // => true
543
- *
544
- * _.isObjectLike(_.noop);
545
- * // => false
546
- *
547
- * _.isObjectLike(null);
548
- * // => false
549
- */
550
-
551
- function isObjectLike$3(value) {
552
- return value != null && typeof value == 'object';
553
- }
554
-
555
- var isObjectLike_1 = isObjectLike$3;
556
-
557
- var baseGetTag$1 = _baseGetTag,
558
- isObjectLike$2 = isObjectLike_1;
559
-
560
- /** `Object#toString` result references. */
561
- var argsTag$1 = '[object Arguments]';
562
-
563
- /**
564
- * The base implementation of `_.isArguments`.
565
- *
566
- * @private
567
- * @param {*} value The value to check.
568
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
569
- */
570
- function baseIsArguments$1(value) {
571
- return isObjectLike$2(value) && baseGetTag$1(value) == argsTag$1;
572
- }
573
-
574
- var _baseIsArguments = baseIsArguments$1;
575
-
576
- var baseIsArguments = _baseIsArguments,
577
- isObjectLike$1 = isObjectLike_1;
578
-
579
- /** Used for built-in method references. */
580
- var objectProto$1 = Object.prototype;
581
-
582
- /** Used to check objects for own properties. */
583
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
584
-
585
- /** Built-in value references. */
586
- var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
587
-
588
- /**
589
- * Checks if `value` is likely an `arguments` object.
590
- *
591
- * @static
592
- * @memberOf _
593
- * @since 0.1.0
594
- * @category Lang
595
- * @param {*} value The value to check.
596
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
597
- * else `false`.
598
- * @example
599
- *
600
- * _.isArguments(function() { return arguments; }());
601
- * // => true
602
- *
603
- * _.isArguments([1, 2, 3]);
604
- * // => false
605
- */
606
- var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
607
- return isObjectLike$1(value) && hasOwnProperty$1.call(value, 'callee') &&
608
- !propertyIsEnumerable.call(value, 'callee');
609
- };
610
-
611
- var isArguments_1 = isArguments$1;
612
-
613
- /**
614
- * Checks if `value` is classified as an `Array` object.
615
- *
616
- * @static
617
- * @memberOf _
618
- * @since 0.1.0
619
- * @category Lang
620
- * @param {*} value The value to check.
621
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
622
- * @example
623
- *
624
- * _.isArray([1, 2, 3]);
625
- * // => true
626
- *
627
- * _.isArray(document.body.children);
628
- * // => false
629
- *
630
- * _.isArray('abc');
631
- * // => false
632
- *
633
- * _.isArray(_.noop);
634
- * // => false
635
- */
636
-
637
- var isArray$1 = Array.isArray;
638
-
639
- var isArray_1 = isArray$1;
640
-
641
- /** Used as references for various `Number` constants. */
642
-
643
- var MAX_SAFE_INTEGER = 9007199254740991;
644
-
645
- /**
646
- * Checks if `value` is a valid array-like length.
647
- *
648
- * **Note:** This method is loosely based on
649
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
650
- *
651
- * @static
652
- * @memberOf _
653
- * @since 4.0.0
654
- * @category Lang
655
- * @param {*} value The value to check.
656
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
657
- * @example
658
- *
659
- * _.isLength(3);
660
- * // => true
661
- *
662
- * _.isLength(Number.MIN_VALUE);
663
- * // => false
664
- *
665
- * _.isLength(Infinity);
666
- * // => false
667
- *
668
- * _.isLength('3');
669
- * // => false
670
- */
671
- function isLength$2(value) {
672
- return typeof value == 'number' &&
673
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
674
- }
675
-
676
- var isLength_1 = isLength$2;
677
-
678
- var isFunction = isFunction_1,
679
- isLength$1 = isLength_1;
680
-
681
- /**
682
- * Checks if `value` is array-like. A value is considered array-like if it's
683
- * not a function and has a `value.length` that's an integer greater than or
684
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
685
- *
686
- * @static
687
- * @memberOf _
688
- * @since 4.0.0
689
- * @category Lang
690
- * @param {*} value The value to check.
691
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
692
- * @example
693
- *
694
- * _.isArrayLike([1, 2, 3]);
695
- * // => true
696
- *
697
- * _.isArrayLike(document.body.children);
698
- * // => true
699
- *
700
- * _.isArrayLike('abc');
701
- * // => true
702
- *
703
- * _.isArrayLike(_.noop);
704
- * // => false
705
- */
706
- function isArrayLike$1(value) {
707
- return value != null && isLength$1(value.length) && !isFunction(value);
708
- }
709
-
710
- var isArrayLike_1 = isArrayLike$1;
711
-
712
- var isBuffer$1 = {exports: {}};
713
-
714
- /**
715
- * This method returns `false`.
716
- *
717
- * @static
718
- * @memberOf _
719
- * @since 4.13.0
720
- * @category Util
721
- * @returns {boolean} Returns `false`.
722
- * @example
723
- *
724
- * _.times(2, _.stubFalse);
725
- * // => [false, false]
726
- */
727
-
728
- function stubFalse() {
729
- return false;
730
- }
731
-
732
- var stubFalse_1 = stubFalse;
733
-
734
- (function (module, exports) {
735
- var root = _root,
736
- stubFalse = stubFalse_1;
737
-
738
- /** Detect free variable `exports`. */
739
- var freeExports = exports && !exports.nodeType && exports;
740
-
741
- /** Detect free variable `module`. */
742
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
743
-
744
- /** Detect the popular CommonJS extension `module.exports`. */
745
- var moduleExports = freeModule && freeModule.exports === freeExports;
746
-
747
- /** Built-in value references. */
748
- var Buffer = moduleExports ? root.Buffer : undefined;
749
-
750
- /* Built-in method references for those with the same name as other `lodash` methods. */
751
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
752
-
753
- /**
754
- * Checks if `value` is a buffer.
755
- *
756
- * @static
757
- * @memberOf _
758
- * @since 4.3.0
759
- * @category Lang
760
- * @param {*} value The value to check.
761
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
762
- * @example
763
- *
764
- * _.isBuffer(new Buffer(2));
765
- * // => true
766
- *
767
- * _.isBuffer(new Uint8Array(2));
768
- * // => false
769
- */
770
- var isBuffer = nativeIsBuffer || stubFalse;
771
-
772
- module.exports = isBuffer;
773
- }(isBuffer$1, isBuffer$1.exports));
774
-
775
- var baseGetTag = _baseGetTag,
776
- isLength = isLength_1,
777
- isObjectLike = isObjectLike_1;
778
-
779
- /** `Object#toString` result references. */
780
- var argsTag = '[object Arguments]',
781
- arrayTag = '[object Array]',
782
- boolTag = '[object Boolean]',
783
- dateTag = '[object Date]',
784
- errorTag = '[object Error]',
785
- funcTag = '[object Function]',
786
- mapTag$1 = '[object Map]',
787
- numberTag = '[object Number]',
788
- objectTag = '[object Object]',
789
- regexpTag = '[object RegExp]',
790
- setTag$1 = '[object Set]',
791
- stringTag = '[object String]',
792
- weakMapTag = '[object WeakMap]';
793
-
794
- var arrayBufferTag = '[object ArrayBuffer]',
795
- dataViewTag = '[object DataView]',
796
- float32Tag = '[object Float32Array]',
797
- float64Tag = '[object Float64Array]',
798
- int8Tag = '[object Int8Array]',
799
- int16Tag = '[object Int16Array]',
800
- int32Tag = '[object Int32Array]',
801
- uint8Tag = '[object Uint8Array]',
802
- uint8ClampedTag = '[object Uint8ClampedArray]',
803
- uint16Tag = '[object Uint16Array]',
804
- uint32Tag = '[object Uint32Array]';
805
-
806
- /** Used to identify `toStringTag` values of typed arrays. */
807
- var typedArrayTags = {};
808
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
809
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
810
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
811
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
812
- typedArrayTags[uint32Tag] = true;
813
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
814
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
815
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
816
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
817
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
818
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
819
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
820
- typedArrayTags[weakMapTag] = false;
821
-
822
- /**
823
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
824
- *
825
- * @private
826
- * @param {*} value The value to check.
827
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
828
- */
829
- function baseIsTypedArray$1(value) {
830
- return isObjectLike(value) &&
831
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
832
- }
833
-
834
- var _baseIsTypedArray = baseIsTypedArray$1;
835
-
836
- /**
837
- * The base implementation of `_.unary` without support for storing metadata.
838
- *
839
- * @private
840
- * @param {Function} func The function to cap arguments for.
841
- * @returns {Function} Returns the new capped function.
842
- */
843
-
844
- function baseUnary$1(func) {
845
- return function(value) {
846
- return func(value);
847
- };
848
- }
849
-
850
- var _baseUnary = baseUnary$1;
851
-
852
- var _nodeUtil = {exports: {}};
853
-
854
- (function (module, exports) {
855
- var freeGlobal = _freeGlobal;
856
-
857
- /** Detect free variable `exports`. */
858
- var freeExports = exports && !exports.nodeType && exports;
859
-
860
- /** Detect free variable `module`. */
861
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
862
-
863
- /** Detect the popular CommonJS extension `module.exports`. */
864
- var moduleExports = freeModule && freeModule.exports === freeExports;
865
-
866
- /** Detect free variable `process` from Node.js. */
867
- var freeProcess = moduleExports && freeGlobal.process;
868
-
869
- /** Used to access faster Node.js helpers. */
870
- var nodeUtil = (function() {
871
- try {
872
- // Use `util.types` for Node.js 10+.
873
- var types = freeModule && freeModule.require && freeModule.require('util').types;
874
-
875
- if (types) {
876
- return types;
877
- }
878
-
879
- // Legacy `process.binding('util')` for Node.js < 10.
880
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
881
- } catch (e) {}
882
- }());
883
-
884
- module.exports = nodeUtil;
885
- }(_nodeUtil, _nodeUtil.exports));
886
-
887
- var baseIsTypedArray = _baseIsTypedArray,
888
- baseUnary = _baseUnary,
889
- nodeUtil = _nodeUtil.exports;
890
-
891
- /* Node.js helper references. */
892
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
893
-
894
- /**
895
- * Checks if `value` is classified as a typed array.
896
- *
897
- * @static
898
- * @memberOf _
899
- * @since 3.0.0
900
- * @category Lang
901
- * @param {*} value The value to check.
902
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
903
- * @example
904
- *
905
- * _.isTypedArray(new Uint8Array);
906
- * // => true
907
- *
908
- * _.isTypedArray([]);
909
- * // => false
910
- */
911
- var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
912
-
913
- var isTypedArray_1 = isTypedArray$1;
914
-
915
- var baseKeys = _baseKeys,
916
- getTag = _getTag,
917
- isArguments = isArguments_1,
918
- isArray = isArray_1,
919
- isArrayLike = isArrayLike_1,
920
- isBuffer = isBuffer$1.exports,
921
- isPrototype = _isPrototype,
922
- isTypedArray = isTypedArray_1;
923
-
924
- /** `Object#toString` result references. */
925
- var mapTag = '[object Map]',
926
- setTag = '[object Set]';
927
-
928
- /** Used for built-in method references. */
929
- var objectProto = Object.prototype;
930
-
931
- /** Used to check objects for own properties. */
932
- var hasOwnProperty = objectProto.hasOwnProperty;
933
-
934
- /**
935
- * Checks if `value` is an empty object, collection, map, or set.
936
- *
937
- * Objects are considered empty if they have no own enumerable string keyed
938
- * properties.
939
- *
940
- * Array-like values such as `arguments` objects, arrays, buffers, strings, or
941
- * jQuery-like collections are considered empty if they have a `length` of `0`.
942
- * Similarly, maps and sets are considered empty if they have a `size` of `0`.
943
- *
944
- * @static
945
- * @memberOf _
946
- * @since 0.1.0
947
- * @category Lang
948
- * @param {*} value The value to check.
949
- * @returns {boolean} Returns `true` if `value` is empty, else `false`.
950
- * @example
951
- *
952
- * _.isEmpty(null);
953
- * // => true
954
- *
955
- * _.isEmpty(true);
956
- * // => true
957
- *
958
- * _.isEmpty(1);
959
- * // => true
960
- *
961
- * _.isEmpty([1, 2, 3]);
962
- * // => false
963
- *
964
- * _.isEmpty({ 'a': 1 });
965
- * // => false
966
- */
967
- function isEmpty(value) {
968
- if (value == null) {
969
- return true;
970
- }
971
- if (isArrayLike(value) &&
972
- (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
973
- isBuffer(value) || isTypedArray(value) || isArguments(value))) {
974
- return !value.length;
975
- }
976
- var tag = getTag(value);
977
- if (tag == mapTag || tag == setTag) {
978
- return !value.size;
979
- }
980
- if (isPrototype(value)) {
981
- return !baseKeys(value).length;
982
- }
983
- for (var key in value) {
984
- if (hasOwnProperty.call(value, key)) {
985
- return false;
986
- }
987
- }
988
- return true;
989
- }
990
-
991
- var isEmpty_1 = isEmpty;
992
-
993
- // Should be exactly the same as configure/defaults.js
994
- var defaults = {
995
- model: {
996
- correctResponse: [],
997
- title: '',
998
- prompt: '',
999
- modelTypeSelected: 'bar',
1000
- maxModelSelected: 1,
1001
- partsPerModel: 5,
1002
- allowedStudentConfig: false,
1003
- showGraphLabels: false
1004
- }
1005
- };
1006
-
1007
- /*
1008
- * Function to check the correctness of the response
1009
- * @param {model} model contains the model object
1010
- * @param {answers} answers contains the answers object
1011
- * @param {env} env contains the environment object
1012
- * @returns {string} returns the correctness of the response
1013
- * */
1014
-
1015
- const getResponseCorrectness = (model, answers, env = {}) => {
1016
- let correct;
1017
-
1018
- if (model.allowedStudentConfig) {
1019
- correct = !!(answers.partsPerModel === model.partsPerModel && partialFillCheck(answers.response, model.partsPerModel) && numeratorCheck(model.correctResponse, answers.response));
1020
- } else {
1021
- correct = !!(partialFillCheck(answers.response, model.partsPerModel) && numeratorCheck(model.correctResponse, answers.response));
1022
- }
1023
-
1024
- return correct ? 'correct' : 'incorrect';
1025
- };
1026
- /*
1027
- * Function to get the correctness of the response
1028
- * @param {question} question contains the question object
1029
- * @param {env} env contains the environment object
1030
- * @param {answers} answers contains the answers object
1031
- * @returns {string} returns the correctness
1032
- * */
1033
-
1034
- const getCorrectness = (question, env, answers = {}) => {
1035
- if (env.mode === 'evaluate') {
1036
- return getResponseCorrectness(question, answers, env);
1037
- }
1038
- };
1039
- /*
1040
- * Function to get the outcome score
1041
- * @param {question} question contains the question object
1042
- * @param {env} env contains the environment object
1043
- * @param {answers} answers contains the answers object
1044
- * @returns {number} returns the score
1045
- * */
1046
-
1047
-
1048
- const getOutComeScore = (question, env, answers = {}) => {
1049
- const correctness = getCorrectness(question, env, answers);
1050
- return correctness === 'correct' ? 1 : 0;
1051
- };
1052
- /*
1053
- * Function to check outcome of the session
1054
- * @param {model} model contains the model object
1055
- * @param {session} session contains the session object
1056
- * @param {env} env contains the environment object
1057
- * @returns {Promise} returns the score
1058
- */
1059
-
1060
-
1061
- const outcome = (model, session, env) => new Promise(resolve => {
1062
- if (!session || isEmpty_1(session)) {
1063
- resolve({
1064
- score: 0,
1065
- empty: true
1066
- });
1067
- } else {
1068
- if (env.mode !== 'evaluate') {
1069
- resolve({
1070
- score: undefined,
1071
- completed: undefined
1072
- });
1073
- } else {
1074
- resolve({
1075
- score: getOutComeScore(model, env, session.answers)
1076
- });
1077
- }
1078
- }
1079
- });
1080
- /*
1081
- * Function to check if the numerator of the response matches the numerator of the correct response
1082
- * @param {correctResponse} correctResponse contains the correct response object
1083
- * @param {response} response contains the response object
1084
- * @returns {boolean} returns true if the numerators match
1085
- * */
1086
-
1087
- const numeratorCheck = (correctResponse, response) => {
1088
- let correctNumerator = 0;
1089
- let responseNumerator = 0;
1090
-
1091
- for (let i = 0; i < correctResponse.length; i++) {
1092
- correctNumerator += correctResponse[i].value;
1093
- }
1094
-
1095
- for (let i = 0; i < response.length; i++) {
1096
- responseNumerator += response[i].value;
1097
- }
1098
-
1099
- return correctNumerator === responseNumerator;
1100
- };
1101
- /*
1102
- * Function to check if the response contains more than one partially-filled model
1103
- * @param {response} response contains the response object
1104
- * @param {partsPerModel} partsPerModel contains the number of parts per model
1105
- * */
1106
-
1107
-
1108
- const partialFillCheck = (response, partsPerModel) => {
1109
- if (response.length > 0) {
1110
- let partialModelCount = 0;
1111
- response.forEach(selection => {
1112
- if (selection.value !== partsPerModel) {
1113
- partialModelCount++;
1114
- }
1115
- });
1116
- return partialModelCount <= 1;
1117
- } else {
1118
- return false;
1119
- }
1120
- };
1121
- /*
1122
- * Function to create a default model
1123
- * @param {model} model contains the model object
1124
- * */
1125
-
1126
-
1127
- const createDefaultModel = (model = {}) => _extends({}, defaults.model, model);
1128
- /*
1129
- * Return the model object
1130
- * */
1131
-
1132
- const model = (question, session, env) => {
1133
- return new Promise(resolve => {
1134
- session = session || {};
1135
- const model = createDefaultModel(question);
1136
- let correctness, score;
1137
-
1138
- if ((!session || isEmpty_1(session)) && env.mode === 'evaluate') {
1139
- correctness = 'unanswered';
1140
- score = '0%';
1141
- } else {
1142
- correctness = getCorrectness(model, env, session && session.answers);
1143
- score = `${getOutComeScore(model, env, session && session.answers) * 100}%`;
1144
- }
1145
-
1146
- const correctInfo = {
1147
- score,
1148
- correctness
1149
- };
1150
-
1151
- const out = _extends({
1152
- env
1153
- }, model, {
1154
- view: env.mode === 'view' || env.mode === 'evaluate'
1155
- });
1156
-
1157
- if (env.mode === 'evaluate') {
1158
- Object.assign(out, {
1159
- correctness: correctInfo
1160
- });
1161
- }
1162
-
1163
- resolve(out);
1164
- });
1165
- };
1166
- /*
1167
- * Function to create a correct response session
1168
- * @param {model} model contains the model object
1169
- * @param {env} env contains the environment object
1170
- * @returns {Promise} returns the correct response session
1171
- * */
1172
-
1173
- const createCorrectResponseSession = (model, env) => {
1174
- return new Promise(resolve => {
1175
- if (env.mode !== 'evaluate' && env.role === 'instructor') {
1176
- const {
1177
- correctResponse,
1178
- maxModelSelected,
1179
- partsPerModel
1180
- } = model;
1181
- resolve({
1182
- answers: {
1183
- response: correctResponse,
1184
- noOfModel: maxModelSelected,
1185
- partsPerModel
1186
- },
1187
- id: '1'
1188
- });
1189
- } else {
1190
- resolve(null);
1191
- }
1192
- });
1193
- };
1194
- /*
1195
- * Function to validate the model
1196
- * @param {model} model contains the model object
1197
- * @param {config} config contains the config object
1198
- * */
1199
-
1200
- const validate = (model = {}, config = {}) => {
1201
- const errors = {};
1202
-
1203
- if (model.correctResponse.length === 0) {
1204
- errors.correctResponse = 'To save the item, at least one section must be marked as correct.';
1205
- }
1206
-
1207
- if (model.correctResponse.length > 0) {
1208
- let partialModelCount = 0;
1209
- model.correctResponse.forEach(selection => {
1210
- if (selection.value !== model.partsPerModel) {
1211
- partialModelCount++;
1212
- }
1213
- });
1214
-
1215
- if (partialModelCount > 1) {
1216
- errors.correctResponse = 'The correct answer should include no more than one partially-filled model';
1217
- }
1218
- }
1219
-
1220
- return errors;
1221
- };
1222
-
1223
- export { createCorrectResponseSession, createDefaultModel, getResponseCorrectness, model, outcome, validate };
1224
- //# sourceMappingURL=controller.js.map