graphiql-rails 1.4.11 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2976 @@
1
+ /** @license React v16.6.0
2
+ * react.development.js
3
+ *
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ (function (global, factory) {
13
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
14
+ typeof define === 'function' && define.amd ? define(factory) :
15
+ (global.React = factory());
16
+ }(this, (function () { 'use strict';
17
+
18
+ // TODO: this is special because it gets imported during build.
19
+
20
+ var ReactVersion = '16.6.0';
21
+
22
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
23
+ // nor polyfill, then a plain number is used for performance.
24
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
25
+
26
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
27
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
28
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
29
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
30
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
31
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
32
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
33
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
34
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
35
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
36
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
37
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
38
+
39
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
40
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
41
+
42
+ function getIteratorFn(maybeIterable) {
43
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
44
+ return null;
45
+ }
46
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
47
+ if (typeof maybeIterator === 'function') {
48
+ return maybeIterator;
49
+ }
50
+ return null;
51
+ }
52
+
53
+ /*
54
+ object-assign
55
+ (c) Sindre Sorhus
56
+ @license MIT
57
+ */
58
+
59
+
60
+ /* eslint-disable no-unused-vars */
61
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
62
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
63
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
64
+
65
+ function toObject(val) {
66
+ if (val === null || val === undefined) {
67
+ throw new TypeError('Object.assign cannot be called with null or undefined');
68
+ }
69
+
70
+ return Object(val);
71
+ }
72
+
73
+ function shouldUseNative() {
74
+ try {
75
+ if (!Object.assign) {
76
+ return false;
77
+ }
78
+
79
+ // Detect buggy property enumeration order in older V8 versions.
80
+
81
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
82
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
83
+ test1[5] = 'de';
84
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
85
+ return false;
86
+ }
87
+
88
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
89
+ var test2 = {};
90
+ for (var i = 0; i < 10; i++) {
91
+ test2['_' + String.fromCharCode(i)] = i;
92
+ }
93
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
94
+ return test2[n];
95
+ });
96
+ if (order2.join('') !== '0123456789') {
97
+ return false;
98
+ }
99
+
100
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
101
+ var test3 = {};
102
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
103
+ test3[letter] = letter;
104
+ });
105
+ if (Object.keys(Object.assign({}, test3)).join('') !==
106
+ 'abcdefghijklmnopqrst') {
107
+ return false;
108
+ }
109
+
110
+ return true;
111
+ } catch (err) {
112
+ // We don't expect any of the above to throw, but better to be safe.
113
+ return false;
114
+ }
115
+ }
116
+
117
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
118
+ var from;
119
+ var to = toObject(target);
120
+ var symbols;
121
+
122
+ for (var s = 1; s < arguments.length; s++) {
123
+ from = Object(arguments[s]);
124
+
125
+ for (var key in from) {
126
+ if (hasOwnProperty.call(from, key)) {
127
+ to[key] = from[key];
128
+ }
129
+ }
130
+
131
+ if (getOwnPropertySymbols) {
132
+ symbols = getOwnPropertySymbols(from);
133
+ for (var i = 0; i < symbols.length; i++) {
134
+ if (propIsEnumerable.call(from, symbols[i])) {
135
+ to[symbols[i]] = from[symbols[i]];
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ return to;
142
+ };
143
+
144
+ /**
145
+ * Use invariant() to assert state which your program assumes to be true.
146
+ *
147
+ * Provide sprintf-style format (only %s is supported) and arguments
148
+ * to provide information about what broke and what you were
149
+ * expecting.
150
+ *
151
+ * The invariant message will be stripped in production, but the invariant
152
+ * will remain to ensure logic does not differ in production.
153
+ */
154
+
155
+ var validateFormat = function () {};
156
+
157
+ {
158
+ validateFormat = function (format) {
159
+ if (format === undefined) {
160
+ throw new Error('invariant requires an error message argument');
161
+ }
162
+ };
163
+ }
164
+
165
+ function invariant(condition, format, a, b, c, d, e, f) {
166
+ validateFormat(format);
167
+
168
+ if (!condition) {
169
+ var error = void 0;
170
+ if (format === undefined) {
171
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
172
+ } else {
173
+ var args = [a, b, c, d, e, f];
174
+ var argIndex = 0;
175
+ error = new Error(format.replace(/%s/g, function () {
176
+ return args[argIndex++];
177
+ }));
178
+ error.name = 'Invariant Violation';
179
+ }
180
+
181
+ error.framesToPop = 1; // we don't care about invariant's own frame
182
+ throw error;
183
+ }
184
+ }
185
+
186
+ // Relying on the `invariant()` implementation lets us
187
+ // preserve the format and params in the www builds.
188
+
189
+ /**
190
+ * Forked from fbjs/warning:
191
+ * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
192
+ *
193
+ * Only change is we use console.warn instead of console.error,
194
+ * and do nothing when 'console' is not supported.
195
+ * This really simplifies the code.
196
+ * ---
197
+ * Similar to invariant but only logs a warning if the condition is not met.
198
+ * This can be used to log issues in development environments in critical
199
+ * paths. Removing the logging code for production environments will keep the
200
+ * same logic and follow the same code paths.
201
+ */
202
+
203
+ var lowPriorityWarning = function () {};
204
+
205
+ {
206
+ var printWarning = function (format) {
207
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
208
+ args[_key - 1] = arguments[_key];
209
+ }
210
+
211
+ var argIndex = 0;
212
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
213
+ return args[argIndex++];
214
+ });
215
+ if (typeof console !== 'undefined') {
216
+ console.warn(message);
217
+ }
218
+ try {
219
+ // --- Welcome to debugging React ---
220
+ // This error was thrown as a convenience so that you can use this stack
221
+ // to find the callsite that caused this warning to fire.
222
+ throw new Error(message);
223
+ } catch (x) {}
224
+ };
225
+
226
+ lowPriorityWarning = function (condition, format) {
227
+ if (format === undefined) {
228
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
229
+ }
230
+ if (!condition) {
231
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
232
+ args[_key2 - 2] = arguments[_key2];
233
+ }
234
+
235
+ printWarning.apply(undefined, [format].concat(args));
236
+ }
237
+ };
238
+ }
239
+
240
+ var lowPriorityWarning$1 = lowPriorityWarning;
241
+
242
+ /**
243
+ * Similar to invariant but only logs a warning if the condition is not met.
244
+ * This can be used to log issues in development environments in critical
245
+ * paths. Removing the logging code for production environments will keep the
246
+ * same logic and follow the same code paths.
247
+ */
248
+
249
+ var warningWithoutStack = function () {};
250
+
251
+ {
252
+ warningWithoutStack = function (condition, format) {
253
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
254
+ args[_key - 2] = arguments[_key];
255
+ }
256
+
257
+ if (format === undefined) {
258
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
259
+ }
260
+ if (args.length > 8) {
261
+ // Check before the condition to catch violations early.
262
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
263
+ }
264
+ if (condition) {
265
+ return;
266
+ }
267
+ if (typeof console !== 'undefined') {
268
+ var _args$map = args.map(function (item) {
269
+ return '' + item;
270
+ }),
271
+ a = _args$map[0],
272
+ b = _args$map[1],
273
+ c = _args$map[2],
274
+ d = _args$map[3],
275
+ e = _args$map[4],
276
+ f = _args$map[5],
277
+ g = _args$map[6],
278
+ h = _args$map[7];
279
+
280
+ var message = 'Warning: ' + format;
281
+
282
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
283
+ // https://github.com/facebook/react/issues/13610
284
+ switch (args.length) {
285
+ case 0:
286
+ console.error(message);
287
+ break;
288
+ case 1:
289
+ console.error(message, a);
290
+ break;
291
+ case 2:
292
+ console.error(message, a, b);
293
+ break;
294
+ case 3:
295
+ console.error(message, a, b, c);
296
+ break;
297
+ case 4:
298
+ console.error(message, a, b, c, d);
299
+ break;
300
+ case 5:
301
+ console.error(message, a, b, c, d, e);
302
+ break;
303
+ case 6:
304
+ console.error(message, a, b, c, d, e, f);
305
+ break;
306
+ case 7:
307
+ console.error(message, a, b, c, d, e, f, g);
308
+ break;
309
+ case 8:
310
+ console.error(message, a, b, c, d, e, f, g, h);
311
+ break;
312
+ default:
313
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
314
+ }
315
+ }
316
+ try {
317
+ // --- Welcome to debugging React ---
318
+ // This error was thrown as a convenience so that you can use this stack
319
+ // to find the callsite that caused this warning to fire.
320
+ var argIndex = 0;
321
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
322
+ return args[argIndex++];
323
+ });
324
+ throw new Error(_message);
325
+ } catch (x) {}
326
+ };
327
+ }
328
+
329
+ var warningWithoutStack$1 = warningWithoutStack;
330
+
331
+ var didWarnStateUpdateForUnmountedComponent = {};
332
+
333
+ function warnNoop(publicInstance, callerName) {
334
+ {
335
+ var _constructor = publicInstance.constructor;
336
+ var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
337
+ var warningKey = componentName + '.' + callerName;
338
+ if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
339
+ return;
340
+ }
341
+ warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
342
+ didWarnStateUpdateForUnmountedComponent[warningKey] = true;
343
+ }
344
+ }
345
+
346
+ /**
347
+ * This is the abstract API for an update queue.
348
+ */
349
+ var ReactNoopUpdateQueue = {
350
+ /**
351
+ * Checks whether or not this composite component is mounted.
352
+ * @param {ReactClass} publicInstance The instance we want to test.
353
+ * @return {boolean} True if mounted, false otherwise.
354
+ * @protected
355
+ * @final
356
+ */
357
+ isMounted: function (publicInstance) {
358
+ return false;
359
+ },
360
+
361
+ /**
362
+ * Forces an update. This should only be invoked when it is known with
363
+ * certainty that we are **not** in a DOM transaction.
364
+ *
365
+ * You may want to call this when you know that some deeper aspect of the
366
+ * component's state has changed but `setState` was not called.
367
+ *
368
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
369
+ * `componentWillUpdate` and `componentDidUpdate`.
370
+ *
371
+ * @param {ReactClass} publicInstance The instance that should rerender.
372
+ * @param {?function} callback Called after component is updated.
373
+ * @param {?string} callerName name of the calling function in the public API.
374
+ * @internal
375
+ */
376
+ enqueueForceUpdate: function (publicInstance, callback, callerName) {
377
+ warnNoop(publicInstance, 'forceUpdate');
378
+ },
379
+
380
+ /**
381
+ * Replaces all of the state. Always use this or `setState` to mutate state.
382
+ * You should treat `this.state` as immutable.
383
+ *
384
+ * There is no guarantee that `this.state` will be immediately updated, so
385
+ * accessing `this.state` after calling this method may return the old value.
386
+ *
387
+ * @param {ReactClass} publicInstance The instance that should rerender.
388
+ * @param {object} completeState Next state.
389
+ * @param {?function} callback Called after component is updated.
390
+ * @param {?string} callerName name of the calling function in the public API.
391
+ * @internal
392
+ */
393
+ enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
394
+ warnNoop(publicInstance, 'replaceState');
395
+ },
396
+
397
+ /**
398
+ * Sets a subset of the state. This only exists because _pendingState is
399
+ * internal. This provides a merging strategy that is not available to deep
400
+ * properties which is confusing. TODO: Expose pendingState or don't use it
401
+ * during the merge.
402
+ *
403
+ * @param {ReactClass} publicInstance The instance that should rerender.
404
+ * @param {object} partialState Next partial state to be merged with state.
405
+ * @param {?function} callback Called after component is updated.
406
+ * @param {?string} Name of the calling function in the public API.
407
+ * @internal
408
+ */
409
+ enqueueSetState: function (publicInstance, partialState, callback, callerName) {
410
+ warnNoop(publicInstance, 'setState');
411
+ }
412
+ };
413
+
414
+ var emptyObject = {};
415
+ {
416
+ Object.freeze(emptyObject);
417
+ }
418
+
419
+ /**
420
+ * Base class helpers for the updating state of a component.
421
+ */
422
+ function Component(props, context, updater) {
423
+ this.props = props;
424
+ this.context = context;
425
+ // If a component has string refs, we will assign a different object later.
426
+ this.refs = emptyObject;
427
+ // We initialize the default updater but the real one gets injected by the
428
+ // renderer.
429
+ this.updater = updater || ReactNoopUpdateQueue;
430
+ }
431
+
432
+ Component.prototype.isReactComponent = {};
433
+
434
+ /**
435
+ * Sets a subset of the state. Always use this to mutate
436
+ * state. You should treat `this.state` as immutable.
437
+ *
438
+ * There is no guarantee that `this.state` will be immediately updated, so
439
+ * accessing `this.state` after calling this method may return the old value.
440
+ *
441
+ * There is no guarantee that calls to `setState` will run synchronously,
442
+ * as they may eventually be batched together. You can provide an optional
443
+ * callback that will be executed when the call to setState is actually
444
+ * completed.
445
+ *
446
+ * When a function is provided to setState, it will be called at some point in
447
+ * the future (not synchronously). It will be called with the up to date
448
+ * component arguments (state, props, context). These values can be different
449
+ * from this.* because your function may be called after receiveProps but before
450
+ * shouldComponentUpdate, and this new state, props, and context will not yet be
451
+ * assigned to this.
452
+ *
453
+ * @param {object|function} partialState Next partial state or function to
454
+ * produce next partial state to be merged with current state.
455
+ * @param {?function} callback Called after state is updated.
456
+ * @final
457
+ * @protected
458
+ */
459
+ Component.prototype.setState = function (partialState, callback) {
460
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
461
+ this.updater.enqueueSetState(this, partialState, callback, 'setState');
462
+ };
463
+
464
+ /**
465
+ * Forces an update. This should only be invoked when it is known with
466
+ * certainty that we are **not** in a DOM transaction.
467
+ *
468
+ * You may want to call this when you know that some deeper aspect of the
469
+ * component's state has changed but `setState` was not called.
470
+ *
471
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
472
+ * `componentWillUpdate` and `componentDidUpdate`.
473
+ *
474
+ * @param {?function} callback Called after update is complete.
475
+ * @final
476
+ * @protected
477
+ */
478
+ Component.prototype.forceUpdate = function (callback) {
479
+ this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
480
+ };
481
+
482
+ /**
483
+ * Deprecated APIs. These APIs used to exist on classic React classes but since
484
+ * we would like to deprecate them, we're not going to move them over to this
485
+ * modern base class. Instead, we define a getter that warns if it's accessed.
486
+ */
487
+ {
488
+ var deprecatedAPIs = {
489
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
490
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
491
+ };
492
+ var defineDeprecationWarning = function (methodName, info) {
493
+ Object.defineProperty(Component.prototype, methodName, {
494
+ get: function () {
495
+ lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
496
+ return undefined;
497
+ }
498
+ });
499
+ };
500
+ for (var fnName in deprecatedAPIs) {
501
+ if (deprecatedAPIs.hasOwnProperty(fnName)) {
502
+ defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
503
+ }
504
+ }
505
+ }
506
+
507
+ function ComponentDummy() {}
508
+ ComponentDummy.prototype = Component.prototype;
509
+
510
+ /**
511
+ * Convenience component with default shallow equality check for sCU.
512
+ */
513
+ function PureComponent(props, context, updater) {
514
+ this.props = props;
515
+ this.context = context;
516
+ // If a component has string refs, we will assign a different object later.
517
+ this.refs = emptyObject;
518
+ this.updater = updater || ReactNoopUpdateQueue;
519
+ }
520
+
521
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
522
+ pureComponentPrototype.constructor = PureComponent;
523
+ // Avoid an extra prototype jump for these methods.
524
+ objectAssign(pureComponentPrototype, Component.prototype);
525
+ pureComponentPrototype.isPureReactComponent = true;
526
+
527
+ // an immutable object with a single mutable value
528
+ function createRef() {
529
+ var refObject = {
530
+ current: null
531
+ };
532
+ {
533
+ Object.seal(refObject);
534
+ }
535
+ return refObject;
536
+ }
537
+
538
+ /* eslint-disable no-var */
539
+
540
+ // TODO: Use symbols?
541
+ var ImmediatePriority = 1;
542
+ var UserBlockingPriority = 2;
543
+ var NormalPriority = 3;
544
+ var IdlePriority = 4;
545
+
546
+ // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
547
+ // Math.pow(2, 30) - 1
548
+ // 0b111111111111111111111111111111
549
+ var maxSigned31BitInt = 1073741823;
550
+
551
+ // Times out immediately
552
+ var IMMEDIATE_PRIORITY_TIMEOUT = -1;
553
+ // Eventually times out
554
+ var USER_BLOCKING_PRIORITY = 250;
555
+ var NORMAL_PRIORITY_TIMEOUT = 5000;
556
+ // Never times out
557
+ var IDLE_PRIORITY = maxSigned31BitInt;
558
+
559
+ // Callbacks are stored as a circular, doubly linked list.
560
+ var firstCallbackNode = null;
561
+
562
+ var currentPriorityLevel = NormalPriority;
563
+ var currentEventStartTime = -1;
564
+ var currentExpirationTime = -1;
565
+
566
+ // This is set when a callback is being executed, to prevent re-entrancy.
567
+ var isExecutingCallback = false;
568
+
569
+ var isHostCallbackScheduled = false;
570
+
571
+ var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
572
+
573
+ var timeRemaining;
574
+ if (hasNativePerformanceNow) {
575
+ timeRemaining = function () {
576
+ if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
577
+ // A higher priority callback was scheduled. Yield so we can switch to
578
+ // working on that.
579
+ return 0;
580
+ }
581
+ // We assume that if we have a performance timer that the rAF callback
582
+ // gets a performance timer value. Not sure if this is always true.
583
+ var remaining = getFrameDeadline() - performance.now();
584
+ return remaining > 0 ? remaining : 0;
585
+ };
586
+ } else {
587
+ timeRemaining = function () {
588
+ // Fallback to Date.now()
589
+ if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
590
+ return 0;
591
+ }
592
+ var remaining = getFrameDeadline() - Date.now();
593
+ return remaining > 0 ? remaining : 0;
594
+ };
595
+ }
596
+
597
+ var deadlineObject = {
598
+ timeRemaining: timeRemaining,
599
+ didTimeout: false
600
+ };
601
+
602
+ function ensureHostCallbackIsScheduled() {
603
+ if (isExecutingCallback) {
604
+ // Don't schedule work yet; wait until the next time we yield.
605
+ return;
606
+ }
607
+ // Schedule the host callback using the earliest expiration in the list.
608
+ var expirationTime = firstCallbackNode.expirationTime;
609
+ if (!isHostCallbackScheduled) {
610
+ isHostCallbackScheduled = true;
611
+ } else {
612
+ // Cancel the existing host callback.
613
+ cancelHostCallback();
614
+ }
615
+ requestHostCallback(flushWork, expirationTime);
616
+ }
617
+
618
+ function flushFirstCallback() {
619
+ var flushedNode = firstCallbackNode;
620
+
621
+ // Remove the node from the list before calling the callback. That way the
622
+ // list is in a consistent state even if the callback throws.
623
+ var next = firstCallbackNode.next;
624
+ if (firstCallbackNode === next) {
625
+ // This is the last callback in the list.
626
+ firstCallbackNode = null;
627
+ next = null;
628
+ } else {
629
+ var lastCallbackNode = firstCallbackNode.previous;
630
+ firstCallbackNode = lastCallbackNode.next = next;
631
+ next.previous = lastCallbackNode;
632
+ }
633
+
634
+ flushedNode.next = flushedNode.previous = null;
635
+
636
+ // Now it's safe to call the callback.
637
+ var callback = flushedNode.callback;
638
+ var expirationTime = flushedNode.expirationTime;
639
+ var priorityLevel = flushedNode.priorityLevel;
640
+ var previousPriorityLevel = currentPriorityLevel;
641
+ var previousExpirationTime = currentExpirationTime;
642
+ currentPriorityLevel = priorityLevel;
643
+ currentExpirationTime = expirationTime;
644
+ var continuationCallback;
645
+ try {
646
+ continuationCallback = callback(deadlineObject);
647
+ } finally {
648
+ currentPriorityLevel = previousPriorityLevel;
649
+ currentExpirationTime = previousExpirationTime;
650
+ }
651
+
652
+ // A callback may return a continuation. The continuation should be scheduled
653
+ // with the same priority and expiration as the just-finished callback.
654
+ if (typeof continuationCallback === 'function') {
655
+ var continuationNode = {
656
+ callback: continuationCallback,
657
+ priorityLevel: priorityLevel,
658
+ expirationTime: expirationTime,
659
+ next: null,
660
+ previous: null
661
+ };
662
+
663
+ // Insert the new callback into the list, sorted by its expiration. This is
664
+ // almost the same as the code in `scheduleCallback`, except the callback
665
+ // is inserted into the list *before* callbacks of equal expiration instead
666
+ // of after.
667
+ if (firstCallbackNode === null) {
668
+ // This is the first callback in the list.
669
+ firstCallbackNode = continuationNode.next = continuationNode.previous = continuationNode;
670
+ } else {
671
+ var nextAfterContinuation = null;
672
+ var node = firstCallbackNode;
673
+ do {
674
+ if (node.expirationTime >= expirationTime) {
675
+ // This callback expires at or after the continuation. We will insert
676
+ // the continuation *before* this callback.
677
+ nextAfterContinuation = node;
678
+ break;
679
+ }
680
+ node = node.next;
681
+ } while (node !== firstCallbackNode);
682
+
683
+ if (nextAfterContinuation === null) {
684
+ // No equal or lower priority callback was found, which means the new
685
+ // callback is the lowest priority callback in the list.
686
+ nextAfterContinuation = firstCallbackNode;
687
+ } else if (nextAfterContinuation === firstCallbackNode) {
688
+ // The new callback is the highest priority callback in the list.
689
+ firstCallbackNode = continuationNode;
690
+ ensureHostCallbackIsScheduled();
691
+ }
692
+
693
+ var previous = nextAfterContinuation.previous;
694
+ previous.next = nextAfterContinuation.previous = continuationNode;
695
+ continuationNode.next = nextAfterContinuation;
696
+ continuationNode.previous = previous;
697
+ }
698
+ }
699
+ }
700
+
701
+ function flushImmediateWork() {
702
+ if (
703
+ // Confirm we've exited the outer most event handler
704
+ currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
705
+ isExecutingCallback = true;
706
+ deadlineObject.didTimeout = true;
707
+ try {
708
+ do {
709
+ flushFirstCallback();
710
+ } while (
711
+ // Keep flushing until there are no more immediate callbacks
712
+ firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority);
713
+ } finally {
714
+ isExecutingCallback = false;
715
+ if (firstCallbackNode !== null) {
716
+ // There's still work remaining. Request another callback.
717
+ ensureHostCallbackIsScheduled();
718
+ } else {
719
+ isHostCallbackScheduled = false;
720
+ }
721
+ }
722
+ }
723
+ }
724
+
725
+ function flushWork(didTimeout) {
726
+ isExecutingCallback = true;
727
+ deadlineObject.didTimeout = didTimeout;
728
+ try {
729
+ if (didTimeout) {
730
+ // Flush all the expired callbacks without yielding.
731
+ while (firstCallbackNode !== null) {
732
+ // Read the current time. Flush all the callbacks that expire at or
733
+ // earlier than that time. Then read the current time again and repeat.
734
+ // This optimizes for as few performance.now calls as possible.
735
+ var currentTime = getCurrentTime();
736
+ if (firstCallbackNode.expirationTime <= currentTime) {
737
+ do {
738
+ flushFirstCallback();
739
+ } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime);
740
+ continue;
741
+ }
742
+ break;
743
+ }
744
+ } else {
745
+ // Keep flushing callbacks until we run out of time in the frame.
746
+ if (firstCallbackNode !== null) {
747
+ do {
748
+ flushFirstCallback();
749
+ } while (firstCallbackNode !== null && getFrameDeadline() - getCurrentTime() > 0);
750
+ }
751
+ }
752
+ } finally {
753
+ isExecutingCallback = false;
754
+ if (firstCallbackNode !== null) {
755
+ // There's still work remaining. Request another callback.
756
+ ensureHostCallbackIsScheduled();
757
+ } else {
758
+ isHostCallbackScheduled = false;
759
+ }
760
+ // Before exiting, flush all the immediate work that was scheduled.
761
+ flushImmediateWork();
762
+ }
763
+ }
764
+
765
+ function unstable_runWithPriority(priorityLevel, eventHandler) {
766
+ switch (priorityLevel) {
767
+ case ImmediatePriority:
768
+ case UserBlockingPriority:
769
+ case NormalPriority:
770
+ case IdlePriority:
771
+ break;
772
+ default:
773
+ priorityLevel = NormalPriority;
774
+ }
775
+
776
+ var previousPriorityLevel = currentPriorityLevel;
777
+ var previousEventStartTime = currentEventStartTime;
778
+ currentPriorityLevel = priorityLevel;
779
+ currentEventStartTime = getCurrentTime();
780
+
781
+ try {
782
+ return eventHandler();
783
+ } finally {
784
+ currentPriorityLevel = previousPriorityLevel;
785
+ currentEventStartTime = previousEventStartTime;
786
+
787
+ // Before exiting, flush all the immediate work that was scheduled.
788
+ flushImmediateWork();
789
+ }
790
+ }
791
+
792
+ function unstable_wrapCallback(callback) {
793
+ var parentPriorityLevel = currentPriorityLevel;
794
+ return function () {
795
+ // This is a fork of runWithPriority, inlined for performance.
796
+ var previousPriorityLevel = currentPriorityLevel;
797
+ var previousEventStartTime = currentEventStartTime;
798
+ currentPriorityLevel = parentPriorityLevel;
799
+ currentEventStartTime = getCurrentTime();
800
+
801
+ try {
802
+ return callback.apply(this, arguments);
803
+ } finally {
804
+ currentPriorityLevel = previousPriorityLevel;
805
+ currentEventStartTime = previousEventStartTime;
806
+ flushImmediateWork();
807
+ }
808
+ };
809
+ }
810
+
811
+ function unstable_scheduleCallback(callback, deprecated_options) {
812
+ var startTime = currentEventStartTime !== -1 ? currentEventStartTime : getCurrentTime();
813
+
814
+ var expirationTime;
815
+ if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
816
+ // FIXME: Remove this branch once we lift expiration times out of React.
817
+ expirationTime = startTime + deprecated_options.timeout;
818
+ } else {
819
+ switch (currentPriorityLevel) {
820
+ case ImmediatePriority:
821
+ expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
822
+ break;
823
+ case UserBlockingPriority:
824
+ expirationTime = startTime + USER_BLOCKING_PRIORITY;
825
+ break;
826
+ case IdlePriority:
827
+ expirationTime = startTime + IDLE_PRIORITY;
828
+ break;
829
+ case NormalPriority:
830
+ default:
831
+ expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
832
+ }
833
+ }
834
+
835
+ var newNode = {
836
+ callback: callback,
837
+ priorityLevel: currentPriorityLevel,
838
+ expirationTime: expirationTime,
839
+ next: null,
840
+ previous: null
841
+ };
842
+
843
+ // Insert the new callback into the list, ordered first by expiration, then
844
+ // by insertion. So the new callback is inserted any other callback with
845
+ // equal expiration.
846
+ if (firstCallbackNode === null) {
847
+ // This is the first callback in the list.
848
+ firstCallbackNode = newNode.next = newNode.previous = newNode;
849
+ ensureHostCallbackIsScheduled();
850
+ } else {
851
+ var next = null;
852
+ var node = firstCallbackNode;
853
+ do {
854
+ if (node.expirationTime > expirationTime) {
855
+ // The new callback expires before this one.
856
+ next = node;
857
+ break;
858
+ }
859
+ node = node.next;
860
+ } while (node !== firstCallbackNode);
861
+
862
+ if (next === null) {
863
+ // No callback with a later expiration was found, which means the new
864
+ // callback has the latest expiration in the list.
865
+ next = firstCallbackNode;
866
+ } else if (next === firstCallbackNode) {
867
+ // The new callback has the earliest expiration in the entire list.
868
+ firstCallbackNode = newNode;
869
+ ensureHostCallbackIsScheduled();
870
+ }
871
+
872
+ var previous = next.previous;
873
+ previous.next = next.previous = newNode;
874
+ newNode.next = next;
875
+ newNode.previous = previous;
876
+ }
877
+
878
+ return newNode;
879
+ }
880
+
881
+ function unstable_cancelCallback(callbackNode) {
882
+ var next = callbackNode.next;
883
+ if (next === null) {
884
+ // Already cancelled.
885
+ return;
886
+ }
887
+
888
+ if (next === callbackNode) {
889
+ // This is the only scheduled callback. Clear the list.
890
+ firstCallbackNode = null;
891
+ } else {
892
+ // Remove the callback from its position in the list.
893
+ if (callbackNode === firstCallbackNode) {
894
+ firstCallbackNode = next;
895
+ }
896
+ var previous = callbackNode.previous;
897
+ previous.next = next;
898
+ next.previous = previous;
899
+ }
900
+
901
+ callbackNode.next = callbackNode.previous = null;
902
+ }
903
+
904
+ function unstable_getCurrentPriorityLevel() {
905
+ return currentPriorityLevel;
906
+ }
907
+
908
+ // The remaining code is essentially a polyfill for requestIdleCallback. It
909
+ // works by scheduling a requestAnimationFrame, storing the time for the start
910
+ // of the frame, then scheduling a postMessage which gets scheduled after paint.
911
+ // Within the postMessage handler do as much work as possible until time + frame
912
+ // rate. By separating the idle call into a separate event tick we ensure that
913
+ // layout, paint and other browser work is counted against the available time.
914
+ // The frame rate is dynamically adjusted.
915
+
916
+ // We capture a local reference to any global, in case it gets polyfilled after
917
+ // this module is initially evaluated. We want to be using a
918
+ // consistent implementation.
919
+ var localDate = Date;
920
+
921
+ // This initialization code may run even on server environments if a component
922
+ // just imports ReactDOM (e.g. for findDOMNode). Some environments might not
923
+ // have setTimeout or clearTimeout. However, we always expect them to be defined
924
+ // on the client. https://github.com/facebook/react/pull/13088
925
+ var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
926
+ var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
927
+
928
+ // We don't expect either of these to necessarily be defined, but we will error
929
+ // later if they are missing on the client.
930
+ var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
931
+ var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
932
+
933
+ var getCurrentTime;
934
+
935
+ // requestAnimationFrame does not run when the tab is in the background. If
936
+ // we're backgrounded we prefer for that work to happen so that the page
937
+ // continues to load in the background. So we also schedule a 'setTimeout' as
938
+ // a fallback.
939
+ // TODO: Need a better heuristic for backgrounded work.
940
+ var ANIMATION_FRAME_TIMEOUT = 100;
941
+ var rAFID;
942
+ var rAFTimeoutID;
943
+ var requestAnimationFrameWithTimeout = function (callback) {
944
+ // schedule rAF and also a setTimeout
945
+ rAFID = localRequestAnimationFrame(function (timestamp) {
946
+ // cancel the setTimeout
947
+ localClearTimeout(rAFTimeoutID);
948
+ callback(timestamp);
949
+ });
950
+ rAFTimeoutID = localSetTimeout(function () {
951
+ // cancel the requestAnimationFrame
952
+ localCancelAnimationFrame(rAFID);
953
+ callback(getCurrentTime());
954
+ }, ANIMATION_FRAME_TIMEOUT);
955
+ };
956
+
957
+ if (hasNativePerformanceNow) {
958
+ var Performance = performance;
959
+ getCurrentTime = function () {
960
+ return Performance.now();
961
+ };
962
+ } else {
963
+ getCurrentTime = function () {
964
+ return localDate.now();
965
+ };
966
+ }
967
+
968
+ var requestHostCallback;
969
+ var cancelHostCallback;
970
+ var getFrameDeadline;
971
+
972
+ if (typeof window !== 'undefined' && window._schedMock) {
973
+ // Dynamic injection, only for testing purposes.
974
+ var impl = window._schedMock;
975
+ requestHostCallback = impl[0];
976
+ cancelHostCallback = impl[1];
977
+ getFrameDeadline = impl[2];
978
+ } else if (
979
+ // If Scheduler runs in a non-DOM environment, it falls back to a naive
980
+ // implementation using setTimeout.
981
+ typeof window === 'undefined' ||
982
+ // "addEventListener" might not be available on the window object
983
+ // if this is a mocked "window" object. So we need to validate that too.
984
+ typeof window.addEventListener !== 'function') {
985
+ var _callback = null;
986
+ var _currentTime = -1;
987
+ var _flushCallback = function (didTimeout, ms) {
988
+ if (_callback !== null) {
989
+ var cb = _callback;
990
+ _callback = null;
991
+ try {
992
+ _currentTime = ms;
993
+ cb(didTimeout);
994
+ } finally {
995
+ _currentTime = -1;
996
+ }
997
+ }
998
+ };
999
+ requestHostCallback = function (cb, ms) {
1000
+ if (_currentTime !== -1) {
1001
+ // Protect against re-entrancy.
1002
+ setTimeout(requestHostCallback, 0, cb, ms);
1003
+ } else {
1004
+ _callback = cb;
1005
+ setTimeout(_flushCallback, ms, true, ms);
1006
+ setTimeout(_flushCallback, maxSigned31BitInt, false, maxSigned31BitInt);
1007
+ }
1008
+ };
1009
+ cancelHostCallback = function () {
1010
+ _callback = null;
1011
+ };
1012
+ getFrameDeadline = function () {
1013
+ return Infinity;
1014
+ };
1015
+ getCurrentTime = function () {
1016
+ return _currentTime === -1 ? 0 : _currentTime;
1017
+ };
1018
+ } else {
1019
+ if (typeof console !== 'undefined') {
1020
+ // TODO: Remove fb.me link
1021
+ if (typeof localRequestAnimationFrame !== 'function') {
1022
+ console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
1023
+ }
1024
+ if (typeof localCancelAnimationFrame !== 'function') {
1025
+ console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
1026
+ }
1027
+ }
1028
+
1029
+ var scheduledHostCallback = null;
1030
+ var isMessageEventScheduled = false;
1031
+ var timeoutTime = -1;
1032
+
1033
+ var isAnimationFrameScheduled = false;
1034
+
1035
+ var isFlushingHostCallback = false;
1036
+
1037
+ var frameDeadline = 0;
1038
+ // We start out assuming that we run at 30fps but then the heuristic tracking
1039
+ // will adjust this value to a faster fps if we get more frequent animation
1040
+ // frames.
1041
+ var previousFrameTime = 33;
1042
+ var activeFrameTime = 33;
1043
+
1044
+ getFrameDeadline = function () {
1045
+ return frameDeadline;
1046
+ };
1047
+
1048
+ // We use the postMessage trick to defer idle work until after the repaint.
1049
+ var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2);
1050
+ var idleTick = function (event) {
1051
+ if (event.source !== window || event.data !== messageKey) {
1052
+ return;
1053
+ }
1054
+
1055
+ isMessageEventScheduled = false;
1056
+
1057
+ var prevScheduledCallback = scheduledHostCallback;
1058
+ var prevTimeoutTime = timeoutTime;
1059
+ scheduledHostCallback = null;
1060
+ timeoutTime = -1;
1061
+
1062
+ var currentTime = getCurrentTime();
1063
+
1064
+ var didTimeout = false;
1065
+ if (frameDeadline - currentTime <= 0) {
1066
+ // There's no time left in this idle period. Check if the callback has
1067
+ // a timeout and whether it's been exceeded.
1068
+ if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
1069
+ // Exceeded the timeout. Invoke the callback even though there's no
1070
+ // time left.
1071
+ didTimeout = true;
1072
+ } else {
1073
+ // No timeout.
1074
+ if (!isAnimationFrameScheduled) {
1075
+ // Schedule another animation callback so we retry later.
1076
+ isAnimationFrameScheduled = true;
1077
+ requestAnimationFrameWithTimeout(animationTick);
1078
+ }
1079
+ // Exit without invoking the callback.
1080
+ scheduledHostCallback = prevScheduledCallback;
1081
+ timeoutTime = prevTimeoutTime;
1082
+ return;
1083
+ }
1084
+ }
1085
+
1086
+ if (prevScheduledCallback !== null) {
1087
+ isFlushingHostCallback = true;
1088
+ try {
1089
+ prevScheduledCallback(didTimeout);
1090
+ } finally {
1091
+ isFlushingHostCallback = false;
1092
+ }
1093
+ }
1094
+ };
1095
+ // Assumes that we have addEventListener in this environment. Might need
1096
+ // something better for old IE.
1097
+ window.addEventListener('message', idleTick, false);
1098
+
1099
+ var animationTick = function (rafTime) {
1100
+ if (scheduledHostCallback !== null) {
1101
+ // Eagerly schedule the next animation callback at the beginning of the
1102
+ // frame. If the scheduler queue is not empty at the end of the frame, it
1103
+ // will continue flushing inside that callback. If the queue *is* empty,
1104
+ // then it will exit immediately. Posting the callback at the start of the
1105
+ // frame ensures it's fired within the earliest possible frame. If we
1106
+ // waited until the end of the frame to post the callback, we risk the
1107
+ // browser skipping a frame and not firing the callback until the frame
1108
+ // after that.
1109
+ requestAnimationFrameWithTimeout(animationTick);
1110
+ } else {
1111
+ // No pending work. Exit.
1112
+ isAnimationFrameScheduled = false;
1113
+ return;
1114
+ }
1115
+
1116
+ var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
1117
+ if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
1118
+ if (nextFrameTime < 8) {
1119
+ // Defensive coding. We don't support higher frame rates than 120hz.
1120
+ // If the calculated frame time gets lower than 8, it is probably a bug.
1121
+ nextFrameTime = 8;
1122
+ }
1123
+ // If one frame goes long, then the next one can be short to catch up.
1124
+ // If two frames are short in a row, then that's an indication that we
1125
+ // actually have a higher frame rate than what we're currently optimizing.
1126
+ // We adjust our heuristic dynamically accordingly. For example, if we're
1127
+ // running on 120hz display or 90hz VR display.
1128
+ // Take the max of the two in case one of them was an anomaly due to
1129
+ // missed frame deadlines.
1130
+ activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
1131
+ } else {
1132
+ previousFrameTime = nextFrameTime;
1133
+ }
1134
+ frameDeadline = rafTime + activeFrameTime;
1135
+ if (!isMessageEventScheduled) {
1136
+ isMessageEventScheduled = true;
1137
+ window.postMessage(messageKey, '*');
1138
+ }
1139
+ };
1140
+
1141
+ requestHostCallback = function (callback, absoluteTimeout) {
1142
+ scheduledHostCallback = callback;
1143
+ timeoutTime = absoluteTimeout;
1144
+ if (isFlushingHostCallback || absoluteTimeout < 0) {
1145
+ // Don't wait for the next frame. Continue working ASAP, in a new event.
1146
+ window.postMessage(messageKey, '*');
1147
+ } else if (!isAnimationFrameScheduled) {
1148
+ // If rAF didn't already schedule one, we need to schedule a frame.
1149
+ // TODO: If this rAF doesn't materialize because the browser throttles, we
1150
+ // might want to still have setTimeout trigger rIC as a backup to ensure
1151
+ // that we keep performing work.
1152
+ isAnimationFrameScheduled = true;
1153
+ requestAnimationFrameWithTimeout(animationTick);
1154
+ }
1155
+ };
1156
+
1157
+ cancelHostCallback = function () {
1158
+ scheduledHostCallback = null;
1159
+ isMessageEventScheduled = false;
1160
+ timeoutTime = -1;
1161
+ };
1162
+ }
1163
+
1164
+ // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
1165
+
1166
+
1167
+ // In some cases, StrictMode should also double-render lifecycles.
1168
+ // This can be confusing for tests though,
1169
+ // And it can be bad for performance in production.
1170
+ // This feature flag can be used to control the behavior:
1171
+
1172
+
1173
+ // To preserve the "Pause on caught exceptions" behavior of the debugger, we
1174
+ // replay the begin phase of a failed component inside invokeGuardedCallback.
1175
+
1176
+
1177
+ // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
1178
+
1179
+
1180
+ // Gather advanced timing metrics for Profiler subtrees.
1181
+
1182
+
1183
+ // Trace which interactions trigger each commit.
1184
+ var enableSchedulerTracing = true;
1185
+
1186
+ // Only used in www builds.
1187
+
1188
+
1189
+ // Only used in www builds.
1190
+
1191
+
1192
+ // React Fire: prevent the value and checked attributes from syncing
1193
+ // with their related DOM properties
1194
+
1195
+ var DEFAULT_THREAD_ID = 0;
1196
+
1197
+ // Counters used to generate unique IDs.
1198
+ var interactionIDCounter = 0;
1199
+ var threadIDCounter = 0;
1200
+
1201
+ // Set of currently traced interactions.
1202
+ // Interactions "stack"–
1203
+ // Meaning that newly traced interactions are appended to the previously active set.
1204
+ // When an interaction goes out of scope, the previous set (if any) is restored.
1205
+ var interactionsRef = null;
1206
+
1207
+ // Listener(s) to notify when interactions begin and end.
1208
+ var subscriberRef = null;
1209
+
1210
+ if (enableSchedulerTracing) {
1211
+ interactionsRef = {
1212
+ current: new Set()
1213
+ };
1214
+ subscriberRef = {
1215
+ current: null
1216
+ };
1217
+ }
1218
+
1219
+ function unstable_clear(callback) {
1220
+ if (!enableSchedulerTracing) {
1221
+ return callback();
1222
+ }
1223
+
1224
+ var prevInteractions = interactionsRef.current;
1225
+ interactionsRef.current = new Set();
1226
+
1227
+ try {
1228
+ return callback();
1229
+ } finally {
1230
+ interactionsRef.current = prevInteractions;
1231
+ }
1232
+ }
1233
+
1234
+ function unstable_getCurrent() {
1235
+ if (!enableSchedulerTracing) {
1236
+ return null;
1237
+ } else {
1238
+ return interactionsRef.current;
1239
+ }
1240
+ }
1241
+
1242
+ function unstable_getThreadID() {
1243
+ return ++threadIDCounter;
1244
+ }
1245
+
1246
+ function unstable_trace(name, timestamp, callback) {
1247
+ var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
1248
+
1249
+ if (!enableSchedulerTracing) {
1250
+ return callback();
1251
+ }
1252
+
1253
+ var interaction = {
1254
+ __count: 1,
1255
+ id: interactionIDCounter++,
1256
+ name: name,
1257
+ timestamp: timestamp
1258
+ };
1259
+
1260
+ var prevInteractions = interactionsRef.current;
1261
+
1262
+ // Traced interactions should stack/accumulate.
1263
+ // To do that, clone the current interactions.
1264
+ // The previous set will be restored upon completion.
1265
+ var interactions = new Set(prevInteractions);
1266
+ interactions.add(interaction);
1267
+ interactionsRef.current = interactions;
1268
+
1269
+ var subscriber = subscriberRef.current;
1270
+ var returnValue = void 0;
1271
+
1272
+ try {
1273
+ if (subscriber !== null) {
1274
+ subscriber.onInteractionTraced(interaction);
1275
+ }
1276
+ } finally {
1277
+ try {
1278
+ if (subscriber !== null) {
1279
+ subscriber.onWorkStarted(interactions, threadID);
1280
+ }
1281
+ } finally {
1282
+ try {
1283
+ returnValue = callback();
1284
+ } finally {
1285
+ interactionsRef.current = prevInteractions;
1286
+
1287
+ try {
1288
+ if (subscriber !== null) {
1289
+ subscriber.onWorkStopped(interactions, threadID);
1290
+ }
1291
+ } finally {
1292
+ interaction.__count--;
1293
+
1294
+ // If no async work was scheduled for this interaction,
1295
+ // Notify subscribers that it's completed.
1296
+ if (subscriber !== null && interaction.__count === 0) {
1297
+ subscriber.onInteractionScheduledWorkCompleted(interaction);
1298
+ }
1299
+ }
1300
+ }
1301
+ }
1302
+ }
1303
+
1304
+ return returnValue;
1305
+ }
1306
+
1307
+ function unstable_wrap(callback) {
1308
+ var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
1309
+
1310
+ if (!enableSchedulerTracing) {
1311
+ return callback;
1312
+ }
1313
+
1314
+ var wrappedInteractions = interactionsRef.current;
1315
+
1316
+ var subscriber = subscriberRef.current;
1317
+ if (subscriber !== null) {
1318
+ subscriber.onWorkScheduled(wrappedInteractions, threadID);
1319
+ }
1320
+
1321
+ // Update the pending async work count for the current interactions.
1322
+ // Update after calling subscribers in case of error.
1323
+ wrappedInteractions.forEach(function (interaction) {
1324
+ interaction.__count++;
1325
+ });
1326
+
1327
+ var hasRun = false;
1328
+
1329
+ function wrapped() {
1330
+ var prevInteractions = interactionsRef.current;
1331
+ interactionsRef.current = wrappedInteractions;
1332
+
1333
+ subscriber = subscriberRef.current;
1334
+
1335
+ try {
1336
+ var returnValue = void 0;
1337
+
1338
+ try {
1339
+ if (subscriber !== null) {
1340
+ subscriber.onWorkStarted(wrappedInteractions, threadID);
1341
+ }
1342
+ } finally {
1343
+ try {
1344
+ returnValue = callback.apply(undefined, arguments);
1345
+ } finally {
1346
+ interactionsRef.current = prevInteractions;
1347
+
1348
+ if (subscriber !== null) {
1349
+ subscriber.onWorkStopped(wrappedInteractions, threadID);
1350
+ }
1351
+ }
1352
+ }
1353
+
1354
+ return returnValue;
1355
+ } finally {
1356
+ if (!hasRun) {
1357
+ // We only expect a wrapped function to be executed once,
1358
+ // But in the event that it's executed more than once–
1359
+ // Only decrement the outstanding interaction counts once.
1360
+ hasRun = true;
1361
+
1362
+ // Update pending async counts for all wrapped interactions.
1363
+ // If this was the last scheduled async work for any of them,
1364
+ // Mark them as completed.
1365
+ wrappedInteractions.forEach(function (interaction) {
1366
+ interaction.__count--;
1367
+
1368
+ if (subscriber !== null && interaction.__count === 0) {
1369
+ subscriber.onInteractionScheduledWorkCompleted(interaction);
1370
+ }
1371
+ });
1372
+ }
1373
+ }
1374
+ }
1375
+
1376
+ wrapped.cancel = function cancel() {
1377
+ subscriber = subscriberRef.current;
1378
+
1379
+ try {
1380
+ if (subscriber !== null) {
1381
+ subscriber.onWorkCanceled(wrappedInteractions, threadID);
1382
+ }
1383
+ } finally {
1384
+ // Update pending async counts for all wrapped interactions.
1385
+ // If this was the last scheduled async work for any of them,
1386
+ // Mark them as completed.
1387
+ wrappedInteractions.forEach(function (interaction) {
1388
+ interaction.__count--;
1389
+
1390
+ if (subscriber && interaction.__count === 0) {
1391
+ subscriber.onInteractionScheduledWorkCompleted(interaction);
1392
+ }
1393
+ });
1394
+ }
1395
+ };
1396
+
1397
+ return wrapped;
1398
+ }
1399
+
1400
+ var subscribers = null;
1401
+ if (enableSchedulerTracing) {
1402
+ subscribers = new Set();
1403
+ }
1404
+
1405
+ function unstable_subscribe(subscriber) {
1406
+ if (enableSchedulerTracing) {
1407
+ subscribers.add(subscriber);
1408
+
1409
+ if (subscribers.size === 1) {
1410
+ subscriberRef.current = {
1411
+ onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
1412
+ onInteractionTraced: onInteractionTraced,
1413
+ onWorkCanceled: onWorkCanceled,
1414
+ onWorkScheduled: onWorkScheduled,
1415
+ onWorkStarted: onWorkStarted,
1416
+ onWorkStopped: onWorkStopped
1417
+ };
1418
+ }
1419
+ }
1420
+ }
1421
+
1422
+ function unstable_unsubscribe(subscriber) {
1423
+ if (enableSchedulerTracing) {
1424
+ subscribers.delete(subscriber);
1425
+
1426
+ if (subscribers.size === 0) {
1427
+ subscriberRef.current = null;
1428
+ }
1429
+ }
1430
+ }
1431
+
1432
+ function onInteractionTraced(interaction) {
1433
+ var didCatchError = false;
1434
+ var caughtError = null;
1435
+
1436
+ subscribers.forEach(function (subscriber) {
1437
+ try {
1438
+ subscriber.onInteractionTraced(interaction);
1439
+ } catch (error) {
1440
+ if (!didCatchError) {
1441
+ didCatchError = true;
1442
+ caughtError = error;
1443
+ }
1444
+ }
1445
+ });
1446
+
1447
+ if (didCatchError) {
1448
+ throw caughtError;
1449
+ }
1450
+ }
1451
+
1452
+ function onInteractionScheduledWorkCompleted(interaction) {
1453
+ var didCatchError = false;
1454
+ var caughtError = null;
1455
+
1456
+ subscribers.forEach(function (subscriber) {
1457
+ try {
1458
+ subscriber.onInteractionScheduledWorkCompleted(interaction);
1459
+ } catch (error) {
1460
+ if (!didCatchError) {
1461
+ didCatchError = true;
1462
+ caughtError = error;
1463
+ }
1464
+ }
1465
+ });
1466
+
1467
+ if (didCatchError) {
1468
+ throw caughtError;
1469
+ }
1470
+ }
1471
+
1472
+ function onWorkScheduled(interactions, threadID) {
1473
+ var didCatchError = false;
1474
+ var caughtError = null;
1475
+
1476
+ subscribers.forEach(function (subscriber) {
1477
+ try {
1478
+ subscriber.onWorkScheduled(interactions, threadID);
1479
+ } catch (error) {
1480
+ if (!didCatchError) {
1481
+ didCatchError = true;
1482
+ caughtError = error;
1483
+ }
1484
+ }
1485
+ });
1486
+
1487
+ if (didCatchError) {
1488
+ throw caughtError;
1489
+ }
1490
+ }
1491
+
1492
+ function onWorkStarted(interactions, threadID) {
1493
+ var didCatchError = false;
1494
+ var caughtError = null;
1495
+
1496
+ subscribers.forEach(function (subscriber) {
1497
+ try {
1498
+ subscriber.onWorkStarted(interactions, threadID);
1499
+ } catch (error) {
1500
+ if (!didCatchError) {
1501
+ didCatchError = true;
1502
+ caughtError = error;
1503
+ }
1504
+ }
1505
+ });
1506
+
1507
+ if (didCatchError) {
1508
+ throw caughtError;
1509
+ }
1510
+ }
1511
+
1512
+ function onWorkStopped(interactions, threadID) {
1513
+ var didCatchError = false;
1514
+ var caughtError = null;
1515
+
1516
+ subscribers.forEach(function (subscriber) {
1517
+ try {
1518
+ subscriber.onWorkStopped(interactions, threadID);
1519
+ } catch (error) {
1520
+ if (!didCatchError) {
1521
+ didCatchError = true;
1522
+ caughtError = error;
1523
+ }
1524
+ }
1525
+ });
1526
+
1527
+ if (didCatchError) {
1528
+ throw caughtError;
1529
+ }
1530
+ }
1531
+
1532
+ function onWorkCanceled(interactions, threadID) {
1533
+ var didCatchError = false;
1534
+ var caughtError = null;
1535
+
1536
+ subscribers.forEach(function (subscriber) {
1537
+ try {
1538
+ subscriber.onWorkCanceled(interactions, threadID);
1539
+ } catch (error) {
1540
+ if (!didCatchError) {
1541
+ didCatchError = true;
1542
+ caughtError = error;
1543
+ }
1544
+ }
1545
+ });
1546
+
1547
+ if (didCatchError) {
1548
+ throw caughtError;
1549
+ }
1550
+ }
1551
+
1552
+ /**
1553
+ * Keeps track of the current owner.
1554
+ *
1555
+ * The current owner is the component who should own any components that are
1556
+ * currently being constructed.
1557
+ */
1558
+ var ReactCurrentOwner = {
1559
+ /**
1560
+ * @internal
1561
+ * @type {ReactComponent}
1562
+ */
1563
+ current: null,
1564
+ currentDispatcher: null
1565
+ };
1566
+
1567
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
1568
+
1569
+ var describeComponentFrame = function (name, source, ownerName) {
1570
+ var sourceInfo = '';
1571
+ if (source) {
1572
+ var path = source.fileName;
1573
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
1574
+ {
1575
+ // In DEV, include code for a common special case:
1576
+ // prefer "folder/index.js" instead of just "index.js".
1577
+ if (/^index\./.test(fileName)) {
1578
+ var match = path.match(BEFORE_SLASH_RE);
1579
+ if (match) {
1580
+ var pathBeforeSlash = match[1];
1581
+ if (pathBeforeSlash) {
1582
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
1583
+ fileName = folderName + '/' + fileName;
1584
+ }
1585
+ }
1586
+ }
1587
+ }
1588
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
1589
+ } else if (ownerName) {
1590
+ sourceInfo = ' (created by ' + ownerName + ')';
1591
+ }
1592
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
1593
+ };
1594
+
1595
+ var Resolved = 1;
1596
+
1597
+
1598
+ function refineResolvedLazyComponent(lazyComponent) {
1599
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
1600
+ }
1601
+
1602
+ function getWrappedName(outerType, innerType, wrapperName) {
1603
+ var functionName = innerType.displayName || innerType.name || '';
1604
+ return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
1605
+ }
1606
+
1607
+ function getComponentName(type) {
1608
+ if (type == null) {
1609
+ // Host root, text node or just invalid type.
1610
+ return null;
1611
+ }
1612
+ {
1613
+ if (typeof type.tag === 'number') {
1614
+ warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
1615
+ }
1616
+ }
1617
+ if (typeof type === 'function') {
1618
+ return type.displayName || type.name || null;
1619
+ }
1620
+ if (typeof type === 'string') {
1621
+ return type;
1622
+ }
1623
+ switch (type) {
1624
+ case REACT_CONCURRENT_MODE_TYPE:
1625
+ return 'ConcurrentMode';
1626
+ case REACT_FRAGMENT_TYPE:
1627
+ return 'Fragment';
1628
+ case REACT_PORTAL_TYPE:
1629
+ return 'Portal';
1630
+ case REACT_PROFILER_TYPE:
1631
+ return 'Profiler';
1632
+ case REACT_STRICT_MODE_TYPE:
1633
+ return 'StrictMode';
1634
+ case REACT_SUSPENSE_TYPE:
1635
+ return 'Suspense';
1636
+ }
1637
+ if (typeof type === 'object') {
1638
+ switch (type.$$typeof) {
1639
+ case REACT_CONTEXT_TYPE:
1640
+ return 'Context.Consumer';
1641
+ case REACT_PROVIDER_TYPE:
1642
+ return 'Context.Provider';
1643
+ case REACT_FORWARD_REF_TYPE:
1644
+ return getWrappedName(type, type.render, 'ForwardRef');
1645
+ case REACT_MEMO_TYPE:
1646
+ return getComponentName(type.type);
1647
+ case REACT_LAZY_TYPE:
1648
+ {
1649
+ var thenable = type;
1650
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
1651
+ if (resolvedThenable) {
1652
+ return getComponentName(resolvedThenable);
1653
+ }
1654
+ }
1655
+ }
1656
+ }
1657
+ return null;
1658
+ }
1659
+
1660
+ var ReactDebugCurrentFrame = {};
1661
+
1662
+ var currentlyValidatingElement = null;
1663
+
1664
+ function setCurrentlyValidatingElement(element) {
1665
+ {
1666
+ currentlyValidatingElement = element;
1667
+ }
1668
+ }
1669
+
1670
+ {
1671
+ // Stack implementation injected by the current renderer.
1672
+ ReactDebugCurrentFrame.getCurrentStack = null;
1673
+
1674
+ ReactDebugCurrentFrame.getStackAddendum = function () {
1675
+ var stack = '';
1676
+
1677
+ // Add an extra top frame while an element is being validated
1678
+ if (currentlyValidatingElement) {
1679
+ var name = getComponentName(currentlyValidatingElement.type);
1680
+ var owner = currentlyValidatingElement._owner;
1681
+ stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
1682
+ }
1683
+
1684
+ // Delegate to the injected renderer-specific implementation
1685
+ var impl = ReactDebugCurrentFrame.getCurrentStack;
1686
+ if (impl) {
1687
+ stack += impl() || '';
1688
+ }
1689
+
1690
+ return stack;
1691
+ };
1692
+ }
1693
+
1694
+ var ReactSharedInternals = {
1695
+ ReactCurrentOwner: ReactCurrentOwner,
1696
+ // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1697
+ assign: objectAssign
1698
+ };
1699
+
1700
+ {
1701
+ // Re-export the schedule API(s) for UMD bundles.
1702
+ // This avoids introducing a dependency on a new UMD global in a minor update,
1703
+ // Since that would be a breaking change (e.g. for all existing CodeSandboxes).
1704
+ // This re-export is only required for UMD bundles;
1705
+ // CJS bundles use the shared NPM package.
1706
+ objectAssign(ReactSharedInternals, {
1707
+ Scheduler: {
1708
+ unstable_cancelCallback: unstable_cancelCallback,
1709
+ unstable_now: getCurrentTime,
1710
+ unstable_scheduleCallback: unstable_scheduleCallback,
1711
+ unstable_runWithPriority: unstable_runWithPriority,
1712
+ unstable_wrapCallback: unstable_wrapCallback,
1713
+ unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel
1714
+ },
1715
+ SchedulerTracing: {
1716
+ __interactionsRef: interactionsRef,
1717
+ __subscriberRef: subscriberRef,
1718
+ unstable_clear: unstable_clear,
1719
+ unstable_getCurrent: unstable_getCurrent,
1720
+ unstable_getThreadID: unstable_getThreadID,
1721
+ unstable_subscribe: unstable_subscribe,
1722
+ unstable_trace: unstable_trace,
1723
+ unstable_unsubscribe: unstable_unsubscribe,
1724
+ unstable_wrap: unstable_wrap
1725
+ }
1726
+ });
1727
+ }
1728
+
1729
+ {
1730
+ objectAssign(ReactSharedInternals, {
1731
+ // These should not be included in production.
1732
+ ReactDebugCurrentFrame: ReactDebugCurrentFrame,
1733
+ // Shim for React DOM 16.0.0 which still destructured (but not used) this.
1734
+ // TODO: remove in React 17.0.
1735
+ ReactComponentTreeHook: {}
1736
+ });
1737
+ }
1738
+
1739
+ /**
1740
+ * Similar to invariant but only logs a warning if the condition is not met.
1741
+ * This can be used to log issues in development environments in critical
1742
+ * paths. Removing the logging code for production environments will keep the
1743
+ * same logic and follow the same code paths.
1744
+ */
1745
+
1746
+ var warning = warningWithoutStack$1;
1747
+
1748
+ {
1749
+ warning = function (condition, format) {
1750
+ if (condition) {
1751
+ return;
1752
+ }
1753
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
1754
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
1755
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
1756
+
1757
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1758
+ args[_key - 2] = arguments[_key];
1759
+ }
1760
+
1761
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
1762
+ };
1763
+ }
1764
+
1765
+ var warning$1 = warning;
1766
+
1767
+ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1768
+
1769
+ var RESERVED_PROPS = {
1770
+ key: true,
1771
+ ref: true,
1772
+ __self: true,
1773
+ __source: true
1774
+ };
1775
+
1776
+ var specialPropKeyWarningShown = void 0;
1777
+ var specialPropRefWarningShown = void 0;
1778
+
1779
+ function hasValidRef(config) {
1780
+ {
1781
+ if (hasOwnProperty$1.call(config, 'ref')) {
1782
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
1783
+ if (getter && getter.isReactWarning) {
1784
+ return false;
1785
+ }
1786
+ }
1787
+ }
1788
+ return config.ref !== undefined;
1789
+ }
1790
+
1791
+ function hasValidKey(config) {
1792
+ {
1793
+ if (hasOwnProperty$1.call(config, 'key')) {
1794
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
1795
+ if (getter && getter.isReactWarning) {
1796
+ return false;
1797
+ }
1798
+ }
1799
+ }
1800
+ return config.key !== undefined;
1801
+ }
1802
+
1803
+ function defineKeyPropWarningGetter(props, displayName) {
1804
+ var warnAboutAccessingKey = function () {
1805
+ if (!specialPropKeyWarningShown) {
1806
+ specialPropKeyWarningShown = true;
1807
+ warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
1808
+ }
1809
+ };
1810
+ warnAboutAccessingKey.isReactWarning = true;
1811
+ Object.defineProperty(props, 'key', {
1812
+ get: warnAboutAccessingKey,
1813
+ configurable: true
1814
+ });
1815
+ }
1816
+
1817
+ function defineRefPropWarningGetter(props, displayName) {
1818
+ var warnAboutAccessingRef = function () {
1819
+ if (!specialPropRefWarningShown) {
1820
+ specialPropRefWarningShown = true;
1821
+ warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
1822
+ }
1823
+ };
1824
+ warnAboutAccessingRef.isReactWarning = true;
1825
+ Object.defineProperty(props, 'ref', {
1826
+ get: warnAboutAccessingRef,
1827
+ configurable: true
1828
+ });
1829
+ }
1830
+
1831
+ /**
1832
+ * Factory method to create a new React element. This no longer adheres to
1833
+ * the class pattern, so do not use new to call it. Also, no instanceof check
1834
+ * will work. Instead test $$typeof field against Symbol.for('react.element') to check
1835
+ * if something is a React Element.
1836
+ *
1837
+ * @param {*} type
1838
+ * @param {*} key
1839
+ * @param {string|object} ref
1840
+ * @param {*} self A *temporary* helper to detect places where `this` is
1841
+ * different from the `owner` when React.createElement is called, so that we
1842
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
1843
+ * functions, and as long as `this` and owner are the same, there will be no
1844
+ * change in behavior.
1845
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
1846
+ * indicating filename, line number, and/or other information.
1847
+ * @param {*} owner
1848
+ * @param {*} props
1849
+ * @internal
1850
+ */
1851
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
1852
+ var element = {
1853
+ // This tag allows us to uniquely identify this as a React Element
1854
+ $$typeof: REACT_ELEMENT_TYPE,
1855
+
1856
+ // Built-in properties that belong on the element
1857
+ type: type,
1858
+ key: key,
1859
+ ref: ref,
1860
+ props: props,
1861
+
1862
+ // Record the component responsible for creating this element.
1863
+ _owner: owner
1864
+ };
1865
+
1866
+ {
1867
+ // The validation flag is currently mutative. We put it on
1868
+ // an external backing store so that we can freeze the whole object.
1869
+ // This can be replaced with a WeakMap once they are implemented in
1870
+ // commonly used development environments.
1871
+ element._store = {};
1872
+
1873
+ // To make comparing ReactElements easier for testing purposes, we make
1874
+ // the validation flag non-enumerable (where possible, which should
1875
+ // include every environment we run tests in), so the test framework
1876
+ // ignores it.
1877
+ Object.defineProperty(element._store, 'validated', {
1878
+ configurable: false,
1879
+ enumerable: false,
1880
+ writable: true,
1881
+ value: false
1882
+ });
1883
+ // self and source are DEV only properties.
1884
+ Object.defineProperty(element, '_self', {
1885
+ configurable: false,
1886
+ enumerable: false,
1887
+ writable: false,
1888
+ value: self
1889
+ });
1890
+ // Two elements created in two different places should be considered
1891
+ // equal for testing purposes and therefore we hide it from enumeration.
1892
+ Object.defineProperty(element, '_source', {
1893
+ configurable: false,
1894
+ enumerable: false,
1895
+ writable: false,
1896
+ value: source
1897
+ });
1898
+ if (Object.freeze) {
1899
+ Object.freeze(element.props);
1900
+ Object.freeze(element);
1901
+ }
1902
+ }
1903
+
1904
+ return element;
1905
+ };
1906
+
1907
+ /**
1908
+ * Create and return a new ReactElement of the given type.
1909
+ * See https://reactjs.org/docs/react-api.html#createelement
1910
+ */
1911
+ function createElement(type, config, children) {
1912
+ var propName = void 0;
1913
+
1914
+ // Reserved names are extracted
1915
+ var props = {};
1916
+
1917
+ var key = null;
1918
+ var ref = null;
1919
+ var self = null;
1920
+ var source = null;
1921
+
1922
+ if (config != null) {
1923
+ if (hasValidRef(config)) {
1924
+ ref = config.ref;
1925
+ }
1926
+ if (hasValidKey(config)) {
1927
+ key = '' + config.key;
1928
+ }
1929
+
1930
+ self = config.__self === undefined ? null : config.__self;
1931
+ source = config.__source === undefined ? null : config.__source;
1932
+ // Remaining properties are added to a new props object
1933
+ for (propName in config) {
1934
+ if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1935
+ props[propName] = config[propName];
1936
+ }
1937
+ }
1938
+ }
1939
+
1940
+ // Children can be more than one argument, and those are transferred onto
1941
+ // the newly allocated props object.
1942
+ var childrenLength = arguments.length - 2;
1943
+ if (childrenLength === 1) {
1944
+ props.children = children;
1945
+ } else if (childrenLength > 1) {
1946
+ var childArray = Array(childrenLength);
1947
+ for (var i = 0; i < childrenLength; i++) {
1948
+ childArray[i] = arguments[i + 2];
1949
+ }
1950
+ {
1951
+ if (Object.freeze) {
1952
+ Object.freeze(childArray);
1953
+ }
1954
+ }
1955
+ props.children = childArray;
1956
+ }
1957
+
1958
+ // Resolve default props
1959
+ if (type && type.defaultProps) {
1960
+ var defaultProps = type.defaultProps;
1961
+ for (propName in defaultProps) {
1962
+ if (props[propName] === undefined) {
1963
+ props[propName] = defaultProps[propName];
1964
+ }
1965
+ }
1966
+ }
1967
+ {
1968
+ if (key || ref) {
1969
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1970
+ if (key) {
1971
+ defineKeyPropWarningGetter(props, displayName);
1972
+ }
1973
+ if (ref) {
1974
+ defineRefPropWarningGetter(props, displayName);
1975
+ }
1976
+ }
1977
+ }
1978
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1979
+ }
1980
+
1981
+ /**
1982
+ * Return a function that produces ReactElements of a given type.
1983
+ * See https://reactjs.org/docs/react-api.html#createfactory
1984
+ */
1985
+
1986
+
1987
+ function cloneAndReplaceKey(oldElement, newKey) {
1988
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1989
+
1990
+ return newElement;
1991
+ }
1992
+
1993
+ /**
1994
+ * Clone and return a new ReactElement using element as the starting point.
1995
+ * See https://reactjs.org/docs/react-api.html#cloneelement
1996
+ */
1997
+ function cloneElement(element, config, children) {
1998
+ !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
1999
+
2000
+ var propName = void 0;
2001
+
2002
+ // Original props are copied
2003
+ var props = objectAssign({}, element.props);
2004
+
2005
+ // Reserved names are extracted
2006
+ var key = element.key;
2007
+ var ref = element.ref;
2008
+ // Self is preserved since the owner is preserved.
2009
+ var self = element._self;
2010
+ // Source is preserved since cloneElement is unlikely to be targeted by a
2011
+ // transpiler, and the original source is probably a better indicator of the
2012
+ // true owner.
2013
+ var source = element._source;
2014
+
2015
+ // Owner will be preserved, unless ref is overridden
2016
+ var owner = element._owner;
2017
+
2018
+ if (config != null) {
2019
+ if (hasValidRef(config)) {
2020
+ // Silently steal the ref from the parent.
2021
+ ref = config.ref;
2022
+ owner = ReactCurrentOwner.current;
2023
+ }
2024
+ if (hasValidKey(config)) {
2025
+ key = '' + config.key;
2026
+ }
2027
+
2028
+ // Remaining properties override existing props
2029
+ var defaultProps = void 0;
2030
+ if (element.type && element.type.defaultProps) {
2031
+ defaultProps = element.type.defaultProps;
2032
+ }
2033
+ for (propName in config) {
2034
+ if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
2035
+ if (config[propName] === undefined && defaultProps !== undefined) {
2036
+ // Resolve default props
2037
+ props[propName] = defaultProps[propName];
2038
+ } else {
2039
+ props[propName] = config[propName];
2040
+ }
2041
+ }
2042
+ }
2043
+ }
2044
+
2045
+ // Children can be more than one argument, and those are transferred onto
2046
+ // the newly allocated props object.
2047
+ var childrenLength = arguments.length - 2;
2048
+ if (childrenLength === 1) {
2049
+ props.children = children;
2050
+ } else if (childrenLength > 1) {
2051
+ var childArray = Array(childrenLength);
2052
+ for (var i = 0; i < childrenLength; i++) {
2053
+ childArray[i] = arguments[i + 2];
2054
+ }
2055
+ props.children = childArray;
2056
+ }
2057
+
2058
+ return ReactElement(element.type, key, ref, self, source, owner, props);
2059
+ }
2060
+
2061
+ /**
2062
+ * Verifies the object is a ReactElement.
2063
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
2064
+ * @param {?object} object
2065
+ * @return {boolean} True if `object` is a ReactElement.
2066
+ * @final
2067
+ */
2068
+ function isValidElement(object) {
2069
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2070
+ }
2071
+
2072
+ var SEPARATOR = '.';
2073
+ var SUBSEPARATOR = ':';
2074
+
2075
+ /**
2076
+ * Escape and wrap key so it is safe to use as a reactid
2077
+ *
2078
+ * @param {string} key to be escaped.
2079
+ * @return {string} the escaped key.
2080
+ */
2081
+ function escape(key) {
2082
+ var escapeRegex = /[=:]/g;
2083
+ var escaperLookup = {
2084
+ '=': '=0',
2085
+ ':': '=2'
2086
+ };
2087
+ var escapedString = ('' + key).replace(escapeRegex, function (match) {
2088
+ return escaperLookup[match];
2089
+ });
2090
+
2091
+ return '$' + escapedString;
2092
+ }
2093
+
2094
+ /**
2095
+ * TODO: Test that a single child and an array with one item have the same key
2096
+ * pattern.
2097
+ */
2098
+
2099
+ var didWarnAboutMaps = false;
2100
+
2101
+ var userProvidedKeyEscapeRegex = /\/+/g;
2102
+ function escapeUserProvidedKey(text) {
2103
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
2104
+ }
2105
+
2106
+ var POOL_SIZE = 10;
2107
+ var traverseContextPool = [];
2108
+ function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
2109
+ if (traverseContextPool.length) {
2110
+ var traverseContext = traverseContextPool.pop();
2111
+ traverseContext.result = mapResult;
2112
+ traverseContext.keyPrefix = keyPrefix;
2113
+ traverseContext.func = mapFunction;
2114
+ traverseContext.context = mapContext;
2115
+ traverseContext.count = 0;
2116
+ return traverseContext;
2117
+ } else {
2118
+ return {
2119
+ result: mapResult,
2120
+ keyPrefix: keyPrefix,
2121
+ func: mapFunction,
2122
+ context: mapContext,
2123
+ count: 0
2124
+ };
2125
+ }
2126
+ }
2127
+
2128
+ function releaseTraverseContext(traverseContext) {
2129
+ traverseContext.result = null;
2130
+ traverseContext.keyPrefix = null;
2131
+ traverseContext.func = null;
2132
+ traverseContext.context = null;
2133
+ traverseContext.count = 0;
2134
+ if (traverseContextPool.length < POOL_SIZE) {
2135
+ traverseContextPool.push(traverseContext);
2136
+ }
2137
+ }
2138
+
2139
+ /**
2140
+ * @param {?*} children Children tree container.
2141
+ * @param {!string} nameSoFar Name of the key path so far.
2142
+ * @param {!function} callback Callback to invoke with each child found.
2143
+ * @param {?*} traverseContext Used to pass information throughout the traversal
2144
+ * process.
2145
+ * @return {!number} The number of children in this subtree.
2146
+ */
2147
+ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
2148
+ var type = typeof children;
2149
+
2150
+ if (type === 'undefined' || type === 'boolean') {
2151
+ // All of the above are perceived as null.
2152
+ children = null;
2153
+ }
2154
+
2155
+ var invokeCallback = false;
2156
+
2157
+ if (children === null) {
2158
+ invokeCallback = true;
2159
+ } else {
2160
+ switch (type) {
2161
+ case 'string':
2162
+ case 'number':
2163
+ invokeCallback = true;
2164
+ break;
2165
+ case 'object':
2166
+ switch (children.$$typeof) {
2167
+ case REACT_ELEMENT_TYPE:
2168
+ case REACT_PORTAL_TYPE:
2169
+ invokeCallback = true;
2170
+ }
2171
+ }
2172
+ }
2173
+
2174
+ if (invokeCallback) {
2175
+ callback(traverseContext, children,
2176
+ // If it's the only child, treat the name as if it was wrapped in an array
2177
+ // so that it's consistent if the number of children grows.
2178
+ nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
2179
+ return 1;
2180
+ }
2181
+
2182
+ var child = void 0;
2183
+ var nextName = void 0;
2184
+ var subtreeCount = 0; // Count of children found in the current subtree.
2185
+ var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
2186
+
2187
+ if (Array.isArray(children)) {
2188
+ for (var i = 0; i < children.length; i++) {
2189
+ child = children[i];
2190
+ nextName = nextNamePrefix + getComponentKey(child, i);
2191
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
2192
+ }
2193
+ } else {
2194
+ var iteratorFn = getIteratorFn(children);
2195
+ if (typeof iteratorFn === 'function') {
2196
+ {
2197
+ // Warn about using Maps as children
2198
+ if (iteratorFn === children.entries) {
2199
+ !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
2200
+ didWarnAboutMaps = true;
2201
+ }
2202
+ }
2203
+
2204
+ var iterator = iteratorFn.call(children);
2205
+ var step = void 0;
2206
+ var ii = 0;
2207
+ while (!(step = iterator.next()).done) {
2208
+ child = step.value;
2209
+ nextName = nextNamePrefix + getComponentKey(child, ii++);
2210
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
2211
+ }
2212
+ } else if (type === 'object') {
2213
+ var addendum = '';
2214
+ {
2215
+ addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
2216
+ }
2217
+ var childrenString = '' + children;
2218
+ invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
2219
+ }
2220
+ }
2221
+
2222
+ return subtreeCount;
2223
+ }
2224
+
2225
+ /**
2226
+ * Traverses children that are typically specified as `props.children`, but
2227
+ * might also be specified through attributes:
2228
+ *
2229
+ * - `traverseAllChildren(this.props.children, ...)`
2230
+ * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
2231
+ *
2232
+ * The `traverseContext` is an optional argument that is passed through the
2233
+ * entire traversal. It can be used to store accumulations or anything else that
2234
+ * the callback might find relevant.
2235
+ *
2236
+ * @param {?*} children Children tree object.
2237
+ * @param {!function} callback To invoke upon traversing each child.
2238
+ * @param {?*} traverseContext Context for traversal.
2239
+ * @return {!number} The number of children in this subtree.
2240
+ */
2241
+ function traverseAllChildren(children, callback, traverseContext) {
2242
+ if (children == null) {
2243
+ return 0;
2244
+ }
2245
+
2246
+ return traverseAllChildrenImpl(children, '', callback, traverseContext);
2247
+ }
2248
+
2249
+ /**
2250
+ * Generate a key string that identifies a component within a set.
2251
+ *
2252
+ * @param {*} component A component that could contain a manual key.
2253
+ * @param {number} index Index that is used if a manual key is not provided.
2254
+ * @return {string}
2255
+ */
2256
+ function getComponentKey(component, index) {
2257
+ // Do some typechecking here since we call this blindly. We want to ensure
2258
+ // that we don't block potential future ES APIs.
2259
+ if (typeof component === 'object' && component !== null && component.key != null) {
2260
+ // Explicit key
2261
+ return escape(component.key);
2262
+ }
2263
+ // Implicit key determined by the index in the set
2264
+ return index.toString(36);
2265
+ }
2266
+
2267
+ function forEachSingleChild(bookKeeping, child, name) {
2268
+ var func = bookKeeping.func,
2269
+ context = bookKeeping.context;
2270
+
2271
+ func.call(context, child, bookKeeping.count++);
2272
+ }
2273
+
2274
+ /**
2275
+ * Iterates through children that are typically specified as `props.children`.
2276
+ *
2277
+ * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
2278
+ *
2279
+ * The provided forEachFunc(child, index) will be called for each
2280
+ * leaf child.
2281
+ *
2282
+ * @param {?*} children Children tree container.
2283
+ * @param {function(*, int)} forEachFunc
2284
+ * @param {*} forEachContext Context for forEachContext.
2285
+ */
2286
+ function forEachChildren(children, forEachFunc, forEachContext) {
2287
+ if (children == null) {
2288
+ return children;
2289
+ }
2290
+ var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
2291
+ traverseAllChildren(children, forEachSingleChild, traverseContext);
2292
+ releaseTraverseContext(traverseContext);
2293
+ }
2294
+
2295
+ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
2296
+ var result = bookKeeping.result,
2297
+ keyPrefix = bookKeeping.keyPrefix,
2298
+ func = bookKeeping.func,
2299
+ context = bookKeeping.context;
2300
+
2301
+
2302
+ var mappedChild = func.call(context, child, bookKeeping.count++);
2303
+ if (Array.isArray(mappedChild)) {
2304
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
2305
+ return c;
2306
+ });
2307
+ } else if (mappedChild != null) {
2308
+ if (isValidElement(mappedChild)) {
2309
+ mappedChild = cloneAndReplaceKey(mappedChild,
2310
+ // Keep both the (mapped) and old keys if they differ, just as
2311
+ // traverseAllChildren used to do for objects as children
2312
+ keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
2313
+ }
2314
+ result.push(mappedChild);
2315
+ }
2316
+ }
2317
+
2318
+ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
2319
+ var escapedPrefix = '';
2320
+ if (prefix != null) {
2321
+ escapedPrefix = escapeUserProvidedKey(prefix) + '/';
2322
+ }
2323
+ var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
2324
+ traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
2325
+ releaseTraverseContext(traverseContext);
2326
+ }
2327
+
2328
+ /**
2329
+ * Maps children that are typically specified as `props.children`.
2330
+ *
2331
+ * See https://reactjs.org/docs/react-api.html#reactchildrenmap
2332
+ *
2333
+ * The provided mapFunction(child, key, index) will be called for each
2334
+ * leaf child.
2335
+ *
2336
+ * @param {?*} children Children tree container.
2337
+ * @param {function(*, int)} func The map function.
2338
+ * @param {*} context Context for mapFunction.
2339
+ * @return {object} Object containing the ordered map of results.
2340
+ */
2341
+ function mapChildren(children, func, context) {
2342
+ if (children == null) {
2343
+ return children;
2344
+ }
2345
+ var result = [];
2346
+ mapIntoWithKeyPrefixInternal(children, result, null, func, context);
2347
+ return result;
2348
+ }
2349
+
2350
+ /**
2351
+ * Count the number of children that are typically specified as
2352
+ * `props.children`.
2353
+ *
2354
+ * See https://reactjs.org/docs/react-api.html#reactchildrencount
2355
+ *
2356
+ * @param {?*} children Children tree container.
2357
+ * @return {number} The number of children.
2358
+ */
2359
+ function countChildren(children) {
2360
+ return traverseAllChildren(children, function () {
2361
+ return null;
2362
+ }, null);
2363
+ }
2364
+
2365
+ /**
2366
+ * Flatten a children object (typically specified as `props.children`) and
2367
+ * return an array with appropriately re-keyed children.
2368
+ *
2369
+ * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
2370
+ */
2371
+ function toArray(children) {
2372
+ var result = [];
2373
+ mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
2374
+ return child;
2375
+ });
2376
+ return result;
2377
+ }
2378
+
2379
+ /**
2380
+ * Returns the first child in a collection of children and verifies that there
2381
+ * is only one child in the collection.
2382
+ *
2383
+ * See https://reactjs.org/docs/react-api.html#reactchildrenonly
2384
+ *
2385
+ * The current implementation of this function assumes that a single child gets
2386
+ * passed without a wrapper, but the purpose of this helper function is to
2387
+ * abstract away the particular structure of children.
2388
+ *
2389
+ * @param {?object} children Child collection structure.
2390
+ * @return {ReactElement} The first and only `ReactElement` contained in the
2391
+ * structure.
2392
+ */
2393
+ function onlyChild(children) {
2394
+ !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
2395
+ return children;
2396
+ }
2397
+
2398
+ function createContext(defaultValue, calculateChangedBits) {
2399
+ if (calculateChangedBits === undefined) {
2400
+ calculateChangedBits = null;
2401
+ } else {
2402
+ {
2403
+ !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
2404
+ }
2405
+ }
2406
+
2407
+ var context = {
2408
+ $$typeof: REACT_CONTEXT_TYPE,
2409
+ _calculateChangedBits: calculateChangedBits,
2410
+ // As a workaround to support multiple concurrent renderers, we categorize
2411
+ // some renderers as primary and others as secondary. We only expect
2412
+ // there to be two concurrent renderers at most: React Native (primary) and
2413
+ // Fabric (secondary); React DOM (primary) and React ART (secondary).
2414
+ // Secondary renderers store their context values on separate fields.
2415
+ _currentValue: defaultValue,
2416
+ _currentValue2: defaultValue,
2417
+ // These are circular
2418
+ Provider: null,
2419
+ Consumer: null
2420
+ };
2421
+
2422
+ context.Provider = {
2423
+ $$typeof: REACT_PROVIDER_TYPE,
2424
+ _context: context
2425
+ };
2426
+
2427
+ var hasWarnedAboutUsingNestedContextConsumers = false;
2428
+ var hasWarnedAboutUsingConsumerProvider = false;
2429
+
2430
+ {
2431
+ // A separate object, but proxies back to the original context object for
2432
+ // backwards compatibility. It has a different $$typeof, so we can properly
2433
+ // warn for the incorrect usage of Context as a Consumer.
2434
+ var Consumer = {
2435
+ $$typeof: REACT_CONTEXT_TYPE,
2436
+ _context: context,
2437
+ _calculateChangedBits: context._calculateChangedBits
2438
+ };
2439
+ // $FlowFixMe: Flow complains about not setting a value, which is intentional here
2440
+ Object.defineProperties(Consumer, {
2441
+ Provider: {
2442
+ get: function () {
2443
+ if (!hasWarnedAboutUsingConsumerProvider) {
2444
+ hasWarnedAboutUsingConsumerProvider = true;
2445
+ warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
2446
+ }
2447
+ return context.Provider;
2448
+ },
2449
+ set: function (_Provider) {
2450
+ context.Provider = _Provider;
2451
+ }
2452
+ },
2453
+ _currentValue: {
2454
+ get: function () {
2455
+ return context._currentValue;
2456
+ },
2457
+ set: function (_currentValue) {
2458
+ context._currentValue = _currentValue;
2459
+ }
2460
+ },
2461
+ _currentValue2: {
2462
+ get: function () {
2463
+ return context._currentValue2;
2464
+ },
2465
+ set: function (_currentValue2) {
2466
+ context._currentValue2 = _currentValue2;
2467
+ }
2468
+ },
2469
+ Consumer: {
2470
+ get: function () {
2471
+ if (!hasWarnedAboutUsingNestedContextConsumers) {
2472
+ hasWarnedAboutUsingNestedContextConsumers = true;
2473
+ warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
2474
+ }
2475
+ return context.Consumer;
2476
+ }
2477
+ }
2478
+ });
2479
+ // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
2480
+ context.Consumer = Consumer;
2481
+ }
2482
+
2483
+ {
2484
+ context._currentRenderer = null;
2485
+ context._currentRenderer2 = null;
2486
+ }
2487
+
2488
+ return context;
2489
+ }
2490
+
2491
+ function lazy(ctor) {
2492
+ return {
2493
+ $$typeof: REACT_LAZY_TYPE,
2494
+ _ctor: ctor,
2495
+ // React uses these fields to store the result.
2496
+ _status: -1,
2497
+ _result: null
2498
+ };
2499
+ }
2500
+
2501
+ function forwardRef(render) {
2502
+ {
2503
+ if (typeof render !== 'function') {
2504
+ warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
2505
+ } else {
2506
+ !(
2507
+ // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
2508
+ render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
2509
+ }
2510
+
2511
+ if (render != null) {
2512
+ !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
2513
+ }
2514
+ }
2515
+
2516
+ return {
2517
+ $$typeof: REACT_FORWARD_REF_TYPE,
2518
+ render: render
2519
+ };
2520
+ }
2521
+
2522
+ function isValidElementType(type) {
2523
+ return typeof type === 'string' || typeof type === 'function' ||
2524
+ // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2525
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_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);
2526
+ }
2527
+
2528
+ function memo(type, compare) {
2529
+ {
2530
+ if (!isValidElementType(type)) {
2531
+ warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
2532
+ }
2533
+ }
2534
+ return {
2535
+ $$typeof: REACT_MEMO_TYPE,
2536
+ type: type,
2537
+ compare: compare === undefined ? null : compare
2538
+ };
2539
+ }
2540
+
2541
+ /**
2542
+ * Copyright (c) 2013-present, Facebook, Inc.
2543
+ *
2544
+ * This source code is licensed under the MIT license found in the
2545
+ * LICENSE file in the root directory of this source tree.
2546
+ */
2547
+
2548
+
2549
+
2550
+ var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2551
+
2552
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
2553
+
2554
+ /**
2555
+ * Copyright (c) 2013-present, Facebook, Inc.
2556
+ *
2557
+ * This source code is licensed under the MIT license found in the
2558
+ * LICENSE file in the root directory of this source tree.
2559
+ */
2560
+
2561
+
2562
+
2563
+ var printWarning$1 = function() {};
2564
+
2565
+ {
2566
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
2567
+ var loggedTypeFailures = {};
2568
+
2569
+ printWarning$1 = function(text) {
2570
+ var message = 'Warning: ' + text;
2571
+ if (typeof console !== 'undefined') {
2572
+ console.error(message);
2573
+ }
2574
+ try {
2575
+ // --- Welcome to debugging React ---
2576
+ // This error was thrown as a convenience so that you can use this stack
2577
+ // to find the callsite that caused this warning to fire.
2578
+ throw new Error(message);
2579
+ } catch (x) {}
2580
+ };
2581
+ }
2582
+
2583
+ /**
2584
+ * Assert that the values match with the type specs.
2585
+ * Error messages are memorized and will only be shown once.
2586
+ *
2587
+ * @param {object} typeSpecs Map of name to a ReactPropType
2588
+ * @param {object} values Runtime values that need to be type-checked
2589
+ * @param {string} location e.g. "prop", "context", "child context"
2590
+ * @param {string} componentName Name of the component for error messages.
2591
+ * @param {?Function} getStack Returns the component stack.
2592
+ * @private
2593
+ */
2594
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
2595
+ {
2596
+ for (var typeSpecName in typeSpecs) {
2597
+ if (typeSpecs.hasOwnProperty(typeSpecName)) {
2598
+ var error;
2599
+ // Prop type validation may throw. In case they do, we don't want to
2600
+ // fail the render phase where it didn't fail before. So we log it.
2601
+ // After these have been cleaned up, we'll let them throw.
2602
+ try {
2603
+ // This is intentionally an invariant that gets caught. It's the same
2604
+ // behavior as without this statement except with a better message.
2605
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
2606
+ var err = Error(
2607
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
2608
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
2609
+ );
2610
+ err.name = 'Invariant Violation';
2611
+ throw err;
2612
+ }
2613
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
2614
+ } catch (ex) {
2615
+ error = ex;
2616
+ }
2617
+ if (error && !(error instanceof Error)) {
2618
+ printWarning$1(
2619
+ (componentName || 'React class') + ': type specification of ' +
2620
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
2621
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
2622
+ 'You may have forgotten to pass an argument to the type checker ' +
2623
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
2624
+ 'shape all require an argument).'
2625
+ );
2626
+
2627
+ }
2628
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
2629
+ // Only monitor this failure once because there tends to be a lot of the
2630
+ // same error.
2631
+ loggedTypeFailures[error.message] = true;
2632
+
2633
+ var stack = getStack ? getStack() : '';
2634
+
2635
+ printWarning$1(
2636
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
2637
+ );
2638
+ }
2639
+ }
2640
+ }
2641
+ }
2642
+ }
2643
+
2644
+ var checkPropTypes_1 = checkPropTypes;
2645
+
2646
+ /**
2647
+ * ReactElementValidator provides a wrapper around a element factory
2648
+ * which validates the props passed to the element. This is intended to be
2649
+ * used only in DEV and could be replaced by a static type checker for languages
2650
+ * that support it.
2651
+ */
2652
+
2653
+ var propTypesMisspellWarningShown = void 0;
2654
+
2655
+ {
2656
+ propTypesMisspellWarningShown = false;
2657
+ }
2658
+
2659
+ function getDeclarationErrorAddendum() {
2660
+ if (ReactCurrentOwner.current) {
2661
+ var name = getComponentName(ReactCurrentOwner.current.type);
2662
+ if (name) {
2663
+ return '\n\nCheck the render method of `' + name + '`.';
2664
+ }
2665
+ }
2666
+ return '';
2667
+ }
2668
+
2669
+ function getSourceInfoErrorAddendum(elementProps) {
2670
+ if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
2671
+ var source = elementProps.__source;
2672
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2673
+ var lineNumber = source.lineNumber;
2674
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2675
+ }
2676
+ return '';
2677
+ }
2678
+
2679
+ /**
2680
+ * Warn if there's no key explicitly set on dynamic arrays of children or
2681
+ * object keys are not valid. This allows us to keep track of children between
2682
+ * updates.
2683
+ */
2684
+ var ownerHasKeyUseWarning = {};
2685
+
2686
+ function getCurrentComponentErrorInfo(parentType) {
2687
+ var info = getDeclarationErrorAddendum();
2688
+
2689
+ if (!info) {
2690
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2691
+ if (parentName) {
2692
+ info = '\n\nCheck the top-level render call using <' + parentName + '>.';
2693
+ }
2694
+ }
2695
+ return info;
2696
+ }
2697
+
2698
+ /**
2699
+ * Warn if the element doesn't have an explicit key assigned to it.
2700
+ * This element is in an array. The array could grow and shrink or be
2701
+ * reordered. All children that haven't already been validated are required to
2702
+ * have a "key" property assigned to it. Error statuses are cached so a warning
2703
+ * will only be shown once.
2704
+ *
2705
+ * @internal
2706
+ * @param {ReactElement} element Element that requires a key.
2707
+ * @param {*} parentType element's parent's type.
2708
+ */
2709
+ function validateExplicitKey(element, parentType) {
2710
+ if (!element._store || element._store.validated || element.key != null) {
2711
+ return;
2712
+ }
2713
+ element._store.validated = true;
2714
+
2715
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2716
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2717
+ return;
2718
+ }
2719
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
2720
+
2721
+ // Usually the current owner is the offender, but if it accepts children as a
2722
+ // property, it may be the creator of the child that's responsible for
2723
+ // assigning it a key.
2724
+ var childOwner = '';
2725
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2726
+ // Give the component that originally created this child.
2727
+ childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
2728
+ }
2729
+
2730
+ setCurrentlyValidatingElement(element);
2731
+ {
2732
+ warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
2733
+ }
2734
+ setCurrentlyValidatingElement(null);
2735
+ }
2736
+
2737
+ /**
2738
+ * Ensure that every element either is passed in a static location, in an
2739
+ * array with an explicit keys property defined, or in an object literal
2740
+ * with valid key property.
2741
+ *
2742
+ * @internal
2743
+ * @param {ReactNode} node Statically passed child of any type.
2744
+ * @param {*} parentType node's parent's type.
2745
+ */
2746
+ function validateChildKeys(node, parentType) {
2747
+ if (typeof node !== 'object') {
2748
+ return;
2749
+ }
2750
+ if (Array.isArray(node)) {
2751
+ for (var i = 0; i < node.length; i++) {
2752
+ var child = node[i];
2753
+ if (isValidElement(child)) {
2754
+ validateExplicitKey(child, parentType);
2755
+ }
2756
+ }
2757
+ } else if (isValidElement(node)) {
2758
+ // This element was passed in a valid location.
2759
+ if (node._store) {
2760
+ node._store.validated = true;
2761
+ }
2762
+ } else if (node) {
2763
+ var iteratorFn = getIteratorFn(node);
2764
+ if (typeof iteratorFn === 'function') {
2765
+ // Entry iterators used to provide implicit keys,
2766
+ // but now we print a separate warning for them later.
2767
+ if (iteratorFn !== node.entries) {
2768
+ var iterator = iteratorFn.call(node);
2769
+ var step = void 0;
2770
+ while (!(step = iterator.next()).done) {
2771
+ if (isValidElement(step.value)) {
2772
+ validateExplicitKey(step.value, parentType);
2773
+ }
2774
+ }
2775
+ }
2776
+ }
2777
+ }
2778
+ }
2779
+
2780
+ /**
2781
+ * Given an element, validate that its props follow the propTypes definition,
2782
+ * provided by the type.
2783
+ *
2784
+ * @param {ReactElement} element
2785
+ */
2786
+ function validatePropTypes(element) {
2787
+ var type = element.type;
2788
+ var name = void 0,
2789
+ propTypes = void 0;
2790
+ if (typeof type === 'function') {
2791
+ // Class or function component
2792
+ name = type.displayName || type.name;
2793
+ propTypes = type.propTypes;
2794
+ } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
2795
+ // ForwardRef
2796
+ var functionName = type.render.displayName || type.render.name || '';
2797
+ name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
2798
+ propTypes = type.propTypes;
2799
+ } else {
2800
+ return;
2801
+ }
2802
+ if (propTypes) {
2803
+ setCurrentlyValidatingElement(element);
2804
+ checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
2805
+ setCurrentlyValidatingElement(null);
2806
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2807
+ propTypesMisspellWarningShown = true;
2808
+ warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
2809
+ }
2810
+ if (typeof type.getDefaultProps === 'function') {
2811
+ !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
2812
+ }
2813
+ }
2814
+
2815
+ /**
2816
+ * Given a fragment, validate that it can only be provided with fragment props
2817
+ * @param {ReactElement} fragment
2818
+ */
2819
+ function validateFragmentProps(fragment) {
2820
+ setCurrentlyValidatingElement(fragment);
2821
+
2822
+ var keys = Object.keys(fragment.props);
2823
+ for (var i = 0; i < keys.length; i++) {
2824
+ var key = keys[i];
2825
+ if (key !== 'children' && key !== 'key') {
2826
+ warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2827
+ break;
2828
+ }
2829
+ }
2830
+
2831
+ if (fragment.ref !== null) {
2832
+ warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
2833
+ }
2834
+
2835
+ setCurrentlyValidatingElement(null);
2836
+ }
2837
+
2838
+ function createElementWithValidation(type, props, children) {
2839
+ var validType = isValidElementType(type);
2840
+
2841
+ // We warn in this case but don't throw. We expect the element creation to
2842
+ // succeed and there will likely be errors in render.
2843
+ if (!validType) {
2844
+ var info = '';
2845
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2846
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
2847
+ }
2848
+
2849
+ var sourceInfo = getSourceInfoErrorAddendum(props);
2850
+ if (sourceInfo) {
2851
+ info += sourceInfo;
2852
+ } else {
2853
+ info += getDeclarationErrorAddendum();
2854
+ }
2855
+
2856
+ var typeString = void 0;
2857
+ if (type === null) {
2858
+ typeString = 'null';
2859
+ } else if (Array.isArray(type)) {
2860
+ typeString = 'array';
2861
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2862
+ typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
2863
+ info = ' Did you accidentally export a JSX literal instead of a component?';
2864
+ } else {
2865
+ typeString = typeof type;
2866
+ }
2867
+
2868
+ warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2869
+ }
2870
+
2871
+ var element = createElement.apply(this, arguments);
2872
+
2873
+ // The result can be nullish if a mock or a custom function is used.
2874
+ // TODO: Drop this when these are no longer allowed as the type argument.
2875
+ if (element == null) {
2876
+ return element;
2877
+ }
2878
+
2879
+ // Skip key warning if the type isn't valid since our key validation logic
2880
+ // doesn't expect a non-string/function type and can throw confusing errors.
2881
+ // We don't want exception behavior to differ between dev and prod.
2882
+ // (Rendering will throw with a helpful message and as soon as the type is
2883
+ // fixed, the key warnings will appear.)
2884
+ if (validType) {
2885
+ for (var i = 2; i < arguments.length; i++) {
2886
+ validateChildKeys(arguments[i], type);
2887
+ }
2888
+ }
2889
+
2890
+ if (type === REACT_FRAGMENT_TYPE) {
2891
+ validateFragmentProps(element);
2892
+ } else {
2893
+ validatePropTypes(element);
2894
+ }
2895
+
2896
+ return element;
2897
+ }
2898
+
2899
+ function createFactoryWithValidation(type) {
2900
+ var validatedFactory = createElementWithValidation.bind(null, type);
2901
+ validatedFactory.type = type;
2902
+ // Legacy hook: remove it
2903
+ {
2904
+ Object.defineProperty(validatedFactory, 'type', {
2905
+ enumerable: false,
2906
+ get: function () {
2907
+ lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2908
+ Object.defineProperty(this, 'type', {
2909
+ value: type
2910
+ });
2911
+ return type;
2912
+ }
2913
+ });
2914
+ }
2915
+
2916
+ return validatedFactory;
2917
+ }
2918
+
2919
+ function cloneElementWithValidation(element, props, children) {
2920
+ var newElement = cloneElement.apply(this, arguments);
2921
+ for (var i = 2; i < arguments.length; i++) {
2922
+ validateChildKeys(arguments[i], newElement.type);
2923
+ }
2924
+ validatePropTypes(newElement);
2925
+ return newElement;
2926
+ }
2927
+
2928
+ var React = {
2929
+ Children: {
2930
+ map: mapChildren,
2931
+ forEach: forEachChildren,
2932
+ count: countChildren,
2933
+ toArray: toArray,
2934
+ only: onlyChild
2935
+ },
2936
+
2937
+ createRef: createRef,
2938
+ Component: Component,
2939
+ PureComponent: PureComponent,
2940
+
2941
+ createContext: createContext,
2942
+ forwardRef: forwardRef,
2943
+ lazy: lazy,
2944
+ memo: memo,
2945
+
2946
+ Fragment: REACT_FRAGMENT_TYPE,
2947
+ StrictMode: REACT_STRICT_MODE_TYPE,
2948
+ unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
2949
+ Suspense: REACT_SUSPENSE_TYPE,
2950
+ unstable_Profiler: REACT_PROFILER_TYPE,
2951
+
2952
+ createElement: createElementWithValidation,
2953
+ cloneElement: cloneElementWithValidation,
2954
+ createFactory: createFactoryWithValidation,
2955
+ isValidElement: isValidElement,
2956
+
2957
+ version: ReactVersion,
2958
+
2959
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
2960
+ };
2961
+
2962
+
2963
+
2964
+ var React$2 = Object.freeze({
2965
+ default: React
2966
+ });
2967
+
2968
+ var React$3 = ( React$2 && React ) || React$2;
2969
+
2970
+ // TODO: decide on the top-level export form.
2971
+ // This is hacky but makes it work with both Rollup and Jest.
2972
+ var react = React$3.default || React$3;
2973
+
2974
+ return react;
2975
+
2976
+ })));