1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
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 |
|
19 |
|
20 | var ReactVersion = '16.8.1';
|
21 |
|
22 |
|
23 |
|
24 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
25 |
|
26 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
27 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
28 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
29 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
30 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
31 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
32 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
33 |
|
34 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
35 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
36 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
37 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
38 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
39 |
|
40 | var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
41 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
42 |
|
43 | function getIteratorFn(maybeIterable) {
|
44 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
45 | return null;
|
46 | }
|
47 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
48 | if (typeof maybeIterator === 'function') {
|
49 | return maybeIterator;
|
50 | }
|
51 | return null;
|
52 | }
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
63 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
64 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
65 |
|
66 | function toObject(val) {
|
67 | if (val === null || val === undefined) {
|
68 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
69 | }
|
70 |
|
71 | return Object(val);
|
72 | }
|
73 |
|
74 | function shouldUseNative() {
|
75 | try {
|
76 | if (!Object.assign) {
|
77 | return false;
|
78 | }
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | var test1 = new String('abc');
|
84 | test1[5] = 'de';
|
85 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
86 | return false;
|
87 | }
|
88 |
|
89 |
|
90 | var test2 = {};
|
91 | for (var i = 0; i < 10; i++) {
|
92 | test2['_' + String.fromCharCode(i)] = i;
|
93 | }
|
94 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
95 | return test2[n];
|
96 | });
|
97 | if (order2.join('') !== '0123456789') {
|
98 | return false;
|
99 | }
|
100 |
|
101 |
|
102 | var test3 = {};
|
103 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
104 | test3[letter] = letter;
|
105 | });
|
106 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
107 | 'abcdefghijklmnopqrst') {
|
108 | return false;
|
109 | }
|
110 |
|
111 | return true;
|
112 | } catch (err) {
|
113 |
|
114 | return false;
|
115 | }
|
116 | }
|
117 |
|
118 | var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
119 | var from;
|
120 | var to = toObject(target);
|
121 | var symbols;
|
122 |
|
123 | for (var s = 1; s < arguments.length; s++) {
|
124 | from = Object(arguments[s]);
|
125 |
|
126 | for (var key in from) {
|
127 | if (hasOwnProperty.call(from, key)) {
|
128 | to[key] = from[key];
|
129 | }
|
130 | }
|
131 |
|
132 | if (getOwnPropertySymbols) {
|
133 | symbols = getOwnPropertySymbols(from);
|
134 | for (var i = 0; i < symbols.length; i++) {
|
135 | if (propIsEnumerable.call(from, symbols[i])) {
|
136 | to[symbols[i]] = from[symbols[i]];
|
137 | }
|
138 | }
|
139 | }
|
140 | }
|
141 |
|
142 | return to;
|
143 | };
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | var validateFormat = function () {};
|
157 |
|
158 | {
|
159 | validateFormat = function (format) {
|
160 | if (format === undefined) {
|
161 | throw new Error('invariant requires an error message argument');
|
162 | }
|
163 | };
|
164 | }
|
165 |
|
166 | function invariant(condition, format, a, b, c, d, e, f) {
|
167 | validateFormat(format);
|
168 |
|
169 | if (!condition) {
|
170 | var error = void 0;
|
171 | if (format === undefined) {
|
172 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
173 | } else {
|
174 | var args = [a, b, c, d, e, f];
|
175 | var argIndex = 0;
|
176 | error = new Error(format.replace(/%s/g, function () {
|
177 | return args[argIndex++];
|
178 | }));
|
179 | error.name = 'Invariant Violation';
|
180 | }
|
181 |
|
182 | error.framesToPop = 1;
|
183 | throw error;
|
184 | }
|
185 | }
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 | var lowPriorityWarning = function () {};
|
205 |
|
206 | {
|
207 | var printWarning = function (format) {
|
208 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
209 | args[_key - 1] = arguments[_key];
|
210 | }
|
211 |
|
212 | var argIndex = 0;
|
213 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
214 | return args[argIndex++];
|
215 | });
|
216 | if (typeof console !== 'undefined') {
|
217 | console.warn(message);
|
218 | }
|
219 | try {
|
220 |
|
221 |
|
222 |
|
223 | throw new Error(message);
|
224 | } catch (x) {}
|
225 | };
|
226 |
|
227 | lowPriorityWarning = function (condition, format) {
|
228 | if (format === undefined) {
|
229 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
230 | }
|
231 | if (!condition) {
|
232 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
233 | args[_key2 - 2] = arguments[_key2];
|
234 | }
|
235 |
|
236 | printWarning.apply(undefined, [format].concat(args));
|
237 | }
|
238 | };
|
239 | }
|
240 |
|
241 | var lowPriorityWarning$1 = lowPriorityWarning;
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 | var warningWithoutStack = function () {};
|
251 |
|
252 | {
|
253 | warningWithoutStack = function (condition, format) {
|
254 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
255 | args[_key - 2] = arguments[_key];
|
256 | }
|
257 |
|
258 | if (format === undefined) {
|
259 | throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
260 | }
|
261 | if (args.length > 8) {
|
262 |
|
263 | throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
264 | }
|
265 | if (condition) {
|
266 | return;
|
267 | }
|
268 | if (typeof console !== 'undefined') {
|
269 | var argsWithFormat = args.map(function (item) {
|
270 | return '' + item;
|
271 | });
|
272 | argsWithFormat.unshift('Warning: ' + format);
|
273 |
|
274 |
|
275 |
|
276 | Function.prototype.apply.call(console.error, console, argsWithFormat);
|
277 | }
|
278 | try {
|
279 |
|
280 |
|
281 |
|
282 | var argIndex = 0;
|
283 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
284 | return args[argIndex++];
|
285 | });
|
286 | throw new Error(message);
|
287 | } catch (x) {}
|
288 | };
|
289 | }
|
290 |
|
291 | var warningWithoutStack$1 = warningWithoutStack;
|
292 |
|
293 | var didWarnStateUpdateForUnmountedComponent = {};
|
294 |
|
295 | function warnNoop(publicInstance, callerName) {
|
296 | {
|
297 | var _constructor = publicInstance.constructor;
|
298 | var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
299 | var warningKey = componentName + '.' + callerName;
|
300 | if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
301 | return;
|
302 | }
|
303 | 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);
|
304 | didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
305 | }
|
306 | }
|
307 |
|
308 |
|
309 |
|
310 |
|
311 | var ReactNoopUpdateQueue = {
|
312 | |
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 | isMounted: function (publicInstance) {
|
320 | return false;
|
321 | },
|
322 |
|
323 | |
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 | enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
339 | warnNoop(publicInstance, 'forceUpdate');
|
340 | },
|
341 |
|
342 | |
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
356 | warnNoop(publicInstance, 'replaceState');
|
357 | },
|
358 |
|
359 | |
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 | enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
372 | warnNoop(publicInstance, 'setState');
|
373 | }
|
374 | };
|
375 |
|
376 | var emptyObject = {};
|
377 | {
|
378 | Object.freeze(emptyObject);
|
379 | }
|
380 |
|
381 |
|
382 |
|
383 |
|
384 | function Component(props, context, updater) {
|
385 | this.props = props;
|
386 | this.context = context;
|
387 |
|
388 | this.refs = emptyObject;
|
389 |
|
390 |
|
391 | this.updater = updater || ReactNoopUpdateQueue;
|
392 | }
|
393 |
|
394 | Component.prototype.isReactComponent = {};
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 | Component.prototype.setState = function (partialState, callback) {
|
422 | !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
423 | this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
424 | };
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 | Component.prototype.forceUpdate = function (callback) {
|
441 | this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
442 | };
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 | {
|
450 | var deprecatedAPIs = {
|
451 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
452 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
453 | };
|
454 | var defineDeprecationWarning = function (methodName, info) {
|
455 | Object.defineProperty(Component.prototype, methodName, {
|
456 | get: function () {
|
457 | lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
458 | return undefined;
|
459 | }
|
460 | });
|
461 | };
|
462 | for (var fnName in deprecatedAPIs) {
|
463 | if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
464 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
465 | }
|
466 | }
|
467 | }
|
468 |
|
469 | function ComponentDummy() {}
|
470 | ComponentDummy.prototype = Component.prototype;
|
471 |
|
472 |
|
473 |
|
474 |
|
475 | function PureComponent(props, context, updater) {
|
476 | this.props = props;
|
477 | this.context = context;
|
478 |
|
479 | this.refs = emptyObject;
|
480 | this.updater = updater || ReactNoopUpdateQueue;
|
481 | }
|
482 |
|
483 | var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
484 | pureComponentPrototype.constructor = PureComponent;
|
485 |
|
486 | objectAssign(pureComponentPrototype, Component.prototype);
|
487 | pureComponentPrototype.isPureReactComponent = true;
|
488 |
|
489 |
|
490 | function createRef() {
|
491 | var refObject = {
|
492 | current: null
|
493 | };
|
494 | {
|
495 | Object.seal(refObject);
|
496 | }
|
497 | return refObject;
|
498 | }
|
499 |
|
500 | var enableSchedulerDebugging = false;
|
501 |
|
502 |
|
503 |
|
504 |
|
505 | var ImmediatePriority = 1;
|
506 | var UserBlockingPriority = 2;
|
507 | var NormalPriority = 3;
|
508 | var LowPriority = 4;
|
509 | var IdlePriority = 5;
|
510 |
|
511 |
|
512 |
|
513 |
|
514 | var maxSigned31BitInt = 1073741823;
|
515 |
|
516 |
|
517 | var IMMEDIATE_PRIORITY_TIMEOUT = -1;
|
518 |
|
519 | var USER_BLOCKING_PRIORITY = 250;
|
520 | var NORMAL_PRIORITY_TIMEOUT = 5000;
|
521 | var LOW_PRIORITY_TIMEOUT = 10000;
|
522 |
|
523 | var IDLE_PRIORITY = maxSigned31BitInt;
|
524 |
|
525 |
|
526 | var firstCallbackNode = null;
|
527 |
|
528 | var currentDidTimeout = false;
|
529 |
|
530 | var isSchedulerPaused = false;
|
531 |
|
532 | var currentPriorityLevel = NormalPriority;
|
533 | var currentEventStartTime = -1;
|
534 | var currentExpirationTime = -1;
|
535 |
|
536 |
|
537 | var isExecutingCallback = false;
|
538 |
|
539 | var isHostCallbackScheduled = false;
|
540 |
|
541 | var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
542 |
|
543 | function ensureHostCallbackIsScheduled() {
|
544 | if (isExecutingCallback) {
|
545 |
|
546 | return;
|
547 | }
|
548 |
|
549 | var expirationTime = firstCallbackNode.expirationTime;
|
550 | if (!isHostCallbackScheduled) {
|
551 | isHostCallbackScheduled = true;
|
552 | } else {
|
553 |
|
554 | cancelHostCallback();
|
555 | }
|
556 | requestHostCallback(flushWork, expirationTime);
|
557 | }
|
558 |
|
559 | function flushFirstCallback() {
|
560 | var flushedNode = firstCallbackNode;
|
561 |
|
562 |
|
563 |
|
564 | var next = firstCallbackNode.next;
|
565 | if (firstCallbackNode === next) {
|
566 |
|
567 | firstCallbackNode = null;
|
568 | next = null;
|
569 | } else {
|
570 | var lastCallbackNode = firstCallbackNode.previous;
|
571 | firstCallbackNode = lastCallbackNode.next = next;
|
572 | next.previous = lastCallbackNode;
|
573 | }
|
574 |
|
575 | flushedNode.next = flushedNode.previous = null;
|
576 |
|
577 |
|
578 | var callback = flushedNode.callback;
|
579 | var expirationTime = flushedNode.expirationTime;
|
580 | var priorityLevel = flushedNode.priorityLevel;
|
581 | var previousPriorityLevel = currentPriorityLevel;
|
582 | var previousExpirationTime = currentExpirationTime;
|
583 | currentPriorityLevel = priorityLevel;
|
584 | currentExpirationTime = expirationTime;
|
585 | var continuationCallback;
|
586 | try {
|
587 | continuationCallback = callback();
|
588 | } finally {
|
589 | currentPriorityLevel = previousPriorityLevel;
|
590 | currentExpirationTime = previousExpirationTime;
|
591 | }
|
592 |
|
593 |
|
594 |
|
595 | if (typeof continuationCallback === 'function') {
|
596 | var continuationNode = {
|
597 | callback: continuationCallback,
|
598 | priorityLevel: priorityLevel,
|
599 | expirationTime: expirationTime,
|
600 | next: null,
|
601 | previous: null
|
602 | };
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 | if (firstCallbackNode === null) {
|
609 |
|
610 | firstCallbackNode = continuationNode.next = continuationNode.previous = continuationNode;
|
611 | } else {
|
612 | var nextAfterContinuation = null;
|
613 | var node = firstCallbackNode;
|
614 | do {
|
615 | if (node.expirationTime >= expirationTime) {
|
616 |
|
617 |
|
618 | nextAfterContinuation = node;
|
619 | break;
|
620 | }
|
621 | node = node.next;
|
622 | } while (node !== firstCallbackNode);
|
623 |
|
624 | if (nextAfterContinuation === null) {
|
625 |
|
626 |
|
627 | nextAfterContinuation = firstCallbackNode;
|
628 | } else if (nextAfterContinuation === firstCallbackNode) {
|
629 |
|
630 | firstCallbackNode = continuationNode;
|
631 | ensureHostCallbackIsScheduled();
|
632 | }
|
633 |
|
634 | var previous = nextAfterContinuation.previous;
|
635 | previous.next = nextAfterContinuation.previous = continuationNode;
|
636 | continuationNode.next = nextAfterContinuation;
|
637 | continuationNode.previous = previous;
|
638 | }
|
639 | }
|
640 | }
|
641 |
|
642 | function flushImmediateWork() {
|
643 | if (
|
644 |
|
645 | currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
|
646 | isExecutingCallback = true;
|
647 | try {
|
648 | do {
|
649 | flushFirstCallback();
|
650 | } while (
|
651 |
|
652 | firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority);
|
653 | } finally {
|
654 | isExecutingCallback = false;
|
655 | if (firstCallbackNode !== null) {
|
656 |
|
657 | ensureHostCallbackIsScheduled();
|
658 | } else {
|
659 | isHostCallbackScheduled = false;
|
660 | }
|
661 | }
|
662 | }
|
663 | }
|
664 |
|
665 | function flushWork(didTimeout) {
|
666 |
|
667 |
|
668 | if (enableSchedulerDebugging && isSchedulerPaused) {
|
669 | return;
|
670 | }
|
671 |
|
672 | isExecutingCallback = true;
|
673 | var previousDidTimeout = currentDidTimeout;
|
674 | currentDidTimeout = didTimeout;
|
675 | try {
|
676 | if (didTimeout) {
|
677 |
|
678 | while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
|
679 |
|
680 |
|
681 |
|
682 |
|
683 | var currentTime = getCurrentTime();
|
684 | if (firstCallbackNode.expirationTime <= currentTime) {
|
685 | do {
|
686 | flushFirstCallback();
|
687 | } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused));
|
688 | continue;
|
689 | }
|
690 | break;
|
691 | }
|
692 | } else {
|
693 |
|
694 | if (firstCallbackNode !== null) {
|
695 | do {
|
696 | if (enableSchedulerDebugging && isSchedulerPaused) {
|
697 | break;
|
698 | }
|
699 | flushFirstCallback();
|
700 | } while (firstCallbackNode !== null && !shouldYieldToHost());
|
701 | }
|
702 | }
|
703 | } finally {
|
704 | isExecutingCallback = false;
|
705 | currentDidTimeout = previousDidTimeout;
|
706 | if (firstCallbackNode !== null) {
|
707 |
|
708 | ensureHostCallbackIsScheduled();
|
709 | } else {
|
710 | isHostCallbackScheduled = false;
|
711 | }
|
712 |
|
713 | flushImmediateWork();
|
714 | }
|
715 | }
|
716 |
|
717 | function unstable_runWithPriority(priorityLevel, eventHandler) {
|
718 | switch (priorityLevel) {
|
719 | case ImmediatePriority:
|
720 | case UserBlockingPriority:
|
721 | case NormalPriority:
|
722 | case LowPriority:
|
723 | case IdlePriority:
|
724 | break;
|
725 | default:
|
726 | priorityLevel = NormalPriority;
|
727 | }
|
728 |
|
729 | var previousPriorityLevel = currentPriorityLevel;
|
730 | var previousEventStartTime = currentEventStartTime;
|
731 | currentPriorityLevel = priorityLevel;
|
732 | currentEventStartTime = getCurrentTime();
|
733 |
|
734 | try {
|
735 | return eventHandler();
|
736 | } finally {
|
737 | currentPriorityLevel = previousPriorityLevel;
|
738 | currentEventStartTime = previousEventStartTime;
|
739 |
|
740 |
|
741 | flushImmediateWork();
|
742 | }
|
743 | }
|
744 |
|
745 | function unstable_wrapCallback(callback) {
|
746 | var parentPriorityLevel = currentPriorityLevel;
|
747 | return function () {
|
748 |
|
749 | var previousPriorityLevel = currentPriorityLevel;
|
750 | var previousEventStartTime = currentEventStartTime;
|
751 | currentPriorityLevel = parentPriorityLevel;
|
752 | currentEventStartTime = getCurrentTime();
|
753 |
|
754 | try {
|
755 | return callback.apply(this, arguments);
|
756 | } finally {
|
757 | currentPriorityLevel = previousPriorityLevel;
|
758 | currentEventStartTime = previousEventStartTime;
|
759 | flushImmediateWork();
|
760 | }
|
761 | };
|
762 | }
|
763 |
|
764 | function unstable_scheduleCallback(callback, deprecated_options) {
|
765 | var startTime = currentEventStartTime !== -1 ? currentEventStartTime : getCurrentTime();
|
766 |
|
767 | var expirationTime;
|
768 | if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
|
769 |
|
770 | expirationTime = startTime + deprecated_options.timeout;
|
771 | } else {
|
772 | switch (currentPriorityLevel) {
|
773 | case ImmediatePriority:
|
774 | expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
|
775 | break;
|
776 | case UserBlockingPriority:
|
777 | expirationTime = startTime + USER_BLOCKING_PRIORITY;
|
778 | break;
|
779 | case IdlePriority:
|
780 | expirationTime = startTime + IDLE_PRIORITY;
|
781 | break;
|
782 | case LowPriority:
|
783 | expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
|
784 | break;
|
785 | case NormalPriority:
|
786 | default:
|
787 | expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
|
788 | }
|
789 | }
|
790 |
|
791 | var newNode = {
|
792 | callback: callback,
|
793 | priorityLevel: currentPriorityLevel,
|
794 | expirationTime: expirationTime,
|
795 | next: null,
|
796 | previous: null
|
797 | };
|
798 |
|
799 |
|
800 |
|
801 |
|
802 | if (firstCallbackNode === null) {
|
803 |
|
804 | firstCallbackNode = newNode.next = newNode.previous = newNode;
|
805 | ensureHostCallbackIsScheduled();
|
806 | } else {
|
807 | var next = null;
|
808 | var node = firstCallbackNode;
|
809 | do {
|
810 | if (node.expirationTime > expirationTime) {
|
811 |
|
812 | next = node;
|
813 | break;
|
814 | }
|
815 | node = node.next;
|
816 | } while (node !== firstCallbackNode);
|
817 |
|
818 | if (next === null) {
|
819 |
|
820 |
|
821 | next = firstCallbackNode;
|
822 | } else if (next === firstCallbackNode) {
|
823 |
|
824 | firstCallbackNode = newNode;
|
825 | ensureHostCallbackIsScheduled();
|
826 | }
|
827 |
|
828 | var previous = next.previous;
|
829 | previous.next = next.previous = newNode;
|
830 | newNode.next = next;
|
831 | newNode.previous = previous;
|
832 | }
|
833 |
|
834 | return newNode;
|
835 | }
|
836 |
|
837 | function unstable_pauseExecution() {
|
838 | isSchedulerPaused = true;
|
839 | }
|
840 |
|
841 | function unstable_continueExecution() {
|
842 | isSchedulerPaused = false;
|
843 | if (firstCallbackNode !== null) {
|
844 | ensureHostCallbackIsScheduled();
|
845 | }
|
846 | }
|
847 |
|
848 | function unstable_getFirstCallbackNode() {
|
849 | return firstCallbackNode;
|
850 | }
|
851 |
|
852 | function unstable_cancelCallback(callbackNode) {
|
853 | var next = callbackNode.next;
|
854 | if (next === null) {
|
855 |
|
856 | return;
|
857 | }
|
858 |
|
859 | if (next === callbackNode) {
|
860 |
|
861 | firstCallbackNode = null;
|
862 | } else {
|
863 |
|
864 | if (callbackNode === firstCallbackNode) {
|
865 | firstCallbackNode = next;
|
866 | }
|
867 | var previous = callbackNode.previous;
|
868 | previous.next = next;
|
869 | next.previous = previous;
|
870 | }
|
871 |
|
872 | callbackNode.next = callbackNode.previous = null;
|
873 | }
|
874 |
|
875 | function unstable_getCurrentPriorityLevel() {
|
876 | return currentPriorityLevel;
|
877 | }
|
878 |
|
879 | function unstable_shouldYield() {
|
880 | return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
|
881 | }
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 | var localDate = Date;
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 | var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
|
901 | var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
|
902 |
|
903 |
|
904 |
|
905 | var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
|
906 | var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
|
907 |
|
908 | var getCurrentTime;
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 | var ANIMATION_FRAME_TIMEOUT = 100;
|
916 | var rAFID;
|
917 | var rAFTimeoutID;
|
918 | var requestAnimationFrameWithTimeout = function (callback) {
|
919 |
|
920 | rAFID = localRequestAnimationFrame(function (timestamp) {
|
921 |
|
922 | localClearTimeout(rAFTimeoutID);
|
923 | callback(timestamp);
|
924 | });
|
925 | rAFTimeoutID = localSetTimeout(function () {
|
926 |
|
927 | localCancelAnimationFrame(rAFID);
|
928 | callback(getCurrentTime());
|
929 | }, ANIMATION_FRAME_TIMEOUT);
|
930 | };
|
931 |
|
932 | if (hasNativePerformanceNow) {
|
933 | var Performance = performance;
|
934 | getCurrentTime = function () {
|
935 | return Performance.now();
|
936 | };
|
937 | } else {
|
938 | getCurrentTime = function () {
|
939 | return localDate.now();
|
940 | };
|
941 | }
|
942 |
|
943 | var requestHostCallback;
|
944 | var cancelHostCallback;
|
945 | var shouldYieldToHost;
|
946 |
|
947 | var globalValue = null;
|
948 | if (typeof window !== 'undefined') {
|
949 | globalValue = window;
|
950 | } else if (typeof global !== 'undefined') {
|
951 | globalValue = global;
|
952 | }
|
953 |
|
954 | if (globalValue && globalValue._schedMock) {
|
955 |
|
956 | var globalImpl = globalValue._schedMock;
|
957 | requestHostCallback = globalImpl[0];
|
958 | cancelHostCallback = globalImpl[1];
|
959 | shouldYieldToHost = globalImpl[2];
|
960 | getCurrentTime = globalImpl[3];
|
961 | } else if (
|
962 |
|
963 |
|
964 | typeof window === 'undefined' ||
|
965 |
|
966 | typeof MessageChannel !== 'function') {
|
967 |
|
968 |
|
969 | var _callback = null;
|
970 | var _flushCallback = function (didTimeout) {
|
971 | if (_callback !== null) {
|
972 | try {
|
973 | _callback(didTimeout);
|
974 | } finally {
|
975 | _callback = null;
|
976 | }
|
977 | }
|
978 | };
|
979 | requestHostCallback = function (cb, ms) {
|
980 | if (_callback !== null) {
|
981 |
|
982 | setTimeout(requestHostCallback, 0, cb);
|
983 | } else {
|
984 | _callback = cb;
|
985 | setTimeout(_flushCallback, 0, false);
|
986 | }
|
987 | };
|
988 | cancelHostCallback = function () {
|
989 | _callback = null;
|
990 | };
|
991 | shouldYieldToHost = function () {
|
992 | return false;
|
993 | };
|
994 | } else {
|
995 | if (typeof console !== 'undefined') {
|
996 |
|
997 | if (typeof localRequestAnimationFrame !== 'function') {
|
998 | console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
999 | }
|
1000 | if (typeof localCancelAnimationFrame !== 'function') {
|
1001 | console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
1002 | }
|
1003 | }
|
1004 |
|
1005 | var scheduledHostCallback = null;
|
1006 | var isMessageEventScheduled = false;
|
1007 | var timeoutTime = -1;
|
1008 |
|
1009 | var isAnimationFrameScheduled = false;
|
1010 |
|
1011 | var isFlushingHostCallback = false;
|
1012 |
|
1013 | var frameDeadline = 0;
|
1014 |
|
1015 |
|
1016 |
|
1017 | var previousFrameTime = 33;
|
1018 | var activeFrameTime = 33;
|
1019 |
|
1020 | shouldYieldToHost = function () {
|
1021 | return frameDeadline <= getCurrentTime();
|
1022 | };
|
1023 |
|
1024 |
|
1025 | var channel = new MessageChannel();
|
1026 | var port = channel.port2;
|
1027 | channel.port1.onmessage = function (event) {
|
1028 | isMessageEventScheduled = false;
|
1029 |
|
1030 | var prevScheduledCallback = scheduledHostCallback;
|
1031 | var prevTimeoutTime = timeoutTime;
|
1032 | scheduledHostCallback = null;
|
1033 | timeoutTime = -1;
|
1034 |
|
1035 | var currentTime = getCurrentTime();
|
1036 |
|
1037 | var didTimeout = false;
|
1038 | if (frameDeadline - currentTime <= 0) {
|
1039 |
|
1040 |
|
1041 | if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
|
1042 |
|
1043 |
|
1044 | didTimeout = true;
|
1045 | } else {
|
1046 |
|
1047 | if (!isAnimationFrameScheduled) {
|
1048 |
|
1049 | isAnimationFrameScheduled = true;
|
1050 | requestAnimationFrameWithTimeout(animationTick);
|
1051 | }
|
1052 |
|
1053 | scheduledHostCallback = prevScheduledCallback;
|
1054 | timeoutTime = prevTimeoutTime;
|
1055 | return;
|
1056 | }
|
1057 | }
|
1058 |
|
1059 | if (prevScheduledCallback !== null) {
|
1060 | isFlushingHostCallback = true;
|
1061 | try {
|
1062 | prevScheduledCallback(didTimeout);
|
1063 | } finally {
|
1064 | isFlushingHostCallback = false;
|
1065 | }
|
1066 | }
|
1067 | };
|
1068 |
|
1069 | var animationTick = function (rafTime) {
|
1070 | if (scheduledHostCallback !== null) {
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 | requestAnimationFrameWithTimeout(animationTick);
|
1080 | } else {
|
1081 |
|
1082 | isAnimationFrameScheduled = false;
|
1083 | return;
|
1084 | }
|
1085 |
|
1086 | var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
|
1087 | if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
|
1088 | if (nextFrameTime < 8) {
|
1089 |
|
1090 |
|
1091 | nextFrameTime = 8;
|
1092 | }
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 | activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
|
1101 | } else {
|
1102 | previousFrameTime = nextFrameTime;
|
1103 | }
|
1104 | frameDeadline = rafTime + activeFrameTime;
|
1105 | if (!isMessageEventScheduled) {
|
1106 | isMessageEventScheduled = true;
|
1107 | port.postMessage(undefined);
|
1108 | }
|
1109 | };
|
1110 |
|
1111 | requestHostCallback = function (callback, absoluteTimeout) {
|
1112 | scheduledHostCallback = callback;
|
1113 | timeoutTime = absoluteTimeout;
|
1114 | if (isFlushingHostCallback || absoluteTimeout < 0) {
|
1115 |
|
1116 | port.postMessage(undefined);
|
1117 | } else if (!isAnimationFrameScheduled) {
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 | isAnimationFrameScheduled = true;
|
1123 | requestAnimationFrameWithTimeout(animationTick);
|
1124 | }
|
1125 | };
|
1126 |
|
1127 | cancelHostCallback = function () {
|
1128 | scheduledHostCallback = null;
|
1129 | isMessageEventScheduled = false;
|
1130 | timeoutTime = -1;
|
1131 | };
|
1132 | }
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 | var enableSchedulerTracing = true;
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 | var enableStableConcurrentModeAPIs = false;
|
1172 |
|
1173 | var DEFAULT_THREAD_ID = 0;
|
1174 |
|
1175 |
|
1176 | var interactionIDCounter = 0;
|
1177 | var threadIDCounter = 0;
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 | var interactionsRef = null;
|
1184 |
|
1185 |
|
1186 | var subscriberRef = null;
|
1187 |
|
1188 | if (enableSchedulerTracing) {
|
1189 | interactionsRef = {
|
1190 | current: new Set()
|
1191 | };
|
1192 | subscriberRef = {
|
1193 | current: null
|
1194 | };
|
1195 | }
|
1196 |
|
1197 | function unstable_clear(callback) {
|
1198 | if (!enableSchedulerTracing) {
|
1199 | return callback();
|
1200 | }
|
1201 |
|
1202 | var prevInteractions = interactionsRef.current;
|
1203 | interactionsRef.current = new Set();
|
1204 |
|
1205 | try {
|
1206 | return callback();
|
1207 | } finally {
|
1208 | interactionsRef.current = prevInteractions;
|
1209 | }
|
1210 | }
|
1211 |
|
1212 | function unstable_getCurrent() {
|
1213 | if (!enableSchedulerTracing) {
|
1214 | return null;
|
1215 | } else {
|
1216 | return interactionsRef.current;
|
1217 | }
|
1218 | }
|
1219 |
|
1220 | function unstable_getThreadID() {
|
1221 | return ++threadIDCounter;
|
1222 | }
|
1223 |
|
1224 | function unstable_trace(name, timestamp, callback) {
|
1225 | var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
|
1226 |
|
1227 | if (!enableSchedulerTracing) {
|
1228 | return callback();
|
1229 | }
|
1230 |
|
1231 | var interaction = {
|
1232 | __count: 1,
|
1233 | id: interactionIDCounter++,
|
1234 | name: name,
|
1235 | timestamp: timestamp
|
1236 | };
|
1237 |
|
1238 | var prevInteractions = interactionsRef.current;
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 | var interactions = new Set(prevInteractions);
|
1244 | interactions.add(interaction);
|
1245 | interactionsRef.current = interactions;
|
1246 |
|
1247 | var subscriber = subscriberRef.current;
|
1248 | var returnValue = void 0;
|
1249 |
|
1250 | try {
|
1251 | if (subscriber !== null) {
|
1252 | subscriber.onInteractionTraced(interaction);
|
1253 | }
|
1254 | } finally {
|
1255 | try {
|
1256 | if (subscriber !== null) {
|
1257 | subscriber.onWorkStarted(interactions, threadID);
|
1258 | }
|
1259 | } finally {
|
1260 | try {
|
1261 | returnValue = callback();
|
1262 | } finally {
|
1263 | interactionsRef.current = prevInteractions;
|
1264 |
|
1265 | try {
|
1266 | if (subscriber !== null) {
|
1267 | subscriber.onWorkStopped(interactions, threadID);
|
1268 | }
|
1269 | } finally {
|
1270 | interaction.__count--;
|
1271 |
|
1272 |
|
1273 |
|
1274 | if (subscriber !== null && interaction.__count === 0) {
|
1275 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1276 | }
|
1277 | }
|
1278 | }
|
1279 | }
|
1280 | }
|
1281 |
|
1282 | return returnValue;
|
1283 | }
|
1284 |
|
1285 | function unstable_wrap(callback) {
|
1286 | var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
|
1287 |
|
1288 | if (!enableSchedulerTracing) {
|
1289 | return callback;
|
1290 | }
|
1291 |
|
1292 | var wrappedInteractions = interactionsRef.current;
|
1293 |
|
1294 | var subscriber = subscriberRef.current;
|
1295 | if (subscriber !== null) {
|
1296 | subscriber.onWorkScheduled(wrappedInteractions, threadID);
|
1297 | }
|
1298 |
|
1299 |
|
1300 |
|
1301 | wrappedInteractions.forEach(function (interaction) {
|
1302 | interaction.__count++;
|
1303 | });
|
1304 |
|
1305 | var hasRun = false;
|
1306 |
|
1307 | function wrapped() {
|
1308 | var prevInteractions = interactionsRef.current;
|
1309 | interactionsRef.current = wrappedInteractions;
|
1310 |
|
1311 | subscriber = subscriberRef.current;
|
1312 |
|
1313 | try {
|
1314 | var returnValue = void 0;
|
1315 |
|
1316 | try {
|
1317 | if (subscriber !== null) {
|
1318 | subscriber.onWorkStarted(wrappedInteractions, threadID);
|
1319 | }
|
1320 | } finally {
|
1321 | try {
|
1322 | returnValue = callback.apply(undefined, arguments);
|
1323 | } finally {
|
1324 | interactionsRef.current = prevInteractions;
|
1325 |
|
1326 | if (subscriber !== null) {
|
1327 | subscriber.onWorkStopped(wrappedInteractions, threadID);
|
1328 | }
|
1329 | }
|
1330 | }
|
1331 |
|
1332 | return returnValue;
|
1333 | } finally {
|
1334 | if (!hasRun) {
|
1335 |
|
1336 |
|
1337 |
|
1338 | hasRun = true;
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 | wrappedInteractions.forEach(function (interaction) {
|
1344 | interaction.__count--;
|
1345 |
|
1346 | if (subscriber !== null && interaction.__count === 0) {
|
1347 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1348 | }
|
1349 | });
|
1350 | }
|
1351 | }
|
1352 | }
|
1353 |
|
1354 | wrapped.cancel = function cancel() {
|
1355 | subscriber = subscriberRef.current;
|
1356 |
|
1357 | try {
|
1358 | if (subscriber !== null) {
|
1359 | subscriber.onWorkCanceled(wrappedInteractions, threadID);
|
1360 | }
|
1361 | } finally {
|
1362 |
|
1363 |
|
1364 |
|
1365 | wrappedInteractions.forEach(function (interaction) {
|
1366 | interaction.__count--;
|
1367 |
|
1368 | if (subscriber && interaction.__count === 0) {
|
1369 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1370 | }
|
1371 | });
|
1372 | }
|
1373 | };
|
1374 |
|
1375 | return wrapped;
|
1376 | }
|
1377 |
|
1378 | var subscribers = null;
|
1379 | if (enableSchedulerTracing) {
|
1380 | subscribers = new Set();
|
1381 | }
|
1382 |
|
1383 | function unstable_subscribe(subscriber) {
|
1384 | if (enableSchedulerTracing) {
|
1385 | subscribers.add(subscriber);
|
1386 |
|
1387 | if (subscribers.size === 1) {
|
1388 | subscriberRef.current = {
|
1389 | onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
|
1390 | onInteractionTraced: onInteractionTraced,
|
1391 | onWorkCanceled: onWorkCanceled,
|
1392 | onWorkScheduled: onWorkScheduled,
|
1393 | onWorkStarted: onWorkStarted,
|
1394 | onWorkStopped: onWorkStopped
|
1395 | };
|
1396 | }
|
1397 | }
|
1398 | }
|
1399 |
|
1400 | function unstable_unsubscribe(subscriber) {
|
1401 | if (enableSchedulerTracing) {
|
1402 | subscribers.delete(subscriber);
|
1403 |
|
1404 | if (subscribers.size === 0) {
|
1405 | subscriberRef.current = null;
|
1406 | }
|
1407 | }
|
1408 | }
|
1409 |
|
1410 | function onInteractionTraced(interaction) {
|
1411 | var didCatchError = false;
|
1412 | var caughtError = null;
|
1413 |
|
1414 | subscribers.forEach(function (subscriber) {
|
1415 | try {
|
1416 | subscriber.onInteractionTraced(interaction);
|
1417 | } catch (error) {
|
1418 | if (!didCatchError) {
|
1419 | didCatchError = true;
|
1420 | caughtError = error;
|
1421 | }
|
1422 | }
|
1423 | });
|
1424 |
|
1425 | if (didCatchError) {
|
1426 | throw caughtError;
|
1427 | }
|
1428 | }
|
1429 |
|
1430 | function onInteractionScheduledWorkCompleted(interaction) {
|
1431 | var didCatchError = false;
|
1432 | var caughtError = null;
|
1433 |
|
1434 | subscribers.forEach(function (subscriber) {
|
1435 | try {
|
1436 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1437 | } catch (error) {
|
1438 | if (!didCatchError) {
|
1439 | didCatchError = true;
|
1440 | caughtError = error;
|
1441 | }
|
1442 | }
|
1443 | });
|
1444 |
|
1445 | if (didCatchError) {
|
1446 | throw caughtError;
|
1447 | }
|
1448 | }
|
1449 |
|
1450 | function onWorkScheduled(interactions, threadID) {
|
1451 | var didCatchError = false;
|
1452 | var caughtError = null;
|
1453 |
|
1454 | subscribers.forEach(function (subscriber) {
|
1455 | try {
|
1456 | subscriber.onWorkScheduled(interactions, threadID);
|
1457 | } catch (error) {
|
1458 | if (!didCatchError) {
|
1459 | didCatchError = true;
|
1460 | caughtError = error;
|
1461 | }
|
1462 | }
|
1463 | });
|
1464 |
|
1465 | if (didCatchError) {
|
1466 | throw caughtError;
|
1467 | }
|
1468 | }
|
1469 |
|
1470 | function onWorkStarted(interactions, threadID) {
|
1471 | var didCatchError = false;
|
1472 | var caughtError = null;
|
1473 |
|
1474 | subscribers.forEach(function (subscriber) {
|
1475 | try {
|
1476 | subscriber.onWorkStarted(interactions, threadID);
|
1477 | } catch (error) {
|
1478 | if (!didCatchError) {
|
1479 | didCatchError = true;
|
1480 | caughtError = error;
|
1481 | }
|
1482 | }
|
1483 | });
|
1484 |
|
1485 | if (didCatchError) {
|
1486 | throw caughtError;
|
1487 | }
|
1488 | }
|
1489 |
|
1490 | function onWorkStopped(interactions, threadID) {
|
1491 | var didCatchError = false;
|
1492 | var caughtError = null;
|
1493 |
|
1494 | subscribers.forEach(function (subscriber) {
|
1495 | try {
|
1496 | subscriber.onWorkStopped(interactions, threadID);
|
1497 | } catch (error) {
|
1498 | if (!didCatchError) {
|
1499 | didCatchError = true;
|
1500 | caughtError = error;
|
1501 | }
|
1502 | }
|
1503 | });
|
1504 |
|
1505 | if (didCatchError) {
|
1506 | throw caughtError;
|
1507 | }
|
1508 | }
|
1509 |
|
1510 | function onWorkCanceled(interactions, threadID) {
|
1511 | var didCatchError = false;
|
1512 | var caughtError = null;
|
1513 |
|
1514 | subscribers.forEach(function (subscriber) {
|
1515 | try {
|
1516 | subscriber.onWorkCanceled(interactions, threadID);
|
1517 | } catch (error) {
|
1518 | if (!didCatchError) {
|
1519 | didCatchError = true;
|
1520 | caughtError = error;
|
1521 | }
|
1522 | }
|
1523 | });
|
1524 |
|
1525 | if (didCatchError) {
|
1526 | throw caughtError;
|
1527 | }
|
1528 | }
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 | var ReactCurrentDispatcher = {
|
1534 | |
1535 |
|
1536 |
|
1537 |
|
1538 | current: null
|
1539 | };
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 | var ReactCurrentOwner = {
|
1548 | |
1549 |
|
1550 |
|
1551 |
|
1552 | current: null
|
1553 | };
|
1554 |
|
1555 | var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
1556 |
|
1557 | var describeComponentFrame = function (name, source, ownerName) {
|
1558 | var sourceInfo = '';
|
1559 | if (source) {
|
1560 | var path = source.fileName;
|
1561 | var fileName = path.replace(BEFORE_SLASH_RE, '');
|
1562 | {
|
1563 |
|
1564 |
|
1565 | if (/^index\./.test(fileName)) {
|
1566 | var match = path.match(BEFORE_SLASH_RE);
|
1567 | if (match) {
|
1568 | var pathBeforeSlash = match[1];
|
1569 | if (pathBeforeSlash) {
|
1570 | var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
1571 | fileName = folderName + '/' + fileName;
|
1572 | }
|
1573 | }
|
1574 | }
|
1575 | }
|
1576 | sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
1577 | } else if (ownerName) {
|
1578 | sourceInfo = ' (created by ' + ownerName + ')';
|
1579 | }
|
1580 | return '\n in ' + (name || 'Unknown') + sourceInfo;
|
1581 | };
|
1582 |
|
1583 | var Resolved = 1;
|
1584 |
|
1585 |
|
1586 | function refineResolvedLazyComponent(lazyComponent) {
|
1587 | return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
1588 | }
|
1589 |
|
1590 | function getWrappedName(outerType, innerType, wrapperName) {
|
1591 | var functionName = innerType.displayName || innerType.name || '';
|
1592 | return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
1593 | }
|
1594 |
|
1595 | function getComponentName(type) {
|
1596 | if (type == null) {
|
1597 |
|
1598 | return null;
|
1599 | }
|
1600 | {
|
1601 | if (typeof type.tag === 'number') {
|
1602 | warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
1603 | }
|
1604 | }
|
1605 | if (typeof type === 'function') {
|
1606 | return type.displayName || type.name || null;
|
1607 | }
|
1608 | if (typeof type === 'string') {
|
1609 | return type;
|
1610 | }
|
1611 | switch (type) {
|
1612 | case REACT_CONCURRENT_MODE_TYPE:
|
1613 | return 'ConcurrentMode';
|
1614 | case REACT_FRAGMENT_TYPE:
|
1615 | return 'Fragment';
|
1616 | case REACT_PORTAL_TYPE:
|
1617 | return 'Portal';
|
1618 | case REACT_PROFILER_TYPE:
|
1619 | return 'Profiler';
|
1620 | case REACT_STRICT_MODE_TYPE:
|
1621 | return 'StrictMode';
|
1622 | case REACT_SUSPENSE_TYPE:
|
1623 | return 'Suspense';
|
1624 | }
|
1625 | if (typeof type === 'object') {
|
1626 | switch (type.$$typeof) {
|
1627 | case REACT_CONTEXT_TYPE:
|
1628 | return 'Context.Consumer';
|
1629 | case REACT_PROVIDER_TYPE:
|
1630 | return 'Context.Provider';
|
1631 | case REACT_FORWARD_REF_TYPE:
|
1632 | return getWrappedName(type, type.render, 'ForwardRef');
|
1633 | case REACT_MEMO_TYPE:
|
1634 | return getComponentName(type.type);
|
1635 | case REACT_LAZY_TYPE:
|
1636 | {
|
1637 | var thenable = type;
|
1638 | var resolvedThenable = refineResolvedLazyComponent(thenable);
|
1639 | if (resolvedThenable) {
|
1640 | return getComponentName(resolvedThenable);
|
1641 | }
|
1642 | }
|
1643 | }
|
1644 | }
|
1645 | return null;
|
1646 | }
|
1647 |
|
1648 | var ReactDebugCurrentFrame = {};
|
1649 |
|
1650 | var currentlyValidatingElement = null;
|
1651 |
|
1652 | function setCurrentlyValidatingElement(element) {
|
1653 | {
|
1654 | currentlyValidatingElement = element;
|
1655 | }
|
1656 | }
|
1657 |
|
1658 | {
|
1659 |
|
1660 | ReactDebugCurrentFrame.getCurrentStack = null;
|
1661 |
|
1662 | ReactDebugCurrentFrame.getStackAddendum = function () {
|
1663 | var stack = '';
|
1664 |
|
1665 |
|
1666 | if (currentlyValidatingElement) {
|
1667 | var name = getComponentName(currentlyValidatingElement.type);
|
1668 | var owner = currentlyValidatingElement._owner;
|
1669 | stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
1670 | }
|
1671 |
|
1672 |
|
1673 | var impl = ReactDebugCurrentFrame.getCurrentStack;
|
1674 | if (impl) {
|
1675 | stack += impl() || '';
|
1676 | }
|
1677 |
|
1678 | return stack;
|
1679 | };
|
1680 | }
|
1681 |
|
1682 | var ReactSharedInternals = {
|
1683 | ReactCurrentDispatcher: ReactCurrentDispatcher,
|
1684 | ReactCurrentOwner: ReactCurrentOwner,
|
1685 |
|
1686 | assign: objectAssign
|
1687 | };
|
1688 |
|
1689 | {
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 | objectAssign(ReactSharedInternals, {
|
1696 | Scheduler: {
|
1697 | unstable_cancelCallback: unstable_cancelCallback,
|
1698 | unstable_shouldYield: unstable_shouldYield,
|
1699 | unstable_now: getCurrentTime,
|
1700 | unstable_scheduleCallback: unstable_scheduleCallback,
|
1701 | unstable_runWithPriority: unstable_runWithPriority,
|
1702 | unstable_wrapCallback: unstable_wrapCallback,
|
1703 | unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
1704 | unstable_pauseExecution: unstable_pauseExecution,
|
1705 | unstable_continueExecution: unstable_continueExecution,
|
1706 | unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel
|
1707 | },
|
1708 | SchedulerTracing: {
|
1709 | __interactionsRef: interactionsRef,
|
1710 | __subscriberRef: subscriberRef,
|
1711 | unstable_clear: unstable_clear,
|
1712 | unstable_getCurrent: unstable_getCurrent,
|
1713 | unstable_getThreadID: unstable_getThreadID,
|
1714 | unstable_subscribe: unstable_subscribe,
|
1715 | unstable_trace: unstable_trace,
|
1716 | unstable_unsubscribe: unstable_unsubscribe,
|
1717 | unstable_wrap: unstable_wrap
|
1718 | }
|
1719 | });
|
1720 | }
|
1721 |
|
1722 | {
|
1723 | objectAssign(ReactSharedInternals, {
|
1724 |
|
1725 | ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
1726 |
|
1727 |
|
1728 | ReactComponentTreeHook: {}
|
1729 | });
|
1730 | }
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 | var warning = warningWithoutStack$1;
|
1740 |
|
1741 | {
|
1742 | warning = function (condition, format) {
|
1743 | if (condition) {
|
1744 | return;
|
1745 | }
|
1746 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
1747 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
1748 |
|
1749 |
|
1750 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
1751 | args[_key - 2] = arguments[_key];
|
1752 | }
|
1753 |
|
1754 | warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
1755 | };
|
1756 | }
|
1757 |
|
1758 | var warning$1 = warning;
|
1759 |
|
1760 | var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
1761 |
|
1762 | var RESERVED_PROPS = {
|
1763 | key: true,
|
1764 | ref: true,
|
1765 | __self: true,
|
1766 | __source: true
|
1767 | };
|
1768 |
|
1769 | var specialPropKeyWarningShown = void 0;
|
1770 | var specialPropRefWarningShown = void 0;
|
1771 |
|
1772 | function hasValidRef(config) {
|
1773 | {
|
1774 | if (hasOwnProperty$1.call(config, 'ref')) {
|
1775 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
1776 | if (getter && getter.isReactWarning) {
|
1777 | return false;
|
1778 | }
|
1779 | }
|
1780 | }
|
1781 | return config.ref !== undefined;
|
1782 | }
|
1783 |
|
1784 | function hasValidKey(config) {
|
1785 | {
|
1786 | if (hasOwnProperty$1.call(config, 'key')) {
|
1787 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
1788 | if (getter && getter.isReactWarning) {
|
1789 | return false;
|
1790 | }
|
1791 | }
|
1792 | }
|
1793 | return config.key !== undefined;
|
1794 | }
|
1795 |
|
1796 | function defineKeyPropWarningGetter(props, displayName) {
|
1797 | var warnAboutAccessingKey = function () {
|
1798 | if (!specialPropKeyWarningShown) {
|
1799 | specialPropKeyWarningShown = true;
|
1800 | 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);
|
1801 | }
|
1802 | };
|
1803 | warnAboutAccessingKey.isReactWarning = true;
|
1804 | Object.defineProperty(props, 'key', {
|
1805 | get: warnAboutAccessingKey,
|
1806 | configurable: true
|
1807 | });
|
1808 | }
|
1809 |
|
1810 | function defineRefPropWarningGetter(props, displayName) {
|
1811 | var warnAboutAccessingRef = function () {
|
1812 | if (!specialPropRefWarningShown) {
|
1813 | specialPropRefWarningShown = true;
|
1814 | 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);
|
1815 | }
|
1816 | };
|
1817 | warnAboutAccessingRef.isReactWarning = true;
|
1818 | Object.defineProperty(props, 'ref', {
|
1819 | get: warnAboutAccessingRef,
|
1820 | configurable: true
|
1821 | });
|
1822 | }
|
1823 |
|
1824 | /**
|
1825 | * Factory method to create a new React element. This no longer adheres to
|
1826 | * the class pattern, so do not use new to call it. Also, no instanceof check
|
1827 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
1828 | * if something is a React Element.
|
1829 | *
|
1830 | * @param {*} type
|
1831 | * @param {*} key
|
1832 | * @param {string|object} ref
|
1833 | * @param {*} self A *temporary* helper to detect places where `this` is
|
1834 | * different from the `owner` when React.createElement is called, so that we
|
1835 | * can warn. We want to get rid of owner and replace string `ref`s with arrow
|
1836 | * functions, and as long as `this` and owner are the same, there will be no
|
1837 | * change in behavior.
|
1838 | * @param {*} source An annotation object (added by a transpiler or otherwise)
|
1839 | * indicating filename, line number, and/or other information.
|
1840 | * @param {*} owner
|
1841 | * @param {*} props
|
1842 | * @internal
|
1843 | */
|
1844 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
1845 | var element = {
|
1846 |
|
1847 | $$typeof: REACT_ELEMENT_TYPE,
|
1848 |
|
1849 |
|
1850 | type: type,
|
1851 | key: key,
|
1852 | ref: ref,
|
1853 | props: props,
|
1854 |
|
1855 |
|
1856 | _owner: owner
|
1857 | };
|
1858 |
|
1859 | {
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 | element._store = {};
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 | Object.defineProperty(element._store, 'validated', {
|
1871 | configurable: false,
|
1872 | enumerable: false,
|
1873 | writable: true,
|
1874 | value: false
|
1875 | });
|
1876 |
|
1877 | Object.defineProperty(element, '_self', {
|
1878 | configurable: false,
|
1879 | enumerable: false,
|
1880 | writable: false,
|
1881 | value: self
|
1882 | });
|
1883 |
|
1884 |
|
1885 | Object.defineProperty(element, '_source', {
|
1886 | configurable: false,
|
1887 | enumerable: false,
|
1888 | writable: false,
|
1889 | value: source
|
1890 | });
|
1891 | if (Object.freeze) {
|
1892 | Object.freeze(element.props);
|
1893 | Object.freeze(element);
|
1894 | }
|
1895 | }
|
1896 |
|
1897 | return element;
|
1898 | };
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 | function createElement(type, config, children) {
|
1905 | var propName = void 0;
|
1906 |
|
1907 |
|
1908 | var props = {};
|
1909 |
|
1910 | var key = null;
|
1911 | var ref = null;
|
1912 | var self = null;
|
1913 | var source = null;
|
1914 |
|
1915 | if (config != null) {
|
1916 | if (hasValidRef(config)) {
|
1917 | ref = config.ref;
|
1918 | }
|
1919 | if (hasValidKey(config)) {
|
1920 | key = '' + config.key;
|
1921 | }
|
1922 |
|
1923 | self = config.__self === undefined ? null : config.__self;
|
1924 | source = config.__source === undefined ? null : config.__source;
|
1925 |
|
1926 | for (propName in config) {
|
1927 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1928 | props[propName] = config[propName];
|
1929 | }
|
1930 | }
|
1931 | }
|
1932 |
|
1933 |
|
1934 |
|
1935 | var childrenLength = arguments.length - 2;
|
1936 | if (childrenLength === 1) {
|
1937 | props.children = children;
|
1938 | } else if (childrenLength > 1) {
|
1939 | var childArray = Array(childrenLength);
|
1940 | for (var i = 0; i < childrenLength; i++) {
|
1941 | childArray[i] = arguments[i + 2];
|
1942 | }
|
1943 | {
|
1944 | if (Object.freeze) {
|
1945 | Object.freeze(childArray);
|
1946 | }
|
1947 | }
|
1948 | props.children = childArray;
|
1949 | }
|
1950 |
|
1951 |
|
1952 | if (type && type.defaultProps) {
|
1953 | var defaultProps = type.defaultProps;
|
1954 | for (propName in defaultProps) {
|
1955 | if (props[propName] === undefined) {
|
1956 | props[propName] = defaultProps[propName];
|
1957 | }
|
1958 | }
|
1959 | }
|
1960 | {
|
1961 | if (key || ref) {
|
1962 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
1963 | if (key) {
|
1964 | defineKeyPropWarningGetter(props, displayName);
|
1965 | }
|
1966 | if (ref) {
|
1967 | defineRefPropWarningGetter(props, displayName);
|
1968 | }
|
1969 | }
|
1970 | }
|
1971 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
1972 | }
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 | function cloneAndReplaceKey(oldElement, newKey) {
|
1981 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
1982 |
|
1983 | return newElement;
|
1984 | }
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 | function cloneElement(element, config, children) {
|
1991 | !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
1992 |
|
1993 | var propName = void 0;
|
1994 |
|
1995 |
|
1996 | var props = objectAssign({}, element.props);
|
1997 |
|
1998 |
|
1999 | var key = element.key;
|
2000 | var ref = element.ref;
|
2001 |
|
2002 | var self = element._self;
|
2003 |
|
2004 |
|
2005 |
|
2006 | var source = element._source;
|
2007 |
|
2008 |
|
2009 | var owner = element._owner;
|
2010 |
|
2011 | if (config != null) {
|
2012 | if (hasValidRef(config)) {
|
2013 |
|
2014 | ref = config.ref;
|
2015 | owner = ReactCurrentOwner.current;
|
2016 | }
|
2017 | if (hasValidKey(config)) {
|
2018 | key = '' + config.key;
|
2019 | }
|
2020 |
|
2021 |
|
2022 | var defaultProps = void 0;
|
2023 | if (element.type && element.type.defaultProps) {
|
2024 | defaultProps = element.type.defaultProps;
|
2025 | }
|
2026 | for (propName in config) {
|
2027 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
2028 | if (config[propName] === undefined && defaultProps !== undefined) {
|
2029 |
|
2030 | props[propName] = defaultProps[propName];
|
2031 | } else {
|
2032 | props[propName] = config[propName];
|
2033 | }
|
2034 | }
|
2035 | }
|
2036 | }
|
2037 |
|
2038 |
|
2039 |
|
2040 | var childrenLength = arguments.length - 2;
|
2041 | if (childrenLength === 1) {
|
2042 | props.children = children;
|
2043 | } else if (childrenLength > 1) {
|
2044 | var childArray = Array(childrenLength);
|
2045 | for (var i = 0; i < childrenLength; i++) {
|
2046 | childArray[i] = arguments[i + 2];
|
2047 | }
|
2048 | props.children = childArray;
|
2049 | }
|
2050 |
|
2051 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
2052 | }
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 | function isValidElement(object) {
|
2062 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
2063 | }
|
2064 |
|
2065 | var SEPARATOR = '.';
|
2066 | var SUBSEPARATOR = ':';
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 | function escape(key) {
|
2075 | var escapeRegex = /[=:]/g;
|
2076 | var escaperLookup = {
|
2077 | '=': '=0',
|
2078 | ':': '=2'
|
2079 | };
|
2080 | var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
2081 | return escaperLookup[match];
|
2082 | });
|
2083 |
|
2084 | return '$' + escapedString;
|
2085 | }
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 | var didWarnAboutMaps = false;
|
2093 |
|
2094 | var userProvidedKeyEscapeRegex = /\/+/g;
|
2095 | function escapeUserProvidedKey(text) {
|
2096 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
2097 | }
|
2098 |
|
2099 | var POOL_SIZE = 10;
|
2100 | var traverseContextPool = [];
|
2101 | function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
2102 | if (traverseContextPool.length) {
|
2103 | var traverseContext = traverseContextPool.pop();
|
2104 | traverseContext.result = mapResult;
|
2105 | traverseContext.keyPrefix = keyPrefix;
|
2106 | traverseContext.func = mapFunction;
|
2107 | traverseContext.context = mapContext;
|
2108 | traverseContext.count = 0;
|
2109 | return traverseContext;
|
2110 | } else {
|
2111 | return {
|
2112 | result: mapResult,
|
2113 | keyPrefix: keyPrefix,
|
2114 | func: mapFunction,
|
2115 | context: mapContext,
|
2116 | count: 0
|
2117 | };
|
2118 | }
|
2119 | }
|
2120 |
|
2121 | function releaseTraverseContext(traverseContext) {
|
2122 | traverseContext.result = null;
|
2123 | traverseContext.keyPrefix = null;
|
2124 | traverseContext.func = null;
|
2125 | traverseContext.context = null;
|
2126 | traverseContext.count = 0;
|
2127 | if (traverseContextPool.length < POOL_SIZE) {
|
2128 | traverseContextPool.push(traverseContext);
|
2129 | }
|
2130 | }
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
2141 | var type = typeof children;
|
2142 |
|
2143 | if (type === 'undefined' || type === 'boolean') {
|
2144 |
|
2145 | children = null;
|
2146 | }
|
2147 |
|
2148 | var invokeCallback = false;
|
2149 |
|
2150 | if (children === null) {
|
2151 | invokeCallback = true;
|
2152 | } else {
|
2153 | switch (type) {
|
2154 | case 'string':
|
2155 | case 'number':
|
2156 | invokeCallback = true;
|
2157 | break;
|
2158 | case 'object':
|
2159 | switch (children.$$typeof) {
|
2160 | case REACT_ELEMENT_TYPE:
|
2161 | case REACT_PORTAL_TYPE:
|
2162 | invokeCallback = true;
|
2163 | }
|
2164 | }
|
2165 | }
|
2166 |
|
2167 | if (invokeCallback) {
|
2168 | callback(traverseContext, children,
|
2169 |
|
2170 |
|
2171 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
2172 | return 1;
|
2173 | }
|
2174 |
|
2175 | var child = void 0;
|
2176 | var nextName = void 0;
|
2177 | var subtreeCount = 0;
|
2178 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
2179 |
|
2180 | if (Array.isArray(children)) {
|
2181 | for (var i = 0; i < children.length; i++) {
|
2182 | child = children[i];
|
2183 | nextName = nextNamePrefix + getComponentKey(child, i);
|
2184 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
2185 | }
|
2186 | } else {
|
2187 | var iteratorFn = getIteratorFn(children);
|
2188 | if (typeof iteratorFn === 'function') {
|
2189 | {
|
2190 |
|
2191 | if (iteratorFn === children.entries) {
|
2192 | !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;
|
2193 | didWarnAboutMaps = true;
|
2194 | }
|
2195 | }
|
2196 |
|
2197 | var iterator = iteratorFn.call(children);
|
2198 | var step = void 0;
|
2199 | var ii = 0;
|
2200 | while (!(step = iterator.next()).done) {
|
2201 | child = step.value;
|
2202 | nextName = nextNamePrefix + getComponentKey(child, ii++);
|
2203 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
2204 | }
|
2205 | } else if (type === 'object') {
|
2206 | var addendum = '';
|
2207 | {
|
2208 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
2209 | }
|
2210 | var childrenString = '' + children;
|
2211 | invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
2212 | }
|
2213 | }
|
2214 |
|
2215 | return subtreeCount;
|
2216 | }
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 | function traverseAllChildren(children, callback, traverseContext) {
|
2235 | if (children == null) {
|
2236 | return 0;
|
2237 | }
|
2238 |
|
2239 | return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
2240 | }
|
2241 |
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 | function getComponentKey(component, index) {
|
2250 |
|
2251 |
|
2252 | if (typeof component === 'object' && component !== null && component.key != null) {
|
2253 |
|
2254 | return escape(component.key);
|
2255 | }
|
2256 |
|
2257 | return index.toString(36);
|
2258 | }
|
2259 |
|
2260 | function forEachSingleChild(bookKeeping, child, name) {
|
2261 | var func = bookKeeping.func,
|
2262 | context = bookKeeping.context;
|
2263 |
|
2264 | func.call(context, child, bookKeeping.count++);
|
2265 | }
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 | function forEachChildren(children, forEachFunc, forEachContext) {
|
2280 | if (children == null) {
|
2281 | return children;
|
2282 | }
|
2283 | var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
2284 | traverseAllChildren(children, forEachSingleChild, traverseContext);
|
2285 | releaseTraverseContext(traverseContext);
|
2286 | }
|
2287 |
|
2288 | function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
2289 | var result = bookKeeping.result,
|
2290 | keyPrefix = bookKeeping.keyPrefix,
|
2291 | func = bookKeeping.func,
|
2292 | context = bookKeeping.context;
|
2293 |
|
2294 |
|
2295 | var mappedChild = func.call(context, child, bookKeeping.count++);
|
2296 | if (Array.isArray(mappedChild)) {
|
2297 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
2298 | return c;
|
2299 | });
|
2300 | } else if (mappedChild != null) {
|
2301 | if (isValidElement(mappedChild)) {
|
2302 | mappedChild = cloneAndReplaceKey(mappedChild,
|
2303 |
|
2304 |
|
2305 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
2306 | }
|
2307 | result.push(mappedChild);
|
2308 | }
|
2309 | }
|
2310 |
|
2311 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
2312 | var escapedPrefix = '';
|
2313 | if (prefix != null) {
|
2314 | escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
2315 | }
|
2316 | var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
2317 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
2318 | releaseTraverseContext(traverseContext);
|
2319 | }
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 | function mapChildren(children, func, context) {
|
2335 | if (children == null) {
|
2336 | return children;
|
2337 | }
|
2338 | var result = [];
|
2339 | mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
2340 | return result;
|
2341 | }
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 | function countChildren(children) {
|
2353 | return traverseAllChildren(children, function () {
|
2354 | return null;
|
2355 | }, null);
|
2356 | }
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 | function toArray(children) {
|
2365 | var result = [];
|
2366 | mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
2367 | return child;
|
2368 | });
|
2369 | return result;
|
2370 | }
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 | function onlyChild(children) {
|
2387 | !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
2388 | return children;
|
2389 | }
|
2390 |
|
2391 | function createContext(defaultValue, calculateChangedBits) {
|
2392 | if (calculateChangedBits === undefined) {
|
2393 | calculateChangedBits = null;
|
2394 | } else {
|
2395 | {
|
2396 | !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
2397 | }
|
2398 | }
|
2399 |
|
2400 | var context = {
|
2401 | $$typeof: REACT_CONTEXT_TYPE,
|
2402 | _calculateChangedBits: calculateChangedBits,
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 | _currentValue: defaultValue,
|
2409 | _currentValue2: defaultValue,
|
2410 |
|
2411 |
|
2412 | _threadCount: 0,
|
2413 |
|
2414 | Provider: null,
|
2415 | Consumer: null
|
2416 | };
|
2417 |
|
2418 | context.Provider = {
|
2419 | $$typeof: REACT_PROVIDER_TYPE,
|
2420 | _context: context
|
2421 | };
|
2422 |
|
2423 | var hasWarnedAboutUsingNestedContextConsumers = false;
|
2424 | var hasWarnedAboutUsingConsumerProvider = false;
|
2425 |
|
2426 | {
|
2427 |
|
2428 |
|
2429 |
|
2430 | var Consumer = {
|
2431 | $$typeof: REACT_CONTEXT_TYPE,
|
2432 | _context: context,
|
2433 | _calculateChangedBits: context._calculateChangedBits
|
2434 | };
|
2435 |
|
2436 | Object.defineProperties(Consumer, {
|
2437 | Provider: {
|
2438 | get: function () {
|
2439 | if (!hasWarnedAboutUsingConsumerProvider) {
|
2440 | hasWarnedAboutUsingConsumerProvider = true;
|
2441 | 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?');
|
2442 | }
|
2443 | return context.Provider;
|
2444 | },
|
2445 | set: function (_Provider) {
|
2446 | context.Provider = _Provider;
|
2447 | }
|
2448 | },
|
2449 | _currentValue: {
|
2450 | get: function () {
|
2451 | return context._currentValue;
|
2452 | },
|
2453 | set: function (_currentValue) {
|
2454 | context._currentValue = _currentValue;
|
2455 | }
|
2456 | },
|
2457 | _currentValue2: {
|
2458 | get: function () {
|
2459 | return context._currentValue2;
|
2460 | },
|
2461 | set: function (_currentValue2) {
|
2462 | context._currentValue2 = _currentValue2;
|
2463 | }
|
2464 | },
|
2465 | _threadCount: {
|
2466 | get: function () {
|
2467 | return context._threadCount;
|
2468 | },
|
2469 | set: function (_threadCount) {
|
2470 | context._threadCount = _threadCount;
|
2471 | }
|
2472 | },
|
2473 | Consumer: {
|
2474 | get: function () {
|
2475 | if (!hasWarnedAboutUsingNestedContextConsumers) {
|
2476 | hasWarnedAboutUsingNestedContextConsumers = true;
|
2477 | 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?');
|
2478 | }
|
2479 | return context.Consumer;
|
2480 | }
|
2481 | }
|
2482 | });
|
2483 |
|
2484 | context.Consumer = Consumer;
|
2485 | }
|
2486 |
|
2487 | {
|
2488 | context._currentRenderer = null;
|
2489 | context._currentRenderer2 = null;
|
2490 | }
|
2491 |
|
2492 | return context;
|
2493 | }
|
2494 |
|
2495 | function lazy(ctor) {
|
2496 | var lazyType = {
|
2497 | $$typeof: REACT_LAZY_TYPE,
|
2498 | _ctor: ctor,
|
2499 |
|
2500 | _status: -1,
|
2501 | _result: null
|
2502 | };
|
2503 |
|
2504 | {
|
2505 |
|
2506 | var defaultProps = void 0;
|
2507 | var propTypes = void 0;
|
2508 | Object.defineProperties(lazyType, {
|
2509 | defaultProps: {
|
2510 | configurable: true,
|
2511 | get: function () {
|
2512 | return defaultProps;
|
2513 | },
|
2514 | set: function (newDefaultProps) {
|
2515 | 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.');
|
2516 | defaultProps = newDefaultProps;
|
2517 |
|
2518 | Object.defineProperty(lazyType, 'defaultProps', {
|
2519 | enumerable: true
|
2520 | });
|
2521 | }
|
2522 | },
|
2523 | propTypes: {
|
2524 | configurable: true,
|
2525 | get: function () {
|
2526 | return propTypes;
|
2527 | },
|
2528 | set: function (newPropTypes) {
|
2529 | 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.');
|
2530 | propTypes = newPropTypes;
|
2531 |
|
2532 | Object.defineProperty(lazyType, 'propTypes', {
|
2533 | enumerable: true
|
2534 | });
|
2535 | }
|
2536 | }
|
2537 | });
|
2538 | }
|
2539 |
|
2540 | return lazyType;
|
2541 | }
|
2542 |
|
2543 | function forwardRef(render) {
|
2544 | {
|
2545 | if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
2546 | warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
2547 | } else if (typeof render !== 'function') {
|
2548 | warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
2549 | } else {
|
2550 | !(
|
2551 |
|
2552 | 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;
|
2553 | }
|
2554 |
|
2555 | if (render != null) {
|
2556 | !(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;
|
2557 | }
|
2558 | }
|
2559 |
|
2560 | return {
|
2561 | $$typeof: REACT_FORWARD_REF_TYPE,
|
2562 | render: render
|
2563 | };
|
2564 | }
|
2565 |
|
2566 | function isValidElementType(type) {
|
2567 | return typeof type === 'string' || typeof type === 'function' ||
|
2568 |
|
2569 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
|
2570 | }
|
2571 |
|
2572 | function memo(type, compare) {
|
2573 | {
|
2574 | if (!isValidElementType(type)) {
|
2575 | warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
2576 | }
|
2577 | }
|
2578 | return {
|
2579 | $$typeof: REACT_MEMO_TYPE,
|
2580 | type: type,
|
2581 | compare: compare === undefined ? null : compare
|
2582 | };
|
2583 | }
|
2584 |
|
2585 | function resolveDispatcher() {
|
2586 | var dispatcher = ReactCurrentDispatcher.current;
|
2587 | !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
|
2588 | return dispatcher;
|
2589 | }
|
2590 |
|
2591 | function useContext(Context, unstable_observedBits) {
|
2592 | var dispatcher = resolveDispatcher();
|
2593 | {
|
2594 | !(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;
|
2595 |
|
2596 |
|
2597 | if (Context._context !== undefined) {
|
2598 | var realContext = Context._context;
|
2599 |
|
2600 |
|
2601 | if (realContext.Consumer === Context) {
|
2602 | 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?');
|
2603 | } else if (realContext.Provider === Context) {
|
2604 | warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
2605 | }
|
2606 | }
|
2607 | }
|
2608 | return dispatcher.useContext(Context, unstable_observedBits);
|
2609 | }
|
2610 |
|
2611 | function useState(initialState) {
|
2612 | var dispatcher = resolveDispatcher();
|
2613 | return dispatcher.useState(initialState);
|
2614 | }
|
2615 |
|
2616 | function useReducer(reducer, initialArg, init) {
|
2617 | var dispatcher = resolveDispatcher();
|
2618 | return dispatcher.useReducer(reducer, initialArg, init);
|
2619 | }
|
2620 |
|
2621 | function useRef(initialValue) {
|
2622 | var dispatcher = resolveDispatcher();
|
2623 | return dispatcher.useRef(initialValue);
|
2624 | }
|
2625 |
|
2626 | function useEffect(create, inputs) {
|
2627 | var dispatcher = resolveDispatcher();
|
2628 | return dispatcher.useEffect(create, inputs);
|
2629 | }
|
2630 |
|
2631 | function useLayoutEffect(create, inputs) {
|
2632 | var dispatcher = resolveDispatcher();
|
2633 | return dispatcher.useLayoutEffect(create, inputs);
|
2634 | }
|
2635 |
|
2636 | function useCallback(callback, inputs) {
|
2637 | var dispatcher = resolveDispatcher();
|
2638 | return dispatcher.useCallback(callback, inputs);
|
2639 | }
|
2640 |
|
2641 | function useMemo(create, inputs) {
|
2642 | var dispatcher = resolveDispatcher();
|
2643 | return dispatcher.useMemo(create, inputs);
|
2644 | }
|
2645 |
|
2646 | function useImperativeHandle(ref, create, inputs) {
|
2647 | var dispatcher = resolveDispatcher();
|
2648 | return dispatcher.useImperativeHandle(ref, create, inputs);
|
2649 | }
|
2650 |
|
2651 | function useDebugValue(value, formatterFn) {
|
2652 | {
|
2653 | var dispatcher = resolveDispatcher();
|
2654 | return dispatcher.useDebugValue(value, formatterFn);
|
2655 | }
|
2656 | }
|
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 | var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
2668 |
|
2669 | var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 | var printWarning$1 = function() {};
|
2681 |
|
2682 | {
|
2683 | var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
2684 | var loggedTypeFailures = {};
|
2685 |
|
2686 | printWarning$1 = function(text) {
|
2687 | var message = 'Warning: ' + text;
|
2688 | if (typeof console !== 'undefined') {
|
2689 | console.error(message);
|
2690 | }
|
2691 | try {
|
2692 |
|
2693 |
|
2694 |
|
2695 | throw new Error(message);
|
2696 | } catch (x) {}
|
2697 | };
|
2698 | }
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
2712 | {
|
2713 | for (var typeSpecName in typeSpecs) {
|
2714 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
2715 | var error;
|
2716 |
|
2717 |
|
2718 |
|
2719 | try {
|
2720 |
|
2721 |
|
2722 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
2723 | var err = Error(
|
2724 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
2725 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
2726 | );
|
2727 | err.name = 'Invariant Violation';
|
2728 | throw err;
|
2729 | }
|
2730 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
2731 | } catch (ex) {
|
2732 | error = ex;
|
2733 | }
|
2734 | if (error && !(error instanceof Error)) {
|
2735 | printWarning$1(
|
2736 | (componentName || 'React class') + ': type specification of ' +
|
2737 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
2738 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
2739 | 'You may have forgotten to pass an argument to the type checker ' +
|
2740 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
2741 | 'shape all require an argument).'
|
2742 | );
|
2743 |
|
2744 | }
|
2745 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
2746 |
|
2747 |
|
2748 | loggedTypeFailures[error.message] = true;
|
2749 |
|
2750 | var stack = getStack ? getStack() : '';
|
2751 |
|
2752 | printWarning$1(
|
2753 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
2754 | );
|
2755 | }
|
2756 | }
|
2757 | }
|
2758 | }
|
2759 | }
|
2760 |
|
2761 | var checkPropTypes_1 = checkPropTypes;
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 | var propTypesMisspellWarningShown = void 0;
|
2771 |
|
2772 | {
|
2773 | propTypesMisspellWarningShown = false;
|
2774 | }
|
2775 |
|
2776 | function getDeclarationErrorAddendum() {
|
2777 | if (ReactCurrentOwner.current) {
|
2778 | var name = getComponentName(ReactCurrentOwner.current.type);
|
2779 | if (name) {
|
2780 | return '\n\nCheck the render method of `' + name + '`.';
|
2781 | }
|
2782 | }
|
2783 | return '';
|
2784 | }
|
2785 |
|
2786 | function getSourceInfoErrorAddendum(elementProps) {
|
2787 | if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
2788 | var source = elementProps.__source;
|
2789 | var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
2790 | var lineNumber = source.lineNumber;
|
2791 | return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
2792 | }
|
2793 | return '';
|
2794 | }
|
2795 |
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 | var ownerHasKeyUseWarning = {};
|
2802 |
|
2803 | function getCurrentComponentErrorInfo(parentType) {
|
2804 | var info = getDeclarationErrorAddendum();
|
2805 |
|
2806 | if (!info) {
|
2807 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
2808 | if (parentName) {
|
2809 | info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
2810 | }
|
2811 | }
|
2812 | return info;
|
2813 | }
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 | function validateExplicitKey(element, parentType) {
|
2827 | if (!element._store || element._store.validated || element.key != null) {
|
2828 | return;
|
2829 | }
|
2830 | element._store.validated = true;
|
2831 |
|
2832 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2833 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
2834 | return;
|
2835 | }
|
2836 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 | var childOwner = '';
|
2842 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
2843 |
|
2844 | childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
2845 | }
|
2846 |
|
2847 | setCurrentlyValidatingElement(element);
|
2848 | {
|
2849 | 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);
|
2850 | }
|
2851 | setCurrentlyValidatingElement(null);
|
2852 | }
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 | function validateChildKeys(node, parentType) {
|
2864 | if (typeof node !== 'object') {
|
2865 | return;
|
2866 | }
|
2867 | if (Array.isArray(node)) {
|
2868 | for (var i = 0; i < node.length; i++) {
|
2869 | var child = node[i];
|
2870 | if (isValidElement(child)) {
|
2871 | validateExplicitKey(child, parentType);
|
2872 | }
|
2873 | }
|
2874 | } else if (isValidElement(node)) {
|
2875 |
|
2876 | if (node._store) {
|
2877 | node._store.validated = true;
|
2878 | }
|
2879 | } else if (node) {
|
2880 | var iteratorFn = getIteratorFn(node);
|
2881 | if (typeof iteratorFn === 'function') {
|
2882 |
|
2883 |
|
2884 | if (iteratorFn !== node.entries) {
|
2885 | var iterator = iteratorFn.call(node);
|
2886 | var step = void 0;
|
2887 | while (!(step = iterator.next()).done) {
|
2888 | if (isValidElement(step.value)) {
|
2889 | validateExplicitKey(step.value, parentType);
|
2890 | }
|
2891 | }
|
2892 | }
|
2893 | }
|
2894 | }
|
2895 | }
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 | function validatePropTypes(element) {
|
2904 | var type = element.type;
|
2905 | if (type === null || type === undefined || typeof type === 'string') {
|
2906 | return;
|
2907 | }
|
2908 | var name = getComponentName(type);
|
2909 | var propTypes = void 0;
|
2910 | if (typeof type === 'function') {
|
2911 | propTypes = type.propTypes;
|
2912 | } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
2913 |
|
2914 |
|
2915 | type.$$typeof === REACT_MEMO_TYPE)) {
|
2916 | propTypes = type.propTypes;
|
2917 | } else {
|
2918 | return;
|
2919 | }
|
2920 | if (propTypes) {
|
2921 | setCurrentlyValidatingElement(element);
|
2922 | checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
2923 | setCurrentlyValidatingElement(null);
|
2924 | } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
2925 | propTypesMisspellWarningShown = true;
|
2926 | warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
2927 | }
|
2928 | if (typeof type.getDefaultProps === 'function') {
|
2929 | !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
2930 | }
|
2931 | }
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 | function validateFragmentProps(fragment) {
|
2938 | setCurrentlyValidatingElement(fragment);
|
2939 |
|
2940 | var keys = Object.keys(fragment.props);
|
2941 | for (var i = 0; i < keys.length; i++) {
|
2942 | var key = keys[i];
|
2943 | if (key !== 'children' && key !== 'key') {
|
2944 | warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
2945 | break;
|
2946 | }
|
2947 | }
|
2948 |
|
2949 | if (fragment.ref !== null) {
|
2950 | warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
2951 | }
|
2952 |
|
2953 | setCurrentlyValidatingElement(null);
|
2954 | }
|
2955 |
|
2956 | function createElementWithValidation(type, props, children) {
|
2957 | var validType = isValidElementType(type);
|
2958 |
|
2959 |
|
2960 |
|
2961 | if (!validType) {
|
2962 | var info = '';
|
2963 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
2964 | 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.";
|
2965 | }
|
2966 |
|
2967 | var sourceInfo = getSourceInfoErrorAddendum(props);
|
2968 | if (sourceInfo) {
|
2969 | info += sourceInfo;
|
2970 | } else {
|
2971 | info += getDeclarationErrorAddendum();
|
2972 | }
|
2973 |
|
2974 | var typeString = void 0;
|
2975 | if (type === null) {
|
2976 | typeString = 'null';
|
2977 | } else if (Array.isArray(type)) {
|
2978 | typeString = 'array';
|
2979 | } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
2980 | typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
2981 | info = ' Did you accidentally export a JSX literal instead of a component?';
|
2982 | } else {
|
2983 | typeString = typeof type;
|
2984 | }
|
2985 |
|
2986 | 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);
|
2987 | }
|
2988 |
|
2989 | var element = createElement.apply(this, arguments);
|
2990 |
|
2991 |
|
2992 |
|
2993 | if (element == null) {
|
2994 | return element;
|
2995 | }
|
2996 |
|
2997 |
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 | if (validType) {
|
3003 | for (var i = 2; i < arguments.length; i++) {
|
3004 | validateChildKeys(arguments[i], type);
|
3005 | }
|
3006 | }
|
3007 |
|
3008 | if (type === REACT_FRAGMENT_TYPE) {
|
3009 | validateFragmentProps(element);
|
3010 | } else {
|
3011 | validatePropTypes(element);
|
3012 | }
|
3013 |
|
3014 | return element;
|
3015 | }
|
3016 |
|
3017 | function createFactoryWithValidation(type) {
|
3018 | var validatedFactory = createElementWithValidation.bind(null, type);
|
3019 | validatedFactory.type = type;
|
3020 |
|
3021 | {
|
3022 | Object.defineProperty(validatedFactory, 'type', {
|
3023 | enumerable: false,
|
3024 | get: function () {
|
3025 | lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
3026 | Object.defineProperty(this, 'type', {
|
3027 | value: type
|
3028 | });
|
3029 | return type;
|
3030 | }
|
3031 | });
|
3032 | }
|
3033 |
|
3034 | return validatedFactory;
|
3035 | }
|
3036 |
|
3037 | function cloneElementWithValidation(element, props, children) {
|
3038 | var newElement = cloneElement.apply(this, arguments);
|
3039 | for (var i = 2; i < arguments.length; i++) {
|
3040 | validateChildKeys(arguments[i], newElement.type);
|
3041 | }
|
3042 | validatePropTypes(newElement);
|
3043 | return newElement;
|
3044 | }
|
3045 |
|
3046 | var React = {
|
3047 | Children: {
|
3048 | map: mapChildren,
|
3049 | forEach: forEachChildren,
|
3050 | count: countChildren,
|
3051 | toArray: toArray,
|
3052 | only: onlyChild
|
3053 | },
|
3054 |
|
3055 | createRef: createRef,
|
3056 | Component: Component,
|
3057 | PureComponent: PureComponent,
|
3058 |
|
3059 | createContext: createContext,
|
3060 | forwardRef: forwardRef,
|
3061 | lazy: lazy,
|
3062 | memo: memo,
|
3063 |
|
3064 | useCallback: useCallback,
|
3065 | useContext: useContext,
|
3066 | useEffect: useEffect,
|
3067 | useImperativeHandle: useImperativeHandle,
|
3068 | useDebugValue: useDebugValue,
|
3069 | useLayoutEffect: useLayoutEffect,
|
3070 | useMemo: useMemo,
|
3071 | useReducer: useReducer,
|
3072 | useRef: useRef,
|
3073 | useState: useState,
|
3074 |
|
3075 | Fragment: REACT_FRAGMENT_TYPE,
|
3076 | StrictMode: REACT_STRICT_MODE_TYPE,
|
3077 | Suspense: REACT_SUSPENSE_TYPE,
|
3078 |
|
3079 | createElement: createElementWithValidation,
|
3080 | cloneElement: cloneElementWithValidation,
|
3081 | createFactory: createFactoryWithValidation,
|
3082 | isValidElement: isValidElement,
|
3083 |
|
3084 | version: ReactVersion,
|
3085 |
|
3086 | unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
3087 | unstable_Profiler: REACT_PROFILER_TYPE,
|
3088 |
|
3089 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
3090 | };
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 | if (enableStableConcurrentModeAPIs) {
|
3098 | React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
3099 | React.Profiler = REACT_PROFILER_TYPE;
|
3100 | React.unstable_ConcurrentMode = undefined;
|
3101 | React.unstable_Profiler = undefined;
|
3102 | }
|
3103 |
|
3104 |
|
3105 |
|
3106 | var React$2 = Object.freeze({
|
3107 | default: React
|
3108 | });
|
3109 |
|
3110 | var React$3 = ( React$2 && React ) || React$2;
|
3111 |
|
3112 |
|
3113 |
|
3114 | var react = React$3.default || React$3;
|
3115 |
|
3116 | return react;
|
3117 |
|
3118 | })));
|