@pie-element/ebsr 12.3.4-next.3 → 13.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/lib/defaults.js +23 -36
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +114 -202
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +188 -271
- package/configure/lib/main.js.map +1 -1
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +1972 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +4213 -0
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +35 -0
- package/configure/node_modules/@pie-element/multiple-choice/README.md +56 -0
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +1387 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +3351 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/__tests__/root.test.js +248 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +200 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +211 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +477 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +22 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +527 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +2316 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/__tests__/index.test.js +520 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/__tests__/utils.test.js +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +33 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +251 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +16 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +15 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +2993 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +2217 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +61 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/pie.manifest.json +11 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +7 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +1332 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +1015 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/choice-input-test.js +117 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/index-test.js +151 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/key-events-test.js +95 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/multiple-choice-test.js +223 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/session-updater-test.js +70 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +370 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +197 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +130 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +292 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +54 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +386 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +92 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +37 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/package.json +39 -0
- package/configure/package.json +9 -6
- package/configure/src/__tests__/index.test.js +99 -108
- package/configure/src/index.js +13 -6
- package/configure/src/main.jsx +14 -18
- package/controller/lib/defaults.js +20 -32
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +224 -349
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +4 -18
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +3 -3
- package/lib/index.js +113 -181
- package/lib/index.js.map +1 -1
- package/lib/print.js +120 -204
- package/lib/print.js.map +1 -1
- package/package.json +5 -13
- package/src/__tests__/index.test.js +18 -5
- package/configure/src/__tests__/__snapshots__/index.test.js.snap +0 -83
- package/esm/configure.js +0 -12003
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -3358
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -2203
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
- package/esm/print.js +0 -4092
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -6469
- package/module/demo.js +0 -77
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -115
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/esm/element.js
DELETED
|
@@ -1,2203 +0,0 @@
|
|
|
1
|
-
import { SessionChangedEvent } from '@pie-framework/pie-player-events';
|
|
2
|
-
import MultipleChoice from '@pie-element/multiple-choice';
|
|
3
|
-
|
|
4
|
-
function _extends() {
|
|
5
|
-
_extends = Object.assign || function (target) {
|
|
6
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
7
|
-
var source = arguments[i];
|
|
8
|
-
|
|
9
|
-
for (var key in source) {
|
|
10
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
11
|
-
target[key] = source[key];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return target;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return _extends.apply(this, arguments);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Checks if `value` is classified as an `Array` object.
|
|
26
|
-
*
|
|
27
|
-
* @static
|
|
28
|
-
* @memberOf _
|
|
29
|
-
* @since 0.1.0
|
|
30
|
-
* @category Lang
|
|
31
|
-
* @param {*} value The value to check.
|
|
32
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
33
|
-
* @example
|
|
34
|
-
*
|
|
35
|
-
* _.isArray([1, 2, 3]);
|
|
36
|
-
* // => true
|
|
37
|
-
*
|
|
38
|
-
* _.isArray(document.body.children);
|
|
39
|
-
* // => false
|
|
40
|
-
*
|
|
41
|
-
* _.isArray('abc');
|
|
42
|
-
* // => false
|
|
43
|
-
*
|
|
44
|
-
* _.isArray(_.noop);
|
|
45
|
-
* // => false
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
var isArray$3 = Array.isArray;
|
|
49
|
-
|
|
50
|
-
var isArray_1 = isArray$3;
|
|
51
|
-
|
|
52
|
-
/** Detect free variable `global` from Node.js. */
|
|
53
|
-
|
|
54
|
-
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
55
|
-
|
|
56
|
-
var _freeGlobal = freeGlobal$1;
|
|
57
|
-
|
|
58
|
-
var freeGlobal = _freeGlobal;
|
|
59
|
-
|
|
60
|
-
/** Detect free variable `self`. */
|
|
61
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
62
|
-
|
|
63
|
-
/** Used as a reference to the global object. */
|
|
64
|
-
var root$3 = freeGlobal || freeSelf || Function('return this')();
|
|
65
|
-
|
|
66
|
-
var _root = root$3;
|
|
67
|
-
|
|
68
|
-
var root$2 = _root;
|
|
69
|
-
|
|
70
|
-
/** Built-in value references. */
|
|
71
|
-
var Symbol$3 = root$2.Symbol;
|
|
72
|
-
|
|
73
|
-
var _Symbol = Symbol$3;
|
|
74
|
-
|
|
75
|
-
var Symbol$2 = _Symbol;
|
|
76
|
-
|
|
77
|
-
/** Used for built-in method references. */
|
|
78
|
-
var objectProto$4 = Object.prototype;
|
|
79
|
-
|
|
80
|
-
/** Used to check objects for own properties. */
|
|
81
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Used to resolve the
|
|
85
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
86
|
-
* of values.
|
|
87
|
-
*/
|
|
88
|
-
var nativeObjectToString$1 = objectProto$4.toString;
|
|
89
|
-
|
|
90
|
-
/** Built-in value references. */
|
|
91
|
-
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
95
|
-
*
|
|
96
|
-
* @private
|
|
97
|
-
* @param {*} value The value to query.
|
|
98
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
99
|
-
*/
|
|
100
|
-
function getRawTag$1(value) {
|
|
101
|
-
var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
|
|
102
|
-
tag = value[symToStringTag$1];
|
|
103
|
-
|
|
104
|
-
try {
|
|
105
|
-
value[symToStringTag$1] = undefined;
|
|
106
|
-
var unmasked = true;
|
|
107
|
-
} catch (e) {}
|
|
108
|
-
|
|
109
|
-
var result = nativeObjectToString$1.call(value);
|
|
110
|
-
if (unmasked) {
|
|
111
|
-
if (isOwn) {
|
|
112
|
-
value[symToStringTag$1] = tag;
|
|
113
|
-
} else {
|
|
114
|
-
delete value[symToStringTag$1];
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return result;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var _getRawTag = getRawTag$1;
|
|
121
|
-
|
|
122
|
-
/** Used for built-in method references. */
|
|
123
|
-
|
|
124
|
-
var objectProto$3 = Object.prototype;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Used to resolve the
|
|
128
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
129
|
-
* of values.
|
|
130
|
-
*/
|
|
131
|
-
var nativeObjectToString = objectProto$3.toString;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
135
|
-
*
|
|
136
|
-
* @private
|
|
137
|
-
* @param {*} value The value to convert.
|
|
138
|
-
* @returns {string} Returns the converted string.
|
|
139
|
-
*/
|
|
140
|
-
function objectToString$1(value) {
|
|
141
|
-
return nativeObjectToString.call(value);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
var _objectToString = objectToString$1;
|
|
145
|
-
|
|
146
|
-
var Symbol$1 = _Symbol,
|
|
147
|
-
getRawTag = _getRawTag,
|
|
148
|
-
objectToString = _objectToString;
|
|
149
|
-
|
|
150
|
-
/** `Object#toString` result references. */
|
|
151
|
-
var nullTag = '[object Null]',
|
|
152
|
-
undefinedTag = '[object Undefined]';
|
|
153
|
-
|
|
154
|
-
/** Built-in value references. */
|
|
155
|
-
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
159
|
-
*
|
|
160
|
-
* @private
|
|
161
|
-
* @param {*} value The value to query.
|
|
162
|
-
* @returns {string} Returns the `toStringTag`.
|
|
163
|
-
*/
|
|
164
|
-
function baseGetTag$2(value) {
|
|
165
|
-
if (value == null) {
|
|
166
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
167
|
-
}
|
|
168
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
169
|
-
? getRawTag(value)
|
|
170
|
-
: objectToString(value);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var _baseGetTag = baseGetTag$2;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
177
|
-
* and has a `typeof` result of "object".
|
|
178
|
-
*
|
|
179
|
-
* @static
|
|
180
|
-
* @memberOf _
|
|
181
|
-
* @since 4.0.0
|
|
182
|
-
* @category Lang
|
|
183
|
-
* @param {*} value The value to check.
|
|
184
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
185
|
-
* @example
|
|
186
|
-
*
|
|
187
|
-
* _.isObjectLike({});
|
|
188
|
-
* // => true
|
|
189
|
-
*
|
|
190
|
-
* _.isObjectLike([1, 2, 3]);
|
|
191
|
-
* // => true
|
|
192
|
-
*
|
|
193
|
-
* _.isObjectLike(_.noop);
|
|
194
|
-
* // => false
|
|
195
|
-
*
|
|
196
|
-
* _.isObjectLike(null);
|
|
197
|
-
* // => false
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
function isObjectLike$1(value) {
|
|
201
|
-
return value != null && typeof value == 'object';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
var isObjectLike_1 = isObjectLike$1;
|
|
205
|
-
|
|
206
|
-
var baseGetTag$1 = _baseGetTag,
|
|
207
|
-
isObjectLike = isObjectLike_1;
|
|
208
|
-
|
|
209
|
-
/** `Object#toString` result references. */
|
|
210
|
-
var symbolTag = '[object Symbol]';
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
214
|
-
*
|
|
215
|
-
* @static
|
|
216
|
-
* @memberOf _
|
|
217
|
-
* @since 4.0.0
|
|
218
|
-
* @category Lang
|
|
219
|
-
* @param {*} value The value to check.
|
|
220
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
221
|
-
* @example
|
|
222
|
-
*
|
|
223
|
-
* _.isSymbol(Symbol.iterator);
|
|
224
|
-
* // => true
|
|
225
|
-
*
|
|
226
|
-
* _.isSymbol('abc');
|
|
227
|
-
* // => false
|
|
228
|
-
*/
|
|
229
|
-
function isSymbol$3(value) {
|
|
230
|
-
return typeof value == 'symbol' ||
|
|
231
|
-
(isObjectLike(value) && baseGetTag$1(value) == symbolTag);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
var isSymbol_1 = isSymbol$3;
|
|
235
|
-
|
|
236
|
-
var isArray$2 = isArray_1,
|
|
237
|
-
isSymbol$2 = isSymbol_1;
|
|
238
|
-
|
|
239
|
-
/** Used to match property names within property paths. */
|
|
240
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
241
|
-
reIsPlainProp = /^\w*$/;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Checks if `value` is a property name and not a property path.
|
|
245
|
-
*
|
|
246
|
-
* @private
|
|
247
|
-
* @param {*} value The value to check.
|
|
248
|
-
* @param {Object} [object] The object to query keys on.
|
|
249
|
-
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
250
|
-
*/
|
|
251
|
-
function isKey$1(value, object) {
|
|
252
|
-
if (isArray$2(value)) {
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
var type = typeof value;
|
|
256
|
-
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
257
|
-
value == null || isSymbol$2(value)) {
|
|
258
|
-
return true;
|
|
259
|
-
}
|
|
260
|
-
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
261
|
-
(object != null && value in Object(object));
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
var _isKey = isKey$1;
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Checks if `value` is the
|
|
268
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
269
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
270
|
-
*
|
|
271
|
-
* @static
|
|
272
|
-
* @memberOf _
|
|
273
|
-
* @since 0.1.0
|
|
274
|
-
* @category Lang
|
|
275
|
-
* @param {*} value The value to check.
|
|
276
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
277
|
-
* @example
|
|
278
|
-
*
|
|
279
|
-
* _.isObject({});
|
|
280
|
-
* // => true
|
|
281
|
-
*
|
|
282
|
-
* _.isObject([1, 2, 3]);
|
|
283
|
-
* // => true
|
|
284
|
-
*
|
|
285
|
-
* _.isObject(_.noop);
|
|
286
|
-
* // => true
|
|
287
|
-
*
|
|
288
|
-
* _.isObject(null);
|
|
289
|
-
* // => false
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
function isObject$2(value) {
|
|
293
|
-
var type = typeof value;
|
|
294
|
-
return value != null && (type == 'object' || type == 'function');
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
var isObject_1 = isObject$2;
|
|
298
|
-
|
|
299
|
-
var baseGetTag = _baseGetTag,
|
|
300
|
-
isObject$1 = isObject_1;
|
|
301
|
-
|
|
302
|
-
/** `Object#toString` result references. */
|
|
303
|
-
var asyncTag = '[object AsyncFunction]',
|
|
304
|
-
funcTag = '[object Function]',
|
|
305
|
-
genTag = '[object GeneratorFunction]',
|
|
306
|
-
proxyTag = '[object Proxy]';
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Checks if `value` is classified as a `Function` object.
|
|
310
|
-
*
|
|
311
|
-
* @static
|
|
312
|
-
* @memberOf _
|
|
313
|
-
* @since 0.1.0
|
|
314
|
-
* @category Lang
|
|
315
|
-
* @param {*} value The value to check.
|
|
316
|
-
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
317
|
-
* @example
|
|
318
|
-
*
|
|
319
|
-
* _.isFunction(_);
|
|
320
|
-
* // => true
|
|
321
|
-
*
|
|
322
|
-
* _.isFunction(/abc/);
|
|
323
|
-
* // => false
|
|
324
|
-
*/
|
|
325
|
-
function isFunction$1(value) {
|
|
326
|
-
if (!isObject$1(value)) {
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
330
|
-
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
331
|
-
var tag = baseGetTag(value);
|
|
332
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
var isFunction_1 = isFunction$1;
|
|
336
|
-
|
|
337
|
-
var root$1 = _root;
|
|
338
|
-
|
|
339
|
-
/** Used to detect overreaching core-js shims. */
|
|
340
|
-
var coreJsData$1 = root$1['__core-js_shared__'];
|
|
341
|
-
|
|
342
|
-
var _coreJsData = coreJsData$1;
|
|
343
|
-
|
|
344
|
-
var coreJsData = _coreJsData;
|
|
345
|
-
|
|
346
|
-
/** Used to detect methods masquerading as native. */
|
|
347
|
-
var maskSrcKey = (function() {
|
|
348
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
349
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
350
|
-
}());
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Checks if `func` has its source masked.
|
|
354
|
-
*
|
|
355
|
-
* @private
|
|
356
|
-
* @param {Function} func The function to check.
|
|
357
|
-
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
358
|
-
*/
|
|
359
|
-
function isMasked$1(func) {
|
|
360
|
-
return !!maskSrcKey && (maskSrcKey in func);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
var _isMasked = isMasked$1;
|
|
364
|
-
|
|
365
|
-
/** Used for built-in method references. */
|
|
366
|
-
|
|
367
|
-
var funcProto$1 = Function.prototype;
|
|
368
|
-
|
|
369
|
-
/** Used to resolve the decompiled source of functions. */
|
|
370
|
-
var funcToString$1 = funcProto$1.toString;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Converts `func` to its source code.
|
|
374
|
-
*
|
|
375
|
-
* @private
|
|
376
|
-
* @param {Function} func The function to convert.
|
|
377
|
-
* @returns {string} Returns the source code.
|
|
378
|
-
*/
|
|
379
|
-
function toSource$1(func) {
|
|
380
|
-
if (func != null) {
|
|
381
|
-
try {
|
|
382
|
-
return funcToString$1.call(func);
|
|
383
|
-
} catch (e) {}
|
|
384
|
-
try {
|
|
385
|
-
return (func + '');
|
|
386
|
-
} catch (e) {}
|
|
387
|
-
}
|
|
388
|
-
return '';
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
var _toSource = toSource$1;
|
|
392
|
-
|
|
393
|
-
var isFunction = isFunction_1,
|
|
394
|
-
isMasked = _isMasked,
|
|
395
|
-
isObject = isObject_1,
|
|
396
|
-
toSource = _toSource;
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Used to match `RegExp`
|
|
400
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
401
|
-
*/
|
|
402
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
403
|
-
|
|
404
|
-
/** Used to detect host constructors (Safari). */
|
|
405
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
406
|
-
|
|
407
|
-
/** Used for built-in method references. */
|
|
408
|
-
var funcProto = Function.prototype,
|
|
409
|
-
objectProto$2 = Object.prototype;
|
|
410
|
-
|
|
411
|
-
/** Used to resolve the decompiled source of functions. */
|
|
412
|
-
var funcToString = funcProto.toString;
|
|
413
|
-
|
|
414
|
-
/** Used to check objects for own properties. */
|
|
415
|
-
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
416
|
-
|
|
417
|
-
/** Used to detect if a method is native. */
|
|
418
|
-
var reIsNative = RegExp('^' +
|
|
419
|
-
funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
|
|
420
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
421
|
-
);
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* The base implementation of `_.isNative` without bad shim checks.
|
|
425
|
-
*
|
|
426
|
-
* @private
|
|
427
|
-
* @param {*} value The value to check.
|
|
428
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
429
|
-
* else `false`.
|
|
430
|
-
*/
|
|
431
|
-
function baseIsNative$1(value) {
|
|
432
|
-
if (!isObject(value) || isMasked(value)) {
|
|
433
|
-
return false;
|
|
434
|
-
}
|
|
435
|
-
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
436
|
-
return pattern.test(toSource(value));
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
var _baseIsNative = baseIsNative$1;
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Gets the value at `key` of `object`.
|
|
443
|
-
*
|
|
444
|
-
* @private
|
|
445
|
-
* @param {Object} [object] The object to query.
|
|
446
|
-
* @param {string} key The key of the property to get.
|
|
447
|
-
* @returns {*} Returns the property value.
|
|
448
|
-
*/
|
|
449
|
-
|
|
450
|
-
function getValue$1(object, key) {
|
|
451
|
-
return object == null ? undefined : object[key];
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
var _getValue = getValue$1;
|
|
455
|
-
|
|
456
|
-
var baseIsNative = _baseIsNative,
|
|
457
|
-
getValue = _getValue;
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Gets the native function at `key` of `object`.
|
|
461
|
-
*
|
|
462
|
-
* @private
|
|
463
|
-
* @param {Object} object The object to query.
|
|
464
|
-
* @param {string} key The key of the method to get.
|
|
465
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
466
|
-
*/
|
|
467
|
-
function getNative$2(object, key) {
|
|
468
|
-
var value = getValue(object, key);
|
|
469
|
-
return baseIsNative(value) ? value : undefined;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
var _getNative = getNative$2;
|
|
473
|
-
|
|
474
|
-
var getNative$1 = _getNative;
|
|
475
|
-
|
|
476
|
-
/* Built-in method references that are verified to be native. */
|
|
477
|
-
var nativeCreate$4 = getNative$1(Object, 'create');
|
|
478
|
-
|
|
479
|
-
var _nativeCreate = nativeCreate$4;
|
|
480
|
-
|
|
481
|
-
var nativeCreate$3 = _nativeCreate;
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Removes all key-value entries from the hash.
|
|
485
|
-
*
|
|
486
|
-
* @private
|
|
487
|
-
* @name clear
|
|
488
|
-
* @memberOf Hash
|
|
489
|
-
*/
|
|
490
|
-
function hashClear$1() {
|
|
491
|
-
this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
|
|
492
|
-
this.size = 0;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
var _hashClear = hashClear$1;
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Removes `key` and its value from the hash.
|
|
499
|
-
*
|
|
500
|
-
* @private
|
|
501
|
-
* @name delete
|
|
502
|
-
* @memberOf Hash
|
|
503
|
-
* @param {Object} hash The hash to modify.
|
|
504
|
-
* @param {string} key The key of the value to remove.
|
|
505
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
506
|
-
*/
|
|
507
|
-
|
|
508
|
-
function hashDelete$1(key) {
|
|
509
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
510
|
-
this.size -= result ? 1 : 0;
|
|
511
|
-
return result;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
var _hashDelete = hashDelete$1;
|
|
515
|
-
|
|
516
|
-
var nativeCreate$2 = _nativeCreate;
|
|
517
|
-
|
|
518
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
519
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
520
|
-
|
|
521
|
-
/** Used for built-in method references. */
|
|
522
|
-
var objectProto$1 = Object.prototype;
|
|
523
|
-
|
|
524
|
-
/** Used to check objects for own properties. */
|
|
525
|
-
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Gets the hash value for `key`.
|
|
529
|
-
*
|
|
530
|
-
* @private
|
|
531
|
-
* @name get
|
|
532
|
-
* @memberOf Hash
|
|
533
|
-
* @param {string} key The key of the value to get.
|
|
534
|
-
* @returns {*} Returns the entry value.
|
|
535
|
-
*/
|
|
536
|
-
function hashGet$1(key) {
|
|
537
|
-
var data = this.__data__;
|
|
538
|
-
if (nativeCreate$2) {
|
|
539
|
-
var result = data[key];
|
|
540
|
-
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
541
|
-
}
|
|
542
|
-
return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
var _hashGet = hashGet$1;
|
|
546
|
-
|
|
547
|
-
var nativeCreate$1 = _nativeCreate;
|
|
548
|
-
|
|
549
|
-
/** Used for built-in method references. */
|
|
550
|
-
var objectProto = Object.prototype;
|
|
551
|
-
|
|
552
|
-
/** Used to check objects for own properties. */
|
|
553
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Checks if a hash value for `key` exists.
|
|
557
|
-
*
|
|
558
|
-
* @private
|
|
559
|
-
* @name has
|
|
560
|
-
* @memberOf Hash
|
|
561
|
-
* @param {string} key The key of the entry to check.
|
|
562
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
563
|
-
*/
|
|
564
|
-
function hashHas$1(key) {
|
|
565
|
-
var data = this.__data__;
|
|
566
|
-
return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
var _hashHas = hashHas$1;
|
|
570
|
-
|
|
571
|
-
var nativeCreate = _nativeCreate;
|
|
572
|
-
|
|
573
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
574
|
-
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Sets the hash `key` to `value`.
|
|
578
|
-
*
|
|
579
|
-
* @private
|
|
580
|
-
* @name set
|
|
581
|
-
* @memberOf Hash
|
|
582
|
-
* @param {string} key The key of the value to set.
|
|
583
|
-
* @param {*} value The value to set.
|
|
584
|
-
* @returns {Object} Returns the hash instance.
|
|
585
|
-
*/
|
|
586
|
-
function hashSet$1(key, value) {
|
|
587
|
-
var data = this.__data__;
|
|
588
|
-
this.size += this.has(key) ? 0 : 1;
|
|
589
|
-
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
590
|
-
return this;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
var _hashSet = hashSet$1;
|
|
594
|
-
|
|
595
|
-
var hashClear = _hashClear,
|
|
596
|
-
hashDelete = _hashDelete,
|
|
597
|
-
hashGet = _hashGet,
|
|
598
|
-
hashHas = _hashHas,
|
|
599
|
-
hashSet = _hashSet;
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Creates a hash object.
|
|
603
|
-
*
|
|
604
|
-
* @private
|
|
605
|
-
* @constructor
|
|
606
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
607
|
-
*/
|
|
608
|
-
function Hash$1(entries) {
|
|
609
|
-
var index = -1,
|
|
610
|
-
length = entries == null ? 0 : entries.length;
|
|
611
|
-
|
|
612
|
-
this.clear();
|
|
613
|
-
while (++index < length) {
|
|
614
|
-
var entry = entries[index];
|
|
615
|
-
this.set(entry[0], entry[1]);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
// Add methods to `Hash`.
|
|
620
|
-
Hash$1.prototype.clear = hashClear;
|
|
621
|
-
Hash$1.prototype['delete'] = hashDelete;
|
|
622
|
-
Hash$1.prototype.get = hashGet;
|
|
623
|
-
Hash$1.prototype.has = hashHas;
|
|
624
|
-
Hash$1.prototype.set = hashSet;
|
|
625
|
-
|
|
626
|
-
var _Hash = Hash$1;
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Removes all key-value entries from the list cache.
|
|
630
|
-
*
|
|
631
|
-
* @private
|
|
632
|
-
* @name clear
|
|
633
|
-
* @memberOf ListCache
|
|
634
|
-
*/
|
|
635
|
-
|
|
636
|
-
function listCacheClear$1() {
|
|
637
|
-
this.__data__ = [];
|
|
638
|
-
this.size = 0;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
var _listCacheClear = listCacheClear$1;
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* Performs a
|
|
645
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
646
|
-
* comparison between two values to determine if they are equivalent.
|
|
647
|
-
*
|
|
648
|
-
* @static
|
|
649
|
-
* @memberOf _
|
|
650
|
-
* @since 4.0.0
|
|
651
|
-
* @category Lang
|
|
652
|
-
* @param {*} value The value to compare.
|
|
653
|
-
* @param {*} other The other value to compare.
|
|
654
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
655
|
-
* @example
|
|
656
|
-
*
|
|
657
|
-
* var object = { 'a': 1 };
|
|
658
|
-
* var other = { 'a': 1 };
|
|
659
|
-
*
|
|
660
|
-
* _.eq(object, object);
|
|
661
|
-
* // => true
|
|
662
|
-
*
|
|
663
|
-
* _.eq(object, other);
|
|
664
|
-
* // => false
|
|
665
|
-
*
|
|
666
|
-
* _.eq('a', 'a');
|
|
667
|
-
* // => true
|
|
668
|
-
*
|
|
669
|
-
* _.eq('a', Object('a'));
|
|
670
|
-
* // => false
|
|
671
|
-
*
|
|
672
|
-
* _.eq(NaN, NaN);
|
|
673
|
-
* // => true
|
|
674
|
-
*/
|
|
675
|
-
|
|
676
|
-
function eq$1(value, other) {
|
|
677
|
-
return value === other || (value !== value && other !== other);
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
var eq_1 = eq$1;
|
|
681
|
-
|
|
682
|
-
var eq = eq_1;
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
686
|
-
*
|
|
687
|
-
* @private
|
|
688
|
-
* @param {Array} array The array to inspect.
|
|
689
|
-
* @param {*} key The key to search for.
|
|
690
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
691
|
-
*/
|
|
692
|
-
function assocIndexOf$4(array, key) {
|
|
693
|
-
var length = array.length;
|
|
694
|
-
while (length--) {
|
|
695
|
-
if (eq(array[length][0], key)) {
|
|
696
|
-
return length;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
return -1;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
var _assocIndexOf = assocIndexOf$4;
|
|
703
|
-
|
|
704
|
-
var assocIndexOf$3 = _assocIndexOf;
|
|
705
|
-
|
|
706
|
-
/** Used for built-in method references. */
|
|
707
|
-
var arrayProto = Array.prototype;
|
|
708
|
-
|
|
709
|
-
/** Built-in value references. */
|
|
710
|
-
var splice = arrayProto.splice;
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* Removes `key` and its value from the list cache.
|
|
714
|
-
*
|
|
715
|
-
* @private
|
|
716
|
-
* @name delete
|
|
717
|
-
* @memberOf ListCache
|
|
718
|
-
* @param {string} key The key of the value to remove.
|
|
719
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
720
|
-
*/
|
|
721
|
-
function listCacheDelete$1(key) {
|
|
722
|
-
var data = this.__data__,
|
|
723
|
-
index = assocIndexOf$3(data, key);
|
|
724
|
-
|
|
725
|
-
if (index < 0) {
|
|
726
|
-
return false;
|
|
727
|
-
}
|
|
728
|
-
var lastIndex = data.length - 1;
|
|
729
|
-
if (index == lastIndex) {
|
|
730
|
-
data.pop();
|
|
731
|
-
} else {
|
|
732
|
-
splice.call(data, index, 1);
|
|
733
|
-
}
|
|
734
|
-
--this.size;
|
|
735
|
-
return true;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
var _listCacheDelete = listCacheDelete$1;
|
|
739
|
-
|
|
740
|
-
var assocIndexOf$2 = _assocIndexOf;
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* Gets the list cache value for `key`.
|
|
744
|
-
*
|
|
745
|
-
* @private
|
|
746
|
-
* @name get
|
|
747
|
-
* @memberOf ListCache
|
|
748
|
-
* @param {string} key The key of the value to get.
|
|
749
|
-
* @returns {*} Returns the entry value.
|
|
750
|
-
*/
|
|
751
|
-
function listCacheGet$1(key) {
|
|
752
|
-
var data = this.__data__,
|
|
753
|
-
index = assocIndexOf$2(data, key);
|
|
754
|
-
|
|
755
|
-
return index < 0 ? undefined : data[index][1];
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
var _listCacheGet = listCacheGet$1;
|
|
759
|
-
|
|
760
|
-
var assocIndexOf$1 = _assocIndexOf;
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* Checks if a list cache value for `key` exists.
|
|
764
|
-
*
|
|
765
|
-
* @private
|
|
766
|
-
* @name has
|
|
767
|
-
* @memberOf ListCache
|
|
768
|
-
* @param {string} key The key of the entry to check.
|
|
769
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
770
|
-
*/
|
|
771
|
-
function listCacheHas$1(key) {
|
|
772
|
-
return assocIndexOf$1(this.__data__, key) > -1;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
var _listCacheHas = listCacheHas$1;
|
|
776
|
-
|
|
777
|
-
var assocIndexOf = _assocIndexOf;
|
|
778
|
-
|
|
779
|
-
/**
|
|
780
|
-
* Sets the list cache `key` to `value`.
|
|
781
|
-
*
|
|
782
|
-
* @private
|
|
783
|
-
* @name set
|
|
784
|
-
* @memberOf ListCache
|
|
785
|
-
* @param {string} key The key of the value to set.
|
|
786
|
-
* @param {*} value The value to set.
|
|
787
|
-
* @returns {Object} Returns the list cache instance.
|
|
788
|
-
*/
|
|
789
|
-
function listCacheSet$1(key, value) {
|
|
790
|
-
var data = this.__data__,
|
|
791
|
-
index = assocIndexOf(data, key);
|
|
792
|
-
|
|
793
|
-
if (index < 0) {
|
|
794
|
-
++this.size;
|
|
795
|
-
data.push([key, value]);
|
|
796
|
-
} else {
|
|
797
|
-
data[index][1] = value;
|
|
798
|
-
}
|
|
799
|
-
return this;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
var _listCacheSet = listCacheSet$1;
|
|
803
|
-
|
|
804
|
-
var listCacheClear = _listCacheClear,
|
|
805
|
-
listCacheDelete = _listCacheDelete,
|
|
806
|
-
listCacheGet = _listCacheGet,
|
|
807
|
-
listCacheHas = _listCacheHas,
|
|
808
|
-
listCacheSet = _listCacheSet;
|
|
809
|
-
|
|
810
|
-
/**
|
|
811
|
-
* Creates an list cache object.
|
|
812
|
-
*
|
|
813
|
-
* @private
|
|
814
|
-
* @constructor
|
|
815
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
816
|
-
*/
|
|
817
|
-
function ListCache$1(entries) {
|
|
818
|
-
var index = -1,
|
|
819
|
-
length = entries == null ? 0 : entries.length;
|
|
820
|
-
|
|
821
|
-
this.clear();
|
|
822
|
-
while (++index < length) {
|
|
823
|
-
var entry = entries[index];
|
|
824
|
-
this.set(entry[0], entry[1]);
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
// Add methods to `ListCache`.
|
|
829
|
-
ListCache$1.prototype.clear = listCacheClear;
|
|
830
|
-
ListCache$1.prototype['delete'] = listCacheDelete;
|
|
831
|
-
ListCache$1.prototype.get = listCacheGet;
|
|
832
|
-
ListCache$1.prototype.has = listCacheHas;
|
|
833
|
-
ListCache$1.prototype.set = listCacheSet;
|
|
834
|
-
|
|
835
|
-
var _ListCache = ListCache$1;
|
|
836
|
-
|
|
837
|
-
var getNative = _getNative,
|
|
838
|
-
root = _root;
|
|
839
|
-
|
|
840
|
-
/* Built-in method references that are verified to be native. */
|
|
841
|
-
var Map$1 = getNative(root, 'Map');
|
|
842
|
-
|
|
843
|
-
var _Map = Map$1;
|
|
844
|
-
|
|
845
|
-
var Hash = _Hash,
|
|
846
|
-
ListCache = _ListCache,
|
|
847
|
-
Map = _Map;
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* Removes all key-value entries from the map.
|
|
851
|
-
*
|
|
852
|
-
* @private
|
|
853
|
-
* @name clear
|
|
854
|
-
* @memberOf MapCache
|
|
855
|
-
*/
|
|
856
|
-
function mapCacheClear$1() {
|
|
857
|
-
this.size = 0;
|
|
858
|
-
this.__data__ = {
|
|
859
|
-
'hash': new Hash,
|
|
860
|
-
'map': new (Map || ListCache),
|
|
861
|
-
'string': new Hash
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
var _mapCacheClear = mapCacheClear$1;
|
|
866
|
-
|
|
867
|
-
/**
|
|
868
|
-
* Checks if `value` is suitable for use as unique object key.
|
|
869
|
-
*
|
|
870
|
-
* @private
|
|
871
|
-
* @param {*} value The value to check.
|
|
872
|
-
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
873
|
-
*/
|
|
874
|
-
|
|
875
|
-
function isKeyable$1(value) {
|
|
876
|
-
var type = typeof value;
|
|
877
|
-
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
878
|
-
? (value !== '__proto__')
|
|
879
|
-
: (value === null);
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
var _isKeyable = isKeyable$1;
|
|
883
|
-
|
|
884
|
-
var isKeyable = _isKeyable;
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* Gets the data for `map`.
|
|
888
|
-
*
|
|
889
|
-
* @private
|
|
890
|
-
* @param {Object} map The map to query.
|
|
891
|
-
* @param {string} key The reference key.
|
|
892
|
-
* @returns {*} Returns the map data.
|
|
893
|
-
*/
|
|
894
|
-
function getMapData$4(map, key) {
|
|
895
|
-
var data = map.__data__;
|
|
896
|
-
return isKeyable(key)
|
|
897
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
898
|
-
: data.map;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
var _getMapData = getMapData$4;
|
|
902
|
-
|
|
903
|
-
var getMapData$3 = _getMapData;
|
|
904
|
-
|
|
905
|
-
/**
|
|
906
|
-
* Removes `key` and its value from the map.
|
|
907
|
-
*
|
|
908
|
-
* @private
|
|
909
|
-
* @name delete
|
|
910
|
-
* @memberOf MapCache
|
|
911
|
-
* @param {string} key The key of the value to remove.
|
|
912
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
913
|
-
*/
|
|
914
|
-
function mapCacheDelete$1(key) {
|
|
915
|
-
var result = getMapData$3(this, key)['delete'](key);
|
|
916
|
-
this.size -= result ? 1 : 0;
|
|
917
|
-
return result;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
var _mapCacheDelete = mapCacheDelete$1;
|
|
921
|
-
|
|
922
|
-
var getMapData$2 = _getMapData;
|
|
923
|
-
|
|
924
|
-
/**
|
|
925
|
-
* Gets the map value for `key`.
|
|
926
|
-
*
|
|
927
|
-
* @private
|
|
928
|
-
* @name get
|
|
929
|
-
* @memberOf MapCache
|
|
930
|
-
* @param {string} key The key of the value to get.
|
|
931
|
-
* @returns {*} Returns the entry value.
|
|
932
|
-
*/
|
|
933
|
-
function mapCacheGet$1(key) {
|
|
934
|
-
return getMapData$2(this, key).get(key);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
var _mapCacheGet = mapCacheGet$1;
|
|
938
|
-
|
|
939
|
-
var getMapData$1 = _getMapData;
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Checks if a map value for `key` exists.
|
|
943
|
-
*
|
|
944
|
-
* @private
|
|
945
|
-
* @name has
|
|
946
|
-
* @memberOf MapCache
|
|
947
|
-
* @param {string} key The key of the entry to check.
|
|
948
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
949
|
-
*/
|
|
950
|
-
function mapCacheHas$1(key) {
|
|
951
|
-
return getMapData$1(this, key).has(key);
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
var _mapCacheHas = mapCacheHas$1;
|
|
955
|
-
|
|
956
|
-
var getMapData = _getMapData;
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* Sets the map `key` to `value`.
|
|
960
|
-
*
|
|
961
|
-
* @private
|
|
962
|
-
* @name set
|
|
963
|
-
* @memberOf MapCache
|
|
964
|
-
* @param {string} key The key of the value to set.
|
|
965
|
-
* @param {*} value The value to set.
|
|
966
|
-
* @returns {Object} Returns the map cache instance.
|
|
967
|
-
*/
|
|
968
|
-
function mapCacheSet$1(key, value) {
|
|
969
|
-
var data = getMapData(this, key),
|
|
970
|
-
size = data.size;
|
|
971
|
-
|
|
972
|
-
data.set(key, value);
|
|
973
|
-
this.size += data.size == size ? 0 : 1;
|
|
974
|
-
return this;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
var _mapCacheSet = mapCacheSet$1;
|
|
978
|
-
|
|
979
|
-
var mapCacheClear = _mapCacheClear,
|
|
980
|
-
mapCacheDelete = _mapCacheDelete,
|
|
981
|
-
mapCacheGet = _mapCacheGet,
|
|
982
|
-
mapCacheHas = _mapCacheHas,
|
|
983
|
-
mapCacheSet = _mapCacheSet;
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* Creates a map cache object to store key-value pairs.
|
|
987
|
-
*
|
|
988
|
-
* @private
|
|
989
|
-
* @constructor
|
|
990
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
991
|
-
*/
|
|
992
|
-
function MapCache$1(entries) {
|
|
993
|
-
var index = -1,
|
|
994
|
-
length = entries == null ? 0 : entries.length;
|
|
995
|
-
|
|
996
|
-
this.clear();
|
|
997
|
-
while (++index < length) {
|
|
998
|
-
var entry = entries[index];
|
|
999
|
-
this.set(entry[0], entry[1]);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
// Add methods to `MapCache`.
|
|
1004
|
-
MapCache$1.prototype.clear = mapCacheClear;
|
|
1005
|
-
MapCache$1.prototype['delete'] = mapCacheDelete;
|
|
1006
|
-
MapCache$1.prototype.get = mapCacheGet;
|
|
1007
|
-
MapCache$1.prototype.has = mapCacheHas;
|
|
1008
|
-
MapCache$1.prototype.set = mapCacheSet;
|
|
1009
|
-
|
|
1010
|
-
var _MapCache = MapCache$1;
|
|
1011
|
-
|
|
1012
|
-
var MapCache = _MapCache;
|
|
1013
|
-
|
|
1014
|
-
/** Error message constants. */
|
|
1015
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1016
|
-
|
|
1017
|
-
/**
|
|
1018
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1019
|
-
* provided, it determines the cache key for storing the result based on the
|
|
1020
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
1021
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
1022
|
-
* is invoked with the `this` binding of the memoized function.
|
|
1023
|
-
*
|
|
1024
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1025
|
-
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1026
|
-
* constructor with one whose instances implement the
|
|
1027
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1028
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
1029
|
-
*
|
|
1030
|
-
* @static
|
|
1031
|
-
* @memberOf _
|
|
1032
|
-
* @since 0.1.0
|
|
1033
|
-
* @category Function
|
|
1034
|
-
* @param {Function} func The function to have its output memoized.
|
|
1035
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1036
|
-
* @returns {Function} Returns the new memoized function.
|
|
1037
|
-
* @example
|
|
1038
|
-
*
|
|
1039
|
-
* var object = { 'a': 1, 'b': 2 };
|
|
1040
|
-
* var other = { 'c': 3, 'd': 4 };
|
|
1041
|
-
*
|
|
1042
|
-
* var values = _.memoize(_.values);
|
|
1043
|
-
* values(object);
|
|
1044
|
-
* // => [1, 2]
|
|
1045
|
-
*
|
|
1046
|
-
* values(other);
|
|
1047
|
-
* // => [3, 4]
|
|
1048
|
-
*
|
|
1049
|
-
* object.a = 2;
|
|
1050
|
-
* values(object);
|
|
1051
|
-
* // => [1, 2]
|
|
1052
|
-
*
|
|
1053
|
-
* // Modify the result cache.
|
|
1054
|
-
* values.cache.set(object, ['a', 'b']);
|
|
1055
|
-
* values(object);
|
|
1056
|
-
* // => ['a', 'b']
|
|
1057
|
-
*
|
|
1058
|
-
* // Replace `_.memoize.Cache`.
|
|
1059
|
-
* _.memoize.Cache = WeakMap;
|
|
1060
|
-
*/
|
|
1061
|
-
function memoize$1(func, resolver) {
|
|
1062
|
-
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
1063
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1064
|
-
}
|
|
1065
|
-
var memoized = function() {
|
|
1066
|
-
var args = arguments,
|
|
1067
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1068
|
-
cache = memoized.cache;
|
|
1069
|
-
|
|
1070
|
-
if (cache.has(key)) {
|
|
1071
|
-
return cache.get(key);
|
|
1072
|
-
}
|
|
1073
|
-
var result = func.apply(this, args);
|
|
1074
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
1075
|
-
return result;
|
|
1076
|
-
};
|
|
1077
|
-
memoized.cache = new (memoize$1.Cache || MapCache);
|
|
1078
|
-
return memoized;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
// Expose `MapCache`.
|
|
1082
|
-
memoize$1.Cache = MapCache;
|
|
1083
|
-
|
|
1084
|
-
var memoize_1 = memoize$1;
|
|
1085
|
-
|
|
1086
|
-
var memoize = memoize_1;
|
|
1087
|
-
|
|
1088
|
-
/** Used as the maximum memoize cache size. */
|
|
1089
|
-
var MAX_MEMOIZE_SIZE = 500;
|
|
1090
|
-
|
|
1091
|
-
/**
|
|
1092
|
-
* A specialized version of `_.memoize` which clears the memoized function's
|
|
1093
|
-
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
1094
|
-
*
|
|
1095
|
-
* @private
|
|
1096
|
-
* @param {Function} func The function to have its output memoized.
|
|
1097
|
-
* @returns {Function} Returns the new memoized function.
|
|
1098
|
-
*/
|
|
1099
|
-
function memoizeCapped$1(func) {
|
|
1100
|
-
var result = memoize(func, function(key) {
|
|
1101
|
-
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1102
|
-
cache.clear();
|
|
1103
|
-
}
|
|
1104
|
-
return key;
|
|
1105
|
-
});
|
|
1106
|
-
|
|
1107
|
-
var cache = result.cache;
|
|
1108
|
-
return result;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
var _memoizeCapped = memoizeCapped$1;
|
|
1112
|
-
|
|
1113
|
-
var memoizeCapped = _memoizeCapped;
|
|
1114
|
-
|
|
1115
|
-
/** Used to match property names within property paths. */
|
|
1116
|
-
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1117
|
-
|
|
1118
|
-
/** Used to match backslashes in property paths. */
|
|
1119
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
1120
|
-
|
|
1121
|
-
/**
|
|
1122
|
-
* Converts `string` to a property path array.
|
|
1123
|
-
*
|
|
1124
|
-
* @private
|
|
1125
|
-
* @param {string} string The string to convert.
|
|
1126
|
-
* @returns {Array} Returns the property path array.
|
|
1127
|
-
*/
|
|
1128
|
-
var stringToPath$1 = memoizeCapped(function(string) {
|
|
1129
|
-
var result = [];
|
|
1130
|
-
if (string.charCodeAt(0) === 46 /* . */) {
|
|
1131
|
-
result.push('');
|
|
1132
|
-
}
|
|
1133
|
-
string.replace(rePropName, function(match, number, quote, subString) {
|
|
1134
|
-
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
1135
|
-
});
|
|
1136
|
-
return result;
|
|
1137
|
-
});
|
|
1138
|
-
|
|
1139
|
-
var _stringToPath = stringToPath$1;
|
|
1140
|
-
|
|
1141
|
-
/**
|
|
1142
|
-
* A specialized version of `_.map` for arrays without support for iteratee
|
|
1143
|
-
* shorthands.
|
|
1144
|
-
*
|
|
1145
|
-
* @private
|
|
1146
|
-
* @param {Array} [array] The array to iterate over.
|
|
1147
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
1148
|
-
* @returns {Array} Returns the new mapped array.
|
|
1149
|
-
*/
|
|
1150
|
-
|
|
1151
|
-
function arrayMap$1(array, iteratee) {
|
|
1152
|
-
var index = -1,
|
|
1153
|
-
length = array == null ? 0 : array.length,
|
|
1154
|
-
result = Array(length);
|
|
1155
|
-
|
|
1156
|
-
while (++index < length) {
|
|
1157
|
-
result[index] = iteratee(array[index], index, array);
|
|
1158
|
-
}
|
|
1159
|
-
return result;
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
var _arrayMap = arrayMap$1;
|
|
1163
|
-
|
|
1164
|
-
var Symbol = _Symbol,
|
|
1165
|
-
arrayMap = _arrayMap,
|
|
1166
|
-
isArray$1 = isArray_1,
|
|
1167
|
-
isSymbol$1 = isSymbol_1;
|
|
1168
|
-
|
|
1169
|
-
/** Used as references for various `Number` constants. */
|
|
1170
|
-
var INFINITY$1 = 1 / 0;
|
|
1171
|
-
|
|
1172
|
-
/** Used to convert symbols to primitives and strings. */
|
|
1173
|
-
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
1174
|
-
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
1178
|
-
* values to empty strings.
|
|
1179
|
-
*
|
|
1180
|
-
* @private
|
|
1181
|
-
* @param {*} value The value to process.
|
|
1182
|
-
* @returns {string} Returns the string.
|
|
1183
|
-
*/
|
|
1184
|
-
function baseToString$1(value) {
|
|
1185
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
1186
|
-
if (typeof value == 'string') {
|
|
1187
|
-
return value;
|
|
1188
|
-
}
|
|
1189
|
-
if (isArray$1(value)) {
|
|
1190
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
1191
|
-
return arrayMap(value, baseToString$1) + '';
|
|
1192
|
-
}
|
|
1193
|
-
if (isSymbol$1(value)) {
|
|
1194
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
1195
|
-
}
|
|
1196
|
-
var result = (value + '');
|
|
1197
|
-
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
var _baseToString = baseToString$1;
|
|
1201
|
-
|
|
1202
|
-
var baseToString = _baseToString;
|
|
1203
|
-
|
|
1204
|
-
/**
|
|
1205
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
1206
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
1207
|
-
*
|
|
1208
|
-
* @static
|
|
1209
|
-
* @memberOf _
|
|
1210
|
-
* @since 4.0.0
|
|
1211
|
-
* @category Lang
|
|
1212
|
-
* @param {*} value The value to convert.
|
|
1213
|
-
* @returns {string} Returns the converted string.
|
|
1214
|
-
* @example
|
|
1215
|
-
*
|
|
1216
|
-
* _.toString(null);
|
|
1217
|
-
* // => ''
|
|
1218
|
-
*
|
|
1219
|
-
* _.toString(-0);
|
|
1220
|
-
* // => '-0'
|
|
1221
|
-
*
|
|
1222
|
-
* _.toString([1, 2, 3]);
|
|
1223
|
-
* // => '1,2,3'
|
|
1224
|
-
*/
|
|
1225
|
-
function toString$1(value) {
|
|
1226
|
-
return value == null ? '' : baseToString(value);
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
var toString_1 = toString$1;
|
|
1230
|
-
|
|
1231
|
-
var isArray = isArray_1,
|
|
1232
|
-
isKey = _isKey,
|
|
1233
|
-
stringToPath = _stringToPath,
|
|
1234
|
-
toString = toString_1;
|
|
1235
|
-
|
|
1236
|
-
/**
|
|
1237
|
-
* Casts `value` to a path array if it's not one.
|
|
1238
|
-
*
|
|
1239
|
-
* @private
|
|
1240
|
-
* @param {*} value The value to inspect.
|
|
1241
|
-
* @param {Object} [object] The object to query keys on.
|
|
1242
|
-
* @returns {Array} Returns the cast property path array.
|
|
1243
|
-
*/
|
|
1244
|
-
function castPath$1(value, object) {
|
|
1245
|
-
if (isArray(value)) {
|
|
1246
|
-
return value;
|
|
1247
|
-
}
|
|
1248
|
-
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
var _castPath = castPath$1;
|
|
1252
|
-
|
|
1253
|
-
var isSymbol = isSymbol_1;
|
|
1254
|
-
|
|
1255
|
-
/** Used as references for various `Number` constants. */
|
|
1256
|
-
var INFINITY = 1 / 0;
|
|
1257
|
-
|
|
1258
|
-
/**
|
|
1259
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
1260
|
-
*
|
|
1261
|
-
* @private
|
|
1262
|
-
* @param {*} value The value to inspect.
|
|
1263
|
-
* @returns {string|symbol} Returns the key.
|
|
1264
|
-
*/
|
|
1265
|
-
function toKey$1(value) {
|
|
1266
|
-
if (typeof value == 'string' || isSymbol(value)) {
|
|
1267
|
-
return value;
|
|
1268
|
-
}
|
|
1269
|
-
var result = (value + '');
|
|
1270
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
var _toKey = toKey$1;
|
|
1274
|
-
|
|
1275
|
-
var castPath = _castPath,
|
|
1276
|
-
toKey = _toKey;
|
|
1277
|
-
|
|
1278
|
-
/**
|
|
1279
|
-
* The base implementation of `_.get` without support for default values.
|
|
1280
|
-
*
|
|
1281
|
-
* @private
|
|
1282
|
-
* @param {Object} object The object to query.
|
|
1283
|
-
* @param {Array|string} path The path of the property to get.
|
|
1284
|
-
* @returns {*} Returns the resolved value.
|
|
1285
|
-
*/
|
|
1286
|
-
function baseGet$1(object, path) {
|
|
1287
|
-
path = castPath(path, object);
|
|
1288
|
-
|
|
1289
|
-
var index = 0,
|
|
1290
|
-
length = path.length;
|
|
1291
|
-
|
|
1292
|
-
while (object != null && index < length) {
|
|
1293
|
-
object = object[toKey(path[index++])];
|
|
1294
|
-
}
|
|
1295
|
-
return (index && index == length) ? object : undefined;
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
var _baseGet = baseGet$1;
|
|
1299
|
-
|
|
1300
|
-
var baseGet = _baseGet;
|
|
1301
|
-
|
|
1302
|
-
/**
|
|
1303
|
-
* Gets the value at `path` of `object`. If the resolved value is
|
|
1304
|
-
* `undefined`, the `defaultValue` is returned in its place.
|
|
1305
|
-
*
|
|
1306
|
-
* @static
|
|
1307
|
-
* @memberOf _
|
|
1308
|
-
* @since 3.7.0
|
|
1309
|
-
* @category Object
|
|
1310
|
-
* @param {Object} object The object to query.
|
|
1311
|
-
* @param {Array|string} path The path of the property to get.
|
|
1312
|
-
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
1313
|
-
* @returns {*} Returns the resolved value.
|
|
1314
|
-
* @example
|
|
1315
|
-
*
|
|
1316
|
-
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
1317
|
-
*
|
|
1318
|
-
* _.get(object, 'a[0].b.c');
|
|
1319
|
-
* // => 3
|
|
1320
|
-
*
|
|
1321
|
-
* _.get(object, ['a', '0', 'b', 'c']);
|
|
1322
|
-
* // => 3
|
|
1323
|
-
*
|
|
1324
|
-
* _.get(object, 'a.b.c', 'default');
|
|
1325
|
-
* // => 'default'
|
|
1326
|
-
*/
|
|
1327
|
-
function get(object, path, defaultValue) {
|
|
1328
|
-
var result = object == null ? undefined : baseGet(object, path);
|
|
1329
|
-
return result === undefined ? defaultValue : result;
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
var get_1 = get;
|
|
1333
|
-
|
|
1334
|
-
var browser = {exports: {}};
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* Helpers.
|
|
1338
|
-
*/
|
|
1339
|
-
|
|
1340
|
-
var s = 1000;
|
|
1341
|
-
var m = s * 60;
|
|
1342
|
-
var h = m * 60;
|
|
1343
|
-
var d = h * 24;
|
|
1344
|
-
var w = d * 7;
|
|
1345
|
-
var y = d * 365.25;
|
|
1346
|
-
|
|
1347
|
-
/**
|
|
1348
|
-
* Parse or format the given `val`.
|
|
1349
|
-
*
|
|
1350
|
-
* Options:
|
|
1351
|
-
*
|
|
1352
|
-
* - `long` verbose formatting [false]
|
|
1353
|
-
*
|
|
1354
|
-
* @param {String|Number} val
|
|
1355
|
-
* @param {Object} [options]
|
|
1356
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
1357
|
-
* @return {String|Number}
|
|
1358
|
-
* @api public
|
|
1359
|
-
*/
|
|
1360
|
-
|
|
1361
|
-
var ms = function(val, options) {
|
|
1362
|
-
options = options || {};
|
|
1363
|
-
var type = typeof val;
|
|
1364
|
-
if (type === 'string' && val.length > 0) {
|
|
1365
|
-
return parse(val);
|
|
1366
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
1367
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
1368
|
-
}
|
|
1369
|
-
throw new Error(
|
|
1370
|
-
'val is not a non-empty string or a valid number. val=' +
|
|
1371
|
-
JSON.stringify(val)
|
|
1372
|
-
);
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* Parse the given `str` and return milliseconds.
|
|
1377
|
-
*
|
|
1378
|
-
* @param {String} str
|
|
1379
|
-
* @return {Number}
|
|
1380
|
-
* @api private
|
|
1381
|
-
*/
|
|
1382
|
-
|
|
1383
|
-
function parse(str) {
|
|
1384
|
-
str = String(str);
|
|
1385
|
-
if (str.length > 100) {
|
|
1386
|
-
return;
|
|
1387
|
-
}
|
|
1388
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
1389
|
-
str
|
|
1390
|
-
);
|
|
1391
|
-
if (!match) {
|
|
1392
|
-
return;
|
|
1393
|
-
}
|
|
1394
|
-
var n = parseFloat(match[1]);
|
|
1395
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
1396
|
-
switch (type) {
|
|
1397
|
-
case 'years':
|
|
1398
|
-
case 'year':
|
|
1399
|
-
case 'yrs':
|
|
1400
|
-
case 'yr':
|
|
1401
|
-
case 'y':
|
|
1402
|
-
return n * y;
|
|
1403
|
-
case 'weeks':
|
|
1404
|
-
case 'week':
|
|
1405
|
-
case 'w':
|
|
1406
|
-
return n * w;
|
|
1407
|
-
case 'days':
|
|
1408
|
-
case 'day':
|
|
1409
|
-
case 'd':
|
|
1410
|
-
return n * d;
|
|
1411
|
-
case 'hours':
|
|
1412
|
-
case 'hour':
|
|
1413
|
-
case 'hrs':
|
|
1414
|
-
case 'hr':
|
|
1415
|
-
case 'h':
|
|
1416
|
-
return n * h;
|
|
1417
|
-
case 'minutes':
|
|
1418
|
-
case 'minute':
|
|
1419
|
-
case 'mins':
|
|
1420
|
-
case 'min':
|
|
1421
|
-
case 'm':
|
|
1422
|
-
return n * m;
|
|
1423
|
-
case 'seconds':
|
|
1424
|
-
case 'second':
|
|
1425
|
-
case 'secs':
|
|
1426
|
-
case 'sec':
|
|
1427
|
-
case 's':
|
|
1428
|
-
return n * s;
|
|
1429
|
-
case 'milliseconds':
|
|
1430
|
-
case 'millisecond':
|
|
1431
|
-
case 'msecs':
|
|
1432
|
-
case 'msec':
|
|
1433
|
-
case 'ms':
|
|
1434
|
-
return n;
|
|
1435
|
-
default:
|
|
1436
|
-
return undefined;
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
/**
|
|
1441
|
-
* Short format for `ms`.
|
|
1442
|
-
*
|
|
1443
|
-
* @param {Number} ms
|
|
1444
|
-
* @return {String}
|
|
1445
|
-
* @api private
|
|
1446
|
-
*/
|
|
1447
|
-
|
|
1448
|
-
function fmtShort(ms) {
|
|
1449
|
-
var msAbs = Math.abs(ms);
|
|
1450
|
-
if (msAbs >= d) {
|
|
1451
|
-
return Math.round(ms / d) + 'd';
|
|
1452
|
-
}
|
|
1453
|
-
if (msAbs >= h) {
|
|
1454
|
-
return Math.round(ms / h) + 'h';
|
|
1455
|
-
}
|
|
1456
|
-
if (msAbs >= m) {
|
|
1457
|
-
return Math.round(ms / m) + 'm';
|
|
1458
|
-
}
|
|
1459
|
-
if (msAbs >= s) {
|
|
1460
|
-
return Math.round(ms / s) + 's';
|
|
1461
|
-
}
|
|
1462
|
-
return ms + 'ms';
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
/**
|
|
1466
|
-
* Long format for `ms`.
|
|
1467
|
-
*
|
|
1468
|
-
* @param {Number} ms
|
|
1469
|
-
* @return {String}
|
|
1470
|
-
* @api private
|
|
1471
|
-
*/
|
|
1472
|
-
|
|
1473
|
-
function fmtLong(ms) {
|
|
1474
|
-
var msAbs = Math.abs(ms);
|
|
1475
|
-
if (msAbs >= d) {
|
|
1476
|
-
return plural(ms, msAbs, d, 'day');
|
|
1477
|
-
}
|
|
1478
|
-
if (msAbs >= h) {
|
|
1479
|
-
return plural(ms, msAbs, h, 'hour');
|
|
1480
|
-
}
|
|
1481
|
-
if (msAbs >= m) {
|
|
1482
|
-
return plural(ms, msAbs, m, 'minute');
|
|
1483
|
-
}
|
|
1484
|
-
if (msAbs >= s) {
|
|
1485
|
-
return plural(ms, msAbs, s, 'second');
|
|
1486
|
-
}
|
|
1487
|
-
return ms + ' ms';
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
/**
|
|
1491
|
-
* Pluralization helper.
|
|
1492
|
-
*/
|
|
1493
|
-
|
|
1494
|
-
function plural(ms, msAbs, n, name) {
|
|
1495
|
-
var isPlural = msAbs >= n * 1.5;
|
|
1496
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
/**
|
|
1500
|
-
* This is the common logic for both the Node.js and web browser
|
|
1501
|
-
* implementations of `debug()`.
|
|
1502
|
-
*/
|
|
1503
|
-
|
|
1504
|
-
function setup(env) {
|
|
1505
|
-
createDebug.debug = createDebug;
|
|
1506
|
-
createDebug.default = createDebug;
|
|
1507
|
-
createDebug.coerce = coerce;
|
|
1508
|
-
createDebug.disable = disable;
|
|
1509
|
-
createDebug.enable = enable;
|
|
1510
|
-
createDebug.enabled = enabled;
|
|
1511
|
-
createDebug.humanize = ms;
|
|
1512
|
-
createDebug.destroy = destroy;
|
|
1513
|
-
|
|
1514
|
-
Object.keys(env).forEach(key => {
|
|
1515
|
-
createDebug[key] = env[key];
|
|
1516
|
-
});
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
* The currently active debug mode names, and names to skip.
|
|
1520
|
-
*/
|
|
1521
|
-
|
|
1522
|
-
createDebug.names = [];
|
|
1523
|
-
createDebug.skips = [];
|
|
1524
|
-
|
|
1525
|
-
/**
|
|
1526
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
1527
|
-
*
|
|
1528
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
1529
|
-
*/
|
|
1530
|
-
createDebug.formatters = {};
|
|
1531
|
-
|
|
1532
|
-
/**
|
|
1533
|
-
* Selects a color for a debug namespace
|
|
1534
|
-
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
1535
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
1536
|
-
* @api private
|
|
1537
|
-
*/
|
|
1538
|
-
function selectColor(namespace) {
|
|
1539
|
-
let hash = 0;
|
|
1540
|
-
|
|
1541
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
1542
|
-
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
1543
|
-
hash |= 0; // Convert to 32bit integer
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
1547
|
-
}
|
|
1548
|
-
createDebug.selectColor = selectColor;
|
|
1549
|
-
|
|
1550
|
-
/**
|
|
1551
|
-
* Create a debugger with the given `namespace`.
|
|
1552
|
-
*
|
|
1553
|
-
* @param {String} namespace
|
|
1554
|
-
* @return {Function}
|
|
1555
|
-
* @api public
|
|
1556
|
-
*/
|
|
1557
|
-
function createDebug(namespace) {
|
|
1558
|
-
let prevTime;
|
|
1559
|
-
let enableOverride = null;
|
|
1560
|
-
let namespacesCache;
|
|
1561
|
-
let enabledCache;
|
|
1562
|
-
|
|
1563
|
-
function debug(...args) {
|
|
1564
|
-
// Disabled?
|
|
1565
|
-
if (!debug.enabled) {
|
|
1566
|
-
return;
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
const self = debug;
|
|
1570
|
-
|
|
1571
|
-
// Set `diff` timestamp
|
|
1572
|
-
const curr = Number(new Date());
|
|
1573
|
-
const ms = curr - (prevTime || curr);
|
|
1574
|
-
self.diff = ms;
|
|
1575
|
-
self.prev = prevTime;
|
|
1576
|
-
self.curr = curr;
|
|
1577
|
-
prevTime = curr;
|
|
1578
|
-
|
|
1579
|
-
args[0] = createDebug.coerce(args[0]);
|
|
1580
|
-
|
|
1581
|
-
if (typeof args[0] !== 'string') {
|
|
1582
|
-
// Anything else let's inspect with %O
|
|
1583
|
-
args.unshift('%O');
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
// Apply any `formatters` transformations
|
|
1587
|
-
let index = 0;
|
|
1588
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
1589
|
-
// If we encounter an escaped % then don't increase the array index
|
|
1590
|
-
if (match === '%%') {
|
|
1591
|
-
return '%';
|
|
1592
|
-
}
|
|
1593
|
-
index++;
|
|
1594
|
-
const formatter = createDebug.formatters[format];
|
|
1595
|
-
if (typeof formatter === 'function') {
|
|
1596
|
-
const val = args[index];
|
|
1597
|
-
match = formatter.call(self, val);
|
|
1598
|
-
|
|
1599
|
-
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
1600
|
-
args.splice(index, 1);
|
|
1601
|
-
index--;
|
|
1602
|
-
}
|
|
1603
|
-
return match;
|
|
1604
|
-
});
|
|
1605
|
-
|
|
1606
|
-
// Apply env-specific formatting (colors, etc.)
|
|
1607
|
-
createDebug.formatArgs.call(self, args);
|
|
1608
|
-
|
|
1609
|
-
const logFn = self.log || createDebug.log;
|
|
1610
|
-
logFn.apply(self, args);
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
debug.namespace = namespace;
|
|
1614
|
-
debug.useColors = createDebug.useColors();
|
|
1615
|
-
debug.color = createDebug.selectColor(namespace);
|
|
1616
|
-
debug.extend = extend;
|
|
1617
|
-
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
1618
|
-
|
|
1619
|
-
Object.defineProperty(debug, 'enabled', {
|
|
1620
|
-
enumerable: true,
|
|
1621
|
-
configurable: false,
|
|
1622
|
-
get: () => {
|
|
1623
|
-
if (enableOverride !== null) {
|
|
1624
|
-
return enableOverride;
|
|
1625
|
-
}
|
|
1626
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
1627
|
-
namespacesCache = createDebug.namespaces;
|
|
1628
|
-
enabledCache = createDebug.enabled(namespace);
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
return enabledCache;
|
|
1632
|
-
},
|
|
1633
|
-
set: v => {
|
|
1634
|
-
enableOverride = v;
|
|
1635
|
-
}
|
|
1636
|
-
});
|
|
1637
|
-
|
|
1638
|
-
// Env-specific initialization logic for debug instances
|
|
1639
|
-
if (typeof createDebug.init === 'function') {
|
|
1640
|
-
createDebug.init(debug);
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
return debug;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
function extend(namespace, delimiter) {
|
|
1647
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
1648
|
-
newDebug.log = this.log;
|
|
1649
|
-
return newDebug;
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
/**
|
|
1653
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
1654
|
-
* separated by a colon and wildcards.
|
|
1655
|
-
*
|
|
1656
|
-
* @param {String} namespaces
|
|
1657
|
-
* @api public
|
|
1658
|
-
*/
|
|
1659
|
-
function enable(namespaces) {
|
|
1660
|
-
createDebug.save(namespaces);
|
|
1661
|
-
createDebug.namespaces = namespaces;
|
|
1662
|
-
|
|
1663
|
-
createDebug.names = [];
|
|
1664
|
-
createDebug.skips = [];
|
|
1665
|
-
|
|
1666
|
-
let i;
|
|
1667
|
-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
1668
|
-
const len = split.length;
|
|
1669
|
-
|
|
1670
|
-
for (i = 0; i < len; i++) {
|
|
1671
|
-
if (!split[i]) {
|
|
1672
|
-
// ignore empty strings
|
|
1673
|
-
continue;
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
1677
|
-
|
|
1678
|
-
if (namespaces[0] === '-') {
|
|
1679
|
-
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
1680
|
-
} else {
|
|
1681
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
/**
|
|
1687
|
-
* Disable debug output.
|
|
1688
|
-
*
|
|
1689
|
-
* @return {String} namespaces
|
|
1690
|
-
* @api public
|
|
1691
|
-
*/
|
|
1692
|
-
function disable() {
|
|
1693
|
-
const namespaces = [
|
|
1694
|
-
...createDebug.names.map(toNamespace),
|
|
1695
|
-
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
1696
|
-
].join(',');
|
|
1697
|
-
createDebug.enable('');
|
|
1698
|
-
return namespaces;
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
/**
|
|
1702
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
1703
|
-
*
|
|
1704
|
-
* @param {String} name
|
|
1705
|
-
* @return {Boolean}
|
|
1706
|
-
* @api public
|
|
1707
|
-
*/
|
|
1708
|
-
function enabled(name) {
|
|
1709
|
-
if (name[name.length - 1] === '*') {
|
|
1710
|
-
return true;
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
let i;
|
|
1714
|
-
let len;
|
|
1715
|
-
|
|
1716
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
1717
|
-
if (createDebug.skips[i].test(name)) {
|
|
1718
|
-
return false;
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
1723
|
-
if (createDebug.names[i].test(name)) {
|
|
1724
|
-
return true;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
return false;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
/**
|
|
1732
|
-
* Convert regexp to namespace
|
|
1733
|
-
*
|
|
1734
|
-
* @param {RegExp} regxep
|
|
1735
|
-
* @return {String} namespace
|
|
1736
|
-
* @api private
|
|
1737
|
-
*/
|
|
1738
|
-
function toNamespace(regexp) {
|
|
1739
|
-
return regexp.toString()
|
|
1740
|
-
.substring(2, regexp.toString().length - 2)
|
|
1741
|
-
.replace(/\.\*\?$/, '*');
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
/**
|
|
1745
|
-
* Coerce `val`.
|
|
1746
|
-
*
|
|
1747
|
-
* @param {Mixed} val
|
|
1748
|
-
* @return {Mixed}
|
|
1749
|
-
* @api private
|
|
1750
|
-
*/
|
|
1751
|
-
function coerce(val) {
|
|
1752
|
-
if (val instanceof Error) {
|
|
1753
|
-
return val.stack || val.message;
|
|
1754
|
-
}
|
|
1755
|
-
return val;
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
/**
|
|
1759
|
-
* XXX DO NOT USE. This is a temporary stub function.
|
|
1760
|
-
* XXX It WILL be removed in the next major release.
|
|
1761
|
-
*/
|
|
1762
|
-
function destroy() {
|
|
1763
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
createDebug.enable(createDebug.load());
|
|
1767
|
-
|
|
1768
|
-
return createDebug;
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
var common = setup;
|
|
1772
|
-
|
|
1773
|
-
/* eslint-env browser */
|
|
1774
|
-
|
|
1775
|
-
(function (module, exports) {
|
|
1776
|
-
/**
|
|
1777
|
-
* This is the web browser implementation of `debug()`.
|
|
1778
|
-
*/
|
|
1779
|
-
|
|
1780
|
-
exports.formatArgs = formatArgs;
|
|
1781
|
-
exports.save = save;
|
|
1782
|
-
exports.load = load;
|
|
1783
|
-
exports.useColors = useColors;
|
|
1784
|
-
exports.storage = localstorage();
|
|
1785
|
-
exports.destroy = (() => {
|
|
1786
|
-
let warned = false;
|
|
1787
|
-
|
|
1788
|
-
return () => {
|
|
1789
|
-
if (!warned) {
|
|
1790
|
-
warned = true;
|
|
1791
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
1792
|
-
}
|
|
1793
|
-
};
|
|
1794
|
-
})();
|
|
1795
|
-
|
|
1796
|
-
/**
|
|
1797
|
-
* Colors.
|
|
1798
|
-
*/
|
|
1799
|
-
|
|
1800
|
-
exports.colors = [
|
|
1801
|
-
'#0000CC',
|
|
1802
|
-
'#0000FF',
|
|
1803
|
-
'#0033CC',
|
|
1804
|
-
'#0033FF',
|
|
1805
|
-
'#0066CC',
|
|
1806
|
-
'#0066FF',
|
|
1807
|
-
'#0099CC',
|
|
1808
|
-
'#0099FF',
|
|
1809
|
-
'#00CC00',
|
|
1810
|
-
'#00CC33',
|
|
1811
|
-
'#00CC66',
|
|
1812
|
-
'#00CC99',
|
|
1813
|
-
'#00CCCC',
|
|
1814
|
-
'#00CCFF',
|
|
1815
|
-
'#3300CC',
|
|
1816
|
-
'#3300FF',
|
|
1817
|
-
'#3333CC',
|
|
1818
|
-
'#3333FF',
|
|
1819
|
-
'#3366CC',
|
|
1820
|
-
'#3366FF',
|
|
1821
|
-
'#3399CC',
|
|
1822
|
-
'#3399FF',
|
|
1823
|
-
'#33CC00',
|
|
1824
|
-
'#33CC33',
|
|
1825
|
-
'#33CC66',
|
|
1826
|
-
'#33CC99',
|
|
1827
|
-
'#33CCCC',
|
|
1828
|
-
'#33CCFF',
|
|
1829
|
-
'#6600CC',
|
|
1830
|
-
'#6600FF',
|
|
1831
|
-
'#6633CC',
|
|
1832
|
-
'#6633FF',
|
|
1833
|
-
'#66CC00',
|
|
1834
|
-
'#66CC33',
|
|
1835
|
-
'#9900CC',
|
|
1836
|
-
'#9900FF',
|
|
1837
|
-
'#9933CC',
|
|
1838
|
-
'#9933FF',
|
|
1839
|
-
'#99CC00',
|
|
1840
|
-
'#99CC33',
|
|
1841
|
-
'#CC0000',
|
|
1842
|
-
'#CC0033',
|
|
1843
|
-
'#CC0066',
|
|
1844
|
-
'#CC0099',
|
|
1845
|
-
'#CC00CC',
|
|
1846
|
-
'#CC00FF',
|
|
1847
|
-
'#CC3300',
|
|
1848
|
-
'#CC3333',
|
|
1849
|
-
'#CC3366',
|
|
1850
|
-
'#CC3399',
|
|
1851
|
-
'#CC33CC',
|
|
1852
|
-
'#CC33FF',
|
|
1853
|
-
'#CC6600',
|
|
1854
|
-
'#CC6633',
|
|
1855
|
-
'#CC9900',
|
|
1856
|
-
'#CC9933',
|
|
1857
|
-
'#CCCC00',
|
|
1858
|
-
'#CCCC33',
|
|
1859
|
-
'#FF0000',
|
|
1860
|
-
'#FF0033',
|
|
1861
|
-
'#FF0066',
|
|
1862
|
-
'#FF0099',
|
|
1863
|
-
'#FF00CC',
|
|
1864
|
-
'#FF00FF',
|
|
1865
|
-
'#FF3300',
|
|
1866
|
-
'#FF3333',
|
|
1867
|
-
'#FF3366',
|
|
1868
|
-
'#FF3399',
|
|
1869
|
-
'#FF33CC',
|
|
1870
|
-
'#FF33FF',
|
|
1871
|
-
'#FF6600',
|
|
1872
|
-
'#FF6633',
|
|
1873
|
-
'#FF9900',
|
|
1874
|
-
'#FF9933',
|
|
1875
|
-
'#FFCC00',
|
|
1876
|
-
'#FFCC33'
|
|
1877
|
-
];
|
|
1878
|
-
|
|
1879
|
-
/**
|
|
1880
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
1881
|
-
* and the Firebug extension (any Firefox version) are known
|
|
1882
|
-
* to support "%c" CSS customizations.
|
|
1883
|
-
*
|
|
1884
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
1885
|
-
*/
|
|
1886
|
-
|
|
1887
|
-
// eslint-disable-next-line complexity
|
|
1888
|
-
function useColors() {
|
|
1889
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
1890
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
1891
|
-
// explicitly
|
|
1892
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
1893
|
-
return true;
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
// Internet Explorer and Edge do not support colors.
|
|
1897
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
1898
|
-
return false;
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
1902
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
1903
|
-
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
1904
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
1905
|
-
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
1906
|
-
// Is firefox >= v31?
|
|
1907
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
1908
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
1909
|
-
// Double check webkit in userAgent just in case we are in a worker
|
|
1910
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
/**
|
|
1914
|
-
* Colorize log arguments if enabled.
|
|
1915
|
-
*
|
|
1916
|
-
* @api public
|
|
1917
|
-
*/
|
|
1918
|
-
|
|
1919
|
-
function formatArgs(args) {
|
|
1920
|
-
args[0] = (this.useColors ? '%c' : '') +
|
|
1921
|
-
this.namespace +
|
|
1922
|
-
(this.useColors ? ' %c' : ' ') +
|
|
1923
|
-
args[0] +
|
|
1924
|
-
(this.useColors ? '%c ' : ' ') +
|
|
1925
|
-
'+' + module.exports.humanize(this.diff);
|
|
1926
|
-
|
|
1927
|
-
if (!this.useColors) {
|
|
1928
|
-
return;
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
const c = 'color: ' + this.color;
|
|
1932
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
1933
|
-
|
|
1934
|
-
// The final "%c" is somewhat tricky, because there could be other
|
|
1935
|
-
// arguments passed either before or after the %c, so we need to
|
|
1936
|
-
// figure out the correct index to insert the CSS into
|
|
1937
|
-
let index = 0;
|
|
1938
|
-
let lastC = 0;
|
|
1939
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
1940
|
-
if (match === '%%') {
|
|
1941
|
-
return;
|
|
1942
|
-
}
|
|
1943
|
-
index++;
|
|
1944
|
-
if (match === '%c') {
|
|
1945
|
-
// We only are interested in the *last* %c
|
|
1946
|
-
// (the user may have provided their own)
|
|
1947
|
-
lastC = index;
|
|
1948
|
-
}
|
|
1949
|
-
});
|
|
1950
|
-
|
|
1951
|
-
args.splice(lastC, 0, c);
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
/**
|
|
1955
|
-
* Invokes `console.debug()` when available.
|
|
1956
|
-
* No-op when `console.debug` is not a "function".
|
|
1957
|
-
* If `console.debug` is not available, falls back
|
|
1958
|
-
* to `console.log`.
|
|
1959
|
-
*
|
|
1960
|
-
* @api public
|
|
1961
|
-
*/
|
|
1962
|
-
exports.log = console.debug || console.log || (() => {});
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* Save `namespaces`.
|
|
1966
|
-
*
|
|
1967
|
-
* @param {String} namespaces
|
|
1968
|
-
* @api private
|
|
1969
|
-
*/
|
|
1970
|
-
function save(namespaces) {
|
|
1971
|
-
try {
|
|
1972
|
-
if (namespaces) {
|
|
1973
|
-
exports.storage.setItem('debug', namespaces);
|
|
1974
|
-
} else {
|
|
1975
|
-
exports.storage.removeItem('debug');
|
|
1976
|
-
}
|
|
1977
|
-
} catch (error) {
|
|
1978
|
-
// Swallow
|
|
1979
|
-
// XXX (@Qix-) should we be logging these?
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
/**
|
|
1984
|
-
* Load `namespaces`.
|
|
1985
|
-
*
|
|
1986
|
-
* @return {String} returns the previously persisted debug modes
|
|
1987
|
-
* @api private
|
|
1988
|
-
*/
|
|
1989
|
-
function load() {
|
|
1990
|
-
let r;
|
|
1991
|
-
try {
|
|
1992
|
-
r = exports.storage.getItem('debug');
|
|
1993
|
-
} catch (error) {
|
|
1994
|
-
// Swallow
|
|
1995
|
-
// XXX (@Qix-) should we be logging these?
|
|
1996
|
-
}
|
|
1997
|
-
|
|
1998
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
1999
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
2000
|
-
r = process.env.DEBUG;
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
return r;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
/**
|
|
2007
|
-
* Localstorage attempts to return the localstorage.
|
|
2008
|
-
*
|
|
2009
|
-
* This is necessary because safari throws
|
|
2010
|
-
* when a user disables cookies/localstorage
|
|
2011
|
-
* and you attempt to access it.
|
|
2012
|
-
*
|
|
2013
|
-
* @return {LocalStorage}
|
|
2014
|
-
* @api private
|
|
2015
|
-
*/
|
|
2016
|
-
|
|
2017
|
-
function localstorage() {
|
|
2018
|
-
try {
|
|
2019
|
-
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
2020
|
-
// The Browser also has localStorage in the global context.
|
|
2021
|
-
return localStorage;
|
|
2022
|
-
} catch (error) {
|
|
2023
|
-
// Swallow
|
|
2024
|
-
// XXX (@Qix-) should we be logging these?
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
module.exports = common(exports);
|
|
2029
|
-
|
|
2030
|
-
const {formatters} = module.exports;
|
|
2031
|
-
|
|
2032
|
-
/**
|
|
2033
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
2034
|
-
*/
|
|
2035
|
-
|
|
2036
|
-
formatters.j = function (v) {
|
|
2037
|
-
try {
|
|
2038
|
-
return JSON.stringify(v);
|
|
2039
|
-
} catch (error) {
|
|
2040
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
2041
|
-
}
|
|
2042
|
-
};
|
|
2043
|
-
}(browser, browser.exports));
|
|
2044
|
-
|
|
2045
|
-
var debug = browser.exports;
|
|
2046
|
-
|
|
2047
|
-
const SESSION_CHANGED = SessionChangedEvent.TYPE;
|
|
2048
|
-
const MC_TAG_NAME = 'ebsr-multiple-choice';
|
|
2049
|
-
const log = debug('pie-elements:ebsr');
|
|
2050
|
-
|
|
2051
|
-
class EbsrMC extends MultipleChoice {}
|
|
2052
|
-
|
|
2053
|
-
const defineMultipleChoice = () => {
|
|
2054
|
-
if (!customElements.get(MC_TAG_NAME)) {
|
|
2055
|
-
customElements.define(MC_TAG_NAME, EbsrMC);
|
|
2056
|
-
}
|
|
2057
|
-
};
|
|
2058
|
-
|
|
2059
|
-
defineMultipleChoice();
|
|
2060
|
-
|
|
2061
|
-
const isNonEmptyArray = a => Array.isArray(a) && a.length > 0;
|
|
2062
|
-
|
|
2063
|
-
const isSessionComplete = session => {
|
|
2064
|
-
const a = get_1(session, 'value.partA.value');
|
|
2065
|
-
const b = get_1(session, 'value.partB.value');
|
|
2066
|
-
return isNonEmptyArray(a) && isNonEmptyArray(b);
|
|
2067
|
-
};
|
|
2068
|
-
class Ebsr extends HTMLElement {
|
|
2069
|
-
constructor() {
|
|
2070
|
-
super();
|
|
2071
|
-
|
|
2072
|
-
this.onSessionUpdated = e => {
|
|
2073
|
-
if (e.target === this) {
|
|
2074
|
-
return;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
e.preventDefault();
|
|
2078
|
-
e.stopImmediatePropagation();
|
|
2079
|
-
const id = e.target.getAttribute('id');
|
|
2080
|
-
|
|
2081
|
-
if (id) {
|
|
2082
|
-
const key = `part${id.toUpperCase()}`;
|
|
2083
|
-
|
|
2084
|
-
if (e.update) {
|
|
2085
|
-
this._model[key] = e.update;
|
|
2086
|
-
} //TODO: accessing a private property here. The session event should contain the update in future to prevent this.
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
this.dispatchSessionChanged(e.srcElement._session, key);
|
|
2090
|
-
}
|
|
2091
|
-
};
|
|
2092
|
-
|
|
2093
|
-
this._model = {};
|
|
2094
|
-
this._session = {};
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
set model(m) {
|
|
2098
|
-
this._model = m;
|
|
2099
|
-
customElements.whenDefined(MC_TAG_NAME).then(() => {
|
|
2100
|
-
this.setPartModel(this.partA, 'partA');
|
|
2101
|
-
this.setPartModel(this.partB, 'partB');
|
|
2102
|
-
});
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
set session(s) {
|
|
2106
|
-
this._session = s;
|
|
2107
|
-
customElements.whenDefined(MC_TAG_NAME).then(() => {
|
|
2108
|
-
this.setPartSession(this.partA, 'partA');
|
|
2109
|
-
this.setPartSession(this.partB, 'partB');
|
|
2110
|
-
});
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
get session() {
|
|
2114
|
-
return this._session;
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
setPartModel(part, key) {
|
|
2118
|
-
if (this._model && this._model[key] && part) {
|
|
2119
|
-
const {
|
|
2120
|
-
mode
|
|
2121
|
-
} = this._model;
|
|
2122
|
-
part.model = _extends({}, this._model[key], {
|
|
2123
|
-
mode,
|
|
2124
|
-
keyMode: this._model[key].choicePrefix
|
|
2125
|
-
});
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
setPartSession(part, key) {
|
|
2130
|
-
if (this._session && this._model && part) {
|
|
2131
|
-
const {
|
|
2132
|
-
value
|
|
2133
|
-
} = this._session;
|
|
2134
|
-
part.session = value && value[key] ? value[key] : {
|
|
2135
|
-
id: key
|
|
2136
|
-
};
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
dispatchSessionChanged(partSession, key) {
|
|
2141
|
-
this._session.value = _extends({}, this._session.value, {
|
|
2142
|
-
[key]: partSession
|
|
2143
|
-
});
|
|
2144
|
-
log('[onSessionChanged] session: ', this._session);
|
|
2145
|
-
const complete = isSessionComplete(this._session);
|
|
2146
|
-
this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
get partA() {
|
|
2150
|
-
return this.querySelector(`${MC_TAG_NAME}#a`);
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
get partB() {
|
|
2154
|
-
return this.querySelector(`${MC_TAG_NAME}#b`);
|
|
2155
|
-
}
|
|
2156
|
-
|
|
2157
|
-
connectedCallback() {
|
|
2158
|
-
this._render();
|
|
2159
|
-
|
|
2160
|
-
this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
disconnectedCallback() {
|
|
2164
|
-
this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
_render() {
|
|
2168
|
-
var _this$_model, _this$_model$extraCSS;
|
|
2169
|
-
|
|
2170
|
-
this.ariaLabel = 'Two-Part Question';
|
|
2171
|
-
this.role = 'region';
|
|
2172
|
-
this.innerHTML = `
|
|
2173
|
-
<style>
|
|
2174
|
-
.srOnly {
|
|
2175
|
-
position: absolute;
|
|
2176
|
-
width: 1px;
|
|
2177
|
-
height: 1px;
|
|
2178
|
-
padding: 0;
|
|
2179
|
-
margin: -1px;
|
|
2180
|
-
overflow: hidden;
|
|
2181
|
-
left: -10000px;
|
|
2182
|
-
top: auto;
|
|
2183
|
-
}
|
|
2184
|
-
${(_this$_model = this._model) == null ? void 0 : (_this$_model$extraCSS = _this$_model.extraCSSRules) == null ? void 0 : _this$_model$extraCSS.rules}
|
|
2185
|
-
</style>
|
|
2186
|
-
<h2 class="srOnly">Two-Part Question</h2>
|
|
2187
|
-
<${MC_TAG_NAME} id="a"></${MC_TAG_NAME}>
|
|
2188
|
-
<${MC_TAG_NAME} id="b"></${MC_TAG_NAME}>
|
|
2189
|
-
`; // when item is re-rendered (due to connectedCallback), if the custom element is already defined,
|
|
2190
|
-
// we need to set the model and session, otherwise the setters are not reached again
|
|
2191
|
-
|
|
2192
|
-
if (customElements.get(MC_TAG_NAME)) {
|
|
2193
|
-
this.setPartModel(this.partA, 'partA');
|
|
2194
|
-
this.setPartModel(this.partB, 'partB');
|
|
2195
|
-
this.setPartSession(this.partA, 'partA');
|
|
2196
|
-
this.setPartSession(this.partB, 'partB');
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
|
-
export { Ebsr as default, isSessionComplete };
|
|
2203
|
-
//# sourceMappingURL=element.js.map
|