@pie-element/boilerplate-item-type 5.3.4-next.0 → 5.3.4-next.3
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/configure.js +11280 -0
- package/esm/configure.js.map +1 -0
- package/esm/controller.js +1082 -0
- package/esm/controller.js.map +1 -0
- package/esm/element.js +1186 -0
- package/esm/element.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/print.js +2442 -0
- package/esm/print.js.map +1 -0
- package/package.json +7 -3
package/esm/print.js
ADDED
|
@@ -0,0 +1,2442 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { UiLayout, PreviewPrompt } from '@pie-lib/render-ui';
|
|
4
|
+
import { renderMath } from '@pie-lib/math-rendering';
|
|
5
|
+
|
|
6
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Checks if `value` is the
|
|
10
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
11
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
12
|
+
*
|
|
13
|
+
* @static
|
|
14
|
+
* @memberOf _
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
* @category Lang
|
|
17
|
+
* @param {*} value The value to check.
|
|
18
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* _.isObject({});
|
|
22
|
+
* // => true
|
|
23
|
+
*
|
|
24
|
+
* _.isObject([1, 2, 3]);
|
|
25
|
+
* // => true
|
|
26
|
+
*
|
|
27
|
+
* _.isObject(_.noop);
|
|
28
|
+
* // => true
|
|
29
|
+
*
|
|
30
|
+
* _.isObject(null);
|
|
31
|
+
* // => false
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function isObject$2(value) {
|
|
35
|
+
var type = typeof value;
|
|
36
|
+
return value != null && (type == 'object' || type == 'function');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var isObject_1 = isObject$2;
|
|
40
|
+
|
|
41
|
+
/** Detect free variable `global` from Node.js. */
|
|
42
|
+
|
|
43
|
+
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
44
|
+
|
|
45
|
+
var _freeGlobal = freeGlobal$1;
|
|
46
|
+
|
|
47
|
+
var freeGlobal = _freeGlobal;
|
|
48
|
+
|
|
49
|
+
/** Detect free variable `self`. */
|
|
50
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
51
|
+
|
|
52
|
+
/** Used as a reference to the global object. */
|
|
53
|
+
var root$2 = freeGlobal || freeSelf || Function('return this')();
|
|
54
|
+
|
|
55
|
+
var _root = root$2;
|
|
56
|
+
|
|
57
|
+
var root$1 = _root;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
61
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
62
|
+
*
|
|
63
|
+
* @static
|
|
64
|
+
* @memberOf _
|
|
65
|
+
* @since 2.4.0
|
|
66
|
+
* @category Date
|
|
67
|
+
* @returns {number} Returns the timestamp.
|
|
68
|
+
* @example
|
|
69
|
+
*
|
|
70
|
+
* _.defer(function(stamp) {
|
|
71
|
+
* console.log(_.now() - stamp);
|
|
72
|
+
* }, _.now());
|
|
73
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
74
|
+
*/
|
|
75
|
+
var now$1 = function() {
|
|
76
|
+
return root$1.Date.now();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var now_1 = now$1;
|
|
80
|
+
|
|
81
|
+
/** Used to match a single whitespace character. */
|
|
82
|
+
|
|
83
|
+
var reWhitespace = /\s/;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
87
|
+
* character of `string`.
|
|
88
|
+
*
|
|
89
|
+
* @private
|
|
90
|
+
* @param {string} string The string to inspect.
|
|
91
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
92
|
+
*/
|
|
93
|
+
function trimmedEndIndex$1(string) {
|
|
94
|
+
var index = string.length;
|
|
95
|
+
|
|
96
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
97
|
+
return index;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var _trimmedEndIndex = trimmedEndIndex$1;
|
|
101
|
+
|
|
102
|
+
var trimmedEndIndex = _trimmedEndIndex;
|
|
103
|
+
|
|
104
|
+
/** Used to match leading whitespace. */
|
|
105
|
+
var reTrimStart = /^\s+/;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The base implementation of `_.trim`.
|
|
109
|
+
*
|
|
110
|
+
* @private
|
|
111
|
+
* @param {string} string The string to trim.
|
|
112
|
+
* @returns {string} Returns the trimmed string.
|
|
113
|
+
*/
|
|
114
|
+
function baseTrim$1(string) {
|
|
115
|
+
return string
|
|
116
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
117
|
+
: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var _baseTrim = baseTrim$1;
|
|
121
|
+
|
|
122
|
+
var root = _root;
|
|
123
|
+
|
|
124
|
+
/** Built-in value references. */
|
|
125
|
+
var Symbol$3 = root.Symbol;
|
|
126
|
+
|
|
127
|
+
var _Symbol = Symbol$3;
|
|
128
|
+
|
|
129
|
+
var Symbol$2 = _Symbol;
|
|
130
|
+
|
|
131
|
+
/** Used for built-in method references. */
|
|
132
|
+
var objectProto$1 = Object.prototype;
|
|
133
|
+
|
|
134
|
+
/** Used to check objects for own properties. */
|
|
135
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Used to resolve the
|
|
139
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
140
|
+
* of values.
|
|
141
|
+
*/
|
|
142
|
+
var nativeObjectToString$1 = objectProto$1.toString;
|
|
143
|
+
|
|
144
|
+
/** Built-in value references. */
|
|
145
|
+
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
149
|
+
*
|
|
150
|
+
* @private
|
|
151
|
+
* @param {*} value The value to query.
|
|
152
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
153
|
+
*/
|
|
154
|
+
function getRawTag$1(value) {
|
|
155
|
+
var isOwn = hasOwnProperty$1.call(value, symToStringTag$1),
|
|
156
|
+
tag = value[symToStringTag$1];
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
value[symToStringTag$1] = undefined;
|
|
160
|
+
var unmasked = true;
|
|
161
|
+
} catch (e) {}
|
|
162
|
+
|
|
163
|
+
var result = nativeObjectToString$1.call(value);
|
|
164
|
+
if (unmasked) {
|
|
165
|
+
if (isOwn) {
|
|
166
|
+
value[symToStringTag$1] = tag;
|
|
167
|
+
} else {
|
|
168
|
+
delete value[symToStringTag$1];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
var _getRawTag = getRawTag$1;
|
|
175
|
+
|
|
176
|
+
/** Used for built-in method references. */
|
|
177
|
+
|
|
178
|
+
var objectProto = Object.prototype;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Used to resolve the
|
|
182
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
183
|
+
* of values.
|
|
184
|
+
*/
|
|
185
|
+
var nativeObjectToString = objectProto.toString;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
* @param {*} value The value to convert.
|
|
192
|
+
* @returns {string} Returns the converted string.
|
|
193
|
+
*/
|
|
194
|
+
function objectToString$1(value) {
|
|
195
|
+
return nativeObjectToString.call(value);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
var _objectToString = objectToString$1;
|
|
199
|
+
|
|
200
|
+
var Symbol$1 = _Symbol,
|
|
201
|
+
getRawTag = _getRawTag,
|
|
202
|
+
objectToString = _objectToString;
|
|
203
|
+
|
|
204
|
+
/** `Object#toString` result references. */
|
|
205
|
+
var nullTag = '[object Null]',
|
|
206
|
+
undefinedTag = '[object Undefined]';
|
|
207
|
+
|
|
208
|
+
/** Built-in value references. */
|
|
209
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
213
|
+
*
|
|
214
|
+
* @private
|
|
215
|
+
* @param {*} value The value to query.
|
|
216
|
+
* @returns {string} Returns the `toStringTag`.
|
|
217
|
+
*/
|
|
218
|
+
function baseGetTag$1(value) {
|
|
219
|
+
if (value == null) {
|
|
220
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
221
|
+
}
|
|
222
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
223
|
+
? getRawTag(value)
|
|
224
|
+
: objectToString(value);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
var _baseGetTag = baseGetTag$1;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
231
|
+
* and has a `typeof` result of "object".
|
|
232
|
+
*
|
|
233
|
+
* @static
|
|
234
|
+
* @memberOf _
|
|
235
|
+
* @since 4.0.0
|
|
236
|
+
* @category Lang
|
|
237
|
+
* @param {*} value The value to check.
|
|
238
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
239
|
+
* @example
|
|
240
|
+
*
|
|
241
|
+
* _.isObjectLike({});
|
|
242
|
+
* // => true
|
|
243
|
+
*
|
|
244
|
+
* _.isObjectLike([1, 2, 3]);
|
|
245
|
+
* // => true
|
|
246
|
+
*
|
|
247
|
+
* _.isObjectLike(_.noop);
|
|
248
|
+
* // => false
|
|
249
|
+
*
|
|
250
|
+
* _.isObjectLike(null);
|
|
251
|
+
* // => false
|
|
252
|
+
*/
|
|
253
|
+
|
|
254
|
+
function isObjectLike$1(value) {
|
|
255
|
+
return value != null && typeof value == 'object';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
var isObjectLike_1 = isObjectLike$1;
|
|
259
|
+
|
|
260
|
+
var baseGetTag = _baseGetTag,
|
|
261
|
+
isObjectLike = isObjectLike_1;
|
|
262
|
+
|
|
263
|
+
/** `Object#toString` result references. */
|
|
264
|
+
var symbolTag = '[object Symbol]';
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
268
|
+
*
|
|
269
|
+
* @static
|
|
270
|
+
* @memberOf _
|
|
271
|
+
* @since 4.0.0
|
|
272
|
+
* @category Lang
|
|
273
|
+
* @param {*} value The value to check.
|
|
274
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
275
|
+
* @example
|
|
276
|
+
*
|
|
277
|
+
* _.isSymbol(Symbol.iterator);
|
|
278
|
+
* // => true
|
|
279
|
+
*
|
|
280
|
+
* _.isSymbol('abc');
|
|
281
|
+
* // => false
|
|
282
|
+
*/
|
|
283
|
+
function isSymbol$1(value) {
|
|
284
|
+
return typeof value == 'symbol' ||
|
|
285
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
var isSymbol_1 = isSymbol$1;
|
|
289
|
+
|
|
290
|
+
var baseTrim = _baseTrim,
|
|
291
|
+
isObject$1 = isObject_1,
|
|
292
|
+
isSymbol = isSymbol_1;
|
|
293
|
+
|
|
294
|
+
/** Used as references for various `Number` constants. */
|
|
295
|
+
var NAN = 0 / 0;
|
|
296
|
+
|
|
297
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
298
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
299
|
+
|
|
300
|
+
/** Used to detect binary string values. */
|
|
301
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
302
|
+
|
|
303
|
+
/** Used to detect octal string values. */
|
|
304
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
305
|
+
|
|
306
|
+
/** Built-in method references without a dependency on `root`. */
|
|
307
|
+
var freeParseInt = parseInt;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Converts `value` to a number.
|
|
311
|
+
*
|
|
312
|
+
* @static
|
|
313
|
+
* @memberOf _
|
|
314
|
+
* @since 4.0.0
|
|
315
|
+
* @category Lang
|
|
316
|
+
* @param {*} value The value to process.
|
|
317
|
+
* @returns {number} Returns the number.
|
|
318
|
+
* @example
|
|
319
|
+
*
|
|
320
|
+
* _.toNumber(3.2);
|
|
321
|
+
* // => 3.2
|
|
322
|
+
*
|
|
323
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
324
|
+
* // => 5e-324
|
|
325
|
+
*
|
|
326
|
+
* _.toNumber(Infinity);
|
|
327
|
+
* // => Infinity
|
|
328
|
+
*
|
|
329
|
+
* _.toNumber('3.2');
|
|
330
|
+
* // => 3.2
|
|
331
|
+
*/
|
|
332
|
+
function toNumber$1(value) {
|
|
333
|
+
if (typeof value == 'number') {
|
|
334
|
+
return value;
|
|
335
|
+
}
|
|
336
|
+
if (isSymbol(value)) {
|
|
337
|
+
return NAN;
|
|
338
|
+
}
|
|
339
|
+
if (isObject$1(value)) {
|
|
340
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
341
|
+
value = isObject$1(other) ? (other + '') : other;
|
|
342
|
+
}
|
|
343
|
+
if (typeof value != 'string') {
|
|
344
|
+
return value === 0 ? value : +value;
|
|
345
|
+
}
|
|
346
|
+
value = baseTrim(value);
|
|
347
|
+
var isBinary = reIsBinary.test(value);
|
|
348
|
+
return (isBinary || reIsOctal.test(value))
|
|
349
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
350
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
var toNumber_1 = toNumber$1;
|
|
354
|
+
|
|
355
|
+
var isObject = isObject_1,
|
|
356
|
+
now = now_1,
|
|
357
|
+
toNumber = toNumber_1;
|
|
358
|
+
|
|
359
|
+
/** Error message constants. */
|
|
360
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
361
|
+
|
|
362
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
363
|
+
var nativeMax = Math.max,
|
|
364
|
+
nativeMin = Math.min;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
368
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
369
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
370
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
371
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
372
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
373
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
374
|
+
* calls to the debounced function return the result of the last `func`
|
|
375
|
+
* invocation.
|
|
376
|
+
*
|
|
377
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
378
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
379
|
+
* is invoked more than once during the `wait` timeout.
|
|
380
|
+
*
|
|
381
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
382
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
383
|
+
*
|
|
384
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
385
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
386
|
+
*
|
|
387
|
+
* @static
|
|
388
|
+
* @memberOf _
|
|
389
|
+
* @since 0.1.0
|
|
390
|
+
* @category Function
|
|
391
|
+
* @param {Function} func The function to debounce.
|
|
392
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
393
|
+
* @param {Object} [options={}] The options object.
|
|
394
|
+
* @param {boolean} [options.leading=false]
|
|
395
|
+
* Specify invoking on the leading edge of the timeout.
|
|
396
|
+
* @param {number} [options.maxWait]
|
|
397
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
398
|
+
* @param {boolean} [options.trailing=true]
|
|
399
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
400
|
+
* @returns {Function} Returns the new debounced function.
|
|
401
|
+
* @example
|
|
402
|
+
*
|
|
403
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
404
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
405
|
+
*
|
|
406
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
407
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
408
|
+
* 'leading': true,
|
|
409
|
+
* 'trailing': false
|
|
410
|
+
* }));
|
|
411
|
+
*
|
|
412
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
413
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
414
|
+
* var source = new EventSource('/stream');
|
|
415
|
+
* jQuery(source).on('message', debounced);
|
|
416
|
+
*
|
|
417
|
+
* // Cancel the trailing debounced invocation.
|
|
418
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
419
|
+
*/
|
|
420
|
+
function debounce(func, wait, options) {
|
|
421
|
+
var lastArgs,
|
|
422
|
+
lastThis,
|
|
423
|
+
maxWait,
|
|
424
|
+
result,
|
|
425
|
+
timerId,
|
|
426
|
+
lastCallTime,
|
|
427
|
+
lastInvokeTime = 0,
|
|
428
|
+
leading = false,
|
|
429
|
+
maxing = false,
|
|
430
|
+
trailing = true;
|
|
431
|
+
|
|
432
|
+
if (typeof func != 'function') {
|
|
433
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
434
|
+
}
|
|
435
|
+
wait = toNumber(wait) || 0;
|
|
436
|
+
if (isObject(options)) {
|
|
437
|
+
leading = !!options.leading;
|
|
438
|
+
maxing = 'maxWait' in options;
|
|
439
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
440
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function invokeFunc(time) {
|
|
444
|
+
var args = lastArgs,
|
|
445
|
+
thisArg = lastThis;
|
|
446
|
+
|
|
447
|
+
lastArgs = lastThis = undefined;
|
|
448
|
+
lastInvokeTime = time;
|
|
449
|
+
result = func.apply(thisArg, args);
|
|
450
|
+
return result;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function leadingEdge(time) {
|
|
454
|
+
// Reset any `maxWait` timer.
|
|
455
|
+
lastInvokeTime = time;
|
|
456
|
+
// Start the timer for the trailing edge.
|
|
457
|
+
timerId = setTimeout(timerExpired, wait);
|
|
458
|
+
// Invoke the leading edge.
|
|
459
|
+
return leading ? invokeFunc(time) : result;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function remainingWait(time) {
|
|
463
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
464
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
465
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
466
|
+
|
|
467
|
+
return maxing
|
|
468
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
469
|
+
: timeWaiting;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function shouldInvoke(time) {
|
|
473
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
474
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
475
|
+
|
|
476
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
477
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
478
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
479
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
480
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function timerExpired() {
|
|
484
|
+
var time = now();
|
|
485
|
+
if (shouldInvoke(time)) {
|
|
486
|
+
return trailingEdge(time);
|
|
487
|
+
}
|
|
488
|
+
// Restart the timer.
|
|
489
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
function trailingEdge(time) {
|
|
493
|
+
timerId = undefined;
|
|
494
|
+
|
|
495
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
496
|
+
// debounced at least once.
|
|
497
|
+
if (trailing && lastArgs) {
|
|
498
|
+
return invokeFunc(time);
|
|
499
|
+
}
|
|
500
|
+
lastArgs = lastThis = undefined;
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function cancel() {
|
|
505
|
+
if (timerId !== undefined) {
|
|
506
|
+
clearTimeout(timerId);
|
|
507
|
+
}
|
|
508
|
+
lastInvokeTime = 0;
|
|
509
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function flush() {
|
|
513
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function debounced() {
|
|
517
|
+
var time = now(),
|
|
518
|
+
isInvoking = shouldInvoke(time);
|
|
519
|
+
|
|
520
|
+
lastArgs = arguments;
|
|
521
|
+
lastThis = this;
|
|
522
|
+
lastCallTime = time;
|
|
523
|
+
|
|
524
|
+
if (isInvoking) {
|
|
525
|
+
if (timerId === undefined) {
|
|
526
|
+
return leadingEdge(lastCallTime);
|
|
527
|
+
}
|
|
528
|
+
if (maxing) {
|
|
529
|
+
// Handle invocations in a tight loop.
|
|
530
|
+
clearTimeout(timerId);
|
|
531
|
+
timerId = setTimeout(timerExpired, wait);
|
|
532
|
+
return invokeFunc(lastCallTime);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (timerId === undefined) {
|
|
536
|
+
timerId = setTimeout(timerExpired, wait);
|
|
537
|
+
}
|
|
538
|
+
return result;
|
|
539
|
+
}
|
|
540
|
+
debounced.cancel = cancel;
|
|
541
|
+
debounced.flush = flush;
|
|
542
|
+
return debounced;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
var debounce_1 = debounce;
|
|
546
|
+
|
|
547
|
+
var propTypes = {exports: {}};
|
|
548
|
+
|
|
549
|
+
var reactIs = {exports: {}};
|
|
550
|
+
|
|
551
|
+
var reactIs_production_min = {};
|
|
552
|
+
|
|
553
|
+
/** @license React v16.13.1
|
|
554
|
+
* react-is.production.min.js
|
|
555
|
+
*
|
|
556
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
557
|
+
*
|
|
558
|
+
* This source code is licensed under the MIT license found in the
|
|
559
|
+
* LICENSE file in the root directory of this source tree.
|
|
560
|
+
*/
|
|
561
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d$1=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h$1=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m$1=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
562
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w$1=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y$1=b?Symbol.for("react.scope"):60119;
|
|
563
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m$1:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h$1:return a;default:return u}}case d$1:return u}}}function A(a){return z(a)===m$1}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m$1;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h$1;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d$1;
|
|
564
|
+
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h$1};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
565
|
+
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d$1};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
566
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m$1||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h$1||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w$1||a.$$typeof===x||a.$$typeof===y$1||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
567
|
+
|
|
568
|
+
var reactIs_development = {};
|
|
569
|
+
|
|
570
|
+
/** @license React v16.13.1
|
|
571
|
+
* react-is.development.js
|
|
572
|
+
*
|
|
573
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
574
|
+
*
|
|
575
|
+
* This source code is licensed under the MIT license found in the
|
|
576
|
+
* LICENSE file in the root directory of this source tree.
|
|
577
|
+
*/
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
if (process.env.NODE_ENV !== "production") {
|
|
582
|
+
(function() {
|
|
583
|
+
|
|
584
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
585
|
+
// nor polyfill, then a plain number is used for performance.
|
|
586
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
587
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
588
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
589
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
590
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
591
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
592
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
593
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
594
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
595
|
+
|
|
596
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
597
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
598
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
599
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
600
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
601
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
602
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
603
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
604
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
605
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
606
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
607
|
+
|
|
608
|
+
function isValidElementType(type) {
|
|
609
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
610
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function typeOf(object) {
|
|
614
|
+
if (typeof object === 'object' && object !== null) {
|
|
615
|
+
var $$typeof = object.$$typeof;
|
|
616
|
+
|
|
617
|
+
switch ($$typeof) {
|
|
618
|
+
case REACT_ELEMENT_TYPE:
|
|
619
|
+
var type = object.type;
|
|
620
|
+
|
|
621
|
+
switch (type) {
|
|
622
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
623
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
624
|
+
case REACT_FRAGMENT_TYPE:
|
|
625
|
+
case REACT_PROFILER_TYPE:
|
|
626
|
+
case REACT_STRICT_MODE_TYPE:
|
|
627
|
+
case REACT_SUSPENSE_TYPE:
|
|
628
|
+
return type;
|
|
629
|
+
|
|
630
|
+
default:
|
|
631
|
+
var $$typeofType = type && type.$$typeof;
|
|
632
|
+
|
|
633
|
+
switch ($$typeofType) {
|
|
634
|
+
case REACT_CONTEXT_TYPE:
|
|
635
|
+
case REACT_FORWARD_REF_TYPE:
|
|
636
|
+
case REACT_LAZY_TYPE:
|
|
637
|
+
case REACT_MEMO_TYPE:
|
|
638
|
+
case REACT_PROVIDER_TYPE:
|
|
639
|
+
return $$typeofType;
|
|
640
|
+
|
|
641
|
+
default:
|
|
642
|
+
return $$typeof;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
case REACT_PORTAL_TYPE:
|
|
648
|
+
return $$typeof;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return undefined;
|
|
653
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
654
|
+
|
|
655
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
656
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
657
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
658
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
659
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
660
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
661
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
662
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
663
|
+
var Memo = REACT_MEMO_TYPE;
|
|
664
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
665
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
666
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
667
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
668
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
669
|
+
|
|
670
|
+
function isAsyncMode(object) {
|
|
671
|
+
{
|
|
672
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
673
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
674
|
+
|
|
675
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
680
|
+
}
|
|
681
|
+
function isConcurrentMode(object) {
|
|
682
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
683
|
+
}
|
|
684
|
+
function isContextConsumer(object) {
|
|
685
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
686
|
+
}
|
|
687
|
+
function isContextProvider(object) {
|
|
688
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
689
|
+
}
|
|
690
|
+
function isElement(object) {
|
|
691
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
692
|
+
}
|
|
693
|
+
function isForwardRef(object) {
|
|
694
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
695
|
+
}
|
|
696
|
+
function isFragment(object) {
|
|
697
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
698
|
+
}
|
|
699
|
+
function isLazy(object) {
|
|
700
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
701
|
+
}
|
|
702
|
+
function isMemo(object) {
|
|
703
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
704
|
+
}
|
|
705
|
+
function isPortal(object) {
|
|
706
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
707
|
+
}
|
|
708
|
+
function isProfiler(object) {
|
|
709
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
710
|
+
}
|
|
711
|
+
function isStrictMode(object) {
|
|
712
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
713
|
+
}
|
|
714
|
+
function isSuspense(object) {
|
|
715
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
reactIs_development.AsyncMode = AsyncMode;
|
|
719
|
+
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
720
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
721
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
722
|
+
reactIs_development.Element = Element;
|
|
723
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
724
|
+
reactIs_development.Fragment = Fragment;
|
|
725
|
+
reactIs_development.Lazy = Lazy;
|
|
726
|
+
reactIs_development.Memo = Memo;
|
|
727
|
+
reactIs_development.Portal = Portal;
|
|
728
|
+
reactIs_development.Profiler = Profiler;
|
|
729
|
+
reactIs_development.StrictMode = StrictMode;
|
|
730
|
+
reactIs_development.Suspense = Suspense;
|
|
731
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
732
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
733
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
734
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
735
|
+
reactIs_development.isElement = isElement;
|
|
736
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
737
|
+
reactIs_development.isFragment = isFragment;
|
|
738
|
+
reactIs_development.isLazy = isLazy;
|
|
739
|
+
reactIs_development.isMemo = isMemo;
|
|
740
|
+
reactIs_development.isPortal = isPortal;
|
|
741
|
+
reactIs_development.isProfiler = isProfiler;
|
|
742
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
743
|
+
reactIs_development.isSuspense = isSuspense;
|
|
744
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
745
|
+
reactIs_development.typeOf = typeOf;
|
|
746
|
+
})();
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
if (process.env.NODE_ENV === 'production') {
|
|
750
|
+
reactIs.exports = reactIs_production_min;
|
|
751
|
+
} else {
|
|
752
|
+
reactIs.exports = reactIs_development;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/*
|
|
756
|
+
object-assign
|
|
757
|
+
(c) Sindre Sorhus
|
|
758
|
+
@license MIT
|
|
759
|
+
*/
|
|
760
|
+
/* eslint-disable no-unused-vars */
|
|
761
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
762
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
763
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
764
|
+
|
|
765
|
+
function toObject(val) {
|
|
766
|
+
if (val === null || val === undefined) {
|
|
767
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
return Object(val);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
function shouldUseNative() {
|
|
774
|
+
try {
|
|
775
|
+
if (!Object.assign) {
|
|
776
|
+
return false;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
780
|
+
|
|
781
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
782
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
783
|
+
test1[5] = 'de';
|
|
784
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
789
|
+
var test2 = {};
|
|
790
|
+
for (var i = 0; i < 10; i++) {
|
|
791
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
792
|
+
}
|
|
793
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
794
|
+
return test2[n];
|
|
795
|
+
});
|
|
796
|
+
if (order2.join('') !== '0123456789') {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
801
|
+
var test3 = {};
|
|
802
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
803
|
+
test3[letter] = letter;
|
|
804
|
+
});
|
|
805
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
806
|
+
'abcdefghijklmnopqrst') {
|
|
807
|
+
return false;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
return true;
|
|
811
|
+
} catch (err) {
|
|
812
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
813
|
+
return false;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
818
|
+
var from;
|
|
819
|
+
var to = toObject(target);
|
|
820
|
+
var symbols;
|
|
821
|
+
|
|
822
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
823
|
+
from = Object(arguments[s]);
|
|
824
|
+
|
|
825
|
+
for (var key in from) {
|
|
826
|
+
if (hasOwnProperty.call(from, key)) {
|
|
827
|
+
to[key] = from[key];
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if (getOwnPropertySymbols) {
|
|
832
|
+
symbols = getOwnPropertySymbols(from);
|
|
833
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
834
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
835
|
+
to[symbols[i]] = from[symbols[i]];
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return to;
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
846
|
+
*
|
|
847
|
+
* This source code is licensed under the MIT license found in the
|
|
848
|
+
* LICENSE file in the root directory of this source tree.
|
|
849
|
+
*/
|
|
850
|
+
|
|
851
|
+
var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
852
|
+
|
|
853
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
|
|
854
|
+
|
|
855
|
+
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
859
|
+
*
|
|
860
|
+
* This source code is licensed under the MIT license found in the
|
|
861
|
+
* LICENSE file in the root directory of this source tree.
|
|
862
|
+
*/
|
|
863
|
+
|
|
864
|
+
var printWarning$1 = function() {};
|
|
865
|
+
|
|
866
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
867
|
+
var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
|
|
868
|
+
var loggedTypeFailures = {};
|
|
869
|
+
var has$1 = has$2;
|
|
870
|
+
|
|
871
|
+
printWarning$1 = function(text) {
|
|
872
|
+
var message = 'Warning: ' + text;
|
|
873
|
+
if (typeof console !== 'undefined') {
|
|
874
|
+
console.error(message);
|
|
875
|
+
}
|
|
876
|
+
try {
|
|
877
|
+
// --- Welcome to debugging React ---
|
|
878
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
879
|
+
// to find the callsite that caused this warning to fire.
|
|
880
|
+
throw new Error(message);
|
|
881
|
+
} catch (x) { /**/ }
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Assert that the values match with the type specs.
|
|
887
|
+
* Error messages are memorized and will only be shown once.
|
|
888
|
+
*
|
|
889
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
890
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
891
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
892
|
+
* @param {string} componentName Name of the component for error messages.
|
|
893
|
+
* @param {?Function} getStack Returns the component stack.
|
|
894
|
+
* @private
|
|
895
|
+
*/
|
|
896
|
+
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
897
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
898
|
+
for (var typeSpecName in typeSpecs) {
|
|
899
|
+
if (has$1(typeSpecs, typeSpecName)) {
|
|
900
|
+
var error;
|
|
901
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
902
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
903
|
+
// After these have been cleaned up, we'll let them throw.
|
|
904
|
+
try {
|
|
905
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
906
|
+
// behavior as without this statement except with a better message.
|
|
907
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
908
|
+
var err = Error(
|
|
909
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
910
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
911
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
912
|
+
);
|
|
913
|
+
err.name = 'Invariant Violation';
|
|
914
|
+
throw err;
|
|
915
|
+
}
|
|
916
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
|
|
917
|
+
} catch (ex) {
|
|
918
|
+
error = ex;
|
|
919
|
+
}
|
|
920
|
+
if (error && !(error instanceof Error)) {
|
|
921
|
+
printWarning$1(
|
|
922
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
923
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
924
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
925
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
926
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
927
|
+
'shape all require an argument).'
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
931
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
932
|
+
// same error.
|
|
933
|
+
loggedTypeFailures[error.message] = true;
|
|
934
|
+
|
|
935
|
+
var stack = getStack ? getStack() : '';
|
|
936
|
+
|
|
937
|
+
printWarning$1(
|
|
938
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Resets warning cache when testing.
|
|
948
|
+
*
|
|
949
|
+
* @private
|
|
950
|
+
*/
|
|
951
|
+
checkPropTypes$1.resetWarningCache = function() {
|
|
952
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
953
|
+
loggedTypeFailures = {};
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
var checkPropTypes_1 = checkPropTypes$1;
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
961
|
+
*
|
|
962
|
+
* This source code is licensed under the MIT license found in the
|
|
963
|
+
* LICENSE file in the root directory of this source tree.
|
|
964
|
+
*/
|
|
965
|
+
|
|
966
|
+
var ReactIs$1 = reactIs.exports;
|
|
967
|
+
var assign = objectAssign;
|
|
968
|
+
|
|
969
|
+
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
970
|
+
var has = has$2;
|
|
971
|
+
var checkPropTypes = checkPropTypes_1;
|
|
972
|
+
|
|
973
|
+
var printWarning = function() {};
|
|
974
|
+
|
|
975
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
976
|
+
printWarning = function(text) {
|
|
977
|
+
var message = 'Warning: ' + text;
|
|
978
|
+
if (typeof console !== 'undefined') {
|
|
979
|
+
console.error(message);
|
|
980
|
+
}
|
|
981
|
+
try {
|
|
982
|
+
// --- Welcome to debugging React ---
|
|
983
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
984
|
+
// to find the callsite that caused this warning to fire.
|
|
985
|
+
throw new Error(message);
|
|
986
|
+
} catch (x) {}
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
function emptyFunctionThatReturnsNull() {
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
995
|
+
/* global Symbol */
|
|
996
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
997
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Returns the iterator method function contained on the iterable object.
|
|
1001
|
+
*
|
|
1002
|
+
* Be sure to invoke the function with the iterable as context:
|
|
1003
|
+
*
|
|
1004
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
1005
|
+
* if (iteratorFn) {
|
|
1006
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
1007
|
+
* ...
|
|
1008
|
+
* }
|
|
1009
|
+
*
|
|
1010
|
+
* @param {?object} maybeIterable
|
|
1011
|
+
* @return {?function}
|
|
1012
|
+
*/
|
|
1013
|
+
function getIteratorFn(maybeIterable) {
|
|
1014
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
1015
|
+
if (typeof iteratorFn === 'function') {
|
|
1016
|
+
return iteratorFn;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
1022
|
+
* supplied to React components. Example usage:
|
|
1023
|
+
*
|
|
1024
|
+
* var Props = require('ReactPropTypes');
|
|
1025
|
+
* var MyArticle = React.createClass({
|
|
1026
|
+
* propTypes: {
|
|
1027
|
+
* // An optional string prop named "description".
|
|
1028
|
+
* description: Props.string,
|
|
1029
|
+
*
|
|
1030
|
+
* // A required enum prop named "category".
|
|
1031
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
1032
|
+
*
|
|
1033
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
1034
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
1035
|
+
* },
|
|
1036
|
+
* render: function() { ... }
|
|
1037
|
+
* });
|
|
1038
|
+
*
|
|
1039
|
+
* A more formal specification of how these methods are used:
|
|
1040
|
+
*
|
|
1041
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
1042
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
1043
|
+
*
|
|
1044
|
+
* Each and every declaration produces a function with the same signature. This
|
|
1045
|
+
* allows the creation of custom validation functions. For example:
|
|
1046
|
+
*
|
|
1047
|
+
* var MyLink = React.createClass({
|
|
1048
|
+
* propTypes: {
|
|
1049
|
+
* // An optional string or URI prop named "href".
|
|
1050
|
+
* href: function(props, propName, componentName) {
|
|
1051
|
+
* var propValue = props[propName];
|
|
1052
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
1053
|
+
* !(propValue instanceof URI)) {
|
|
1054
|
+
* return new Error(
|
|
1055
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
1056
|
+
* componentName
|
|
1057
|
+
* );
|
|
1058
|
+
* }
|
|
1059
|
+
* }
|
|
1060
|
+
* },
|
|
1061
|
+
* render: function() {...}
|
|
1062
|
+
* });
|
|
1063
|
+
*
|
|
1064
|
+
* @internal
|
|
1065
|
+
*/
|
|
1066
|
+
|
|
1067
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
1068
|
+
|
|
1069
|
+
// Important!
|
|
1070
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
1071
|
+
var ReactPropTypes = {
|
|
1072
|
+
array: createPrimitiveTypeChecker('array'),
|
|
1073
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
1074
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
1075
|
+
func: createPrimitiveTypeChecker('function'),
|
|
1076
|
+
number: createPrimitiveTypeChecker('number'),
|
|
1077
|
+
object: createPrimitiveTypeChecker('object'),
|
|
1078
|
+
string: createPrimitiveTypeChecker('string'),
|
|
1079
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
1080
|
+
|
|
1081
|
+
any: createAnyTypeChecker(),
|
|
1082
|
+
arrayOf: createArrayOfTypeChecker,
|
|
1083
|
+
element: createElementTypeChecker(),
|
|
1084
|
+
elementType: createElementTypeTypeChecker(),
|
|
1085
|
+
instanceOf: createInstanceTypeChecker,
|
|
1086
|
+
node: createNodeChecker(),
|
|
1087
|
+
objectOf: createObjectOfTypeChecker,
|
|
1088
|
+
oneOf: createEnumTypeChecker,
|
|
1089
|
+
oneOfType: createUnionTypeChecker,
|
|
1090
|
+
shape: createShapeTypeChecker,
|
|
1091
|
+
exact: createStrictShapeTypeChecker,
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
1096
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
1097
|
+
*/
|
|
1098
|
+
/*eslint-disable no-self-compare*/
|
|
1099
|
+
function is(x, y) {
|
|
1100
|
+
// SameValue algorithm
|
|
1101
|
+
if (x === y) {
|
|
1102
|
+
// Steps 1-5, 7-10
|
|
1103
|
+
// Steps 6.b-6.e: +0 != -0
|
|
1104
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
1105
|
+
} else {
|
|
1106
|
+
// Step 6.a: NaN == NaN
|
|
1107
|
+
return x !== x && y !== y;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
/*eslint-enable no-self-compare*/
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
1114
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
1115
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
1116
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
1117
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
1118
|
+
*/
|
|
1119
|
+
function PropTypeError(message, data) {
|
|
1120
|
+
this.message = message;
|
|
1121
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
1122
|
+
this.stack = '';
|
|
1123
|
+
}
|
|
1124
|
+
// Make `instanceof Error` still work for returned errors.
|
|
1125
|
+
PropTypeError.prototype = Error.prototype;
|
|
1126
|
+
|
|
1127
|
+
function createChainableTypeChecker(validate) {
|
|
1128
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1129
|
+
var manualPropTypeCallCache = {};
|
|
1130
|
+
var manualPropTypeWarningCount = 0;
|
|
1131
|
+
}
|
|
1132
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
1133
|
+
componentName = componentName || ANONYMOUS;
|
|
1134
|
+
propFullName = propFullName || propName;
|
|
1135
|
+
|
|
1136
|
+
if (secret !== ReactPropTypesSecret$1) {
|
|
1137
|
+
if (throwOnDirectAccess) {
|
|
1138
|
+
// New behavior only for users of `prop-types` package
|
|
1139
|
+
var err = new Error(
|
|
1140
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1141
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
1142
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
1143
|
+
);
|
|
1144
|
+
err.name = 'Invariant Violation';
|
|
1145
|
+
throw err;
|
|
1146
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
1147
|
+
// Old behavior for people using React.PropTypes
|
|
1148
|
+
var cacheKey = componentName + ':' + propName;
|
|
1149
|
+
if (
|
|
1150
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
1151
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
1152
|
+
manualPropTypeWarningCount < 3
|
|
1153
|
+
) {
|
|
1154
|
+
printWarning(
|
|
1155
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
1156
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
1157
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
1158
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
1159
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
1160
|
+
);
|
|
1161
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
1162
|
+
manualPropTypeWarningCount++;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
if (props[propName] == null) {
|
|
1167
|
+
if (isRequired) {
|
|
1168
|
+
if (props[propName] === null) {
|
|
1169
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
1170
|
+
}
|
|
1171
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
1172
|
+
}
|
|
1173
|
+
return null;
|
|
1174
|
+
} else {
|
|
1175
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
1180
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
1181
|
+
|
|
1182
|
+
return chainedCheckType;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
1186
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
1187
|
+
var propValue = props[propName];
|
|
1188
|
+
var propType = getPropType(propValue);
|
|
1189
|
+
if (propType !== expectedType) {
|
|
1190
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
1191
|
+
// check, but we can offer a more precise error message here rather than
|
|
1192
|
+
// 'of type `object`'.
|
|
1193
|
+
var preciseType = getPreciseType(propValue);
|
|
1194
|
+
|
|
1195
|
+
return new PropTypeError(
|
|
1196
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
1197
|
+
{expectedType: expectedType}
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
return null;
|
|
1201
|
+
}
|
|
1202
|
+
return createChainableTypeChecker(validate);
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
function createAnyTypeChecker() {
|
|
1206
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
1210
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1211
|
+
if (typeof typeChecker !== 'function') {
|
|
1212
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
1213
|
+
}
|
|
1214
|
+
var propValue = props[propName];
|
|
1215
|
+
if (!Array.isArray(propValue)) {
|
|
1216
|
+
var propType = getPropType(propValue);
|
|
1217
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
1218
|
+
}
|
|
1219
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
1220
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
|
|
1221
|
+
if (error instanceof Error) {
|
|
1222
|
+
return error;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return null;
|
|
1226
|
+
}
|
|
1227
|
+
return createChainableTypeChecker(validate);
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
function createElementTypeChecker() {
|
|
1231
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1232
|
+
var propValue = props[propName];
|
|
1233
|
+
if (!isValidElement(propValue)) {
|
|
1234
|
+
var propType = getPropType(propValue);
|
|
1235
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
1236
|
+
}
|
|
1237
|
+
return null;
|
|
1238
|
+
}
|
|
1239
|
+
return createChainableTypeChecker(validate);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
function createElementTypeTypeChecker() {
|
|
1243
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1244
|
+
var propValue = props[propName];
|
|
1245
|
+
if (!ReactIs$1.isValidElementType(propValue)) {
|
|
1246
|
+
var propType = getPropType(propValue);
|
|
1247
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
1248
|
+
}
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
return createChainableTypeChecker(validate);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
1255
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1256
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
1257
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
1258
|
+
var actualClassName = getClassName(props[propName]);
|
|
1259
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
1260
|
+
}
|
|
1261
|
+
return null;
|
|
1262
|
+
}
|
|
1263
|
+
return createChainableTypeChecker(validate);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
function createEnumTypeChecker(expectedValues) {
|
|
1267
|
+
if (!Array.isArray(expectedValues)) {
|
|
1268
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1269
|
+
if (arguments.length > 1) {
|
|
1270
|
+
printWarning(
|
|
1271
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
1272
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
1273
|
+
);
|
|
1274
|
+
} else {
|
|
1275
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
return emptyFunctionThatReturnsNull;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1282
|
+
var propValue = props[propName];
|
|
1283
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
1284
|
+
if (is(propValue, expectedValues[i])) {
|
|
1285
|
+
return null;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
1290
|
+
var type = getPreciseType(value);
|
|
1291
|
+
if (type === 'symbol') {
|
|
1292
|
+
return String(value);
|
|
1293
|
+
}
|
|
1294
|
+
return value;
|
|
1295
|
+
});
|
|
1296
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
1297
|
+
}
|
|
1298
|
+
return createChainableTypeChecker(validate);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
1302
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1303
|
+
if (typeof typeChecker !== 'function') {
|
|
1304
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
1305
|
+
}
|
|
1306
|
+
var propValue = props[propName];
|
|
1307
|
+
var propType = getPropType(propValue);
|
|
1308
|
+
if (propType !== 'object') {
|
|
1309
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
1310
|
+
}
|
|
1311
|
+
for (var key in propValue) {
|
|
1312
|
+
if (has(propValue, key)) {
|
|
1313
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
1314
|
+
if (error instanceof Error) {
|
|
1315
|
+
return error;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
return null;
|
|
1320
|
+
}
|
|
1321
|
+
return createChainableTypeChecker(validate);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
1325
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
1326
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1327
|
+
return emptyFunctionThatReturnsNull;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1331
|
+
var checker = arrayOfTypeCheckers[i];
|
|
1332
|
+
if (typeof checker !== 'function') {
|
|
1333
|
+
printWarning(
|
|
1334
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
1335
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
1336
|
+
);
|
|
1337
|
+
return emptyFunctionThatReturnsNull;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1342
|
+
var expectedTypes = [];
|
|
1343
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1344
|
+
var checker = arrayOfTypeCheckers[i];
|
|
1345
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
|
|
1346
|
+
if (checkerResult == null) {
|
|
1347
|
+
return null;
|
|
1348
|
+
}
|
|
1349
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
1350
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
1354
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
1355
|
+
}
|
|
1356
|
+
return createChainableTypeChecker(validate);
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
function createNodeChecker() {
|
|
1360
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1361
|
+
if (!isNode(props[propName])) {
|
|
1362
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
1363
|
+
}
|
|
1364
|
+
return null;
|
|
1365
|
+
}
|
|
1366
|
+
return createChainableTypeChecker(validate);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1370
|
+
return new PropTypeError(
|
|
1371
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
1372
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
1377
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1378
|
+
var propValue = props[propName];
|
|
1379
|
+
var propType = getPropType(propValue);
|
|
1380
|
+
if (propType !== 'object') {
|
|
1381
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1382
|
+
}
|
|
1383
|
+
for (var key in shapeTypes) {
|
|
1384
|
+
var checker = shapeTypes[key];
|
|
1385
|
+
if (typeof checker !== 'function') {
|
|
1386
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1387
|
+
}
|
|
1388
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
1389
|
+
if (error) {
|
|
1390
|
+
return error;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
return null;
|
|
1394
|
+
}
|
|
1395
|
+
return createChainableTypeChecker(validate);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
1399
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1400
|
+
var propValue = props[propName];
|
|
1401
|
+
var propType = getPropType(propValue);
|
|
1402
|
+
if (propType !== 'object') {
|
|
1403
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1404
|
+
}
|
|
1405
|
+
// We need to check all keys in case some are required but missing from props.
|
|
1406
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1407
|
+
for (var key in allKeys) {
|
|
1408
|
+
var checker = shapeTypes[key];
|
|
1409
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1410
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1411
|
+
}
|
|
1412
|
+
if (!checker) {
|
|
1413
|
+
return new PropTypeError(
|
|
1414
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1415
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1416
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
1419
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
1420
|
+
if (error) {
|
|
1421
|
+
return error;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return null;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
return createChainableTypeChecker(validate);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
function isNode(propValue) {
|
|
1431
|
+
switch (typeof propValue) {
|
|
1432
|
+
case 'number':
|
|
1433
|
+
case 'string':
|
|
1434
|
+
case 'undefined':
|
|
1435
|
+
return true;
|
|
1436
|
+
case 'boolean':
|
|
1437
|
+
return !propValue;
|
|
1438
|
+
case 'object':
|
|
1439
|
+
if (Array.isArray(propValue)) {
|
|
1440
|
+
return propValue.every(isNode);
|
|
1441
|
+
}
|
|
1442
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
1443
|
+
return true;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
1447
|
+
if (iteratorFn) {
|
|
1448
|
+
var iterator = iteratorFn.call(propValue);
|
|
1449
|
+
var step;
|
|
1450
|
+
if (iteratorFn !== propValue.entries) {
|
|
1451
|
+
while (!(step = iterator.next()).done) {
|
|
1452
|
+
if (!isNode(step.value)) {
|
|
1453
|
+
return false;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
} else {
|
|
1457
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1458
|
+
while (!(step = iterator.next()).done) {
|
|
1459
|
+
var entry = step.value;
|
|
1460
|
+
if (entry) {
|
|
1461
|
+
if (!isNode(entry[1])) {
|
|
1462
|
+
return false;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
} else {
|
|
1468
|
+
return false;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
return true;
|
|
1472
|
+
default:
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
function isSymbol(propType, propValue) {
|
|
1478
|
+
// Native Symbol.
|
|
1479
|
+
if (propType === 'symbol') {
|
|
1480
|
+
return true;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
// falsy value can't be a Symbol
|
|
1484
|
+
if (!propValue) {
|
|
1485
|
+
return false;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1489
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1490
|
+
return true;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1494
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1495
|
+
return true;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
return false;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1502
|
+
function getPropType(propValue) {
|
|
1503
|
+
var propType = typeof propValue;
|
|
1504
|
+
if (Array.isArray(propValue)) {
|
|
1505
|
+
return 'array';
|
|
1506
|
+
}
|
|
1507
|
+
if (propValue instanceof RegExp) {
|
|
1508
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1509
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1510
|
+
// passes PropTypes.object.
|
|
1511
|
+
return 'object';
|
|
1512
|
+
}
|
|
1513
|
+
if (isSymbol(propType, propValue)) {
|
|
1514
|
+
return 'symbol';
|
|
1515
|
+
}
|
|
1516
|
+
return propType;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1520
|
+
// See `createPrimitiveTypeChecker`.
|
|
1521
|
+
function getPreciseType(propValue) {
|
|
1522
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1523
|
+
return '' + propValue;
|
|
1524
|
+
}
|
|
1525
|
+
var propType = getPropType(propValue);
|
|
1526
|
+
if (propType === 'object') {
|
|
1527
|
+
if (propValue instanceof Date) {
|
|
1528
|
+
return 'date';
|
|
1529
|
+
} else if (propValue instanceof RegExp) {
|
|
1530
|
+
return 'regexp';
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
return propType;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1537
|
+
// For example, "undefined" or "of type array"
|
|
1538
|
+
function getPostfixForTypeWarning(value) {
|
|
1539
|
+
var type = getPreciseType(value);
|
|
1540
|
+
switch (type) {
|
|
1541
|
+
case 'array':
|
|
1542
|
+
case 'object':
|
|
1543
|
+
return 'an ' + type;
|
|
1544
|
+
case 'boolean':
|
|
1545
|
+
case 'date':
|
|
1546
|
+
case 'regexp':
|
|
1547
|
+
return 'a ' + type;
|
|
1548
|
+
default:
|
|
1549
|
+
return type;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
// Returns class name of the object, if any.
|
|
1554
|
+
function getClassName(propValue) {
|
|
1555
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1556
|
+
return ANONYMOUS;
|
|
1557
|
+
}
|
|
1558
|
+
return propValue.constructor.name;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1562
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1563
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1564
|
+
|
|
1565
|
+
return ReactPropTypes;
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1570
|
+
*
|
|
1571
|
+
* This source code is licensed under the MIT license found in the
|
|
1572
|
+
* LICENSE file in the root directory of this source tree.
|
|
1573
|
+
*/
|
|
1574
|
+
|
|
1575
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1576
|
+
|
|
1577
|
+
function emptyFunction() {}
|
|
1578
|
+
function emptyFunctionWithReset() {}
|
|
1579
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1580
|
+
|
|
1581
|
+
var factoryWithThrowingShims = function() {
|
|
1582
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1583
|
+
if (secret === ReactPropTypesSecret) {
|
|
1584
|
+
// It is still safe when called from React.
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
var err = new Error(
|
|
1588
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1589
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1590
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
1591
|
+
);
|
|
1592
|
+
err.name = 'Invariant Violation';
|
|
1593
|
+
throw err;
|
|
1594
|
+
} shim.isRequired = shim;
|
|
1595
|
+
function getShim() {
|
|
1596
|
+
return shim;
|
|
1597
|
+
} // Important!
|
|
1598
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1599
|
+
var ReactPropTypes = {
|
|
1600
|
+
array: shim,
|
|
1601
|
+
bigint: shim,
|
|
1602
|
+
bool: shim,
|
|
1603
|
+
func: shim,
|
|
1604
|
+
number: shim,
|
|
1605
|
+
object: shim,
|
|
1606
|
+
string: shim,
|
|
1607
|
+
symbol: shim,
|
|
1608
|
+
|
|
1609
|
+
any: shim,
|
|
1610
|
+
arrayOf: getShim,
|
|
1611
|
+
element: shim,
|
|
1612
|
+
elementType: shim,
|
|
1613
|
+
instanceOf: getShim,
|
|
1614
|
+
node: shim,
|
|
1615
|
+
objectOf: getShim,
|
|
1616
|
+
oneOf: getShim,
|
|
1617
|
+
oneOfType: getShim,
|
|
1618
|
+
shape: getShim,
|
|
1619
|
+
exact: getShim,
|
|
1620
|
+
|
|
1621
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1622
|
+
resetWarningCache: emptyFunction
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1626
|
+
|
|
1627
|
+
return ReactPropTypes;
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1632
|
+
*
|
|
1633
|
+
* This source code is licensed under the MIT license found in the
|
|
1634
|
+
* LICENSE file in the root directory of this source tree.
|
|
1635
|
+
*/
|
|
1636
|
+
|
|
1637
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1638
|
+
var ReactIs = reactIs.exports;
|
|
1639
|
+
|
|
1640
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1641
|
+
// http://fb.me/prop-types-in-prod
|
|
1642
|
+
var throwOnDirectAccess = true;
|
|
1643
|
+
propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1644
|
+
} else {
|
|
1645
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1646
|
+
// http://fb.me/prop-types-in-prod
|
|
1647
|
+
propTypes.exports = factoryWithThrowingShims();
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
var PropTypes = propTypes.exports;
|
|
1651
|
+
|
|
1652
|
+
class Main extends React.Component {
|
|
1653
|
+
render() {
|
|
1654
|
+
const {
|
|
1655
|
+
model
|
|
1656
|
+
} = this.props;
|
|
1657
|
+
const {
|
|
1658
|
+
extraCSSRules
|
|
1659
|
+
} = model;
|
|
1660
|
+
return /*#__PURE__*/React.createElement(UiLayout, {
|
|
1661
|
+
extraCSSRules: extraCSSRules
|
|
1662
|
+
}, model.prompt && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "Boilerplate Item"), /*#__PURE__*/React.createElement(PreviewPrompt, {
|
|
1663
|
+
prompt: model.prompt
|
|
1664
|
+
})));
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
}
|
|
1668
|
+
Main.propTypes = {
|
|
1669
|
+
model: PropTypes.object,
|
|
1670
|
+
session: PropTypes.object,
|
|
1671
|
+
onSessionChange: PropTypes.func.isRequired
|
|
1672
|
+
};
|
|
1673
|
+
Main.defaultProps = {};
|
|
1674
|
+
|
|
1675
|
+
var browser = {exports: {}};
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* Helpers.
|
|
1679
|
+
*/
|
|
1680
|
+
|
|
1681
|
+
var s = 1000;
|
|
1682
|
+
var m = s * 60;
|
|
1683
|
+
var h = m * 60;
|
|
1684
|
+
var d = h * 24;
|
|
1685
|
+
var w = d * 7;
|
|
1686
|
+
var y = d * 365.25;
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Parse or format the given `val`.
|
|
1690
|
+
*
|
|
1691
|
+
* Options:
|
|
1692
|
+
*
|
|
1693
|
+
* - `long` verbose formatting [false]
|
|
1694
|
+
*
|
|
1695
|
+
* @param {String|Number} val
|
|
1696
|
+
* @param {Object} [options]
|
|
1697
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
1698
|
+
* @return {String|Number}
|
|
1699
|
+
* @api public
|
|
1700
|
+
*/
|
|
1701
|
+
|
|
1702
|
+
var ms = function(val, options) {
|
|
1703
|
+
options = options || {};
|
|
1704
|
+
var type = typeof val;
|
|
1705
|
+
if (type === 'string' && val.length > 0) {
|
|
1706
|
+
return parse(val);
|
|
1707
|
+
} else if (type === 'number' && isFinite(val)) {
|
|
1708
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
1709
|
+
}
|
|
1710
|
+
throw new Error(
|
|
1711
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
1712
|
+
JSON.stringify(val)
|
|
1713
|
+
);
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Parse the given `str` and return milliseconds.
|
|
1718
|
+
*
|
|
1719
|
+
* @param {String} str
|
|
1720
|
+
* @return {Number}
|
|
1721
|
+
* @api private
|
|
1722
|
+
*/
|
|
1723
|
+
|
|
1724
|
+
function parse(str) {
|
|
1725
|
+
str = String(str);
|
|
1726
|
+
if (str.length > 100) {
|
|
1727
|
+
return;
|
|
1728
|
+
}
|
|
1729
|
+
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(
|
|
1730
|
+
str
|
|
1731
|
+
);
|
|
1732
|
+
if (!match) {
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
var n = parseFloat(match[1]);
|
|
1736
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
1737
|
+
switch (type) {
|
|
1738
|
+
case 'years':
|
|
1739
|
+
case 'year':
|
|
1740
|
+
case 'yrs':
|
|
1741
|
+
case 'yr':
|
|
1742
|
+
case 'y':
|
|
1743
|
+
return n * y;
|
|
1744
|
+
case 'weeks':
|
|
1745
|
+
case 'week':
|
|
1746
|
+
case 'w':
|
|
1747
|
+
return n * w;
|
|
1748
|
+
case 'days':
|
|
1749
|
+
case 'day':
|
|
1750
|
+
case 'd':
|
|
1751
|
+
return n * d;
|
|
1752
|
+
case 'hours':
|
|
1753
|
+
case 'hour':
|
|
1754
|
+
case 'hrs':
|
|
1755
|
+
case 'hr':
|
|
1756
|
+
case 'h':
|
|
1757
|
+
return n * h;
|
|
1758
|
+
case 'minutes':
|
|
1759
|
+
case 'minute':
|
|
1760
|
+
case 'mins':
|
|
1761
|
+
case 'min':
|
|
1762
|
+
case 'm':
|
|
1763
|
+
return n * m;
|
|
1764
|
+
case 'seconds':
|
|
1765
|
+
case 'second':
|
|
1766
|
+
case 'secs':
|
|
1767
|
+
case 'sec':
|
|
1768
|
+
case 's':
|
|
1769
|
+
return n * s;
|
|
1770
|
+
case 'milliseconds':
|
|
1771
|
+
case 'millisecond':
|
|
1772
|
+
case 'msecs':
|
|
1773
|
+
case 'msec':
|
|
1774
|
+
case 'ms':
|
|
1775
|
+
return n;
|
|
1776
|
+
default:
|
|
1777
|
+
return undefined;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* Short format for `ms`.
|
|
1783
|
+
*
|
|
1784
|
+
* @param {Number} ms
|
|
1785
|
+
* @return {String}
|
|
1786
|
+
* @api private
|
|
1787
|
+
*/
|
|
1788
|
+
|
|
1789
|
+
function fmtShort(ms) {
|
|
1790
|
+
var msAbs = Math.abs(ms);
|
|
1791
|
+
if (msAbs >= d) {
|
|
1792
|
+
return Math.round(ms / d) + 'd';
|
|
1793
|
+
}
|
|
1794
|
+
if (msAbs >= h) {
|
|
1795
|
+
return Math.round(ms / h) + 'h';
|
|
1796
|
+
}
|
|
1797
|
+
if (msAbs >= m) {
|
|
1798
|
+
return Math.round(ms / m) + 'm';
|
|
1799
|
+
}
|
|
1800
|
+
if (msAbs >= s) {
|
|
1801
|
+
return Math.round(ms / s) + 's';
|
|
1802
|
+
}
|
|
1803
|
+
return ms + 'ms';
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* Long format for `ms`.
|
|
1808
|
+
*
|
|
1809
|
+
* @param {Number} ms
|
|
1810
|
+
* @return {String}
|
|
1811
|
+
* @api private
|
|
1812
|
+
*/
|
|
1813
|
+
|
|
1814
|
+
function fmtLong(ms) {
|
|
1815
|
+
var msAbs = Math.abs(ms);
|
|
1816
|
+
if (msAbs >= d) {
|
|
1817
|
+
return plural(ms, msAbs, d, 'day');
|
|
1818
|
+
}
|
|
1819
|
+
if (msAbs >= h) {
|
|
1820
|
+
return plural(ms, msAbs, h, 'hour');
|
|
1821
|
+
}
|
|
1822
|
+
if (msAbs >= m) {
|
|
1823
|
+
return plural(ms, msAbs, m, 'minute');
|
|
1824
|
+
}
|
|
1825
|
+
if (msAbs >= s) {
|
|
1826
|
+
return plural(ms, msAbs, s, 'second');
|
|
1827
|
+
}
|
|
1828
|
+
return ms + ' ms';
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* Pluralization helper.
|
|
1833
|
+
*/
|
|
1834
|
+
|
|
1835
|
+
function plural(ms, msAbs, n, name) {
|
|
1836
|
+
var isPlural = msAbs >= n * 1.5;
|
|
1837
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* This is the common logic for both the Node.js and web browser
|
|
1842
|
+
* implementations of `debug()`.
|
|
1843
|
+
*/
|
|
1844
|
+
|
|
1845
|
+
function setup(env) {
|
|
1846
|
+
createDebug.debug = createDebug;
|
|
1847
|
+
createDebug.default = createDebug;
|
|
1848
|
+
createDebug.coerce = coerce;
|
|
1849
|
+
createDebug.disable = disable;
|
|
1850
|
+
createDebug.enable = enable;
|
|
1851
|
+
createDebug.enabled = enabled;
|
|
1852
|
+
createDebug.humanize = ms;
|
|
1853
|
+
createDebug.destroy = destroy;
|
|
1854
|
+
|
|
1855
|
+
Object.keys(env).forEach(key => {
|
|
1856
|
+
createDebug[key] = env[key];
|
|
1857
|
+
});
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* The currently active debug mode names, and names to skip.
|
|
1861
|
+
*/
|
|
1862
|
+
|
|
1863
|
+
createDebug.names = [];
|
|
1864
|
+
createDebug.skips = [];
|
|
1865
|
+
|
|
1866
|
+
/**
|
|
1867
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
1868
|
+
*
|
|
1869
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
1870
|
+
*/
|
|
1871
|
+
createDebug.formatters = {};
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Selects a color for a debug namespace
|
|
1875
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
1876
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
1877
|
+
* @api private
|
|
1878
|
+
*/
|
|
1879
|
+
function selectColor(namespace) {
|
|
1880
|
+
let hash = 0;
|
|
1881
|
+
|
|
1882
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
1883
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
1884
|
+
hash |= 0; // Convert to 32bit integer
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
1888
|
+
}
|
|
1889
|
+
createDebug.selectColor = selectColor;
|
|
1890
|
+
|
|
1891
|
+
/**
|
|
1892
|
+
* Create a debugger with the given `namespace`.
|
|
1893
|
+
*
|
|
1894
|
+
* @param {String} namespace
|
|
1895
|
+
* @return {Function}
|
|
1896
|
+
* @api public
|
|
1897
|
+
*/
|
|
1898
|
+
function createDebug(namespace) {
|
|
1899
|
+
let prevTime;
|
|
1900
|
+
let enableOverride = null;
|
|
1901
|
+
let namespacesCache;
|
|
1902
|
+
let enabledCache;
|
|
1903
|
+
|
|
1904
|
+
function debug(...args) {
|
|
1905
|
+
// Disabled?
|
|
1906
|
+
if (!debug.enabled) {
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
const self = debug;
|
|
1911
|
+
|
|
1912
|
+
// Set `diff` timestamp
|
|
1913
|
+
const curr = Number(new Date());
|
|
1914
|
+
const ms = curr - (prevTime || curr);
|
|
1915
|
+
self.diff = ms;
|
|
1916
|
+
self.prev = prevTime;
|
|
1917
|
+
self.curr = curr;
|
|
1918
|
+
prevTime = curr;
|
|
1919
|
+
|
|
1920
|
+
args[0] = createDebug.coerce(args[0]);
|
|
1921
|
+
|
|
1922
|
+
if (typeof args[0] !== 'string') {
|
|
1923
|
+
// Anything else let's inspect with %O
|
|
1924
|
+
args.unshift('%O');
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
// Apply any `formatters` transformations
|
|
1928
|
+
let index = 0;
|
|
1929
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
1930
|
+
// If we encounter an escaped % then don't increase the array index
|
|
1931
|
+
if (match === '%%') {
|
|
1932
|
+
return '%';
|
|
1933
|
+
}
|
|
1934
|
+
index++;
|
|
1935
|
+
const formatter = createDebug.formatters[format];
|
|
1936
|
+
if (typeof formatter === 'function') {
|
|
1937
|
+
const val = args[index];
|
|
1938
|
+
match = formatter.call(self, val);
|
|
1939
|
+
|
|
1940
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
1941
|
+
args.splice(index, 1);
|
|
1942
|
+
index--;
|
|
1943
|
+
}
|
|
1944
|
+
return match;
|
|
1945
|
+
});
|
|
1946
|
+
|
|
1947
|
+
// Apply env-specific formatting (colors, etc.)
|
|
1948
|
+
createDebug.formatArgs.call(self, args);
|
|
1949
|
+
|
|
1950
|
+
const logFn = self.log || createDebug.log;
|
|
1951
|
+
logFn.apply(self, args);
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
debug.namespace = namespace;
|
|
1955
|
+
debug.useColors = createDebug.useColors();
|
|
1956
|
+
debug.color = createDebug.selectColor(namespace);
|
|
1957
|
+
debug.extend = extend;
|
|
1958
|
+
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
1959
|
+
|
|
1960
|
+
Object.defineProperty(debug, 'enabled', {
|
|
1961
|
+
enumerable: true,
|
|
1962
|
+
configurable: false,
|
|
1963
|
+
get: () => {
|
|
1964
|
+
if (enableOverride !== null) {
|
|
1965
|
+
return enableOverride;
|
|
1966
|
+
}
|
|
1967
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
1968
|
+
namespacesCache = createDebug.namespaces;
|
|
1969
|
+
enabledCache = createDebug.enabled(namespace);
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
return enabledCache;
|
|
1973
|
+
},
|
|
1974
|
+
set: v => {
|
|
1975
|
+
enableOverride = v;
|
|
1976
|
+
}
|
|
1977
|
+
});
|
|
1978
|
+
|
|
1979
|
+
// Env-specific initialization logic for debug instances
|
|
1980
|
+
if (typeof createDebug.init === 'function') {
|
|
1981
|
+
createDebug.init(debug);
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
return debug;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
function extend(namespace, delimiter) {
|
|
1988
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
1989
|
+
newDebug.log = this.log;
|
|
1990
|
+
return newDebug;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
1995
|
+
* separated by a colon and wildcards.
|
|
1996
|
+
*
|
|
1997
|
+
* @param {String} namespaces
|
|
1998
|
+
* @api public
|
|
1999
|
+
*/
|
|
2000
|
+
function enable(namespaces) {
|
|
2001
|
+
createDebug.save(namespaces);
|
|
2002
|
+
createDebug.namespaces = namespaces;
|
|
2003
|
+
|
|
2004
|
+
createDebug.names = [];
|
|
2005
|
+
createDebug.skips = [];
|
|
2006
|
+
|
|
2007
|
+
let i;
|
|
2008
|
+
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
2009
|
+
const len = split.length;
|
|
2010
|
+
|
|
2011
|
+
for (i = 0; i < len; i++) {
|
|
2012
|
+
if (!split[i]) {
|
|
2013
|
+
// ignore empty strings
|
|
2014
|
+
continue;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
2018
|
+
|
|
2019
|
+
if (namespaces[0] === '-') {
|
|
2020
|
+
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
2021
|
+
} else {
|
|
2022
|
+
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
/**
|
|
2028
|
+
* Disable debug output.
|
|
2029
|
+
*
|
|
2030
|
+
* @return {String} namespaces
|
|
2031
|
+
* @api public
|
|
2032
|
+
*/
|
|
2033
|
+
function disable() {
|
|
2034
|
+
const namespaces = [
|
|
2035
|
+
...createDebug.names.map(toNamespace),
|
|
2036
|
+
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
2037
|
+
].join(',');
|
|
2038
|
+
createDebug.enable('');
|
|
2039
|
+
return namespaces;
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
2044
|
+
*
|
|
2045
|
+
* @param {String} name
|
|
2046
|
+
* @return {Boolean}
|
|
2047
|
+
* @api public
|
|
2048
|
+
*/
|
|
2049
|
+
function enabled(name) {
|
|
2050
|
+
if (name[name.length - 1] === '*') {
|
|
2051
|
+
return true;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
let i;
|
|
2055
|
+
let len;
|
|
2056
|
+
|
|
2057
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
2058
|
+
if (createDebug.skips[i].test(name)) {
|
|
2059
|
+
return false;
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
2064
|
+
if (createDebug.names[i].test(name)) {
|
|
2065
|
+
return true;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
return false;
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
/**
|
|
2073
|
+
* Convert regexp to namespace
|
|
2074
|
+
*
|
|
2075
|
+
* @param {RegExp} regxep
|
|
2076
|
+
* @return {String} namespace
|
|
2077
|
+
* @api private
|
|
2078
|
+
*/
|
|
2079
|
+
function toNamespace(regexp) {
|
|
2080
|
+
return regexp.toString()
|
|
2081
|
+
.substring(2, regexp.toString().length - 2)
|
|
2082
|
+
.replace(/\.\*\?$/, '*');
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* Coerce `val`.
|
|
2087
|
+
*
|
|
2088
|
+
* @param {Mixed} val
|
|
2089
|
+
* @return {Mixed}
|
|
2090
|
+
* @api private
|
|
2091
|
+
*/
|
|
2092
|
+
function coerce(val) {
|
|
2093
|
+
if (val instanceof Error) {
|
|
2094
|
+
return val.stack || val.message;
|
|
2095
|
+
}
|
|
2096
|
+
return val;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
/**
|
|
2100
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
2101
|
+
* XXX It WILL be removed in the next major release.
|
|
2102
|
+
*/
|
|
2103
|
+
function destroy() {
|
|
2104
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
createDebug.enable(createDebug.load());
|
|
2108
|
+
|
|
2109
|
+
return createDebug;
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
var common = setup;
|
|
2113
|
+
|
|
2114
|
+
/* eslint-env browser */
|
|
2115
|
+
|
|
2116
|
+
(function (module, exports) {
|
|
2117
|
+
/**
|
|
2118
|
+
* This is the web browser implementation of `debug()`.
|
|
2119
|
+
*/
|
|
2120
|
+
|
|
2121
|
+
exports.formatArgs = formatArgs;
|
|
2122
|
+
exports.save = save;
|
|
2123
|
+
exports.load = load;
|
|
2124
|
+
exports.useColors = useColors;
|
|
2125
|
+
exports.storage = localstorage();
|
|
2126
|
+
exports.destroy = (() => {
|
|
2127
|
+
let warned = false;
|
|
2128
|
+
|
|
2129
|
+
return () => {
|
|
2130
|
+
if (!warned) {
|
|
2131
|
+
warned = true;
|
|
2132
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
})();
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Colors.
|
|
2139
|
+
*/
|
|
2140
|
+
|
|
2141
|
+
exports.colors = [
|
|
2142
|
+
'#0000CC',
|
|
2143
|
+
'#0000FF',
|
|
2144
|
+
'#0033CC',
|
|
2145
|
+
'#0033FF',
|
|
2146
|
+
'#0066CC',
|
|
2147
|
+
'#0066FF',
|
|
2148
|
+
'#0099CC',
|
|
2149
|
+
'#0099FF',
|
|
2150
|
+
'#00CC00',
|
|
2151
|
+
'#00CC33',
|
|
2152
|
+
'#00CC66',
|
|
2153
|
+
'#00CC99',
|
|
2154
|
+
'#00CCCC',
|
|
2155
|
+
'#00CCFF',
|
|
2156
|
+
'#3300CC',
|
|
2157
|
+
'#3300FF',
|
|
2158
|
+
'#3333CC',
|
|
2159
|
+
'#3333FF',
|
|
2160
|
+
'#3366CC',
|
|
2161
|
+
'#3366FF',
|
|
2162
|
+
'#3399CC',
|
|
2163
|
+
'#3399FF',
|
|
2164
|
+
'#33CC00',
|
|
2165
|
+
'#33CC33',
|
|
2166
|
+
'#33CC66',
|
|
2167
|
+
'#33CC99',
|
|
2168
|
+
'#33CCCC',
|
|
2169
|
+
'#33CCFF',
|
|
2170
|
+
'#6600CC',
|
|
2171
|
+
'#6600FF',
|
|
2172
|
+
'#6633CC',
|
|
2173
|
+
'#6633FF',
|
|
2174
|
+
'#66CC00',
|
|
2175
|
+
'#66CC33',
|
|
2176
|
+
'#9900CC',
|
|
2177
|
+
'#9900FF',
|
|
2178
|
+
'#9933CC',
|
|
2179
|
+
'#9933FF',
|
|
2180
|
+
'#99CC00',
|
|
2181
|
+
'#99CC33',
|
|
2182
|
+
'#CC0000',
|
|
2183
|
+
'#CC0033',
|
|
2184
|
+
'#CC0066',
|
|
2185
|
+
'#CC0099',
|
|
2186
|
+
'#CC00CC',
|
|
2187
|
+
'#CC00FF',
|
|
2188
|
+
'#CC3300',
|
|
2189
|
+
'#CC3333',
|
|
2190
|
+
'#CC3366',
|
|
2191
|
+
'#CC3399',
|
|
2192
|
+
'#CC33CC',
|
|
2193
|
+
'#CC33FF',
|
|
2194
|
+
'#CC6600',
|
|
2195
|
+
'#CC6633',
|
|
2196
|
+
'#CC9900',
|
|
2197
|
+
'#CC9933',
|
|
2198
|
+
'#CCCC00',
|
|
2199
|
+
'#CCCC33',
|
|
2200
|
+
'#FF0000',
|
|
2201
|
+
'#FF0033',
|
|
2202
|
+
'#FF0066',
|
|
2203
|
+
'#FF0099',
|
|
2204
|
+
'#FF00CC',
|
|
2205
|
+
'#FF00FF',
|
|
2206
|
+
'#FF3300',
|
|
2207
|
+
'#FF3333',
|
|
2208
|
+
'#FF3366',
|
|
2209
|
+
'#FF3399',
|
|
2210
|
+
'#FF33CC',
|
|
2211
|
+
'#FF33FF',
|
|
2212
|
+
'#FF6600',
|
|
2213
|
+
'#FF6633',
|
|
2214
|
+
'#FF9900',
|
|
2215
|
+
'#FF9933',
|
|
2216
|
+
'#FFCC00',
|
|
2217
|
+
'#FFCC33'
|
|
2218
|
+
];
|
|
2219
|
+
|
|
2220
|
+
/**
|
|
2221
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
2222
|
+
* and the Firebug extension (any Firefox version) are known
|
|
2223
|
+
* to support "%c" CSS customizations.
|
|
2224
|
+
*
|
|
2225
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
2226
|
+
*/
|
|
2227
|
+
|
|
2228
|
+
// eslint-disable-next-line complexity
|
|
2229
|
+
function useColors() {
|
|
2230
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
2231
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
2232
|
+
// explicitly
|
|
2233
|
+
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
2234
|
+
return true;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
// Internet Explorer and Edge do not support colors.
|
|
2238
|
+
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
2239
|
+
return false;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
2243
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
2244
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
2245
|
+
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
2246
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
2247
|
+
// Is firefox >= v31?
|
|
2248
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
2249
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
2250
|
+
// Double check webkit in userAgent just in case we are in a worker
|
|
2251
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* Colorize log arguments if enabled.
|
|
2256
|
+
*
|
|
2257
|
+
* @api public
|
|
2258
|
+
*/
|
|
2259
|
+
|
|
2260
|
+
function formatArgs(args) {
|
|
2261
|
+
args[0] = (this.useColors ? '%c' : '') +
|
|
2262
|
+
this.namespace +
|
|
2263
|
+
(this.useColors ? ' %c' : ' ') +
|
|
2264
|
+
args[0] +
|
|
2265
|
+
(this.useColors ? '%c ' : ' ') +
|
|
2266
|
+
'+' + module.exports.humanize(this.diff);
|
|
2267
|
+
|
|
2268
|
+
if (!this.useColors) {
|
|
2269
|
+
return;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
const c = 'color: ' + this.color;
|
|
2273
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
2274
|
+
|
|
2275
|
+
// The final "%c" is somewhat tricky, because there could be other
|
|
2276
|
+
// arguments passed either before or after the %c, so we need to
|
|
2277
|
+
// figure out the correct index to insert the CSS into
|
|
2278
|
+
let index = 0;
|
|
2279
|
+
let lastC = 0;
|
|
2280
|
+
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
2281
|
+
if (match === '%%') {
|
|
2282
|
+
return;
|
|
2283
|
+
}
|
|
2284
|
+
index++;
|
|
2285
|
+
if (match === '%c') {
|
|
2286
|
+
// We only are interested in the *last* %c
|
|
2287
|
+
// (the user may have provided their own)
|
|
2288
|
+
lastC = index;
|
|
2289
|
+
}
|
|
2290
|
+
});
|
|
2291
|
+
|
|
2292
|
+
args.splice(lastC, 0, c);
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
/**
|
|
2296
|
+
* Invokes `console.debug()` when available.
|
|
2297
|
+
* No-op when `console.debug` is not a "function".
|
|
2298
|
+
* If `console.debug` is not available, falls back
|
|
2299
|
+
* to `console.log`.
|
|
2300
|
+
*
|
|
2301
|
+
* @api public
|
|
2302
|
+
*/
|
|
2303
|
+
exports.log = console.debug || console.log || (() => {});
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* Save `namespaces`.
|
|
2307
|
+
*
|
|
2308
|
+
* @param {String} namespaces
|
|
2309
|
+
* @api private
|
|
2310
|
+
*/
|
|
2311
|
+
function save(namespaces) {
|
|
2312
|
+
try {
|
|
2313
|
+
if (namespaces) {
|
|
2314
|
+
exports.storage.setItem('debug', namespaces);
|
|
2315
|
+
} else {
|
|
2316
|
+
exports.storage.removeItem('debug');
|
|
2317
|
+
}
|
|
2318
|
+
} catch (error) {
|
|
2319
|
+
// Swallow
|
|
2320
|
+
// XXX (@Qix-) should we be logging these?
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
/**
|
|
2325
|
+
* Load `namespaces`.
|
|
2326
|
+
*
|
|
2327
|
+
* @return {String} returns the previously persisted debug modes
|
|
2328
|
+
* @api private
|
|
2329
|
+
*/
|
|
2330
|
+
function load() {
|
|
2331
|
+
let r;
|
|
2332
|
+
try {
|
|
2333
|
+
r = exports.storage.getItem('debug');
|
|
2334
|
+
} catch (error) {
|
|
2335
|
+
// Swallow
|
|
2336
|
+
// XXX (@Qix-) should we be logging these?
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
2340
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
2341
|
+
r = process.env.DEBUG;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
return r;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* Localstorage attempts to return the localstorage.
|
|
2349
|
+
*
|
|
2350
|
+
* This is necessary because safari throws
|
|
2351
|
+
* when a user disables cookies/localstorage
|
|
2352
|
+
* and you attempt to access it.
|
|
2353
|
+
*
|
|
2354
|
+
* @return {LocalStorage}
|
|
2355
|
+
* @api private
|
|
2356
|
+
*/
|
|
2357
|
+
|
|
2358
|
+
function localstorage() {
|
|
2359
|
+
try {
|
|
2360
|
+
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
2361
|
+
// The Browser also has localStorage in the global context.
|
|
2362
|
+
return localStorage;
|
|
2363
|
+
} catch (error) {
|
|
2364
|
+
// Swallow
|
|
2365
|
+
// XXX (@Qix-) should we be logging these?
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
module.exports = common(exports);
|
|
2370
|
+
|
|
2371
|
+
const {formatters} = module.exports;
|
|
2372
|
+
|
|
2373
|
+
/**
|
|
2374
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
2375
|
+
*/
|
|
2376
|
+
|
|
2377
|
+
formatters.j = function (v) {
|
|
2378
|
+
try {
|
|
2379
|
+
return JSON.stringify(v);
|
|
2380
|
+
} catch (error) {
|
|
2381
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
2382
|
+
}
|
|
2383
|
+
};
|
|
2384
|
+
}(browser, browser.exports));
|
|
2385
|
+
|
|
2386
|
+
var debug = browser.exports;
|
|
2387
|
+
|
|
2388
|
+
const log = debug('pie-element:multiple-choice:print');
|
|
2389
|
+
/**
|
|
2390
|
+
* Live in same package as main element - so we can access some of the shared comps!
|
|
2391
|
+
*
|
|
2392
|
+
* - update pslb to build print if src/print.js is there
|
|
2393
|
+
* - update demo el
|
|
2394
|
+
* - get configure/controller building
|
|
2395
|
+
*/
|
|
2396
|
+
|
|
2397
|
+
const preparePrintModel = (model, opts) => {
|
|
2398
|
+
return model;
|
|
2399
|
+
};
|
|
2400
|
+
|
|
2401
|
+
class BoilerPlateItemTypePrint extends HTMLElement {
|
|
2402
|
+
constructor() {
|
|
2403
|
+
super();
|
|
2404
|
+
this._options = null;
|
|
2405
|
+
this._model = null;
|
|
2406
|
+
this._session = [];
|
|
2407
|
+
this._rerender = debounce_1(() => {
|
|
2408
|
+
if (this._model && this._session) {
|
|
2409
|
+
const printModel = preparePrintModel(this._model, this._options);
|
|
2410
|
+
const element = this._options && /*#__PURE__*/React.createElement(Main, {
|
|
2411
|
+
model: printModel,
|
|
2412
|
+
session: {}
|
|
2413
|
+
});
|
|
2414
|
+
ReactDOM.render(element, this, () => {
|
|
2415
|
+
log('render complete - render math');
|
|
2416
|
+
renderMath(this);
|
|
2417
|
+
});
|
|
2418
|
+
} else {
|
|
2419
|
+
log('skip');
|
|
2420
|
+
}
|
|
2421
|
+
}, 50, {
|
|
2422
|
+
leading: false,
|
|
2423
|
+
trailing: true
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
set options(o) {
|
|
2428
|
+
this._options = o;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
set model(s) {
|
|
2432
|
+
this._model = s;
|
|
2433
|
+
|
|
2434
|
+
this._rerender();
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
connectedCallback() {}
|
|
2438
|
+
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
export { BoilerPlateItemTypePrint as default };
|
|
2442
|
+
//# sourceMappingURL=print.js.map
|