UNPKG

120 kBJavaScriptView Raw
1/** @license React v16.9.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
20var ReactVersion = '16.9.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.
24var hasSymbol = typeof Symbol === 'function' && Symbol.for;
25
26var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
27var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
28var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
29var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
30var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
31var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
32var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
33// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
34// (unstable) APIs that have been removed. Can we remove the symbols?
35
36var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
37var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
38var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
39var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
40var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
41var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
42var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
43var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
44
45var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
46var FAUX_ITERATOR_SYMBOL = '@@iterator';
47
48function getIteratorFn(maybeIterable) {
49 if (maybeIterable === null || typeof maybeIterable !== 'object') {
50 return null;
51 }
52 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
53 if (typeof maybeIterator === 'function') {
54 return maybeIterator;
55 }
56 return null;
57}
58
59/*
60object-assign
61(c) Sindre Sorhus
62@license MIT
63*/
64
65
66/* eslint-disable no-unused-vars */
67var getOwnPropertySymbols = Object.getOwnPropertySymbols;
68var hasOwnProperty = Object.prototype.hasOwnProperty;
69var propIsEnumerable = Object.prototype.propertyIsEnumerable;
70
71function toObject(val) {
72 if (val === null || val === undefined) {
73 throw new TypeError('Object.assign cannot be called with null or undefined');
74 }
75
76 return Object(val);
77}
78
79function shouldUseNative() {
80 try {
81 if (!Object.assign) {
82 return false;
83 }
84
85 // Detect buggy property enumeration order in older V8 versions.
86
87 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
88 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
89 test1[5] = 'de';
90 if (Object.getOwnPropertyNames(test1)[0] === '5') {
91 return false;
92 }
93
94 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
95 var test2 = {};
96 for (var i = 0; i < 10; i++) {
97 test2['_' + String.fromCharCode(i)] = i;
98 }
99 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
100 return test2[n];
101 });
102 if (order2.join('') !== '0123456789') {
103 return false;
104 }
105
106 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
107 var test3 = {};
108 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
109 test3[letter] = letter;
110 });
111 if (Object.keys(Object.assign({}, test3)).join('') !==
112 'abcdefghijklmnopqrst') {
113 return false;
114 }
115
116 return true;
117 } catch (err) {
118 // We don't expect any of the above to throw, but better to be safe.
119 return false;
120 }
121}
122
123var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
124 var from;
125 var to = toObject(target);
126 var symbols;
127
128 for (var s = 1; s < arguments.length; s++) {
129 from = Object(arguments[s]);
130
131 for (var key in from) {
132 if (hasOwnProperty.call(from, key)) {
133 to[key] = from[key];
134 }
135 }
136
137 if (getOwnPropertySymbols) {
138 symbols = getOwnPropertySymbols(from);
139 for (var i = 0; i < symbols.length; i++) {
140 if (propIsEnumerable.call(from, symbols[i])) {
141 to[symbols[i]] = from[symbols[i]];
142 }
143 }
144 }
145 }
146
147 return to;
148};
149
150// Do not require this module directly! Use normal `invariant` calls with
151// template literal strings. The messages will be converted to ReactError during
152// build, and in production they will be minified.
153
154// Do not require this module directly! Use normal `invariant` calls with
155// template literal strings. The messages will be converted to ReactError during
156// build, and in production they will be minified.
157
158function ReactError(error) {
159 error.name = 'Invariant Violation';
160 return error;
161}
162
163/**
164 * Use invariant() to assert state which your program assumes to be true.
165 *
166 * Provide sprintf-style format (only %s is supported) and arguments
167 * to provide information about what broke and what you were
168 * expecting.
169 *
170 * The invariant message will be stripped in production, but the invariant
171 * will remain to ensure logic does not differ in production.
172 */
173
174/**
175 * Forked from fbjs/warning:
176 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
177 *
178 * Only change is we use console.warn instead of console.error,
179 * and do nothing when 'console' is not supported.
180 * This really simplifies the code.
181 * ---
182 * Similar to invariant but only logs a warning if the condition is not met.
183 * This can be used to log issues in development environments in critical
184 * paths. Removing the logging code for production environments will keep the
185 * same logic and follow the same code paths.
186 */
187
188var lowPriorityWarning = function () {};
189
190{
191 var printWarning = function (format) {
192 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
193 args[_key - 1] = arguments[_key];
194 }
195
196 var argIndex = 0;
197 var message = 'Warning: ' + format.replace(/%s/g, function () {
198 return args[argIndex++];
199 });
200 if (typeof console !== 'undefined') {
201 console.warn(message);
202 }
203 try {
204 // --- Welcome to debugging React ---
205 // This error was thrown as a convenience so that you can use this stack
206 // to find the callsite that caused this warning to fire.
207 throw new Error(message);
208 } catch (x) {}
209 };
210
211 lowPriorityWarning = function (condition, format) {
212 if (format === undefined) {
213 throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
214 }
215 if (!condition) {
216 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
217 args[_key2 - 2] = arguments[_key2];
218 }
219
220 printWarning.apply(undefined, [format].concat(args));
221 }
222 };
223}
224
225var lowPriorityWarning$1 = lowPriorityWarning;
226
227/**
228 * Similar to invariant but only logs a warning if the condition is not met.
229 * This can be used to log issues in development environments in critical
230 * paths. Removing the logging code for production environments will keep the
231 * same logic and follow the same code paths.
232 */
233
234var warningWithoutStack = function () {};
235
236{
237 warningWithoutStack = function (condition, format) {
238 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
239 args[_key - 2] = arguments[_key];
240 }
241
242 if (format === undefined) {
243 throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
244 }
245 if (args.length > 8) {
246 // Check before the condition to catch violations early.
247 throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
248 }
249 if (condition) {
250 return;
251 }
252 if (typeof console !== 'undefined') {
253 var argsWithFormat = args.map(function (item) {
254 return '' + item;
255 });
256 argsWithFormat.unshift('Warning: ' + format);
257
258 // We intentionally don't use spread (or .apply) directly because it
259 // breaks IE9: https://github.com/facebook/react/issues/13610
260 Function.prototype.apply.call(console.error, console, argsWithFormat);
261 }
262 try {
263 // --- Welcome to debugging React ---
264 // This error was thrown as a convenience so that you can use this stack
265 // to find the callsite that caused this warning to fire.
266 var argIndex = 0;
267 var message = 'Warning: ' + format.replace(/%s/g, function () {
268 return args[argIndex++];
269 });
270 throw new Error(message);
271 } catch (x) {}
272 };
273}
274
275var warningWithoutStack$1 = warningWithoutStack;
276
277var didWarnStateUpdateForUnmountedComponent = {};
278
279function warnNoop(publicInstance, callerName) {
280 {
281 var _constructor = publicInstance.constructor;
282 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
283 var warningKey = componentName + '.' + callerName;
284 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
285 return;
286 }
287 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);
288 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
289 }
290}
291
292/**
293 * This is the abstract API for an update queue.
294 */
295var ReactNoopUpdateQueue = {
296 /**
297 * Checks whether or not this composite component is mounted.
298 * @param {ReactClass} publicInstance The instance we want to test.
299 * @return {boolean} True if mounted, false otherwise.
300 * @protected
301 * @final
302 */
303 isMounted: function (publicInstance) {
304 return false;
305 },
306
307 /**
308 * Forces an update. This should only be invoked when it is known with
309 * certainty that we are **not** in a DOM transaction.
310 *
311 * You may want to call this when you know that some deeper aspect of the
312 * component's state has changed but `setState` was not called.
313 *
314 * This will not invoke `shouldComponentUpdate`, but it will invoke
315 * `componentWillUpdate` and `componentDidUpdate`.
316 *
317 * @param {ReactClass} publicInstance The instance that should rerender.
318 * @param {?function} callback Called after component is updated.
319 * @param {?string} callerName name of the calling function in the public API.
320 * @internal
321 */
322 enqueueForceUpdate: function (publicInstance, callback, callerName) {
323 warnNoop(publicInstance, 'forceUpdate');
324 },
325
326 /**
327 * Replaces all of the state. Always use this or `setState` to mutate state.
328 * You should treat `this.state` as immutable.
329 *
330 * There is no guarantee that `this.state` will be immediately updated, so
331 * accessing `this.state` after calling this method may return the old value.
332 *
333 * @param {ReactClass} publicInstance The instance that should rerender.
334 * @param {object} completeState Next state.
335 * @param {?function} callback Called after component is updated.
336 * @param {?string} callerName name of the calling function in the public API.
337 * @internal
338 */
339 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
340 warnNoop(publicInstance, 'replaceState');
341 },
342
343 /**
344 * Sets a subset of the state. This only exists because _pendingState is
345 * internal. This provides a merging strategy that is not available to deep
346 * properties which is confusing. TODO: Expose pendingState or don't use it
347 * during the merge.
348 *
349 * @param {ReactClass} publicInstance The instance that should rerender.
350 * @param {object} partialState Next partial state to be merged with state.
351 * @param {?function} callback Called after component is updated.
352 * @param {?string} Name of the calling function in the public API.
353 * @internal
354 */
355 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
356 warnNoop(publicInstance, 'setState');
357 }
358};
359
360var emptyObject = {};
361{
362 Object.freeze(emptyObject);
363}
364
365/**
366 * Base class helpers for the updating state of a component.
367 */
368function Component(props, context, updater) {
369 this.props = props;
370 this.context = context;
371 // If a component has string refs, we will assign a different object later.
372 this.refs = emptyObject;
373 // We initialize the default updater but the real one gets injected by the
374 // renderer.
375 this.updater = updater || ReactNoopUpdateQueue;
376}
377
378Component.prototype.isReactComponent = {};
379
380/**
381 * Sets a subset of the state. Always use this to mutate
382 * state. 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 * There is no guarantee that calls to `setState` will run synchronously,
388 * as they may eventually be batched together. You can provide an optional
389 * callback that will be executed when the call to setState is actually
390 * completed.
391 *
392 * When a function is provided to setState, it will be called at some point in
393 * the future (not synchronously). It will be called with the up to date
394 * component arguments (state, props, context). These values can be different
395 * from this.* because your function may be called after receiveProps but before
396 * shouldComponentUpdate, and this new state, props, and context will not yet be
397 * assigned to this.
398 *
399 * @param {object|function} partialState Next partial state or function to
400 * produce next partial state to be merged with current state.
401 * @param {?function} callback Called after state is updated.
402 * @final
403 * @protected
404 */
405Component.prototype.setState = function (partialState, callback) {
406 (function () {
407 if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
408 {
409 throw ReactError(Error('setState(...): takes an object of state variables to update or a function which returns an object of state variables.'));
410 }
411 }
412 })();
413 this.updater.enqueueSetState(this, partialState, callback, 'setState');
414};
415
416/**
417 * Forces an update. This should only be invoked when it is known with
418 * certainty that we are **not** in a DOM transaction.
419 *
420 * You may want to call this when you know that some deeper aspect of the
421 * component's state has changed but `setState` was not called.
422 *
423 * This will not invoke `shouldComponentUpdate`, but it will invoke
424 * `componentWillUpdate` and `componentDidUpdate`.
425 *
426 * @param {?function} callback Called after update is complete.
427 * @final
428 * @protected
429 */
430Component.prototype.forceUpdate = function (callback) {
431 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
432};
433
434/**
435 * Deprecated APIs. These APIs used to exist on classic React classes but since
436 * we would like to deprecate them, we're not going to move them over to this
437 * modern base class. Instead, we define a getter that warns if it's accessed.
438 */
439{
440 var deprecatedAPIs = {
441 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
442 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
443 };
444 var defineDeprecationWarning = function (methodName, info) {
445 Object.defineProperty(Component.prototype, methodName, {
446 get: function () {
447 lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
448 return undefined;
449 }
450 });
451 };
452 for (var fnName in deprecatedAPIs) {
453 if (deprecatedAPIs.hasOwnProperty(fnName)) {
454 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
455 }
456 }
457}
458
459function ComponentDummy() {}
460ComponentDummy.prototype = Component.prototype;
461
462/**
463 * Convenience component with default shallow equality check for sCU.
464 */
465function PureComponent(props, context, updater) {
466 this.props = props;
467 this.context = context;
468 // If a component has string refs, we will assign a different object later.
469 this.refs = emptyObject;
470 this.updater = updater || ReactNoopUpdateQueue;
471}
472
473var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
474pureComponentPrototype.constructor = PureComponent;
475// Avoid an extra prototype jump for these methods.
476objectAssign(pureComponentPrototype, Component.prototype);
477pureComponentPrototype.isPureReactComponent = true;
478
479// an immutable object with a single mutable value
480function createRef() {
481 var refObject = {
482 current: null
483 };
484 {
485 Object.seal(refObject);
486 }
487 return refObject;
488}
489
490/**
491 * Keeps track of the current dispatcher.
492 */
493var ReactCurrentDispatcher = {
494 /**
495 * @internal
496 * @type {ReactComponent}
497 */
498 current: null
499};
500
501/**
502 * Keeps track of the current batch's configuration such as how long an update
503 * should suspend for if it needs to.
504 */
505var ReactCurrentBatchConfig = {
506 suspense: null
507};
508
509/**
510 * Keeps track of the current owner.
511 *
512 * The current owner is the component who should own any components that are
513 * currently being constructed.
514 */
515var ReactCurrentOwner = {
516 /**
517 * @internal
518 * @type {ReactComponent}
519 */
520 current: null
521};
522
523var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
524
525var describeComponentFrame = function (name, source, ownerName) {
526 var sourceInfo = '';
527 if (source) {
528 var path = source.fileName;
529 var fileName = path.replace(BEFORE_SLASH_RE, '');
530 {
531 // In DEV, include code for a common special case:
532 // prefer "folder/index.js" instead of just "index.js".
533 if (/^index\./.test(fileName)) {
534 var match = path.match(BEFORE_SLASH_RE);
535 if (match) {
536 var pathBeforeSlash = match[1];
537 if (pathBeforeSlash) {
538 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
539 fileName = folderName + '/' + fileName;
540 }
541 }
542 }
543 }
544 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
545 } else if (ownerName) {
546 sourceInfo = ' (created by ' + ownerName + ')';
547 }
548 return '\n in ' + (name || 'Unknown') + sourceInfo;
549};
550
551var Resolved = 1;
552
553
554function refineResolvedLazyComponent(lazyComponent) {
555 return lazyComponent._status === Resolved ? lazyComponent._result : null;
556}
557
558function getWrappedName(outerType, innerType, wrapperName) {
559 var functionName = innerType.displayName || innerType.name || '';
560 return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
561}
562
563function getComponentName(type) {
564 if (type == null) {
565 // Host root, text node or just invalid type.
566 return null;
567 }
568 {
569 if (typeof type.tag === 'number') {
570 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
571 }
572 }
573 if (typeof type === 'function') {
574 return type.displayName || type.name || null;
575 }
576 if (typeof type === 'string') {
577 return type;
578 }
579 switch (type) {
580 case REACT_FRAGMENT_TYPE:
581 return 'Fragment';
582 case REACT_PORTAL_TYPE:
583 return 'Portal';
584 case REACT_PROFILER_TYPE:
585 return 'Profiler';
586 case REACT_STRICT_MODE_TYPE:
587 return 'StrictMode';
588 case REACT_SUSPENSE_TYPE:
589 return 'Suspense';
590 case REACT_SUSPENSE_LIST_TYPE:
591 return 'SuspenseList';
592 }
593 if (typeof type === 'object') {
594 switch (type.$$typeof) {
595 case REACT_CONTEXT_TYPE:
596 return 'Context.Consumer';
597 case REACT_PROVIDER_TYPE:
598 return 'Context.Provider';
599 case REACT_FORWARD_REF_TYPE:
600 return getWrappedName(type, type.render, 'ForwardRef');
601 case REACT_MEMO_TYPE:
602 return getComponentName(type.type);
603 case REACT_LAZY_TYPE:
604 {
605 var thenable = type;
606 var resolvedThenable = refineResolvedLazyComponent(thenable);
607 if (resolvedThenable) {
608 return getComponentName(resolvedThenable);
609 }
610 break;
611 }
612 }
613 }
614 return null;
615}
616
617var ReactDebugCurrentFrame = {};
618
619var currentlyValidatingElement = null;
620
621function setCurrentlyValidatingElement(element) {
622 {
623 currentlyValidatingElement = element;
624 }
625}
626
627{
628 // Stack implementation injected by the current renderer.
629 ReactDebugCurrentFrame.getCurrentStack = null;
630
631 ReactDebugCurrentFrame.getStackAddendum = function () {
632 var stack = '';
633
634 // Add an extra top frame while an element is being validated
635 if (currentlyValidatingElement) {
636 var name = getComponentName(currentlyValidatingElement.type);
637 var owner = currentlyValidatingElement._owner;
638 stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
639 }
640
641 // Delegate to the injected renderer-specific implementation
642 var impl = ReactDebugCurrentFrame.getCurrentStack;
643 if (impl) {
644 stack += impl() || '';
645 }
646
647 return stack;
648 };
649}
650
651/**
652 * Used by act() to track whether you're inside an act() scope.
653 */
654
655var IsSomeRendererActing = {
656 current: false
657};
658
659var ReactSharedInternals = {
660 ReactCurrentDispatcher: ReactCurrentDispatcher,
661 ReactCurrentBatchConfig: ReactCurrentBatchConfig,
662 ReactCurrentOwner: ReactCurrentOwner,
663 IsSomeRendererActing: IsSomeRendererActing,
664 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
665 assign: objectAssign
666};
667
668{
669 objectAssign(ReactSharedInternals, {
670 // These should not be included in production.
671 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
672 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
673 // TODO: remove in React 17.0.
674 ReactComponentTreeHook: {}
675 });
676}
677
678/**
679 * Similar to invariant but only logs a warning if the condition is not met.
680 * This can be used to log issues in development environments in critical
681 * paths. Removing the logging code for production environments will keep the
682 * same logic and follow the same code paths.
683 */
684
685var warning = warningWithoutStack$1;
686
687{
688 warning = function (condition, format) {
689 if (condition) {
690 return;
691 }
692 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
693 var stack = ReactDebugCurrentFrame.getStackAddendum();
694 // eslint-disable-next-line react-internal/warning-and-invariant-args
695
696 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
697 args[_key - 2] = arguments[_key];
698 }
699
700 warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
701 };
702}
703
704var warning$1 = warning;
705
706var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
707
708var RESERVED_PROPS = {
709 key: true,
710 ref: true,
711 __self: true,
712 __source: true
713};
714
715var specialPropKeyWarningShown = void 0;
716var specialPropRefWarningShown = void 0;
717
718function hasValidRef(config) {
719 {
720 if (hasOwnProperty$1.call(config, 'ref')) {
721 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
722 if (getter && getter.isReactWarning) {
723 return false;
724 }
725 }
726 }
727 return config.ref !== undefined;
728}
729
730function hasValidKey(config) {
731 {
732 if (hasOwnProperty$1.call(config, 'key')) {
733 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
734 if (getter && getter.isReactWarning) {
735 return false;
736 }
737 }
738 }
739 return config.key !== undefined;
740}
741
742function defineKeyPropWarningGetter(props, displayName) {
743 var warnAboutAccessingKey = function () {
744 if (!specialPropKeyWarningShown) {
745 specialPropKeyWarningShown = true;
746 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);
747 }
748 };
749 warnAboutAccessingKey.isReactWarning = true;
750 Object.defineProperty(props, 'key', {
751 get: warnAboutAccessingKey,
752 configurable: true
753 });
754}
755
756function defineRefPropWarningGetter(props, displayName) {
757 var warnAboutAccessingRef = function () {
758 if (!specialPropRefWarningShown) {
759 specialPropRefWarningShown = true;
760 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);
761 }
762 };
763 warnAboutAccessingRef.isReactWarning = true;
764 Object.defineProperty(props, 'ref', {
765 get: warnAboutAccessingRef,
766 configurable: true
767 });
768}
769
770/**
771 * Factory method to create a new React element. This no longer adheres to
772 * the class pattern, so do not use new to call it. Also, no instanceof check
773 * will work. Instead test $$typeof field against Symbol.for('react.element') to check
774 * if something is a React Element.
775 *
776 * @param {*} type
777 * @param {*} props
778 * @param {*} key
779 * @param {string|object} ref
780 * @param {*} owner
781 * @param {*} self A *temporary* helper to detect places where `this` is
782 * different from the `owner` when React.createElement is called, so that we
783 * can warn. We want to get rid of owner and replace string `ref`s with arrow
784 * functions, and as long as `this` and owner are the same, there will be no
785 * change in behavior.
786 * @param {*} source An annotation object (added by a transpiler or otherwise)
787 * indicating filename, line number, and/or other information.
788 * @internal
789 */
790var ReactElement = function (type, key, ref, self, source, owner, props) {
791 var element = {
792 // This tag allows us to uniquely identify this as a React Element
793 $$typeof: REACT_ELEMENT_TYPE,
794
795 // Built-in properties that belong on the element
796 type: type,
797 key: key,
798 ref: ref,
799 props: props,
800
801 // Record the component responsible for creating this element.
802 _owner: owner
803 };
804
805 {
806 // The validation flag is currently mutative. We put it on
807 // an external backing store so that we can freeze the whole object.
808 // This can be replaced with a WeakMap once they are implemented in
809 // commonly used development environments.
810 element._store = {};
811
812 // To make comparing ReactElements easier for testing purposes, we make
813 // the validation flag non-enumerable (where possible, which should
814 // include every environment we run tests in), so the test framework
815 // ignores it.
816 Object.defineProperty(element._store, 'validated', {
817 configurable: false,
818 enumerable: false,
819 writable: true,
820 value: false
821 });
822 // self and source are DEV only properties.
823 Object.defineProperty(element, '_self', {
824 configurable: false,
825 enumerable: false,
826 writable: false,
827 value: self
828 });
829 // Two elements created in two different places should be considered
830 // equal for testing purposes and therefore we hide it from enumeration.
831 Object.defineProperty(element, '_source', {
832 configurable: false,
833 enumerable: false,
834 writable: false,
835 value: source
836 });
837 if (Object.freeze) {
838 Object.freeze(element.props);
839 Object.freeze(element);
840 }
841 }
842
843 return element;
844};
845
846/**
847 * https://github.com/reactjs/rfcs/pull/107
848 * @param {*} type
849 * @param {object} props
850 * @param {string} key
851 */
852
853
854/**
855 * https://github.com/reactjs/rfcs/pull/107
856 * @param {*} type
857 * @param {object} props
858 * @param {string} key
859 */
860function jsxDEV(type, config, maybeKey, source, self) {
861 var propName = void 0;
862
863 // Reserved names are extracted
864 var props = {};
865
866 var key = null;
867 var ref = null;
868
869 if (hasValidRef(config)) {
870 ref = config.ref;
871 }
872
873 if (hasValidKey(config)) {
874 key = '' + config.key;
875 }
876
877 // Remaining properties are added to a new props object
878 for (propName in config) {
879 if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
880 props[propName] = config[propName];
881 }
882 }
883
884 // intentionally not checking if key was set above
885 // this key is higher priority as it's static
886 if (maybeKey !== undefined) {
887 key = '' + maybeKey;
888 }
889
890 // Resolve default props
891 if (type && type.defaultProps) {
892 var defaultProps = type.defaultProps;
893 for (propName in defaultProps) {
894 if (props[propName] === undefined) {
895 props[propName] = defaultProps[propName];
896 }
897 }
898 }
899
900 if (key || ref) {
901 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
902 if (key) {
903 defineKeyPropWarningGetter(props, displayName);
904 }
905 if (ref) {
906 defineRefPropWarningGetter(props, displayName);
907 }
908 }
909
910 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
911}
912
913/**
914 * Create and return a new ReactElement of the given type.
915 * See https://reactjs.org/docs/react-api.html#createelement
916 */
917function createElement(type, config, children) {
918 var propName = void 0;
919
920 // Reserved names are extracted
921 var props = {};
922
923 var key = null;
924 var ref = null;
925 var self = null;
926 var source = null;
927
928 if (config != null) {
929 if (hasValidRef(config)) {
930 ref = config.ref;
931 }
932 if (hasValidKey(config)) {
933 key = '' + config.key;
934 }
935
936 self = config.__self === undefined ? null : config.__self;
937 source = config.__source === undefined ? null : config.__source;
938 // Remaining properties are added to a new props object
939 for (propName in config) {
940 if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
941 props[propName] = config[propName];
942 }
943 }
944 }
945
946 // Children can be more than one argument, and those are transferred onto
947 // the newly allocated props object.
948 var childrenLength = arguments.length - 2;
949 if (childrenLength === 1) {
950 props.children = children;
951 } else if (childrenLength > 1) {
952 var childArray = Array(childrenLength);
953 for (var i = 0; i < childrenLength; i++) {
954 childArray[i] = arguments[i + 2];
955 }
956 {
957 if (Object.freeze) {
958 Object.freeze(childArray);
959 }
960 }
961 props.children = childArray;
962 }
963
964 // Resolve default props
965 if (type && type.defaultProps) {
966 var defaultProps = type.defaultProps;
967 for (propName in defaultProps) {
968 if (props[propName] === undefined) {
969 props[propName] = defaultProps[propName];
970 }
971 }
972 }
973 {
974 if (key || ref) {
975 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
976 if (key) {
977 defineKeyPropWarningGetter(props, displayName);
978 }
979 if (ref) {
980 defineRefPropWarningGetter(props, displayName);
981 }
982 }
983 }
984 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
985}
986
987/**
988 * Return a function that produces ReactElements of a given type.
989 * See https://reactjs.org/docs/react-api.html#createfactory
990 */
991
992
993function cloneAndReplaceKey(oldElement, newKey) {
994 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
995
996 return newElement;
997}
998
999/**
1000 * Clone and return a new ReactElement using element as the starting point.
1001 * See https://reactjs.org/docs/react-api.html#cloneelement
1002 */
1003function cloneElement(element, config, children) {
1004 (function () {
1005 if (!!(element === null || element === undefined)) {
1006 {
1007 throw ReactError(Error('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.'));
1008 }
1009 }
1010 })();
1011
1012 var propName = void 0;
1013
1014 // Original props are copied
1015 var props = objectAssign({}, element.props);
1016
1017 // Reserved names are extracted
1018 var key = element.key;
1019 var ref = element.ref;
1020 // Self is preserved since the owner is preserved.
1021 var self = element._self;
1022 // Source is preserved since cloneElement is unlikely to be targeted by a
1023 // transpiler, and the original source is probably a better indicator of the
1024 // true owner.
1025 var source = element._source;
1026
1027 // Owner will be preserved, unless ref is overridden
1028 var owner = element._owner;
1029
1030 if (config != null) {
1031 if (hasValidRef(config)) {
1032 // Silently steal the ref from the parent.
1033 ref = config.ref;
1034 owner = ReactCurrentOwner.current;
1035 }
1036 if (hasValidKey(config)) {
1037 key = '' + config.key;
1038 }
1039
1040 // Remaining properties override existing props
1041 var defaultProps = void 0;
1042 if (element.type && element.type.defaultProps) {
1043 defaultProps = element.type.defaultProps;
1044 }
1045 for (propName in config) {
1046 if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1047 if (config[propName] === undefined && defaultProps !== undefined) {
1048 // Resolve default props
1049 props[propName] = defaultProps[propName];
1050 } else {
1051 props[propName] = config[propName];
1052 }
1053 }
1054 }
1055 }
1056
1057 // Children can be more than one argument, and those are transferred onto
1058 // the newly allocated props object.
1059 var childrenLength = arguments.length - 2;
1060 if (childrenLength === 1) {
1061 props.children = children;
1062 } else if (childrenLength > 1) {
1063 var childArray = Array(childrenLength);
1064 for (var i = 0; i < childrenLength; i++) {
1065 childArray[i] = arguments[i + 2];
1066 }
1067 props.children = childArray;
1068 }
1069
1070 return ReactElement(element.type, key, ref, self, source, owner, props);
1071}
1072
1073/**
1074 * Verifies the object is a ReactElement.
1075 * See https://reactjs.org/docs/react-api.html#isvalidelement
1076 * @param {?object} object
1077 * @return {boolean} True if `object` is a ReactElement.
1078 * @final
1079 */
1080function isValidElement(object) {
1081 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1082}
1083
1084var SEPARATOR = '.';
1085var SUBSEPARATOR = ':';
1086
1087/**
1088 * Escape and wrap key so it is safe to use as a reactid
1089 *
1090 * @param {string} key to be escaped.
1091 * @return {string} the escaped key.
1092 */
1093function escape(key) {
1094 var escapeRegex = /[=:]/g;
1095 var escaperLookup = {
1096 '=': '=0',
1097 ':': '=2'
1098 };
1099 var escapedString = ('' + key).replace(escapeRegex, function (match) {
1100 return escaperLookup[match];
1101 });
1102
1103 return '$' + escapedString;
1104}
1105
1106/**
1107 * TODO: Test that a single child and an array with one item have the same key
1108 * pattern.
1109 */
1110
1111var didWarnAboutMaps = false;
1112
1113var userProvidedKeyEscapeRegex = /\/+/g;
1114function escapeUserProvidedKey(text) {
1115 return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
1116}
1117
1118var POOL_SIZE = 10;
1119var traverseContextPool = [];
1120function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
1121 if (traverseContextPool.length) {
1122 var traverseContext = traverseContextPool.pop();
1123 traverseContext.result = mapResult;
1124 traverseContext.keyPrefix = keyPrefix;
1125 traverseContext.func = mapFunction;
1126 traverseContext.context = mapContext;
1127 traverseContext.count = 0;
1128 return traverseContext;
1129 } else {
1130 return {
1131 result: mapResult,
1132 keyPrefix: keyPrefix,
1133 func: mapFunction,
1134 context: mapContext,
1135 count: 0
1136 };
1137 }
1138}
1139
1140function releaseTraverseContext(traverseContext) {
1141 traverseContext.result = null;
1142 traverseContext.keyPrefix = null;
1143 traverseContext.func = null;
1144 traverseContext.context = null;
1145 traverseContext.count = 0;
1146 if (traverseContextPool.length < POOL_SIZE) {
1147 traverseContextPool.push(traverseContext);
1148 }
1149}
1150
1151/**
1152 * @param {?*} children Children tree container.
1153 * @param {!string} nameSoFar Name of the key path so far.
1154 * @param {!function} callback Callback to invoke with each child found.
1155 * @param {?*} traverseContext Used to pass information throughout the traversal
1156 * process.
1157 * @return {!number} The number of children in this subtree.
1158 */
1159function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
1160 var type = typeof children;
1161
1162 if (type === 'undefined' || type === 'boolean') {
1163 // All of the above are perceived as null.
1164 children = null;
1165 }
1166
1167 var invokeCallback = false;
1168
1169 if (children === null) {
1170 invokeCallback = true;
1171 } else {
1172 switch (type) {
1173 case 'string':
1174 case 'number':
1175 invokeCallback = true;
1176 break;
1177 case 'object':
1178 switch (children.$$typeof) {
1179 case REACT_ELEMENT_TYPE:
1180 case REACT_PORTAL_TYPE:
1181 invokeCallback = true;
1182 }
1183 }
1184 }
1185
1186 if (invokeCallback) {
1187 callback(traverseContext, children,
1188 // If it's the only child, treat the name as if it was wrapped in an array
1189 // so that it's consistent if the number of children grows.
1190 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
1191 return 1;
1192 }
1193
1194 var child = void 0;
1195 var nextName = void 0;
1196 var subtreeCount = 0; // Count of children found in the current subtree.
1197 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1198
1199 if (Array.isArray(children)) {
1200 for (var i = 0; i < children.length; i++) {
1201 child = children[i];
1202 nextName = nextNamePrefix + getComponentKey(child, i);
1203 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1204 }
1205 } else {
1206 var iteratorFn = getIteratorFn(children);
1207 if (typeof iteratorFn === 'function') {
1208 {
1209 // Warn about using Maps as children
1210 if (iteratorFn === children.entries) {
1211 !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;
1212 didWarnAboutMaps = true;
1213 }
1214 }
1215
1216 var iterator = iteratorFn.call(children);
1217 var step = void 0;
1218 var ii = 0;
1219 while (!(step = iterator.next()).done) {
1220 child = step.value;
1221 nextName = nextNamePrefix + getComponentKey(child, ii++);
1222 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1223 }
1224 } else if (type === 'object') {
1225 var addendum = '';
1226 {
1227 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
1228 }
1229 var childrenString = '' + children;
1230 (function () {
1231 {
1232 {
1233 throw ReactError(Error('Objects are not valid as a React child (found: ' + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ').' + addendum));
1234 }
1235 }
1236 })();
1237 }
1238 }
1239
1240 return subtreeCount;
1241}
1242
1243/**
1244 * Traverses children that are typically specified as `props.children`, but
1245 * might also be specified through attributes:
1246 *
1247 * - `traverseAllChildren(this.props.children, ...)`
1248 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1249 *
1250 * The `traverseContext` is an optional argument that is passed through the
1251 * entire traversal. It can be used to store accumulations or anything else that
1252 * the callback might find relevant.
1253 *
1254 * @param {?*} children Children tree object.
1255 * @param {!function} callback To invoke upon traversing each child.
1256 * @param {?*} traverseContext Context for traversal.
1257 * @return {!number} The number of children in this subtree.
1258 */
1259function traverseAllChildren(children, callback, traverseContext) {
1260 if (children == null) {
1261 return 0;
1262 }
1263
1264 return traverseAllChildrenImpl(children, '', callback, traverseContext);
1265}
1266
1267/**
1268 * Generate a key string that identifies a component within a set.
1269 *
1270 * @param {*} component A component that could contain a manual key.
1271 * @param {number} index Index that is used if a manual key is not provided.
1272 * @return {string}
1273 */
1274function getComponentKey(component, index) {
1275 // Do some typechecking here since we call this blindly. We want to ensure
1276 // that we don't block potential future ES APIs.
1277 if (typeof component === 'object' && component !== null && component.key != null) {
1278 // Explicit key
1279 return escape(component.key);
1280 }
1281 // Implicit key determined by the index in the set
1282 return index.toString(36);
1283}
1284
1285function forEachSingleChild(bookKeeping, child, name) {
1286 var func = bookKeeping.func,
1287 context = bookKeeping.context;
1288
1289 func.call(context, child, bookKeeping.count++);
1290}
1291
1292/**
1293 * Iterates through children that are typically specified as `props.children`.
1294 *
1295 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1296 *
1297 * The provided forEachFunc(child, index) will be called for each
1298 * leaf child.
1299 *
1300 * @param {?*} children Children tree container.
1301 * @param {function(*, int)} forEachFunc
1302 * @param {*} forEachContext Context for forEachContext.
1303 */
1304function forEachChildren(children, forEachFunc, forEachContext) {
1305 if (children == null) {
1306 return children;
1307 }
1308 var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
1309 traverseAllChildren(children, forEachSingleChild, traverseContext);
1310 releaseTraverseContext(traverseContext);
1311}
1312
1313function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1314 var result = bookKeeping.result,
1315 keyPrefix = bookKeeping.keyPrefix,
1316 func = bookKeeping.func,
1317 context = bookKeeping.context;
1318
1319
1320 var mappedChild = func.call(context, child, bookKeeping.count++);
1321 if (Array.isArray(mappedChild)) {
1322 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1323 return c;
1324 });
1325 } else if (mappedChild != null) {
1326 if (isValidElement(mappedChild)) {
1327 mappedChild = cloneAndReplaceKey(mappedChild,
1328 // Keep both the (mapped) and old keys if they differ, just as
1329 // traverseAllChildren used to do for objects as children
1330 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
1331 }
1332 result.push(mappedChild);
1333 }
1334}
1335
1336function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1337 var escapedPrefix = '';
1338 if (prefix != null) {
1339 escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1340 }
1341 var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
1342 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1343 releaseTraverseContext(traverseContext);
1344}
1345
1346/**
1347 * Maps children that are typically specified as `props.children`.
1348 *
1349 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1350 *
1351 * The provided mapFunction(child, key, index) will be called for each
1352 * leaf child.
1353 *
1354 * @param {?*} children Children tree container.
1355 * @param {function(*, int)} func The map function.
1356 * @param {*} context Context for mapFunction.
1357 * @return {object} Object containing the ordered map of results.
1358 */
1359function mapChildren(children, func, context) {
1360 if (children == null) {
1361 return children;
1362 }
1363 var result = [];
1364 mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1365 return result;
1366}
1367
1368/**
1369 * Count the number of children that are typically specified as
1370 * `props.children`.
1371 *
1372 * See https://reactjs.org/docs/react-api.html#reactchildrencount
1373 *
1374 * @param {?*} children Children tree container.
1375 * @return {number} The number of children.
1376 */
1377function countChildren(children) {
1378 return traverseAllChildren(children, function () {
1379 return null;
1380 }, null);
1381}
1382
1383/**
1384 * Flatten a children object (typically specified as `props.children`) and
1385 * return an array with appropriately re-keyed children.
1386 *
1387 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1388 */
1389function toArray(children) {
1390 var result = [];
1391 mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1392 return child;
1393 });
1394 return result;
1395}
1396
1397/**
1398 * Returns the first child in a collection of children and verifies that there
1399 * is only one child in the collection.
1400 *
1401 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1402 *
1403 * The current implementation of this function assumes that a single child gets
1404 * passed without a wrapper, but the purpose of this helper function is to
1405 * abstract away the particular structure of children.
1406 *
1407 * @param {?object} children Child collection structure.
1408 * @return {ReactElement} The first and only `ReactElement` contained in the
1409 * structure.
1410 */
1411function onlyChild(children) {
1412 (function () {
1413 if (!isValidElement(children)) {
1414 {
1415 throw ReactError(Error('React.Children.only expected to receive a single React element child.'));
1416 }
1417 }
1418 })();
1419 return children;
1420}
1421
1422function createContext(defaultValue, calculateChangedBits) {
1423 if (calculateChangedBits === undefined) {
1424 calculateChangedBits = null;
1425 } else {
1426 {
1427 !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
1428 }
1429 }
1430
1431 var context = {
1432 $$typeof: REACT_CONTEXT_TYPE,
1433 _calculateChangedBits: calculateChangedBits,
1434 // As a workaround to support multiple concurrent renderers, we categorize
1435 // some renderers as primary and others as secondary. We only expect
1436 // there to be two concurrent renderers at most: React Native (primary) and
1437 // Fabric (secondary); React DOM (primary) and React ART (secondary).
1438 // Secondary renderers store their context values on separate fields.
1439 _currentValue: defaultValue,
1440 _currentValue2: defaultValue,
1441 // Used to track how many concurrent renderers this context currently
1442 // supports within in a single renderer. Such as parallel server rendering.
1443 _threadCount: 0,
1444 // These are circular
1445 Provider: null,
1446 Consumer: null
1447 };
1448
1449 context.Provider = {
1450 $$typeof: REACT_PROVIDER_TYPE,
1451 _context: context
1452 };
1453
1454 var hasWarnedAboutUsingNestedContextConsumers = false;
1455 var hasWarnedAboutUsingConsumerProvider = false;
1456
1457 {
1458 // A separate object, but proxies back to the original context object for
1459 // backwards compatibility. It has a different $$typeof, so we can properly
1460 // warn for the incorrect usage of Context as a Consumer.
1461 var Consumer = {
1462 $$typeof: REACT_CONTEXT_TYPE,
1463 _context: context,
1464 _calculateChangedBits: context._calculateChangedBits
1465 };
1466 // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1467 Object.defineProperties(Consumer, {
1468 Provider: {
1469 get: function () {
1470 if (!hasWarnedAboutUsingConsumerProvider) {
1471 hasWarnedAboutUsingConsumerProvider = true;
1472 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?');
1473 }
1474 return context.Provider;
1475 },
1476 set: function (_Provider) {
1477 context.Provider = _Provider;
1478 }
1479 },
1480 _currentValue: {
1481 get: function () {
1482 return context._currentValue;
1483 },
1484 set: function (_currentValue) {
1485 context._currentValue = _currentValue;
1486 }
1487 },
1488 _currentValue2: {
1489 get: function () {
1490 return context._currentValue2;
1491 },
1492 set: function (_currentValue2) {
1493 context._currentValue2 = _currentValue2;
1494 }
1495 },
1496 _threadCount: {
1497 get: function () {
1498 return context._threadCount;
1499 },
1500 set: function (_threadCount) {
1501 context._threadCount = _threadCount;
1502 }
1503 },
1504 Consumer: {
1505 get: function () {
1506 if (!hasWarnedAboutUsingNestedContextConsumers) {
1507 hasWarnedAboutUsingNestedContextConsumers = true;
1508 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?');
1509 }
1510 return context.Consumer;
1511 }
1512 }
1513 });
1514 // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1515 context.Consumer = Consumer;
1516 }
1517
1518 {
1519 context._currentRenderer = null;
1520 context._currentRenderer2 = null;
1521 }
1522
1523 return context;
1524}
1525
1526function lazy(ctor) {
1527 var lazyType = {
1528 $$typeof: REACT_LAZY_TYPE,
1529 _ctor: ctor,
1530 // React uses these fields to store the result.
1531 _status: -1,
1532 _result: null
1533 };
1534
1535 {
1536 // In production, this would just set it on the object.
1537 var defaultProps = void 0;
1538 var propTypes = void 0;
1539 Object.defineProperties(lazyType, {
1540 defaultProps: {
1541 configurable: true,
1542 get: function () {
1543 return defaultProps;
1544 },
1545 set: function (newDefaultProps) {
1546 warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1547 defaultProps = newDefaultProps;
1548 // Match production behavior more closely:
1549 Object.defineProperty(lazyType, 'defaultProps', {
1550 enumerable: true
1551 });
1552 }
1553 },
1554 propTypes: {
1555 configurable: true,
1556 get: function () {
1557 return propTypes;
1558 },
1559 set: function (newPropTypes) {
1560 warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1561 propTypes = newPropTypes;
1562 // Match production behavior more closely:
1563 Object.defineProperty(lazyType, 'propTypes', {
1564 enumerable: true
1565 });
1566 }
1567 }
1568 });
1569 }
1570
1571 return lazyType;
1572}
1573
1574function forwardRef(render) {
1575 {
1576 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1577 warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1578 } else if (typeof render !== 'function') {
1579 warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1580 } else {
1581 !(
1582 // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
1583 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;
1584 }
1585
1586 if (render != null) {
1587 !(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;
1588 }
1589 }
1590
1591 return {
1592 $$typeof: REACT_FORWARD_REF_TYPE,
1593 render: render
1594 };
1595}
1596
1597function isValidElementType(type) {
1598 return typeof type === 'string' || typeof type === 'function' ||
1599 // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1600 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE);
1601}
1602
1603function memo(type, compare) {
1604 {
1605 if (!isValidElementType(type)) {
1606 warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1607 }
1608 }
1609 return {
1610 $$typeof: REACT_MEMO_TYPE,
1611 type: type,
1612 compare: compare === undefined ? null : compare
1613 };
1614}
1615
1616function resolveDispatcher() {
1617 var dispatcher = ReactCurrentDispatcher.current;
1618 (function () {
1619 if (!(dispatcher !== null)) {
1620 {
1621 throw ReactError(Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.'));
1622 }
1623 }
1624 })();
1625 return dispatcher;
1626}
1627
1628function useContext(Context, unstable_observedBits) {
1629 var dispatcher = resolveDispatcher();
1630 {
1631 !(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
1632
1633 // TODO: add a more generic warning for invalid values.
1634 if (Context._context !== undefined) {
1635 var realContext = Context._context;
1636 // Don't deduplicate because this legitimately causes bugs
1637 // and nobody should be using this in existing code.
1638 if (realContext.Consumer === Context) {
1639 warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
1640 } else if (realContext.Provider === Context) {
1641 warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1642 }
1643 }
1644 }
1645 return dispatcher.useContext(Context, unstable_observedBits);
1646}
1647
1648function useState(initialState) {
1649 var dispatcher = resolveDispatcher();
1650 return dispatcher.useState(initialState);
1651}
1652
1653function useReducer(reducer, initialArg, init) {
1654 var dispatcher = resolveDispatcher();
1655 return dispatcher.useReducer(reducer, initialArg, init);
1656}
1657
1658function useRef(initialValue) {
1659 var dispatcher = resolveDispatcher();
1660 return dispatcher.useRef(initialValue);
1661}
1662
1663function useEffect(create, inputs) {
1664 var dispatcher = resolveDispatcher();
1665 return dispatcher.useEffect(create, inputs);
1666}
1667
1668function useLayoutEffect(create, inputs) {
1669 var dispatcher = resolveDispatcher();
1670 return dispatcher.useLayoutEffect(create, inputs);
1671}
1672
1673function useCallback(callback, inputs) {
1674 var dispatcher = resolveDispatcher();
1675 return dispatcher.useCallback(callback, inputs);
1676}
1677
1678function useMemo(create, inputs) {
1679 var dispatcher = resolveDispatcher();
1680 return dispatcher.useMemo(create, inputs);
1681}
1682
1683function useImperativeHandle(ref, create, inputs) {
1684 var dispatcher = resolveDispatcher();
1685 return dispatcher.useImperativeHandle(ref, create, inputs);
1686}
1687
1688function useDebugValue(value, formatterFn) {
1689 {
1690 var dispatcher = resolveDispatcher();
1691 return dispatcher.useDebugValue(value, formatterFn);
1692 }
1693}
1694
1695var emptyObject$1 = {};
1696
1697function useResponder(responder, listenerProps) {
1698 var dispatcher = resolveDispatcher();
1699 {
1700 if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
1701 warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
1702 return;
1703 }
1704 }
1705 return dispatcher.useResponder(responder, listenerProps || emptyObject$1);
1706}
1707
1708// Within the scope of the callback, mark all updates as being allowed to suspend.
1709function withSuspenseConfig(scope, config) {
1710 var previousConfig = ReactCurrentBatchConfig.suspense;
1711 ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
1712 try {
1713 scope();
1714 } finally {
1715 ReactCurrentBatchConfig.suspense = previousConfig;
1716 }
1717}
1718
1719/**
1720 * Copyright (c) 2013-present, Facebook, Inc.
1721 *
1722 * This source code is licensed under the MIT license found in the
1723 * LICENSE file in the root directory of this source tree.
1724 */
1725
1726
1727
1728var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1729
1730var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
1731
1732/**
1733 * Copyright (c) 2013-present, Facebook, Inc.
1734 *
1735 * This source code is licensed under the MIT license found in the
1736 * LICENSE file in the root directory of this source tree.
1737 */
1738
1739
1740
1741var printWarning$1 = function() {};
1742
1743{
1744 var ReactPropTypesSecret = ReactPropTypesSecret_1;
1745 var loggedTypeFailures = {};
1746
1747 printWarning$1 = function(text) {
1748 var message = 'Warning: ' + text;
1749 if (typeof console !== 'undefined') {
1750 console.error(message);
1751 }
1752 try {
1753 // --- Welcome to debugging React ---
1754 // This error was thrown as a convenience so that you can use this stack
1755 // to find the callsite that caused this warning to fire.
1756 throw new Error(message);
1757 } catch (x) {}
1758 };
1759}
1760
1761/**
1762 * Assert that the values match with the type specs.
1763 * Error messages are memorized and will only be shown once.
1764 *
1765 * @param {object} typeSpecs Map of name to a ReactPropType
1766 * @param {object} values Runtime values that need to be type-checked
1767 * @param {string} location e.g. "prop", "context", "child context"
1768 * @param {string} componentName Name of the component for error messages.
1769 * @param {?Function} getStack Returns the component stack.
1770 * @private
1771 */
1772function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1773 {
1774 for (var typeSpecName in typeSpecs) {
1775 if (typeSpecs.hasOwnProperty(typeSpecName)) {
1776 var error;
1777 // Prop type validation may throw. In case they do, we don't want to
1778 // fail the render phase where it didn't fail before. So we log it.
1779 // After these have been cleaned up, we'll let them throw.
1780 try {
1781 // This is intentionally an invariant that gets caught. It's the same
1782 // behavior as without this statement except with a better message.
1783 if (typeof typeSpecs[typeSpecName] !== 'function') {
1784 var err = Error(
1785 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
1786 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
1787 );
1788 err.name = 'Invariant Violation';
1789 throw err;
1790 }
1791 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
1792 } catch (ex) {
1793 error = ex;
1794 }
1795 if (error && !(error instanceof Error)) {
1796 printWarning$1(
1797 (componentName || 'React class') + ': type specification of ' +
1798 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
1799 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
1800 'You may have forgotten to pass an argument to the type checker ' +
1801 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
1802 'shape all require an argument).'
1803 );
1804
1805 }
1806 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1807 // Only monitor this failure once because there tends to be a lot of the
1808 // same error.
1809 loggedTypeFailures[error.message] = true;
1810
1811 var stack = getStack ? getStack() : '';
1812
1813 printWarning$1(
1814 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
1815 );
1816 }
1817 }
1818 }
1819 }
1820}
1821
1822var checkPropTypes_1 = checkPropTypes;
1823
1824/**
1825 * ReactElementValidator provides a wrapper around a element factory
1826 * which validates the props passed to the element. This is intended to be
1827 * used only in DEV and could be replaced by a static type checker for languages
1828 * that support it.
1829 */
1830
1831var propTypesMisspellWarningShown = void 0;
1832
1833{
1834 propTypesMisspellWarningShown = false;
1835}
1836
1837function getDeclarationErrorAddendum() {
1838 if (ReactCurrentOwner.current) {
1839 var name = getComponentName(ReactCurrentOwner.current.type);
1840 if (name) {
1841 return '\n\nCheck the render method of `' + name + '`.';
1842 }
1843 }
1844 return '';
1845}
1846
1847function getSourceInfoErrorAddendum(source) {
1848 if (source !== undefined) {
1849 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1850 var lineNumber = source.lineNumber;
1851 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1852 }
1853 return '';
1854}
1855
1856function getSourceInfoErrorAddendumForProps(elementProps) {
1857 if (elementProps !== null && elementProps !== undefined) {
1858 return getSourceInfoErrorAddendum(elementProps.__source);
1859 }
1860 return '';
1861}
1862
1863/**
1864 * Warn if there's no key explicitly set on dynamic arrays of children or
1865 * object keys are not valid. This allows us to keep track of children between
1866 * updates.
1867 */
1868var ownerHasKeyUseWarning = {};
1869
1870function getCurrentComponentErrorInfo(parentType) {
1871 var info = getDeclarationErrorAddendum();
1872
1873 if (!info) {
1874 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1875 if (parentName) {
1876 info = '\n\nCheck the top-level render call using <' + parentName + '>.';
1877 }
1878 }
1879 return info;
1880}
1881
1882/**
1883 * Warn if the element doesn't have an explicit key assigned to it.
1884 * This element is in an array. The array could grow and shrink or be
1885 * reordered. All children that haven't already been validated are required to
1886 * have a "key" property assigned to it. Error statuses are cached so a warning
1887 * will only be shown once.
1888 *
1889 * @internal
1890 * @param {ReactElement} element Element that requires a key.
1891 * @param {*} parentType element's parent's type.
1892 */
1893function validateExplicitKey(element, parentType) {
1894 if (!element._store || element._store.validated || element.key != null) {
1895 return;
1896 }
1897 element._store.validated = true;
1898
1899 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1900 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1901 return;
1902 }
1903 ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1904
1905 // Usually the current owner is the offender, but if it accepts children as a
1906 // property, it may be the creator of the child that's responsible for
1907 // assigning it a key.
1908 var childOwner = '';
1909 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1910 // Give the component that originally created this child.
1911 childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
1912 }
1913
1914 setCurrentlyValidatingElement(element);
1915 {
1916 warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1917 }
1918 setCurrentlyValidatingElement(null);
1919}
1920
1921/**
1922 * Ensure that every element either is passed in a static location, in an
1923 * array with an explicit keys property defined, or in an object literal
1924 * with valid key property.
1925 *
1926 * @internal
1927 * @param {ReactNode} node Statically passed child of any type.
1928 * @param {*} parentType node's parent's type.
1929 */
1930function validateChildKeys(node, parentType) {
1931 if (typeof node !== 'object') {
1932 return;
1933 }
1934 if (Array.isArray(node)) {
1935 for (var i = 0; i < node.length; i++) {
1936 var child = node[i];
1937 if (isValidElement(child)) {
1938 validateExplicitKey(child, parentType);
1939 }
1940 }
1941 } else if (isValidElement(node)) {
1942 // This element was passed in a valid location.
1943 if (node._store) {
1944 node._store.validated = true;
1945 }
1946 } else if (node) {
1947 var iteratorFn = getIteratorFn(node);
1948 if (typeof iteratorFn === 'function') {
1949 // Entry iterators used to provide implicit keys,
1950 // but now we print a separate warning for them later.
1951 if (iteratorFn !== node.entries) {
1952 var iterator = iteratorFn.call(node);
1953 var step = void 0;
1954 while (!(step = iterator.next()).done) {
1955 if (isValidElement(step.value)) {
1956 validateExplicitKey(step.value, parentType);
1957 }
1958 }
1959 }
1960 }
1961 }
1962}
1963
1964/**
1965 * Given an element, validate that its props follow the propTypes definition,
1966 * provided by the type.
1967 *
1968 * @param {ReactElement} element
1969 */
1970function validatePropTypes(element) {
1971 var type = element.type;
1972 if (type === null || type === undefined || typeof type === 'string') {
1973 return;
1974 }
1975 var name = getComponentName(type);
1976 var propTypes = void 0;
1977 if (typeof type === 'function') {
1978 propTypes = type.propTypes;
1979 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
1980 // Note: Memo only checks outer props here.
1981 // Inner props are checked in the reconciler.
1982 type.$$typeof === REACT_MEMO_TYPE)) {
1983 propTypes = type.propTypes;
1984 } else {
1985 return;
1986 }
1987 if (propTypes) {
1988 setCurrentlyValidatingElement(element);
1989 checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1990 setCurrentlyValidatingElement(null);
1991 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1992 propTypesMisspellWarningShown = true;
1993 warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1994 }
1995 if (typeof type.getDefaultProps === 'function') {
1996 !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1997 }
1998}
1999
2000/**
2001 * Given a fragment, validate that it can only be provided with fragment props
2002 * @param {ReactElement} fragment
2003 */
2004function validateFragmentProps(fragment) {
2005 setCurrentlyValidatingElement(fragment);
2006
2007 var keys = Object.keys(fragment.props);
2008 for (var i = 0; i < keys.length; i++) {
2009 var key = keys[i];
2010 if (key !== 'children' && key !== 'key') {
2011 warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2012 break;
2013 }
2014 }
2015
2016 if (fragment.ref !== null) {
2017 warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
2018 }
2019
2020 setCurrentlyValidatingElement(null);
2021}
2022
2023function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
2024 var validType = isValidElementType(type);
2025
2026 // We warn in this case but don't throw. We expect the element creation to
2027 // succeed and there will likely be errors in render.
2028 if (!validType) {
2029 var info = '';
2030 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2031 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.";
2032 }
2033
2034 var sourceInfo = getSourceInfoErrorAddendum(source);
2035 if (sourceInfo) {
2036 info += sourceInfo;
2037 } else {
2038 info += getDeclarationErrorAddendum();
2039 }
2040
2041 var typeString = void 0;
2042 if (type === null) {
2043 typeString = 'null';
2044 } else if (Array.isArray(type)) {
2045 typeString = 'array';
2046 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2047 typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
2048 info = ' Did you accidentally export a JSX literal instead of a component?';
2049 } else {
2050 typeString = typeof type;
2051 }
2052
2053 warning$1(false, 'React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2054 }
2055
2056 var element = jsxDEV(type, props, key, source, self);
2057
2058 // The result can be nullish if a mock or a custom function is used.
2059 // TODO: Drop this when these are no longer allowed as the type argument.
2060 if (element == null) {
2061 return element;
2062 }
2063
2064 // Skip key warning if the type isn't valid since our key validation logic
2065 // doesn't expect a non-string/function type and can throw confusing errors.
2066 // We don't want exception behavior to differ between dev and prod.
2067 // (Rendering will throw with a helpful message and as soon as the type is
2068 // fixed, the key warnings will appear.)
2069 if (validType) {
2070 var children = props.children;
2071 if (children !== undefined) {
2072 if (isStaticChildren) {
2073 for (var i = 0; i < children.length; i++) {
2074 validateChildKeys(children[i], type);
2075 }
2076 } else {
2077 validateChildKeys(children, type);
2078 }
2079 }
2080 }
2081
2082 if (props.key !== undefined) {
2083 warning$1(false, 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
2084 }
2085
2086 if (type === REACT_FRAGMENT_TYPE) {
2087 validateFragmentProps(element);
2088 } else {
2089 validatePropTypes(element);
2090 }
2091
2092 return element;
2093}
2094
2095// These two functions exist to still get child warnings in dev
2096// even with the prod transform. This means that jsxDEV is purely
2097// opt-in behavior for better messages but that we won't stop
2098// giving you warnings if you use production apis.
2099function jsxWithValidationStatic(type, props, key) {
2100 return jsxWithValidation(type, props, key, true);
2101}
2102
2103function jsxWithValidationDynamic(type, props, key) {
2104 return jsxWithValidation(type, props, key, false);
2105}
2106
2107function createElementWithValidation(type, props, children) {
2108 var validType = isValidElementType(type);
2109
2110 // We warn in this case but don't throw. We expect the element creation to
2111 // succeed and there will likely be errors in render.
2112 if (!validType) {
2113 var info = '';
2114 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2115 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.";
2116 }
2117
2118 var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2119 if (sourceInfo) {
2120 info += sourceInfo;
2121 } else {
2122 info += getDeclarationErrorAddendum();
2123 }
2124
2125 var typeString = void 0;
2126 if (type === null) {
2127 typeString = 'null';
2128 } else if (Array.isArray(type)) {
2129 typeString = 'array';
2130 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2131 typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
2132 info = ' Did you accidentally export a JSX literal instead of a component?';
2133 } else {
2134 typeString = typeof type;
2135 }
2136
2137 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);
2138 }
2139
2140 var element = createElement.apply(this, arguments);
2141
2142 // The result can be nullish if a mock or a custom function is used.
2143 // TODO: Drop this when these are no longer allowed as the type argument.
2144 if (element == null) {
2145 return element;
2146 }
2147
2148 // Skip key warning if the type isn't valid since our key validation logic
2149 // doesn't expect a non-string/function type and can throw confusing errors.
2150 // We don't want exception behavior to differ between dev and prod.
2151 // (Rendering will throw with a helpful message and as soon as the type is
2152 // fixed, the key warnings will appear.)
2153 if (validType) {
2154 for (var i = 2; i < arguments.length; i++) {
2155 validateChildKeys(arguments[i], type);
2156 }
2157 }
2158
2159 if (type === REACT_FRAGMENT_TYPE) {
2160 validateFragmentProps(element);
2161 } else {
2162 validatePropTypes(element);
2163 }
2164
2165 return element;
2166}
2167
2168function createFactoryWithValidation(type) {
2169 var validatedFactory = createElementWithValidation.bind(null, type);
2170 validatedFactory.type = type;
2171 // Legacy hook: remove it
2172 {
2173 Object.defineProperty(validatedFactory, 'type', {
2174 enumerable: false,
2175 get: function () {
2176 lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2177 Object.defineProperty(this, 'type', {
2178 value: type
2179 });
2180 return type;
2181 }
2182 });
2183 }
2184
2185 return validatedFactory;
2186}
2187
2188function cloneElementWithValidation(element, props, children) {
2189 var newElement = cloneElement.apply(this, arguments);
2190 for (var i = 2; i < arguments.length; i++) {
2191 validateChildKeys(arguments[i], newElement.type);
2192 }
2193 validatePropTypes(newElement);
2194 return newElement;
2195}
2196
2197var enableSchedulerDebugging = false;
2198var enableIsInputPending = false;
2199var requestIdleCallbackBeforeFirstFrame = false;
2200var requestTimerEventBeforeFirstFrame = false;
2201var enableMessageLoopImplementation = false;
2202
2203// The DOM Scheduler implementation is similar to requestIdleCallback. It
2204// works by scheduling a requestAnimationFrame, storing the time for the start
2205// of the frame, then scheduling a postMessage which gets scheduled after paint.
2206// Within the postMessage handler do as much work as possible until time + frame
2207// rate. By separating the idle call into a separate event tick we ensure that
2208// layout, paint and other browser work is counted against the available time.
2209// The frame rate is dynamically adjusted.
2210
2211var requestHostCallback = void 0;
2212
2213var requestHostTimeout = void 0;
2214var cancelHostTimeout = void 0;
2215var shouldYieldToHost = void 0;
2216var requestPaint = void 0;
2217var getCurrentTime = void 0;
2218var forceFrameRate = void 0;
2219
2220if (
2221// If Scheduler runs in a non-DOM environment, it falls back to a naive
2222// implementation using setTimeout.
2223typeof window === 'undefined' ||
2224// Check if MessageChannel is supported, too.
2225typeof MessageChannel !== 'function') {
2226 // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
2227 // fallback to a naive implementation.
2228 var _callback = null;
2229 var _timeoutID = null;
2230 var _flushCallback = function () {
2231 if (_callback !== null) {
2232 try {
2233 var currentTime = getCurrentTime();
2234 var hasRemainingTime = true;
2235 _callback(hasRemainingTime, currentTime);
2236 _callback = null;
2237 } catch (e) {
2238 setTimeout(_flushCallback, 0);
2239 throw e;
2240 }
2241 }
2242 };
2243 getCurrentTime = function () {
2244 return Date.now();
2245 };
2246 requestHostCallback = function (cb) {
2247 if (_callback !== null) {
2248 // Protect against re-entrancy.
2249 setTimeout(requestHostCallback, 0, cb);
2250 } else {
2251 _callback = cb;
2252 setTimeout(_flushCallback, 0);
2253 }
2254 };
2255 requestHostTimeout = function (cb, ms) {
2256 _timeoutID = setTimeout(cb, ms);
2257 };
2258 cancelHostTimeout = function () {
2259 clearTimeout(_timeoutID);
2260 };
2261 shouldYieldToHost = function () {
2262 return false;
2263 };
2264 requestPaint = forceFrameRate = function () {};
2265} else {
2266 // Capture local references to native APIs, in case a polyfill overrides them.
2267 var performance = window.performance;
2268 var _Date = window.Date;
2269 var _setTimeout = window.setTimeout;
2270 var _clearTimeout = window.clearTimeout;
2271 var requestAnimationFrame = window.requestAnimationFrame;
2272 var cancelAnimationFrame = window.cancelAnimationFrame;
2273 var requestIdleCallback = window.requestIdleCallback;
2274
2275 if (typeof console !== 'undefined') {
2276 // TODO: Remove fb.me link
2277 if (typeof requestAnimationFrame !== 'function') {
2278 console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
2279 }
2280 if (typeof cancelAnimationFrame !== 'function') {
2281 console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
2282 }
2283 }
2284
2285 var requestIdleCallbackBeforeFirstFrame$1 = requestIdleCallbackBeforeFirstFrame && typeof requestIdleCallback === 'function' && typeof cancelIdleCallback === 'function';
2286
2287 getCurrentTime = typeof performance === 'object' && typeof performance.now === 'function' ? function () {
2288 return performance.now();
2289 } : function () {
2290 return _Date.now();
2291 };
2292
2293 var isRAFLoopRunning = false;
2294 var isMessageLoopRunning = false;
2295 var scheduledHostCallback = null;
2296 var rAFTimeoutID = -1;
2297 var taskTimeoutID = -1;
2298
2299 var frameLength = enableMessageLoopImplementation ? // We won't attempt to align with the vsync. Instead we'll yield multiple
2300 // times per frame, often enough to keep it responsive even at really
2301 // high frame rates > 120.
2302 5 : // Use a heuristic to measure the frame rate and yield at the end of the
2303 // frame. We start out assuming that we run at 30fps but then the
2304 // heuristic tracking will adjust this value to a faster fps if we get
2305 // more frequent animation frames.
2306 33.33;
2307
2308 var prevRAFTime = -1;
2309 var prevRAFInterval = -1;
2310 var frameDeadline = 0;
2311
2312 var fpsLocked = false;
2313
2314 // TODO: Make this configurable
2315 // TODO: Adjust this based on priority?
2316 var maxFrameLength = 300;
2317 var needsPaint = false;
2318
2319 if (enableIsInputPending && navigator !== undefined && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined) {
2320 var scheduling = navigator.scheduling;
2321 shouldYieldToHost = function () {
2322 var currentTime = getCurrentTime();
2323 if (currentTime >= frameDeadline) {
2324 // There's no time left in the frame. We may want to yield control of
2325 // the main thread, so the browser can perform high priority tasks. The
2326 // main ones are painting and user input. If there's a pending paint or
2327 // a pending input, then we should yield. But if there's neither, then
2328 // we can yield less often while remaining responsive. We'll eventually
2329 // yield regardless, since there could be a pending paint that wasn't
2330 // accompanied by a call to `requestPaint`, or other main thread tasks
2331 // like network events.
2332 if (needsPaint || scheduling.isInputPending()) {
2333 // There is either a pending paint or a pending input.
2334 return true;
2335 }
2336 // There's no pending input. Only yield if we've reached the max
2337 // frame length.
2338 return currentTime >= frameDeadline + maxFrameLength;
2339 } else {
2340 // There's still time left in the frame.
2341 return false;
2342 }
2343 };
2344
2345 requestPaint = function () {
2346 needsPaint = true;
2347 };
2348 } else {
2349 // `isInputPending` is not available. Since we have no way of knowing if
2350 // there's pending input, always yield at the end of the frame.
2351 shouldYieldToHost = function () {
2352 return getCurrentTime() >= frameDeadline;
2353 };
2354
2355 // Since we yield every frame regardless, `requestPaint` has no effect.
2356 requestPaint = function () {};
2357 }
2358
2359 forceFrameRate = function (fps) {
2360 if (fps < 0 || fps > 125) {
2361 console.error('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported');
2362 return;
2363 }
2364 if (fps > 0) {
2365 frameLength = Math.floor(1000 / fps);
2366 fpsLocked = true;
2367 } else {
2368 // reset the framerate
2369 frameLength = 33.33;
2370 fpsLocked = false;
2371 }
2372 };
2373
2374 var performWorkUntilDeadline = function () {
2375 if (enableMessageLoopImplementation) {
2376 if (scheduledHostCallback !== null) {
2377 var currentTime = getCurrentTime();
2378 // Yield after `frameLength` ms, regardless of where we are in the vsync
2379 // cycle. This means there's always time remaining at the beginning of
2380 // the message event.
2381 frameDeadline = currentTime + frameLength;
2382 var hasTimeRemaining = true;
2383 try {
2384 var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
2385 if (!hasMoreWork) {
2386 isMessageLoopRunning = false;
2387 scheduledHostCallback = null;
2388 } else {
2389 // If there's more work, schedule the next message event at the end
2390 // of the preceding one.
2391 port.postMessage(null);
2392 }
2393 } catch (error) {
2394 // If a scheduler task throws, exit the current browser task so the
2395 // error can be observed.
2396 port.postMessage(null);
2397 throw error;
2398 }
2399 }
2400 // Yielding to the browser will give it a chance to paint, so we can
2401 // reset this.
2402 needsPaint = false;
2403 } else {
2404 if (scheduledHostCallback !== null) {
2405 var _currentTime = getCurrentTime();
2406 var _hasTimeRemaining = frameDeadline - _currentTime > 0;
2407 try {
2408 var _hasMoreWork = scheduledHostCallback(_hasTimeRemaining, _currentTime);
2409 if (!_hasMoreWork) {
2410 scheduledHostCallback = null;
2411 }
2412 } catch (error) {
2413 // If a scheduler task throws, exit the current browser task so the
2414 // error can be observed, and post a new task as soon as possible
2415 // so we can continue where we left off.
2416 port.postMessage(null);
2417 throw error;
2418 }
2419 }
2420 // Yielding to the browser will give it a chance to paint, so we can
2421 // reset this.
2422 needsPaint = false;
2423 }
2424 };
2425
2426 var channel = new MessageChannel();
2427 var port = channel.port2;
2428 channel.port1.onmessage = performWorkUntilDeadline;
2429
2430 var onAnimationFrame = function (rAFTime) {
2431 if (scheduledHostCallback === null) {
2432 // No scheduled work. Exit.
2433 prevRAFTime = -1;
2434 prevRAFInterval = -1;
2435 isRAFLoopRunning = false;
2436 return;
2437 }
2438
2439 // Eagerly schedule the next animation callback at the beginning of the
2440 // frame. If the scheduler queue is not empty at the end of the frame, it
2441 // will continue flushing inside that callback. If the queue *is* empty,
2442 // then it will exit immediately. Posting the callback at the start of the
2443 // frame ensures it's fired within the earliest possible frame. If we
2444 // waited until the end of the frame to post the callback, we risk the
2445 // browser skipping a frame and not firing the callback until the frame
2446 // after that.
2447 isRAFLoopRunning = true;
2448 requestAnimationFrame(function (nextRAFTime) {
2449 _clearTimeout(rAFTimeoutID);
2450 onAnimationFrame(nextRAFTime);
2451 });
2452
2453 // requestAnimationFrame is throttled when the tab is backgrounded. We
2454 // don't want to stop working entirely. So we'll fallback to a timeout loop.
2455 // TODO: Need a better heuristic for backgrounded work.
2456 var onTimeout = function () {
2457 frameDeadline = getCurrentTime() + frameLength / 2;
2458 performWorkUntilDeadline();
2459 rAFTimeoutID = _setTimeout(onTimeout, frameLength * 3);
2460 };
2461 rAFTimeoutID = _setTimeout(onTimeout, frameLength * 3);
2462
2463 if (prevRAFTime !== -1 &&
2464 // Make sure this rAF time is different from the previous one. This check
2465 // could fail if two rAFs fire in the same frame.
2466 rAFTime - prevRAFTime > 0.1) {
2467 var rAFInterval = rAFTime - prevRAFTime;
2468 if (!fpsLocked && prevRAFInterval !== -1) {
2469 // We've observed two consecutive frame intervals. We'll use this to
2470 // dynamically adjust the frame rate.
2471 //
2472 // If one frame goes long, then the next one can be short to catch up.
2473 // If two frames are short in a row, then that's an indication that we
2474 // actually have a higher frame rate than what we're currently
2475 // optimizing. For example, if we're running on 120hz display or 90hz VR
2476 // display. Take the max of the two in case one of them was an anomaly
2477 // due to missed frame deadlines.
2478 if (rAFInterval < frameLength && prevRAFInterval < frameLength) {
2479 frameLength = rAFInterval < prevRAFInterval ? prevRAFInterval : rAFInterval;
2480 if (frameLength < 8.33) {
2481 // Defensive coding. We don't support higher frame rates than 120hz.
2482 // If the calculated frame length gets lower than 8, it is probably
2483 // a bug.
2484 frameLength = 8.33;
2485 }
2486 }
2487 }
2488 prevRAFInterval = rAFInterval;
2489 }
2490 prevRAFTime = rAFTime;
2491 frameDeadline = rAFTime + frameLength;
2492
2493 // We use the postMessage trick to defer idle work until after the repaint.
2494 port.postMessage(null);
2495 };
2496
2497 requestHostCallback = function (callback) {
2498 scheduledHostCallback = callback;
2499 if (enableMessageLoopImplementation) {
2500 if (!isMessageLoopRunning) {
2501 isMessageLoopRunning = true;
2502 port.postMessage(null);
2503 }
2504 } else {
2505 if (!isRAFLoopRunning) {
2506 // Start a rAF loop.
2507 isRAFLoopRunning = true;
2508 requestAnimationFrame(function (rAFTime) {
2509 if (requestIdleCallbackBeforeFirstFrame$1) {
2510 cancelIdleCallback(idleCallbackID);
2511 }
2512 if (requestTimerEventBeforeFirstFrame) {
2513 _clearTimeout(idleTimeoutID);
2514 }
2515 onAnimationFrame(rAFTime);
2516 });
2517
2518 // If we just missed the last vsync, the next rAF might not happen for
2519 // another frame. To claim as much idle time as possible, post a
2520 // callback with `requestIdleCallback`, which should fire if there's
2521 // idle time left in the frame.
2522 //
2523 // This should only be an issue for the first rAF in the loop;
2524 // subsequent rAFs are scheduled at the beginning of the
2525 // preceding frame.
2526 var idleCallbackID = void 0;
2527 if (requestIdleCallbackBeforeFirstFrame$1) {
2528 idleCallbackID = requestIdleCallback(function onIdleCallbackBeforeFirstFrame() {
2529 if (requestTimerEventBeforeFirstFrame) {
2530 _clearTimeout(idleTimeoutID);
2531 }
2532 frameDeadline = getCurrentTime() + frameLength;
2533 performWorkUntilDeadline();
2534 });
2535 }
2536 // Alternate strategy to address the same problem. Scheduler a timer
2537 // with no delay. If this fires before the rAF, that likely indicates
2538 // that there's idle time before the next vsync. This isn't always the
2539 // case, but we'll be aggressive and assume it is, as a trade off to
2540 // prevent idle periods.
2541 var idleTimeoutID = void 0;
2542 if (requestTimerEventBeforeFirstFrame) {
2543 idleTimeoutID = _setTimeout(function onTimerEventBeforeFirstFrame() {
2544 if (requestIdleCallbackBeforeFirstFrame$1) {
2545 cancelIdleCallback(idleCallbackID);
2546 }
2547 frameDeadline = getCurrentTime() + frameLength;
2548 performWorkUntilDeadline();
2549 }, 0);
2550 }
2551 }
2552 }
2553 };
2554
2555 requestHostTimeout = function (callback, ms) {
2556 taskTimeoutID = _setTimeout(function () {
2557 callback(getCurrentTime());
2558 }, ms);
2559 };
2560
2561 cancelHostTimeout = function () {
2562 _clearTimeout(taskTimeoutID);
2563 taskTimeoutID = -1;
2564 };
2565}
2566
2567/* eslint-disable no-var */
2568
2569// TODO: Use symbols?
2570var ImmediatePriority = 1;
2571var UserBlockingPriority = 2;
2572var NormalPriority = 3;
2573var LowPriority = 4;
2574var IdlePriority = 5;
2575
2576// Max 31 bit integer. The max integer size in V8 for 32-bit systems.
2577// Math.pow(2, 30) - 1
2578// 0b111111111111111111111111111111
2579var maxSigned31BitInt = 1073741823;
2580
2581// Times out immediately
2582var IMMEDIATE_PRIORITY_TIMEOUT = -1;
2583// Eventually times out
2584var USER_BLOCKING_PRIORITY = 250;
2585var NORMAL_PRIORITY_TIMEOUT = 5000;
2586var LOW_PRIORITY_TIMEOUT = 10000;
2587// Never times out
2588var IDLE_PRIORITY = maxSigned31BitInt;
2589
2590// Tasks are stored as a circular, doubly linked list.
2591var firstTask = null;
2592var firstDelayedTask = null;
2593
2594// Pausing the scheduler is useful for debugging.
2595var isSchedulerPaused = false;
2596
2597var currentTask = null;
2598var currentPriorityLevel = NormalPriority;
2599
2600// This is set while performing work, to prevent re-entrancy.
2601var isPerformingWork = false;
2602
2603var isHostCallbackScheduled = false;
2604var isHostTimeoutScheduled = false;
2605
2606function scheduler_flushTaskAtPriority_Immediate(callback, didTimeout) {
2607 return callback(didTimeout);
2608}
2609function scheduler_flushTaskAtPriority_UserBlocking(callback, didTimeout) {
2610 return callback(didTimeout);
2611}
2612function scheduler_flushTaskAtPriority_Normal(callback, didTimeout) {
2613 return callback(didTimeout);
2614}
2615function scheduler_flushTaskAtPriority_Low(callback, didTimeout) {
2616 return callback(didTimeout);
2617}
2618function scheduler_flushTaskAtPriority_Idle(callback, didTimeout) {
2619 return callback(didTimeout);
2620}
2621
2622function flushTask(task, currentTime) {
2623 // Remove the task from the list before calling the callback. That way the
2624 // list is in a consistent state even if the callback throws.
2625 var next = task.next;
2626 if (next === task) {
2627 // This is the only scheduled task. Clear the list.
2628 firstTask = null;
2629 } else {
2630 // Remove the task from its position in the list.
2631 if (task === firstTask) {
2632 firstTask = next;
2633 }
2634 var previous = task.previous;
2635 previous.next = next;
2636 next.previous = previous;
2637 }
2638 task.next = task.previous = null;
2639
2640 // Now it's safe to execute the task.
2641 var callback = task.callback;
2642 var previousPriorityLevel = currentPriorityLevel;
2643 var previousTask = currentTask;
2644 currentPriorityLevel = task.priorityLevel;
2645 currentTask = task;
2646 var continuationCallback;
2647 try {
2648 var didUserCallbackTimeout = task.expirationTime <= currentTime;
2649 // Add an extra function to the callstack. Profiling tools can use this
2650 // to infer the priority of work that appears higher in the stack.
2651 switch (currentPriorityLevel) {
2652 case ImmediatePriority:
2653 continuationCallback = scheduler_flushTaskAtPriority_Immediate(callback, didUserCallbackTimeout);
2654 break;
2655 case UserBlockingPriority:
2656 continuationCallback = scheduler_flushTaskAtPriority_UserBlocking(callback, didUserCallbackTimeout);
2657 break;
2658 case NormalPriority:
2659 continuationCallback = scheduler_flushTaskAtPriority_Normal(callback, didUserCallbackTimeout);
2660 break;
2661 case LowPriority:
2662 continuationCallback = scheduler_flushTaskAtPriority_Low(callback, didUserCallbackTimeout);
2663 break;
2664 case IdlePriority:
2665 continuationCallback = scheduler_flushTaskAtPriority_Idle(callback, didUserCallbackTimeout);
2666 break;
2667 }
2668 } catch (error) {
2669 throw error;
2670 } finally {
2671 currentPriorityLevel = previousPriorityLevel;
2672 currentTask = previousTask;
2673 }
2674
2675 // A callback may return a continuation. The continuation should be scheduled
2676 // with the same priority and expiration as the just-finished callback.
2677 if (typeof continuationCallback === 'function') {
2678 var expirationTime = task.expirationTime;
2679 var continuationTask = task;
2680 continuationTask.callback = continuationCallback;
2681
2682 // Insert the new callback into the list, sorted by its timeout. This is
2683 // almost the same as the code in `scheduleCallback`, except the callback
2684 // is inserted into the list *before* callbacks of equal timeout instead
2685 // of after.
2686 if (firstTask === null) {
2687 // This is the first callback in the list.
2688 firstTask = continuationTask.next = continuationTask.previous = continuationTask;
2689 } else {
2690 var nextAfterContinuation = null;
2691 var t = firstTask;
2692 do {
2693 if (expirationTime <= t.expirationTime) {
2694 // This task times out at or after the continuation. We will insert
2695 // the continuation *before* this task.
2696 nextAfterContinuation = t;
2697 break;
2698 }
2699 t = t.next;
2700 } while (t !== firstTask);
2701 if (nextAfterContinuation === null) {
2702 // No equal or lower priority task was found, which means the new task
2703 // is the lowest priority task in the list.
2704 nextAfterContinuation = firstTask;
2705 } else if (nextAfterContinuation === firstTask) {
2706 // The new task is the highest priority task in the list.
2707 firstTask = continuationTask;
2708 }
2709
2710 var _previous = nextAfterContinuation.previous;
2711 _previous.next = nextAfterContinuation.previous = continuationTask;
2712 continuationTask.next = nextAfterContinuation;
2713 continuationTask.previous = _previous;
2714 }
2715 }
2716}
2717
2718function advanceTimers(currentTime) {
2719 // Check for tasks that are no longer delayed and add them to the queue.
2720 if (firstDelayedTask !== null && firstDelayedTask.startTime <= currentTime) {
2721 do {
2722 var task = firstDelayedTask;
2723 var next = task.next;
2724 if (task === next) {
2725 firstDelayedTask = null;
2726 } else {
2727 firstDelayedTask = next;
2728 var previous = task.previous;
2729 previous.next = next;
2730 next.previous = previous;
2731 }
2732 task.next = task.previous = null;
2733 insertScheduledTask(task, task.expirationTime);
2734 } while (firstDelayedTask !== null && firstDelayedTask.startTime <= currentTime);
2735 }
2736}
2737
2738function handleTimeout(currentTime) {
2739 isHostTimeoutScheduled = false;
2740 advanceTimers(currentTime);
2741
2742 if (!isHostCallbackScheduled) {
2743 if (firstTask !== null) {
2744 isHostCallbackScheduled = true;
2745 requestHostCallback(flushWork);
2746 } else if (firstDelayedTask !== null) {
2747 requestHostTimeout(handleTimeout, firstDelayedTask.startTime - currentTime);
2748 }
2749 }
2750}
2751
2752function flushWork(hasTimeRemaining, initialTime) {
2753 // Exit right away if we're currently paused
2754 if (enableSchedulerDebugging && isSchedulerPaused) {
2755 return;
2756 }
2757
2758 // We'll need a host callback the next time work is scheduled.
2759 isHostCallbackScheduled = false;
2760 if (isHostTimeoutScheduled) {
2761 // We scheduled a timeout but it's no longer needed. Cancel it.
2762 isHostTimeoutScheduled = false;
2763 cancelHostTimeout();
2764 }
2765
2766 var currentTime = initialTime;
2767 advanceTimers(currentTime);
2768
2769 isPerformingWork = true;
2770 try {
2771 if (!hasTimeRemaining) {
2772 // Flush all the expired callbacks without yielding.
2773 // TODO: Split flushWork into two separate functions instead of using
2774 // a boolean argument?
2775 while (firstTask !== null && firstTask.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused)) {
2776 flushTask(firstTask, currentTime);
2777 currentTime = getCurrentTime();
2778 advanceTimers(currentTime);
2779 }
2780 } else {
2781 // Keep flushing callbacks until we run out of time in the frame.
2782 if (firstTask !== null) {
2783 do {
2784 flushTask(firstTask, currentTime);
2785 currentTime = getCurrentTime();
2786 advanceTimers(currentTime);
2787 } while (firstTask !== null && !shouldYieldToHost() && !(enableSchedulerDebugging && isSchedulerPaused));
2788 }
2789 }
2790 // Return whether there's additional work
2791 if (firstTask !== null) {
2792 return true;
2793 } else {
2794 if (firstDelayedTask !== null) {
2795 requestHostTimeout(handleTimeout, firstDelayedTask.startTime - currentTime);
2796 }
2797 return false;
2798 }
2799 } finally {
2800 isPerformingWork = false;
2801 }
2802}
2803
2804function unstable_runWithPriority(priorityLevel, eventHandler) {
2805 switch (priorityLevel) {
2806 case ImmediatePriority:
2807 case UserBlockingPriority:
2808 case NormalPriority:
2809 case LowPriority:
2810 case IdlePriority:
2811 break;
2812 default:
2813 priorityLevel = NormalPriority;
2814 }
2815
2816 var previousPriorityLevel = currentPriorityLevel;
2817 currentPriorityLevel = priorityLevel;
2818
2819 try {
2820 return eventHandler();
2821 } finally {
2822 currentPriorityLevel = previousPriorityLevel;
2823 }
2824}
2825
2826function unstable_next(eventHandler) {
2827 var priorityLevel;
2828 switch (currentPriorityLevel) {
2829 case ImmediatePriority:
2830 case UserBlockingPriority:
2831 case NormalPriority:
2832 // Shift down to normal priority
2833 priorityLevel = NormalPriority;
2834 break;
2835 default:
2836 // Anything lower than normal priority should remain at the current level.
2837 priorityLevel = currentPriorityLevel;
2838 break;
2839 }
2840
2841 var previousPriorityLevel = currentPriorityLevel;
2842 currentPriorityLevel = priorityLevel;
2843
2844 try {
2845 return eventHandler();
2846 } finally {
2847 currentPriorityLevel = previousPriorityLevel;
2848 }
2849}
2850
2851function unstable_wrapCallback(callback) {
2852 var parentPriorityLevel = currentPriorityLevel;
2853 return function () {
2854 // This is a fork of runWithPriority, inlined for performance.
2855 var previousPriorityLevel = currentPriorityLevel;
2856 currentPriorityLevel = parentPriorityLevel;
2857
2858 try {
2859 return callback.apply(this, arguments);
2860 } finally {
2861 currentPriorityLevel = previousPriorityLevel;
2862 }
2863 };
2864}
2865
2866function timeoutForPriorityLevel(priorityLevel) {
2867 switch (priorityLevel) {
2868 case ImmediatePriority:
2869 return IMMEDIATE_PRIORITY_TIMEOUT;
2870 case UserBlockingPriority:
2871 return USER_BLOCKING_PRIORITY;
2872 case IdlePriority:
2873 return IDLE_PRIORITY;
2874 case LowPriority:
2875 return LOW_PRIORITY_TIMEOUT;
2876 case NormalPriority:
2877 default:
2878 return NORMAL_PRIORITY_TIMEOUT;
2879 }
2880}
2881
2882function unstable_scheduleCallback(priorityLevel, callback, options) {
2883 var currentTime = getCurrentTime();
2884
2885 var startTime;
2886 var timeout;
2887 if (typeof options === 'object' && options !== null) {
2888 var delay = options.delay;
2889 if (typeof delay === 'number' && delay > 0) {
2890 startTime = currentTime + delay;
2891 } else {
2892 startTime = currentTime;
2893 }
2894 timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel);
2895 } else {
2896 timeout = timeoutForPriorityLevel(priorityLevel);
2897 startTime = currentTime;
2898 }
2899
2900 var expirationTime = startTime + timeout;
2901
2902 var newTask = {
2903 callback: callback,
2904 priorityLevel: priorityLevel,
2905 startTime: startTime,
2906 expirationTime: expirationTime,
2907 next: null,
2908 previous: null
2909 };
2910
2911 if (startTime > currentTime) {
2912 // This is a delayed task.
2913 insertDelayedTask(newTask, startTime);
2914 if (firstTask === null && firstDelayedTask === newTask) {
2915 // All tasks are delayed, and this is the task with the earliest delay.
2916 if (isHostTimeoutScheduled) {
2917 // Cancel an existing timeout.
2918 cancelHostTimeout();
2919 } else {
2920 isHostTimeoutScheduled = true;
2921 }
2922 // Schedule a timeout.
2923 requestHostTimeout(handleTimeout, startTime - currentTime);
2924 }
2925 } else {
2926 insertScheduledTask(newTask, expirationTime);
2927 // Schedule a host callback, if needed. If we're already performing work,
2928 // wait until the next time we yield.
2929 if (!isHostCallbackScheduled && !isPerformingWork) {
2930 isHostCallbackScheduled = true;
2931 requestHostCallback(flushWork);
2932 }
2933 }
2934
2935 return newTask;
2936}
2937
2938function insertScheduledTask(newTask, expirationTime) {
2939 // Insert the new task into the list, ordered first by its timeout, then by
2940 // insertion. So the new task is inserted after any other task the
2941 // same timeout
2942 if (firstTask === null) {
2943 // This is the first task in the list.
2944 firstTask = newTask.next = newTask.previous = newTask;
2945 } else {
2946 var next = null;
2947 var task = firstTask;
2948 do {
2949 if (expirationTime < task.expirationTime) {
2950 // The new task times out before this one.
2951 next = task;
2952 break;
2953 }
2954 task = task.next;
2955 } while (task !== firstTask);
2956
2957 if (next === null) {
2958 // No task with a later timeout was found, which means the new task has
2959 // the latest timeout in the list.
2960 next = firstTask;
2961 } else if (next === firstTask) {
2962 // The new task has the earliest expiration in the entire list.
2963 firstTask = newTask;
2964 }
2965
2966 var previous = next.previous;
2967 previous.next = next.previous = newTask;
2968 newTask.next = next;
2969 newTask.previous = previous;
2970 }
2971}
2972
2973function insertDelayedTask(newTask, startTime) {
2974 // Insert the new task into the list, ordered by its start time.
2975 if (firstDelayedTask === null) {
2976 // This is the first task in the list.
2977 firstDelayedTask = newTask.next = newTask.previous = newTask;
2978 } else {
2979 var next = null;
2980 var task = firstDelayedTask;
2981 do {
2982 if (startTime < task.startTime) {
2983 // The new task times out before this one.
2984 next = task;
2985 break;
2986 }
2987 task = task.next;
2988 } while (task !== firstDelayedTask);
2989
2990 if (next === null) {
2991 // No task with a later timeout was found, which means the new task has
2992 // the latest timeout in the list.
2993 next = firstDelayedTask;
2994 } else if (next === firstDelayedTask) {
2995 // The new task has the earliest expiration in the entire list.
2996 firstDelayedTask = newTask;
2997 }
2998
2999 var previous = next.previous;
3000 previous.next = next.previous = newTask;
3001 newTask.next = next;
3002 newTask.previous = previous;
3003 }
3004}
3005
3006function unstable_pauseExecution() {
3007 isSchedulerPaused = true;
3008}
3009
3010function unstable_continueExecution() {
3011 isSchedulerPaused = false;
3012 if (!isHostCallbackScheduled && !isPerformingWork) {
3013 isHostCallbackScheduled = true;
3014 requestHostCallback(flushWork);
3015 }
3016}
3017
3018function unstable_getFirstCallbackNode() {
3019 return firstTask;
3020}
3021
3022function unstable_cancelCallback(task) {
3023 var next = task.next;
3024 if (next === null) {
3025 // Already cancelled.
3026 return;
3027 }
3028
3029 if (task === next) {
3030 if (task === firstTask) {
3031 firstTask = null;
3032 } else if (task === firstDelayedTask) {
3033 firstDelayedTask = null;
3034 }
3035 } else {
3036 if (task === firstTask) {
3037 firstTask = next;
3038 } else if (task === firstDelayedTask) {
3039 firstDelayedTask = next;
3040 }
3041 var previous = task.previous;
3042 previous.next = next;
3043 next.previous = previous;
3044 }
3045
3046 task.next = task.previous = null;
3047}
3048
3049function unstable_getCurrentPriorityLevel() {
3050 return currentPriorityLevel;
3051}
3052
3053function unstable_shouldYield() {
3054 var currentTime = getCurrentTime();
3055 advanceTimers(currentTime);
3056 return currentTask !== null && firstTask !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost();
3057}
3058
3059var unstable_requestPaint = requestPaint;
3060
3061
3062
3063var Scheduler = Object.freeze({
3064 unstable_ImmediatePriority: ImmediatePriority,
3065 unstable_UserBlockingPriority: UserBlockingPriority,
3066 unstable_NormalPriority: NormalPriority,
3067 unstable_IdlePriority: IdlePriority,
3068 unstable_LowPriority: LowPriority,
3069 unstable_runWithPriority: unstable_runWithPriority,
3070 unstable_next: unstable_next,
3071 unstable_scheduleCallback: unstable_scheduleCallback,
3072 unstable_cancelCallback: unstable_cancelCallback,
3073 unstable_wrapCallback: unstable_wrapCallback,
3074 unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
3075 unstable_shouldYield: unstable_shouldYield,
3076 unstable_requestPaint: unstable_requestPaint,
3077 unstable_continueExecution: unstable_continueExecution,
3078 unstable_pauseExecution: unstable_pauseExecution,
3079 unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
3080 get unstable_now () { return getCurrentTime; },
3081 get unstable_forceFrameRate () { return forceFrameRate; }
3082});
3083
3084// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
3085
3086
3087// In some cases, StrictMode should also double-render lifecycles.
3088// This can be confusing for tests though,
3089// And it can be bad for performance in production.
3090// This feature flag can be used to control the behavior:
3091
3092
3093// To preserve the "Pause on caught exceptions" behavior of the debugger, we
3094// replay the begin phase of a failed component inside invokeGuardedCallback.
3095
3096
3097// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
3098
3099
3100// Gather advanced timing metrics for Profiler subtrees.
3101
3102
3103// Trace which interactions trigger each commit.
3104var enableSchedulerTracing = true;
3105
3106// Only used in www builds.
3107 // TODO: true? Here it might just be false.
3108
3109// Only used in www builds.
3110
3111
3112// Only used in www builds.
3113
3114
3115// Disable javascript: URL strings in href for XSS protection.
3116
3117
3118// React Fire: prevent the value and checked attributes from syncing
3119// with their related DOM properties
3120
3121
3122// These APIs will no longer be "unstable" in the upcoming 16.7 release,
3123// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
3124
3125
3126
3127
3128// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
3129// This is a flag so we can fix warnings in RN core before turning it on
3130
3131
3132// Experimental React Flare event system and event components support.
3133var enableFlareAPI = false;
3134
3135// Experimental Host Component support.
3136var enableFundamentalAPI = false;
3137
3138// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
3139var enableJSXTransformAPI = false;
3140
3141// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
3142// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
3143
3144// Temporary flag to revert the fix in #15650
3145
3146
3147// For tests, we flush suspense fallbacks in an act scope;
3148// *except* in some of our own tests, where we test incremental loading states.
3149
3150
3151// Changes priority of some events like mousemove to user-blocking priority,
3152// but without making them discrete. The flag exists in case it causes
3153// starvation problems.
3154
3155
3156// Add a callback property to suspense to notify which promises are currently
3157// in the update queue. This allows reporting and tracing of what is causing
3158// the user to see a loading state.
3159
3160
3161// Part of the simplification of React.createElement so we can eventually move
3162// from React.createElement to React.jsx
3163// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
3164
3165var DEFAULT_THREAD_ID = 0;
3166
3167// Counters used to generate unique IDs.
3168var interactionIDCounter = 0;
3169var threadIDCounter = 0;
3170
3171// Set of currently traced interactions.
3172// Interactions "stack"–
3173// Meaning that newly traced interactions are appended to the previously active set.
3174// When an interaction goes out of scope, the previous set (if any) is restored.
3175var interactionsRef = null;
3176
3177// Listener(s) to notify when interactions begin and end.
3178var subscriberRef = null;
3179
3180if (enableSchedulerTracing) {
3181 interactionsRef = {
3182 current: new Set()
3183 };
3184 subscriberRef = {
3185 current: null
3186 };
3187}
3188
3189function unstable_clear(callback) {
3190 if (!enableSchedulerTracing) {
3191 return callback();
3192 }
3193
3194 var prevInteractions = interactionsRef.current;
3195 interactionsRef.current = new Set();
3196
3197 try {
3198 return callback();
3199 } finally {
3200 interactionsRef.current = prevInteractions;
3201 }
3202}
3203
3204function unstable_getCurrent() {
3205 if (!enableSchedulerTracing) {
3206 return null;
3207 } else {
3208 return interactionsRef.current;
3209 }
3210}
3211
3212function unstable_getThreadID() {
3213 return ++threadIDCounter;
3214}
3215
3216function unstable_trace(name, timestamp, callback) {
3217 var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
3218
3219 if (!enableSchedulerTracing) {
3220 return callback();
3221 }
3222
3223 var interaction = {
3224 __count: 1,
3225 id: interactionIDCounter++,
3226 name: name,
3227 timestamp: timestamp
3228 };
3229
3230 var prevInteractions = interactionsRef.current;
3231
3232 // Traced interactions should stack/accumulate.
3233 // To do that, clone the current interactions.
3234 // The previous set will be restored upon completion.
3235 var interactions = new Set(prevInteractions);
3236 interactions.add(interaction);
3237 interactionsRef.current = interactions;
3238
3239 var subscriber = subscriberRef.current;
3240 var returnValue = void 0;
3241
3242 try {
3243 if (subscriber !== null) {
3244 subscriber.onInteractionTraced(interaction);
3245 }
3246 } finally {
3247 try {
3248 if (subscriber !== null) {
3249 subscriber.onWorkStarted(interactions, threadID);
3250 }
3251 } finally {
3252 try {
3253 returnValue = callback();
3254 } finally {
3255 interactionsRef.current = prevInteractions;
3256
3257 try {
3258 if (subscriber !== null) {
3259 subscriber.onWorkStopped(interactions, threadID);
3260 }
3261 } finally {
3262 interaction.__count--;
3263
3264 // If no async work was scheduled for this interaction,
3265 // Notify subscribers that it's completed.
3266 if (subscriber !== null && interaction.__count === 0) {
3267 subscriber.onInteractionScheduledWorkCompleted(interaction);
3268 }
3269 }
3270 }
3271 }
3272 }
3273
3274 return returnValue;
3275}
3276
3277function unstable_wrap(callback) {
3278 var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
3279
3280 if (!enableSchedulerTracing) {
3281 return callback;
3282 }
3283
3284 var wrappedInteractions = interactionsRef.current;
3285
3286 var subscriber = subscriberRef.current;
3287 if (subscriber !== null) {
3288 subscriber.onWorkScheduled(wrappedInteractions, threadID);
3289 }
3290
3291 // Update the pending async work count for the current interactions.
3292 // Update after calling subscribers in case of error.
3293 wrappedInteractions.forEach(function (interaction) {
3294 interaction.__count++;
3295 });
3296
3297 var hasRun = false;
3298
3299 function wrapped() {
3300 var prevInteractions = interactionsRef.current;
3301 interactionsRef.current = wrappedInteractions;
3302
3303 subscriber = subscriberRef.current;
3304
3305 try {
3306 var returnValue = void 0;
3307
3308 try {
3309 if (subscriber !== null) {
3310 subscriber.onWorkStarted(wrappedInteractions, threadID);
3311 }
3312 } finally {
3313 try {
3314 returnValue = callback.apply(undefined, arguments);
3315 } finally {
3316 interactionsRef.current = prevInteractions;
3317
3318 if (subscriber !== null) {
3319 subscriber.onWorkStopped(wrappedInteractions, threadID);
3320 }
3321 }
3322 }
3323
3324 return returnValue;
3325 } finally {
3326 if (!hasRun) {
3327 // We only expect a wrapped function to be executed once,
3328 // But in the event that it's executed more than once–
3329 // Only decrement the outstanding interaction counts once.
3330 hasRun = true;
3331
3332 // Update pending async counts for all wrapped interactions.
3333 // If this was the last scheduled async work for any of them,
3334 // Mark them as completed.
3335 wrappedInteractions.forEach(function (interaction) {
3336 interaction.__count--;
3337
3338 if (subscriber !== null && interaction.__count === 0) {
3339 subscriber.onInteractionScheduledWorkCompleted(interaction);
3340 }
3341 });
3342 }
3343 }
3344 }
3345
3346 wrapped.cancel = function cancel() {
3347 subscriber = subscriberRef.current;
3348
3349 try {
3350 if (subscriber !== null) {
3351 subscriber.onWorkCanceled(wrappedInteractions, threadID);
3352 }
3353 } finally {
3354 // Update pending async counts for all wrapped interactions.
3355 // If this was the last scheduled async work for any of them,
3356 // Mark them as completed.
3357 wrappedInteractions.forEach(function (interaction) {
3358 interaction.__count--;
3359
3360 if (subscriber && interaction.__count === 0) {
3361 subscriber.onInteractionScheduledWorkCompleted(interaction);
3362 }
3363 });
3364 }
3365 };
3366
3367 return wrapped;
3368}
3369
3370var subscribers = null;
3371if (enableSchedulerTracing) {
3372 subscribers = new Set();
3373}
3374
3375function unstable_subscribe(subscriber) {
3376 if (enableSchedulerTracing) {
3377 subscribers.add(subscriber);
3378
3379 if (subscribers.size === 1) {
3380 subscriberRef.current = {
3381 onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
3382 onInteractionTraced: onInteractionTraced,
3383 onWorkCanceled: onWorkCanceled,
3384 onWorkScheduled: onWorkScheduled,
3385 onWorkStarted: onWorkStarted,
3386 onWorkStopped: onWorkStopped
3387 };
3388 }
3389 }
3390}
3391
3392function unstable_unsubscribe(subscriber) {
3393 if (enableSchedulerTracing) {
3394 subscribers.delete(subscriber);
3395
3396 if (subscribers.size === 0) {
3397 subscriberRef.current = null;
3398 }
3399 }
3400}
3401
3402function onInteractionTraced(interaction) {
3403 var didCatchError = false;
3404 var caughtError = null;
3405
3406 subscribers.forEach(function (subscriber) {
3407 try {
3408 subscriber.onInteractionTraced(interaction);
3409 } catch (error) {
3410 if (!didCatchError) {
3411 didCatchError = true;
3412 caughtError = error;
3413 }
3414 }
3415 });
3416
3417 if (didCatchError) {
3418 throw caughtError;
3419 }
3420}
3421
3422function onInteractionScheduledWorkCompleted(interaction) {
3423 var didCatchError = false;
3424 var caughtError = null;
3425
3426 subscribers.forEach(function (subscriber) {
3427 try {
3428 subscriber.onInteractionScheduledWorkCompleted(interaction);
3429 } catch (error) {
3430 if (!didCatchError) {
3431 didCatchError = true;
3432 caughtError = error;
3433 }
3434 }
3435 });
3436
3437 if (didCatchError) {
3438 throw caughtError;
3439 }
3440}
3441
3442function onWorkScheduled(interactions, threadID) {
3443 var didCatchError = false;
3444 var caughtError = null;
3445
3446 subscribers.forEach(function (subscriber) {
3447 try {
3448 subscriber.onWorkScheduled(interactions, threadID);
3449 } catch (error) {
3450 if (!didCatchError) {
3451 didCatchError = true;
3452 caughtError = error;
3453 }
3454 }
3455 });
3456
3457 if (didCatchError) {
3458 throw caughtError;
3459 }
3460}
3461
3462function onWorkStarted(interactions, threadID) {
3463 var didCatchError = false;
3464 var caughtError = null;
3465
3466 subscribers.forEach(function (subscriber) {
3467 try {
3468 subscriber.onWorkStarted(interactions, threadID);
3469 } catch (error) {
3470 if (!didCatchError) {
3471 didCatchError = true;
3472 caughtError = error;
3473 }
3474 }
3475 });
3476
3477 if (didCatchError) {
3478 throw caughtError;
3479 }
3480}
3481
3482function onWorkStopped(interactions, threadID) {
3483 var didCatchError = false;
3484 var caughtError = null;
3485
3486 subscribers.forEach(function (subscriber) {
3487 try {
3488 subscriber.onWorkStopped(interactions, threadID);
3489 } catch (error) {
3490 if (!didCatchError) {
3491 didCatchError = true;
3492 caughtError = error;
3493 }
3494 }
3495 });
3496
3497 if (didCatchError) {
3498 throw caughtError;
3499 }
3500}
3501
3502function onWorkCanceled(interactions, threadID) {
3503 var didCatchError = false;
3504 var caughtError = null;
3505
3506 subscribers.forEach(function (subscriber) {
3507 try {
3508 subscriber.onWorkCanceled(interactions, threadID);
3509 } catch (error) {
3510 if (!didCatchError) {
3511 didCatchError = true;
3512 caughtError = error;
3513 }
3514 }
3515 });
3516
3517 if (didCatchError) {
3518 throw caughtError;
3519 }
3520}
3521
3522
3523
3524var SchedulerTracing = Object.freeze({
3525 get __interactionsRef () { return interactionsRef; },
3526 get __subscriberRef () { return subscriberRef; },
3527 unstable_clear: unstable_clear,
3528 unstable_getCurrent: unstable_getCurrent,
3529 unstable_getThreadID: unstable_getThreadID,
3530 unstable_trace: unstable_trace,
3531 unstable_wrap: unstable_wrap,
3532 unstable_subscribe: unstable_subscribe,
3533 unstable_unsubscribe: unstable_unsubscribe
3534});
3535
3536var ReactSharedInternals$2 = {
3537 ReactCurrentDispatcher: ReactCurrentDispatcher,
3538 ReactCurrentOwner: ReactCurrentOwner,
3539 IsSomeRendererActing: IsSomeRendererActing,
3540 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
3541 assign: objectAssign
3542};
3543
3544{
3545 objectAssign(ReactSharedInternals$2, {
3546 // These should not be included in production.
3547 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
3548 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
3549 // TODO: remove in React 17.0.
3550 ReactComponentTreeHook: {}
3551 });
3552}
3553
3554// Re-export the schedule API(s) for UMD bundles.
3555// This avoids introducing a dependency on a new UMD global in a minor update,
3556// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
3557// This re-export is only required for UMD bundles;
3558// CJS bundles use the shared NPM package.
3559objectAssign(ReactSharedInternals$2, {
3560 Scheduler: Scheduler,
3561 SchedulerTracing: SchedulerTracing
3562});
3563
3564var hasBadMapPolyfill = void 0;
3565
3566{
3567 hasBadMapPolyfill = false;
3568 try {
3569 var frozenObject = Object.freeze({});
3570 var testMap = new Map([[frozenObject, null]]);
3571 var testSet = new Set([frozenObject]);
3572 // This is necessary for Rollup to not consider these unused.
3573 // https://github.com/rollup/rollup/issues/1771
3574 // TODO: we can remove these if Rollup fixes the bug.
3575 testMap.set(0, 0);
3576 testSet.add(0);
3577 } catch (e) {
3578 // TODO: Consider warning about bad polyfills
3579 hasBadMapPolyfill = true;
3580 }
3581}
3582
3583function createFundamentalComponent(impl) {
3584 // We use responder as a Map key later on. When we have a bad
3585 // polyfill, then we can't use it as a key as the polyfill tries
3586 // to add a property to the object.
3587 if (true && !hasBadMapPolyfill) {
3588 Object.freeze(impl);
3589 }
3590 var fundamantalComponent = {
3591 $$typeof: REACT_FUNDAMENTAL_TYPE,
3592 impl: impl
3593 };
3594 {
3595 Object.freeze(fundamantalComponent);
3596 }
3597 return fundamantalComponent;
3598}
3599
3600function createEventResponder(displayName, responderConfig) {
3601 var getInitialState = responderConfig.getInitialState,
3602 onEvent = responderConfig.onEvent,
3603 onMount = responderConfig.onMount,
3604 onUnmount = responderConfig.onUnmount,
3605 onOwnershipChange = responderConfig.onOwnershipChange,
3606 onRootEvent = responderConfig.onRootEvent,
3607 rootEventTypes = responderConfig.rootEventTypes,
3608 targetEventTypes = responderConfig.targetEventTypes;
3609
3610 var eventResponder = {
3611 $$typeof: REACT_RESPONDER_TYPE,
3612 displayName: displayName,
3613 getInitialState: getInitialState || null,
3614 onEvent: onEvent || null,
3615 onMount: onMount || null,
3616 onOwnershipChange: onOwnershipChange || null,
3617 onRootEvent: onRootEvent || null,
3618 onUnmount: onUnmount || null,
3619 rootEventTypes: rootEventTypes || null,
3620 targetEventTypes: targetEventTypes || null
3621 };
3622 // We use responder as a Map key later on. When we have a bad
3623 // polyfill, then we can't use it as a key as the polyfill tries
3624 // to add a property to the object.
3625 if (true && !hasBadMapPolyfill) {
3626 Object.freeze(eventResponder);
3627 }
3628 return eventResponder;
3629}
3630
3631var React = {
3632 Children: {
3633 map: mapChildren,
3634 forEach: forEachChildren,
3635 count: countChildren,
3636 toArray: toArray,
3637 only: onlyChild
3638 },
3639
3640 createRef: createRef,
3641 Component: Component,
3642 PureComponent: PureComponent,
3643
3644 createContext: createContext,
3645 forwardRef: forwardRef,
3646 lazy: lazy,
3647 memo: memo,
3648
3649 useCallback: useCallback,
3650 useContext: useContext,
3651 useEffect: useEffect,
3652 useImperativeHandle: useImperativeHandle,
3653 useDebugValue: useDebugValue,
3654 useLayoutEffect: useLayoutEffect,
3655 useMemo: useMemo,
3656 useReducer: useReducer,
3657 useRef: useRef,
3658 useState: useState,
3659
3660 Fragment: REACT_FRAGMENT_TYPE,
3661 Profiler: REACT_PROFILER_TYPE,
3662 StrictMode: REACT_STRICT_MODE_TYPE,
3663 Suspense: REACT_SUSPENSE_TYPE,
3664 unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE,
3665
3666 createElement: createElementWithValidation,
3667 cloneElement: cloneElementWithValidation,
3668 createFactory: createFactoryWithValidation,
3669 isValidElement: isValidElement,
3670
3671 version: ReactVersion,
3672
3673 unstable_withSuspenseConfig: withSuspenseConfig,
3674
3675 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals$2
3676};
3677
3678if (enableFlareAPI) {
3679 React.unstable_useResponder = useResponder;
3680 React.unstable_createResponder = createEventResponder;
3681}
3682
3683if (enableFundamentalAPI) {
3684 React.unstable_createFundamental = createFundamentalComponent;
3685}
3686
3687// Note: some APIs are added with feature flags.
3688// Make sure that stable builds for open source
3689// don't modify the React object to avoid deopts.
3690// Also let's not expose their names in stable builds.
3691
3692if (enableJSXTransformAPI) {
3693 {
3694 React.jsxDEV = jsxWithValidation;
3695 React.jsx = jsxWithValidationDynamic;
3696 React.jsxs = jsxWithValidationStatic;
3697 }
3698}
3699
3700
3701
3702var React$2 = Object.freeze({
3703 default: React
3704});
3705
3706var React$3 = ( React$2 && React ) || React$2;
3707
3708// TODO: decide on the top-level export form.
3709// This is hacky but makes it work with both Rollup and Jest.
3710var react = React$3.default || React$3;
3711
3712return react;
3713
3714})));