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.6';
|
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_next(eventHandler) {
|
746 | var priorityLevel = void 0;
|
747 | switch (currentPriorityLevel) {
|
748 | case ImmediatePriority:
|
749 | case UserBlockingPriority:
|
750 | case NormalPriority:
|
751 |
|
752 | priorityLevel = NormalPriority;
|
753 | break;
|
754 | default:
|
755 |
|
756 | priorityLevel = currentPriorityLevel;
|
757 | break;
|
758 | }
|
759 |
|
760 | var previousPriorityLevel = currentPriorityLevel;
|
761 | var previousEventStartTime = currentEventStartTime;
|
762 | currentPriorityLevel = priorityLevel;
|
763 | currentEventStartTime = getCurrentTime();
|
764 |
|
765 | try {
|
766 | return eventHandler();
|
767 | } finally {
|
768 | currentPriorityLevel = previousPriorityLevel;
|
769 | currentEventStartTime = previousEventStartTime;
|
770 |
|
771 |
|
772 | flushImmediateWork();
|
773 | }
|
774 | }
|
775 |
|
776 | function unstable_wrapCallback(callback) {
|
777 | var parentPriorityLevel = currentPriorityLevel;
|
778 | return function () {
|
779 |
|
780 | var previousPriorityLevel = currentPriorityLevel;
|
781 | var previousEventStartTime = currentEventStartTime;
|
782 | currentPriorityLevel = parentPriorityLevel;
|
783 | currentEventStartTime = getCurrentTime();
|
784 |
|
785 | try {
|
786 | return callback.apply(this, arguments);
|
787 | } finally {
|
788 | currentPriorityLevel = previousPriorityLevel;
|
789 | currentEventStartTime = previousEventStartTime;
|
790 | flushImmediateWork();
|
791 | }
|
792 | };
|
793 | }
|
794 |
|
795 | function unstable_scheduleCallback(callback, deprecated_options) {
|
796 | var startTime = currentEventStartTime !== -1 ? currentEventStartTime : getCurrentTime();
|
797 |
|
798 | var expirationTime;
|
799 | if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
|
800 |
|
801 | expirationTime = startTime + deprecated_options.timeout;
|
802 | } else {
|
803 | switch (currentPriorityLevel) {
|
804 | case ImmediatePriority:
|
805 | expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
|
806 | break;
|
807 | case UserBlockingPriority:
|
808 | expirationTime = startTime + USER_BLOCKING_PRIORITY;
|
809 | break;
|
810 | case IdlePriority:
|
811 | expirationTime = startTime + IDLE_PRIORITY;
|
812 | break;
|
813 | case LowPriority:
|
814 | expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
|
815 | break;
|
816 | case NormalPriority:
|
817 | default:
|
818 | expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
|
819 | }
|
820 | }
|
821 |
|
822 | var newNode = {
|
823 | callback: callback,
|
824 | priorityLevel: currentPriorityLevel,
|
825 | expirationTime: expirationTime,
|
826 | next: null,
|
827 | previous: null
|
828 | };
|
829 |
|
830 |
|
831 |
|
832 |
|
833 | if (firstCallbackNode === null) {
|
834 |
|
835 | firstCallbackNode = newNode.next = newNode.previous = newNode;
|
836 | ensureHostCallbackIsScheduled();
|
837 | } else {
|
838 | var next = null;
|
839 | var node = firstCallbackNode;
|
840 | do {
|
841 | if (node.expirationTime > expirationTime) {
|
842 |
|
843 | next = node;
|
844 | break;
|
845 | }
|
846 | node = node.next;
|
847 | } while (node !== firstCallbackNode);
|
848 |
|
849 | if (next === null) {
|
850 |
|
851 |
|
852 | next = firstCallbackNode;
|
853 | } else if (next === firstCallbackNode) {
|
854 |
|
855 | firstCallbackNode = newNode;
|
856 | ensureHostCallbackIsScheduled();
|
857 | }
|
858 |
|
859 | var previous = next.previous;
|
860 | previous.next = next.previous = newNode;
|
861 | newNode.next = next;
|
862 | newNode.previous = previous;
|
863 | }
|
864 |
|
865 | return newNode;
|
866 | }
|
867 |
|
868 | function unstable_pauseExecution() {
|
869 | isSchedulerPaused = true;
|
870 | }
|
871 |
|
872 | function unstable_continueExecution() {
|
873 | isSchedulerPaused = false;
|
874 | if (firstCallbackNode !== null) {
|
875 | ensureHostCallbackIsScheduled();
|
876 | }
|
877 | }
|
878 |
|
879 | function unstable_getFirstCallbackNode() {
|
880 | return firstCallbackNode;
|
881 | }
|
882 |
|
883 | function unstable_cancelCallback(callbackNode) {
|
884 | var next = callbackNode.next;
|
885 | if (next === null) {
|
886 |
|
887 | return;
|
888 | }
|
889 |
|
890 | if (next === callbackNode) {
|
891 |
|
892 | firstCallbackNode = null;
|
893 | } else {
|
894 |
|
895 | if (callbackNode === firstCallbackNode) {
|
896 | firstCallbackNode = next;
|
897 | }
|
898 | var previous = callbackNode.previous;
|
899 | previous.next = next;
|
900 | next.previous = previous;
|
901 | }
|
902 |
|
903 | callbackNode.next = callbackNode.previous = null;
|
904 | }
|
905 |
|
906 | function unstable_getCurrentPriorityLevel() {
|
907 | return currentPriorityLevel;
|
908 | }
|
909 |
|
910 | function unstable_shouldYield() {
|
911 | return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
|
912 | }
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 | var localDate = Date;
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 | var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
|
932 | var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
|
933 |
|
934 |
|
935 |
|
936 | var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
|
937 | var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
|
938 |
|
939 | var getCurrentTime;
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 | var ANIMATION_FRAME_TIMEOUT = 100;
|
947 | var rAFID;
|
948 | var rAFTimeoutID;
|
949 | var requestAnimationFrameWithTimeout = function (callback) {
|
950 |
|
951 | rAFID = localRequestAnimationFrame(function (timestamp) {
|
952 |
|
953 | localClearTimeout(rAFTimeoutID);
|
954 | callback(timestamp);
|
955 | });
|
956 | rAFTimeoutID = localSetTimeout(function () {
|
957 |
|
958 | localCancelAnimationFrame(rAFID);
|
959 | callback(getCurrentTime());
|
960 | }, ANIMATION_FRAME_TIMEOUT);
|
961 | };
|
962 |
|
963 | if (hasNativePerformanceNow) {
|
964 | var Performance = performance;
|
965 | getCurrentTime = function () {
|
966 | return Performance.now();
|
967 | };
|
968 | } else {
|
969 | getCurrentTime = function () {
|
970 | return localDate.now();
|
971 | };
|
972 | }
|
973 |
|
974 | var requestHostCallback;
|
975 | var cancelHostCallback;
|
976 | var shouldYieldToHost;
|
977 |
|
978 | var globalValue = null;
|
979 | if (typeof window !== 'undefined') {
|
980 | globalValue = window;
|
981 | } else if (typeof global !== 'undefined') {
|
982 | globalValue = global;
|
983 | }
|
984 |
|
985 | if (globalValue && globalValue._schedMock) {
|
986 |
|
987 | var globalImpl = globalValue._schedMock;
|
988 | requestHostCallback = globalImpl[0];
|
989 | cancelHostCallback = globalImpl[1];
|
990 | shouldYieldToHost = globalImpl[2];
|
991 | getCurrentTime = globalImpl[3];
|
992 | } else if (
|
993 |
|
994 |
|
995 | typeof window === 'undefined' ||
|
996 |
|
997 | typeof MessageChannel !== 'function') {
|
998 |
|
999 |
|
1000 | var _callback = null;
|
1001 | var _flushCallback = function (didTimeout) {
|
1002 | if (_callback !== null) {
|
1003 | try {
|
1004 | _callback(didTimeout);
|
1005 | } finally {
|
1006 | _callback = null;
|
1007 | }
|
1008 | }
|
1009 | };
|
1010 | requestHostCallback = function (cb, ms) {
|
1011 | if (_callback !== null) {
|
1012 |
|
1013 | setTimeout(requestHostCallback, 0, cb);
|
1014 | } else {
|
1015 | _callback = cb;
|
1016 | setTimeout(_flushCallback, 0, false);
|
1017 | }
|
1018 | };
|
1019 | cancelHostCallback = function () {
|
1020 | _callback = null;
|
1021 | };
|
1022 | shouldYieldToHost = function () {
|
1023 | return false;
|
1024 | };
|
1025 | } else {
|
1026 | if (typeof console !== 'undefined') {
|
1027 |
|
1028 | if (typeof localRequestAnimationFrame !== 'function') {
|
1029 | console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
1030 | }
|
1031 | if (typeof localCancelAnimationFrame !== 'function') {
|
1032 | console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
1033 | }
|
1034 | }
|
1035 |
|
1036 | var scheduledHostCallback = null;
|
1037 | var isMessageEventScheduled = false;
|
1038 | var timeoutTime = -1;
|
1039 |
|
1040 | var isAnimationFrameScheduled = false;
|
1041 |
|
1042 | var isFlushingHostCallback = false;
|
1043 |
|
1044 | var frameDeadline = 0;
|
1045 |
|
1046 |
|
1047 |
|
1048 | var previousFrameTime = 33;
|
1049 | var activeFrameTime = 33;
|
1050 |
|
1051 | shouldYieldToHost = function () {
|
1052 | return frameDeadline <= getCurrentTime();
|
1053 | };
|
1054 |
|
1055 |
|
1056 | var channel = new MessageChannel();
|
1057 | var port = channel.port2;
|
1058 | channel.port1.onmessage = function (event) {
|
1059 | isMessageEventScheduled = false;
|
1060 |
|
1061 | var prevScheduledCallback = scheduledHostCallback;
|
1062 | var prevTimeoutTime = timeoutTime;
|
1063 | scheduledHostCallback = null;
|
1064 | timeoutTime = -1;
|
1065 |
|
1066 | var currentTime = getCurrentTime();
|
1067 |
|
1068 | var didTimeout = false;
|
1069 | if (frameDeadline - currentTime <= 0) {
|
1070 |
|
1071 |
|
1072 | if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
|
1073 |
|
1074 |
|
1075 | didTimeout = true;
|
1076 | } else {
|
1077 |
|
1078 | if (!isAnimationFrameScheduled) {
|
1079 |
|
1080 | isAnimationFrameScheduled = true;
|
1081 | requestAnimationFrameWithTimeout(animationTick);
|
1082 | }
|
1083 |
|
1084 | scheduledHostCallback = prevScheduledCallback;
|
1085 | timeoutTime = prevTimeoutTime;
|
1086 | return;
|
1087 | }
|
1088 | }
|
1089 |
|
1090 | if (prevScheduledCallback !== null) {
|
1091 | isFlushingHostCallback = true;
|
1092 | try {
|
1093 | prevScheduledCallback(didTimeout);
|
1094 | } finally {
|
1095 | isFlushingHostCallback = false;
|
1096 | }
|
1097 | }
|
1098 | };
|
1099 |
|
1100 | var animationTick = function (rafTime) {
|
1101 | if (scheduledHostCallback !== null) {
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 | requestAnimationFrameWithTimeout(animationTick);
|
1111 | } else {
|
1112 |
|
1113 | isAnimationFrameScheduled = false;
|
1114 | return;
|
1115 | }
|
1116 |
|
1117 | var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
|
1118 | if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
|
1119 | if (nextFrameTime < 8) {
|
1120 |
|
1121 |
|
1122 | nextFrameTime = 8;
|
1123 | }
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 | activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
|
1132 | } else {
|
1133 | previousFrameTime = nextFrameTime;
|
1134 | }
|
1135 | frameDeadline = rafTime + activeFrameTime;
|
1136 | if (!isMessageEventScheduled) {
|
1137 | isMessageEventScheduled = true;
|
1138 | port.postMessage(undefined);
|
1139 | }
|
1140 | };
|
1141 |
|
1142 | requestHostCallback = function (callback, absoluteTimeout) {
|
1143 | scheduledHostCallback = callback;
|
1144 | timeoutTime = absoluteTimeout;
|
1145 | if (isFlushingHostCallback || absoluteTimeout < 0) {
|
1146 |
|
1147 | port.postMessage(undefined);
|
1148 | } else if (!isAnimationFrameScheduled) {
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 | isAnimationFrameScheduled = true;
|
1154 | requestAnimationFrameWithTimeout(animationTick);
|
1155 | }
|
1156 | };
|
1157 |
|
1158 | cancelHostCallback = function () {
|
1159 | scheduledHostCallback = null;
|
1160 | isMessageEventScheduled = false;
|
1161 | timeoutTime = -1;
|
1162 | };
|
1163 | }
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 | var enableSchedulerTracing = true;
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 |
|
1201 |
|
1202 | var enableStableConcurrentModeAPIs = false;
|
1203 |
|
1204 | var DEFAULT_THREAD_ID = 0;
|
1205 |
|
1206 |
|
1207 | var interactionIDCounter = 0;
|
1208 | var threadIDCounter = 0;
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 | var interactionsRef = null;
|
1215 |
|
1216 |
|
1217 | var subscriberRef = null;
|
1218 |
|
1219 | if (enableSchedulerTracing) {
|
1220 | interactionsRef = {
|
1221 | current: new Set()
|
1222 | };
|
1223 | subscriberRef = {
|
1224 | current: null
|
1225 | };
|
1226 | }
|
1227 |
|
1228 | function unstable_clear(callback) {
|
1229 | if (!enableSchedulerTracing) {
|
1230 | return callback();
|
1231 | }
|
1232 |
|
1233 | var prevInteractions = interactionsRef.current;
|
1234 | interactionsRef.current = new Set();
|
1235 |
|
1236 | try {
|
1237 | return callback();
|
1238 | } finally {
|
1239 | interactionsRef.current = prevInteractions;
|
1240 | }
|
1241 | }
|
1242 |
|
1243 | function unstable_getCurrent() {
|
1244 | if (!enableSchedulerTracing) {
|
1245 | return null;
|
1246 | } else {
|
1247 | return interactionsRef.current;
|
1248 | }
|
1249 | }
|
1250 |
|
1251 | function unstable_getThreadID() {
|
1252 | return ++threadIDCounter;
|
1253 | }
|
1254 |
|
1255 | function unstable_trace(name, timestamp, callback) {
|
1256 | var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
|
1257 |
|
1258 | if (!enableSchedulerTracing) {
|
1259 | return callback();
|
1260 | }
|
1261 |
|
1262 | var interaction = {
|
1263 | __count: 1,
|
1264 | id: interactionIDCounter++,
|
1265 | name: name,
|
1266 | timestamp: timestamp
|
1267 | };
|
1268 |
|
1269 | var prevInteractions = interactionsRef.current;
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 | var interactions = new Set(prevInteractions);
|
1275 | interactions.add(interaction);
|
1276 | interactionsRef.current = interactions;
|
1277 |
|
1278 | var subscriber = subscriberRef.current;
|
1279 | var returnValue = void 0;
|
1280 |
|
1281 | try {
|
1282 | if (subscriber !== null) {
|
1283 | subscriber.onInteractionTraced(interaction);
|
1284 | }
|
1285 | } finally {
|
1286 | try {
|
1287 | if (subscriber !== null) {
|
1288 | subscriber.onWorkStarted(interactions, threadID);
|
1289 | }
|
1290 | } finally {
|
1291 | try {
|
1292 | returnValue = callback();
|
1293 | } finally {
|
1294 | interactionsRef.current = prevInteractions;
|
1295 |
|
1296 | try {
|
1297 | if (subscriber !== null) {
|
1298 | subscriber.onWorkStopped(interactions, threadID);
|
1299 | }
|
1300 | } finally {
|
1301 | interaction.__count--;
|
1302 |
|
1303 |
|
1304 |
|
1305 | if (subscriber !== null && interaction.__count === 0) {
|
1306 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1307 | }
|
1308 | }
|
1309 | }
|
1310 | }
|
1311 | }
|
1312 |
|
1313 | return returnValue;
|
1314 | }
|
1315 |
|
1316 | function unstable_wrap(callback) {
|
1317 | var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
|
1318 |
|
1319 | if (!enableSchedulerTracing) {
|
1320 | return callback;
|
1321 | }
|
1322 |
|
1323 | var wrappedInteractions = interactionsRef.current;
|
1324 |
|
1325 | var subscriber = subscriberRef.current;
|
1326 | if (subscriber !== null) {
|
1327 | subscriber.onWorkScheduled(wrappedInteractions, threadID);
|
1328 | }
|
1329 |
|
1330 |
|
1331 |
|
1332 | wrappedInteractions.forEach(function (interaction) {
|
1333 | interaction.__count++;
|
1334 | });
|
1335 |
|
1336 | var hasRun = false;
|
1337 |
|
1338 | function wrapped() {
|
1339 | var prevInteractions = interactionsRef.current;
|
1340 | interactionsRef.current = wrappedInteractions;
|
1341 |
|
1342 | subscriber = subscriberRef.current;
|
1343 |
|
1344 | try {
|
1345 | var returnValue = void 0;
|
1346 |
|
1347 | try {
|
1348 | if (subscriber !== null) {
|
1349 | subscriber.onWorkStarted(wrappedInteractions, threadID);
|
1350 | }
|
1351 | } finally {
|
1352 | try {
|
1353 | returnValue = callback.apply(undefined, arguments);
|
1354 | } finally {
|
1355 | interactionsRef.current = prevInteractions;
|
1356 |
|
1357 | if (subscriber !== null) {
|
1358 | subscriber.onWorkStopped(wrappedInteractions, threadID);
|
1359 | }
|
1360 | }
|
1361 | }
|
1362 |
|
1363 | return returnValue;
|
1364 | } finally {
|
1365 | if (!hasRun) {
|
1366 |
|
1367 |
|
1368 |
|
1369 | hasRun = true;
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 | wrappedInteractions.forEach(function (interaction) {
|
1375 | interaction.__count--;
|
1376 |
|
1377 | if (subscriber !== null && interaction.__count === 0) {
|
1378 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1379 | }
|
1380 | });
|
1381 | }
|
1382 | }
|
1383 | }
|
1384 |
|
1385 | wrapped.cancel = function cancel() {
|
1386 | subscriber = subscriberRef.current;
|
1387 |
|
1388 | try {
|
1389 | if (subscriber !== null) {
|
1390 | subscriber.onWorkCanceled(wrappedInteractions, threadID);
|
1391 | }
|
1392 | } finally {
|
1393 |
|
1394 |
|
1395 |
|
1396 | wrappedInteractions.forEach(function (interaction) {
|
1397 | interaction.__count--;
|
1398 |
|
1399 | if (subscriber && interaction.__count === 0) {
|
1400 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1401 | }
|
1402 | });
|
1403 | }
|
1404 | };
|
1405 |
|
1406 | return wrapped;
|
1407 | }
|
1408 |
|
1409 | var subscribers = null;
|
1410 | if (enableSchedulerTracing) {
|
1411 | subscribers = new Set();
|
1412 | }
|
1413 |
|
1414 | function unstable_subscribe(subscriber) {
|
1415 | if (enableSchedulerTracing) {
|
1416 | subscribers.add(subscriber);
|
1417 |
|
1418 | if (subscribers.size === 1) {
|
1419 | subscriberRef.current = {
|
1420 | onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
|
1421 | onInteractionTraced: onInteractionTraced,
|
1422 | onWorkCanceled: onWorkCanceled,
|
1423 | onWorkScheduled: onWorkScheduled,
|
1424 | onWorkStarted: onWorkStarted,
|
1425 | onWorkStopped: onWorkStopped
|
1426 | };
|
1427 | }
|
1428 | }
|
1429 | }
|
1430 |
|
1431 | function unstable_unsubscribe(subscriber) {
|
1432 | if (enableSchedulerTracing) {
|
1433 | subscribers.delete(subscriber);
|
1434 |
|
1435 | if (subscribers.size === 0) {
|
1436 | subscriberRef.current = null;
|
1437 | }
|
1438 | }
|
1439 | }
|
1440 |
|
1441 | function onInteractionTraced(interaction) {
|
1442 | var didCatchError = false;
|
1443 | var caughtError = null;
|
1444 |
|
1445 | subscribers.forEach(function (subscriber) {
|
1446 | try {
|
1447 | subscriber.onInteractionTraced(interaction);
|
1448 | } catch (error) {
|
1449 | if (!didCatchError) {
|
1450 | didCatchError = true;
|
1451 | caughtError = error;
|
1452 | }
|
1453 | }
|
1454 | });
|
1455 |
|
1456 | if (didCatchError) {
|
1457 | throw caughtError;
|
1458 | }
|
1459 | }
|
1460 |
|
1461 | function onInteractionScheduledWorkCompleted(interaction) {
|
1462 | var didCatchError = false;
|
1463 | var caughtError = null;
|
1464 |
|
1465 | subscribers.forEach(function (subscriber) {
|
1466 | try {
|
1467 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
1468 | } catch (error) {
|
1469 | if (!didCatchError) {
|
1470 | didCatchError = true;
|
1471 | caughtError = error;
|
1472 | }
|
1473 | }
|
1474 | });
|
1475 |
|
1476 | if (didCatchError) {
|
1477 | throw caughtError;
|
1478 | }
|
1479 | }
|
1480 |
|
1481 | function onWorkScheduled(interactions, threadID) {
|
1482 | var didCatchError = false;
|
1483 | var caughtError = null;
|
1484 |
|
1485 | subscribers.forEach(function (subscriber) {
|
1486 | try {
|
1487 | subscriber.onWorkScheduled(interactions, threadID);
|
1488 | } catch (error) {
|
1489 | if (!didCatchError) {
|
1490 | didCatchError = true;
|
1491 | caughtError = error;
|
1492 | }
|
1493 | }
|
1494 | });
|
1495 |
|
1496 | if (didCatchError) {
|
1497 | throw caughtError;
|
1498 | }
|
1499 | }
|
1500 |
|
1501 | function onWorkStarted(interactions, threadID) {
|
1502 | var didCatchError = false;
|
1503 | var caughtError = null;
|
1504 |
|
1505 | subscribers.forEach(function (subscriber) {
|
1506 | try {
|
1507 | subscriber.onWorkStarted(interactions, threadID);
|
1508 | } catch (error) {
|
1509 | if (!didCatchError) {
|
1510 | didCatchError = true;
|
1511 | caughtError = error;
|
1512 | }
|
1513 | }
|
1514 | });
|
1515 |
|
1516 | if (didCatchError) {
|
1517 | throw caughtError;
|
1518 | }
|
1519 | }
|
1520 |
|
1521 | function onWorkStopped(interactions, threadID) {
|
1522 | var didCatchError = false;
|
1523 | var caughtError = null;
|
1524 |
|
1525 | subscribers.forEach(function (subscriber) {
|
1526 | try {
|
1527 | subscriber.onWorkStopped(interactions, threadID);
|
1528 | } catch (error) {
|
1529 | if (!didCatchError) {
|
1530 | didCatchError = true;
|
1531 | caughtError = error;
|
1532 | }
|
1533 | }
|
1534 | });
|
1535 |
|
1536 | if (didCatchError) {
|
1537 | throw caughtError;
|
1538 | }
|
1539 | }
|
1540 |
|
1541 | function onWorkCanceled(interactions, threadID) {
|
1542 | var didCatchError = false;
|
1543 | var caughtError = null;
|
1544 |
|
1545 | subscribers.forEach(function (subscriber) {
|
1546 | try {
|
1547 | subscriber.onWorkCanceled(interactions, threadID);
|
1548 | } catch (error) {
|
1549 | if (!didCatchError) {
|
1550 | didCatchError = true;
|
1551 | caughtError = error;
|
1552 | }
|
1553 | }
|
1554 | });
|
1555 |
|
1556 | if (didCatchError) {
|
1557 | throw caughtError;
|
1558 | }
|
1559 | }
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 | var ReactCurrentDispatcher = {
|
1565 | |
1566 |
|
1567 |
|
1568 |
|
1569 | current: null
|
1570 | };
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 | var ReactCurrentOwner = {
|
1579 | |
1580 |
|
1581 |
|
1582 |
|
1583 | current: null
|
1584 | };
|
1585 |
|
1586 | var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
1587 |
|
1588 | var describeComponentFrame = function (name, source, ownerName) {
|
1589 | var sourceInfo = '';
|
1590 | if (source) {
|
1591 | var path = source.fileName;
|
1592 | var fileName = path.replace(BEFORE_SLASH_RE, '');
|
1593 | {
|
1594 |
|
1595 |
|
1596 | if (/^index\./.test(fileName)) {
|
1597 | var match = path.match(BEFORE_SLASH_RE);
|
1598 | if (match) {
|
1599 | var pathBeforeSlash = match[1];
|
1600 | if (pathBeforeSlash) {
|
1601 | var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
1602 | fileName = folderName + '/' + fileName;
|
1603 | }
|
1604 | }
|
1605 | }
|
1606 | }
|
1607 | sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
1608 | } else if (ownerName) {
|
1609 | sourceInfo = ' (created by ' + ownerName + ')';
|
1610 | }
|
1611 | return '\n in ' + (name || 'Unknown') + sourceInfo;
|
1612 | };
|
1613 |
|
1614 | var Resolved = 1;
|
1615 |
|
1616 |
|
1617 | function refineResolvedLazyComponent(lazyComponent) {
|
1618 | return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
1619 | }
|
1620 |
|
1621 | function getWrappedName(outerType, innerType, wrapperName) {
|
1622 | var functionName = innerType.displayName || innerType.name || '';
|
1623 | return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
1624 | }
|
1625 |
|
1626 | function getComponentName(type) {
|
1627 | if (type == null) {
|
1628 |
|
1629 | return null;
|
1630 | }
|
1631 | {
|
1632 | if (typeof type.tag === 'number') {
|
1633 | warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
1634 | }
|
1635 | }
|
1636 | if (typeof type === 'function') {
|
1637 | return type.displayName || type.name || null;
|
1638 | }
|
1639 | if (typeof type === 'string') {
|
1640 | return type;
|
1641 | }
|
1642 | switch (type) {
|
1643 | case REACT_CONCURRENT_MODE_TYPE:
|
1644 | return 'ConcurrentMode';
|
1645 | case REACT_FRAGMENT_TYPE:
|
1646 | return 'Fragment';
|
1647 | case REACT_PORTAL_TYPE:
|
1648 | return 'Portal';
|
1649 | case REACT_PROFILER_TYPE:
|
1650 | return 'Profiler';
|
1651 | case REACT_STRICT_MODE_TYPE:
|
1652 | return 'StrictMode';
|
1653 | case REACT_SUSPENSE_TYPE:
|
1654 | return 'Suspense';
|
1655 | }
|
1656 | if (typeof type === 'object') {
|
1657 | switch (type.$$typeof) {
|
1658 | case REACT_CONTEXT_TYPE:
|
1659 | return 'Context.Consumer';
|
1660 | case REACT_PROVIDER_TYPE:
|
1661 | return 'Context.Provider';
|
1662 | case REACT_FORWARD_REF_TYPE:
|
1663 | return getWrappedName(type, type.render, 'ForwardRef');
|
1664 | case REACT_MEMO_TYPE:
|
1665 | return getComponentName(type.type);
|
1666 | case REACT_LAZY_TYPE:
|
1667 | {
|
1668 | var thenable = type;
|
1669 | var resolvedThenable = refineResolvedLazyComponent(thenable);
|
1670 | if (resolvedThenable) {
|
1671 | return getComponentName(resolvedThenable);
|
1672 | }
|
1673 | }
|
1674 | }
|
1675 | }
|
1676 | return null;
|
1677 | }
|
1678 |
|
1679 | var ReactDebugCurrentFrame = {};
|
1680 |
|
1681 | var currentlyValidatingElement = null;
|
1682 |
|
1683 | function setCurrentlyValidatingElement(element) {
|
1684 | {
|
1685 | currentlyValidatingElement = element;
|
1686 | }
|
1687 | }
|
1688 |
|
1689 | {
|
1690 |
|
1691 | ReactDebugCurrentFrame.getCurrentStack = null;
|
1692 |
|
1693 | ReactDebugCurrentFrame.getStackAddendum = function () {
|
1694 | var stack = '';
|
1695 |
|
1696 |
|
1697 | if (currentlyValidatingElement) {
|
1698 | var name = getComponentName(currentlyValidatingElement.type);
|
1699 | var owner = currentlyValidatingElement._owner;
|
1700 | stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
1701 | }
|
1702 |
|
1703 |
|
1704 | var impl = ReactDebugCurrentFrame.getCurrentStack;
|
1705 | if (impl) {
|
1706 | stack += impl() || '';
|
1707 | }
|
1708 |
|
1709 | return stack;
|
1710 | };
|
1711 | }
|
1712 |
|
1713 | var ReactSharedInternals = {
|
1714 | ReactCurrentDispatcher: ReactCurrentDispatcher,
|
1715 | ReactCurrentOwner: ReactCurrentOwner,
|
1716 |
|
1717 | assign: objectAssign
|
1718 | };
|
1719 |
|
1720 | {
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 | objectAssign(ReactSharedInternals, {
|
1727 | Scheduler: {
|
1728 | unstable_cancelCallback: unstable_cancelCallback,
|
1729 | unstable_shouldYield: unstable_shouldYield,
|
1730 | unstable_now: getCurrentTime,
|
1731 | unstable_scheduleCallback: unstable_scheduleCallback,
|
1732 | unstable_runWithPriority: unstable_runWithPriority,
|
1733 | unstable_next: unstable_next,
|
1734 | unstable_wrapCallback: unstable_wrapCallback,
|
1735 | unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
1736 | unstable_pauseExecution: unstable_pauseExecution,
|
1737 | unstable_continueExecution: unstable_continueExecution,
|
1738 | unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
|
1739 | unstable_IdlePriority: IdlePriority,
|
1740 | unstable_ImmediatePriority: ImmediatePriority,
|
1741 | unstable_LowPriority: LowPriority,
|
1742 | unstable_NormalPriority: NormalPriority,
|
1743 | unstable_UserBlockingPriority: UserBlockingPriority
|
1744 | },
|
1745 | SchedulerTracing: {
|
1746 | __interactionsRef: interactionsRef,
|
1747 | __subscriberRef: subscriberRef,
|
1748 | unstable_clear: unstable_clear,
|
1749 | unstable_getCurrent: unstable_getCurrent,
|
1750 | unstable_getThreadID: unstable_getThreadID,
|
1751 | unstable_subscribe: unstable_subscribe,
|
1752 | unstable_trace: unstable_trace,
|
1753 | unstable_unsubscribe: unstable_unsubscribe,
|
1754 | unstable_wrap: unstable_wrap
|
1755 | }
|
1756 | });
|
1757 | }
|
1758 |
|
1759 | {
|
1760 | objectAssign(ReactSharedInternals, {
|
1761 |
|
1762 | ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
1763 |
|
1764 |
|
1765 | ReactComponentTreeHook: {}
|
1766 | });
|
1767 | }
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 | var warning = warningWithoutStack$1;
|
1777 |
|
1778 | {
|
1779 | warning = function (condition, format) {
|
1780 | if (condition) {
|
1781 | return;
|
1782 | }
|
1783 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
1784 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
1785 |
|
1786 |
|
1787 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
1788 | args[_key - 2] = arguments[_key];
|
1789 | }
|
1790 |
|
1791 | warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
1792 | };
|
1793 | }
|
1794 |
|
1795 | var warning$1 = warning;
|
1796 |
|
1797 | var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
1798 |
|
1799 | var RESERVED_PROPS = {
|
1800 | key: true,
|
1801 | ref: true,
|
1802 | __self: true,
|
1803 | __source: true
|
1804 | };
|
1805 |
|
1806 | var specialPropKeyWarningShown = void 0;
|
1807 | var specialPropRefWarningShown = void 0;
|
1808 |
|
1809 | function hasValidRef(config) {
|
1810 | {
|
1811 | if (hasOwnProperty$1.call(config, 'ref')) {
|
1812 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
1813 | if (getter && getter.isReactWarning) {
|
1814 | return false;
|
1815 | }
|
1816 | }
|
1817 | }
|
1818 | return config.ref !== undefined;
|
1819 | }
|
1820 |
|
1821 | function hasValidKey(config) {
|
1822 | {
|
1823 | if (hasOwnProperty$1.call(config, 'key')) {
|
1824 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
1825 | if (getter && getter.isReactWarning) {
|
1826 | return false;
|
1827 | }
|
1828 | }
|
1829 | }
|
1830 | return config.key !== undefined;
|
1831 | }
|
1832 |
|
1833 | function defineKeyPropWarningGetter(props, displayName) {
|
1834 | var warnAboutAccessingKey = function () {
|
1835 | if (!specialPropKeyWarningShown) {
|
1836 | specialPropKeyWarningShown = true;
|
1837 | 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);
|
1838 | }
|
1839 | };
|
1840 | warnAboutAccessingKey.isReactWarning = true;
|
1841 | Object.defineProperty(props, 'key', {
|
1842 | get: warnAboutAccessingKey,
|
1843 | configurable: true
|
1844 | });
|
1845 | }
|
1846 |
|
1847 | function defineRefPropWarningGetter(props, displayName) {
|
1848 | var warnAboutAccessingRef = function () {
|
1849 | if (!specialPropRefWarningShown) {
|
1850 | specialPropRefWarningShown = true;
|
1851 | 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);
|
1852 | }
|
1853 | };
|
1854 | warnAboutAccessingRef.isReactWarning = true;
|
1855 | Object.defineProperty(props, 'ref', {
|
1856 | get: warnAboutAccessingRef,
|
1857 | configurable: true
|
1858 | });
|
1859 | }
|
1860 |
|
1861 | /**
|
1862 | * Factory method to create a new React element. This no longer adheres to
|
1863 | * the class pattern, so do not use new to call it. Also, no instanceof check
|
1864 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
1865 | * if something is a React Element.
|
1866 | *
|
1867 | * @param {*} type
|
1868 | * @param {*} key
|
1869 | * @param {string|object} ref
|
1870 | * @param {*} self A *temporary* helper to detect places where `this` is
|
1871 | * different from the `owner` when React.createElement is called, so that we
|
1872 | * can warn. We want to get rid of owner and replace string `ref`s with arrow
|
1873 | * functions, and as long as `this` and owner are the same, there will be no
|
1874 | * change in behavior.
|
1875 | * @param {*} source An annotation object (added by a transpiler or otherwise)
|
1876 | * indicating filename, line number, and/or other information.
|
1877 | * @param {*} owner
|
1878 | * @param {*} props
|
1879 | * @internal
|
1880 | */
|
1881 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
1882 | var element = {
|
1883 |
|
1884 | $$typeof: REACT_ELEMENT_TYPE,
|
1885 |
|
1886 |
|
1887 | type: type,
|
1888 | key: key,
|
1889 | ref: ref,
|
1890 | props: props,
|
1891 |
|
1892 |
|
1893 | _owner: owner
|
1894 | };
|
1895 |
|
1896 | {
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 | element._store = {};
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 | Object.defineProperty(element._store, 'validated', {
|
1908 | configurable: false,
|
1909 | enumerable: false,
|
1910 | writable: true,
|
1911 | value: false
|
1912 | });
|
1913 |
|
1914 | Object.defineProperty(element, '_self', {
|
1915 | configurable: false,
|
1916 | enumerable: false,
|
1917 | writable: false,
|
1918 | value: self
|
1919 | });
|
1920 |
|
1921 |
|
1922 | Object.defineProperty(element, '_source', {
|
1923 | configurable: false,
|
1924 | enumerable: false,
|
1925 | writable: false,
|
1926 | value: source
|
1927 | });
|
1928 | if (Object.freeze) {
|
1929 | Object.freeze(element.props);
|
1930 | Object.freeze(element);
|
1931 | }
|
1932 | }
|
1933 |
|
1934 | return element;
|
1935 | };
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 | function createElement(type, config, children) {
|
1942 | var propName = void 0;
|
1943 |
|
1944 |
|
1945 | var props = {};
|
1946 |
|
1947 | var key = null;
|
1948 | var ref = null;
|
1949 | var self = null;
|
1950 | var source = null;
|
1951 |
|
1952 | if (config != null) {
|
1953 | if (hasValidRef(config)) {
|
1954 | ref = config.ref;
|
1955 | }
|
1956 | if (hasValidKey(config)) {
|
1957 | key = '' + config.key;
|
1958 | }
|
1959 |
|
1960 | self = config.__self === undefined ? null : config.__self;
|
1961 | source = config.__source === undefined ? null : config.__source;
|
1962 |
|
1963 | for (propName in config) {
|
1964 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1965 | props[propName] = config[propName];
|
1966 | }
|
1967 | }
|
1968 | }
|
1969 |
|
1970 |
|
1971 |
|
1972 | var childrenLength = arguments.length - 2;
|
1973 | if (childrenLength === 1) {
|
1974 | props.children = children;
|
1975 | } else if (childrenLength > 1) {
|
1976 | var childArray = Array(childrenLength);
|
1977 | for (var i = 0; i < childrenLength; i++) {
|
1978 | childArray[i] = arguments[i + 2];
|
1979 | }
|
1980 | {
|
1981 | if (Object.freeze) {
|
1982 | Object.freeze(childArray);
|
1983 | }
|
1984 | }
|
1985 | props.children = childArray;
|
1986 | }
|
1987 |
|
1988 |
|
1989 | if (type && type.defaultProps) {
|
1990 | var defaultProps = type.defaultProps;
|
1991 | for (propName in defaultProps) {
|
1992 | if (props[propName] === undefined) {
|
1993 | props[propName] = defaultProps[propName];
|
1994 | }
|
1995 | }
|
1996 | }
|
1997 | {
|
1998 | if (key || ref) {
|
1999 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
2000 | if (key) {
|
2001 | defineKeyPropWarningGetter(props, displayName);
|
2002 | }
|
2003 | if (ref) {
|
2004 | defineRefPropWarningGetter(props, displayName);
|
2005 | }
|
2006 | }
|
2007 | }
|
2008 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
2009 | }
|
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 | function cloneAndReplaceKey(oldElement, newKey) {
|
2018 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
2019 |
|
2020 | return newElement;
|
2021 | }
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 | function cloneElement(element, config, children) {
|
2028 | !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
2029 |
|
2030 | var propName = void 0;
|
2031 |
|
2032 |
|
2033 | var props = objectAssign({}, element.props);
|
2034 |
|
2035 |
|
2036 | var key = element.key;
|
2037 | var ref = element.ref;
|
2038 |
|
2039 | var self = element._self;
|
2040 |
|
2041 |
|
2042 |
|
2043 | var source = element._source;
|
2044 |
|
2045 |
|
2046 | var owner = element._owner;
|
2047 |
|
2048 | if (config != null) {
|
2049 | if (hasValidRef(config)) {
|
2050 |
|
2051 | ref = config.ref;
|
2052 | owner = ReactCurrentOwner.current;
|
2053 | }
|
2054 | if (hasValidKey(config)) {
|
2055 | key = '' + config.key;
|
2056 | }
|
2057 |
|
2058 |
|
2059 | var defaultProps = void 0;
|
2060 | if (element.type && element.type.defaultProps) {
|
2061 | defaultProps = element.type.defaultProps;
|
2062 | }
|
2063 | for (propName in config) {
|
2064 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
2065 | if (config[propName] === undefined && defaultProps !== undefined) {
|
2066 |
|
2067 | props[propName] = defaultProps[propName];
|
2068 | } else {
|
2069 | props[propName] = config[propName];
|
2070 | }
|
2071 | }
|
2072 | }
|
2073 | }
|
2074 |
|
2075 |
|
2076 |
|
2077 | var childrenLength = arguments.length - 2;
|
2078 | if (childrenLength === 1) {
|
2079 | props.children = children;
|
2080 | } else if (childrenLength > 1) {
|
2081 | var childArray = Array(childrenLength);
|
2082 | for (var i = 0; i < childrenLength; i++) {
|
2083 | childArray[i] = arguments[i + 2];
|
2084 | }
|
2085 | props.children = childArray;
|
2086 | }
|
2087 |
|
2088 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
2089 | }
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 | function isValidElement(object) {
|
2099 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
2100 | }
|
2101 |
|
2102 | var SEPARATOR = '.';
|
2103 | var SUBSEPARATOR = ':';
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 | function escape(key) {
|
2112 | var escapeRegex = /[=:]/g;
|
2113 | var escaperLookup = {
|
2114 | '=': '=0',
|
2115 | ':': '=2'
|
2116 | };
|
2117 | var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
2118 | return escaperLookup[match];
|
2119 | });
|
2120 |
|
2121 | return '$' + escapedString;
|
2122 | }
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 | var didWarnAboutMaps = false;
|
2130 |
|
2131 | var userProvidedKeyEscapeRegex = /\/+/g;
|
2132 | function escapeUserProvidedKey(text) {
|
2133 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
2134 | }
|
2135 |
|
2136 | var POOL_SIZE = 10;
|
2137 | var traverseContextPool = [];
|
2138 | function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
2139 | if (traverseContextPool.length) {
|
2140 | var traverseContext = traverseContextPool.pop();
|
2141 | traverseContext.result = mapResult;
|
2142 | traverseContext.keyPrefix = keyPrefix;
|
2143 | traverseContext.func = mapFunction;
|
2144 | traverseContext.context = mapContext;
|
2145 | traverseContext.count = 0;
|
2146 | return traverseContext;
|
2147 | } else {
|
2148 | return {
|
2149 | result: mapResult,
|
2150 | keyPrefix: keyPrefix,
|
2151 | func: mapFunction,
|
2152 | context: mapContext,
|
2153 | count: 0
|
2154 | };
|
2155 | }
|
2156 | }
|
2157 |
|
2158 | function releaseTraverseContext(traverseContext) {
|
2159 | traverseContext.result = null;
|
2160 | traverseContext.keyPrefix = null;
|
2161 | traverseContext.func = null;
|
2162 | traverseContext.context = null;
|
2163 | traverseContext.count = 0;
|
2164 | if (traverseContextPool.length < POOL_SIZE) {
|
2165 | traverseContextPool.push(traverseContext);
|
2166 | }
|
2167 | }
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
2178 | var type = typeof children;
|
2179 |
|
2180 | if (type === 'undefined' || type === 'boolean') {
|
2181 |
|
2182 | children = null;
|
2183 | }
|
2184 |
|
2185 | var invokeCallback = false;
|
2186 |
|
2187 | if (children === null) {
|
2188 | invokeCallback = true;
|
2189 | } else {
|
2190 | switch (type) {
|
2191 | case 'string':
|
2192 | case 'number':
|
2193 | invokeCallback = true;
|
2194 | break;
|
2195 | case 'object':
|
2196 | switch (children.$$typeof) {
|
2197 | case REACT_ELEMENT_TYPE:
|
2198 | case REACT_PORTAL_TYPE:
|
2199 | invokeCallback = true;
|
2200 | }
|
2201 | }
|
2202 | }
|
2203 |
|
2204 | if (invokeCallback) {
|
2205 | callback(traverseContext, children,
|
2206 |
|
2207 |
|
2208 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
2209 | return 1;
|
2210 | }
|
2211 |
|
2212 | var child = void 0;
|
2213 | var nextName = void 0;
|
2214 | var subtreeCount = 0;
|
2215 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
2216 |
|
2217 | if (Array.isArray(children)) {
|
2218 | for (var i = 0; i < children.length; i++) {
|
2219 | child = children[i];
|
2220 | nextName = nextNamePrefix + getComponentKey(child, i);
|
2221 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
2222 | }
|
2223 | } else {
|
2224 | var iteratorFn = getIteratorFn(children);
|
2225 | if (typeof iteratorFn === 'function') {
|
2226 | {
|
2227 |
|
2228 | if (iteratorFn === children.entries) {
|
2229 | !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;
|
2230 | didWarnAboutMaps = true;
|
2231 | }
|
2232 | }
|
2233 |
|
2234 | var iterator = iteratorFn.call(children);
|
2235 | var step = void 0;
|
2236 | var ii = 0;
|
2237 | while (!(step = iterator.next()).done) {
|
2238 | child = step.value;
|
2239 | nextName = nextNamePrefix + getComponentKey(child, ii++);
|
2240 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
2241 | }
|
2242 | } else if (type === 'object') {
|
2243 | var addendum = '';
|
2244 | {
|
2245 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
2246 | }
|
2247 | var childrenString = '' + children;
|
2248 | 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);
|
2249 | }
|
2250 | }
|
2251 |
|
2252 | return subtreeCount;
|
2253 | }
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 | function traverseAllChildren(children, callback, traverseContext) {
|
2272 | if (children == null) {
|
2273 | return 0;
|
2274 | }
|
2275 |
|
2276 | return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
2277 | }
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 | function getComponentKey(component, index) {
|
2287 |
|
2288 |
|
2289 | if (typeof component === 'object' && component !== null && component.key != null) {
|
2290 |
|
2291 | return escape(component.key);
|
2292 | }
|
2293 |
|
2294 | return index.toString(36);
|
2295 | }
|
2296 |
|
2297 | function forEachSingleChild(bookKeeping, child, name) {
|
2298 | var func = bookKeeping.func,
|
2299 | context = bookKeeping.context;
|
2300 |
|
2301 | func.call(context, child, bookKeeping.count++);
|
2302 | }
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 | function forEachChildren(children, forEachFunc, forEachContext) {
|
2317 | if (children == null) {
|
2318 | return children;
|
2319 | }
|
2320 | var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
2321 | traverseAllChildren(children, forEachSingleChild, traverseContext);
|
2322 | releaseTraverseContext(traverseContext);
|
2323 | }
|
2324 |
|
2325 | function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
2326 | var result = bookKeeping.result,
|
2327 | keyPrefix = bookKeeping.keyPrefix,
|
2328 | func = bookKeeping.func,
|
2329 | context = bookKeeping.context;
|
2330 |
|
2331 |
|
2332 | var mappedChild = func.call(context, child, bookKeeping.count++);
|
2333 | if (Array.isArray(mappedChild)) {
|
2334 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
2335 | return c;
|
2336 | });
|
2337 | } else if (mappedChild != null) {
|
2338 | if (isValidElement(mappedChild)) {
|
2339 | mappedChild = cloneAndReplaceKey(mappedChild,
|
2340 |
|
2341 |
|
2342 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
2343 | }
|
2344 | result.push(mappedChild);
|
2345 | }
|
2346 | }
|
2347 |
|
2348 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
2349 | var escapedPrefix = '';
|
2350 | if (prefix != null) {
|
2351 | escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
2352 | }
|
2353 | var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
2354 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
2355 | releaseTraverseContext(traverseContext);
|
2356 | }
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 | function mapChildren(children, func, context) {
|
2372 | if (children == null) {
|
2373 | return children;
|
2374 | }
|
2375 | var result = [];
|
2376 | mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
2377 | return result;
|
2378 | }
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 | function countChildren(children) {
|
2390 | return traverseAllChildren(children, function () {
|
2391 | return null;
|
2392 | }, null);
|
2393 | }
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 | function toArray(children) {
|
2402 | var result = [];
|
2403 | mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
2404 | return child;
|
2405 | });
|
2406 | return result;
|
2407 | }
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 | function onlyChild(children) {
|
2424 | !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
2425 | return children;
|
2426 | }
|
2427 |
|
2428 | function createContext(defaultValue, calculateChangedBits) {
|
2429 | if (calculateChangedBits === undefined) {
|
2430 | calculateChangedBits = null;
|
2431 | } else {
|
2432 | {
|
2433 | !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
2434 | }
|
2435 | }
|
2436 |
|
2437 | var context = {
|
2438 | $$typeof: REACT_CONTEXT_TYPE,
|
2439 | _calculateChangedBits: calculateChangedBits,
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 | _currentValue: defaultValue,
|
2446 | _currentValue2: defaultValue,
|
2447 |
|
2448 |
|
2449 | _threadCount: 0,
|
2450 |
|
2451 | Provider: null,
|
2452 | Consumer: null
|
2453 | };
|
2454 |
|
2455 | context.Provider = {
|
2456 | $$typeof: REACT_PROVIDER_TYPE,
|
2457 | _context: context
|
2458 | };
|
2459 |
|
2460 | var hasWarnedAboutUsingNestedContextConsumers = false;
|
2461 | var hasWarnedAboutUsingConsumerProvider = false;
|
2462 |
|
2463 | {
|
2464 |
|
2465 |
|
2466 |
|
2467 | var Consumer = {
|
2468 | $$typeof: REACT_CONTEXT_TYPE,
|
2469 | _context: context,
|
2470 | _calculateChangedBits: context._calculateChangedBits
|
2471 | };
|
2472 |
|
2473 | Object.defineProperties(Consumer, {
|
2474 | Provider: {
|
2475 | get: function () {
|
2476 | if (!hasWarnedAboutUsingConsumerProvider) {
|
2477 | hasWarnedAboutUsingConsumerProvider = true;
|
2478 | 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?');
|
2479 | }
|
2480 | return context.Provider;
|
2481 | },
|
2482 | set: function (_Provider) {
|
2483 | context.Provider = _Provider;
|
2484 | }
|
2485 | },
|
2486 | _currentValue: {
|
2487 | get: function () {
|
2488 | return context._currentValue;
|
2489 | },
|
2490 | set: function (_currentValue) {
|
2491 | context._currentValue = _currentValue;
|
2492 | }
|
2493 | },
|
2494 | _currentValue2: {
|
2495 | get: function () {
|
2496 | return context._currentValue2;
|
2497 | },
|
2498 | set: function (_currentValue2) {
|
2499 | context._currentValue2 = _currentValue2;
|
2500 | }
|
2501 | },
|
2502 | _threadCount: {
|
2503 | get: function () {
|
2504 | return context._threadCount;
|
2505 | },
|
2506 | set: function (_threadCount) {
|
2507 | context._threadCount = _threadCount;
|
2508 | }
|
2509 | },
|
2510 | Consumer: {
|
2511 | get: function () {
|
2512 | if (!hasWarnedAboutUsingNestedContextConsumers) {
|
2513 | hasWarnedAboutUsingNestedContextConsumers = true;
|
2514 | 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?');
|
2515 | }
|
2516 | return context.Consumer;
|
2517 | }
|
2518 | }
|
2519 | });
|
2520 |
|
2521 | context.Consumer = Consumer;
|
2522 | }
|
2523 |
|
2524 | {
|
2525 | context._currentRenderer = null;
|
2526 | context._currentRenderer2 = null;
|
2527 | }
|
2528 |
|
2529 | return context;
|
2530 | }
|
2531 |
|
2532 | function lazy(ctor) {
|
2533 | var lazyType = {
|
2534 | $$typeof: REACT_LAZY_TYPE,
|
2535 | _ctor: ctor,
|
2536 |
|
2537 | _status: -1,
|
2538 | _result: null
|
2539 | };
|
2540 |
|
2541 | {
|
2542 |
|
2543 | var defaultProps = void 0;
|
2544 | var propTypes = void 0;
|
2545 | Object.defineProperties(lazyType, {
|
2546 | defaultProps: {
|
2547 | configurable: true,
|
2548 | get: function () {
|
2549 | return defaultProps;
|
2550 | },
|
2551 | set: function (newDefaultProps) {
|
2552 | 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.');
|
2553 | defaultProps = newDefaultProps;
|
2554 |
|
2555 | Object.defineProperty(lazyType, 'defaultProps', {
|
2556 | enumerable: true
|
2557 | });
|
2558 | }
|
2559 | },
|
2560 | propTypes: {
|
2561 | configurable: true,
|
2562 | get: function () {
|
2563 | return propTypes;
|
2564 | },
|
2565 | set: function (newPropTypes) {
|
2566 | 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.');
|
2567 | propTypes = newPropTypes;
|
2568 |
|
2569 | Object.defineProperty(lazyType, 'propTypes', {
|
2570 | enumerable: true
|
2571 | });
|
2572 | }
|
2573 | }
|
2574 | });
|
2575 | }
|
2576 |
|
2577 | return lazyType;
|
2578 | }
|
2579 |
|
2580 | function forwardRef(render) {
|
2581 | {
|
2582 | if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
2583 | warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
2584 | } else if (typeof render !== 'function') {
|
2585 | warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
2586 | } else {
|
2587 | !(
|
2588 |
|
2589 | 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;
|
2590 | }
|
2591 |
|
2592 | if (render != null) {
|
2593 | !(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;
|
2594 | }
|
2595 | }
|
2596 |
|
2597 | return {
|
2598 | $$typeof: REACT_FORWARD_REF_TYPE,
|
2599 | render: render
|
2600 | };
|
2601 | }
|
2602 |
|
2603 | function isValidElementType(type) {
|
2604 | return typeof type === 'string' || typeof type === 'function' ||
|
2605 |
|
2606 | 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);
|
2607 | }
|
2608 |
|
2609 | function memo(type, compare) {
|
2610 | {
|
2611 | if (!isValidElementType(type)) {
|
2612 | warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
2613 | }
|
2614 | }
|
2615 | return {
|
2616 | $$typeof: REACT_MEMO_TYPE,
|
2617 | type: type,
|
2618 | compare: compare === undefined ? null : compare
|
2619 | };
|
2620 | }
|
2621 |
|
2622 | function resolveDispatcher() {
|
2623 | var dispatcher = ReactCurrentDispatcher.current;
|
2624 | !(dispatcher !== null) ? invariant(false, '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.') : void 0;
|
2625 | return dispatcher;
|
2626 | }
|
2627 |
|
2628 | function useContext(Context, unstable_observedBits) {
|
2629 | var dispatcher = resolveDispatcher();
|
2630 | {
|
2631 | !(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;
|
2632 |
|
2633 |
|
2634 | if (Context._context !== undefined) {
|
2635 | var realContext = Context._context;
|
2636 |
|
2637 |
|
2638 | if (realContext.Consumer === Context) {
|
2639 | 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?');
|
2640 | } else if (realContext.Provider === Context) {
|
2641 | warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
2642 | }
|
2643 | }
|
2644 | }
|
2645 | return dispatcher.useContext(Context, unstable_observedBits);
|
2646 | }
|
2647 |
|
2648 | function useState(initialState) {
|
2649 | var dispatcher = resolveDispatcher();
|
2650 | return dispatcher.useState(initialState);
|
2651 | }
|
2652 |
|
2653 | function useReducer(reducer, initialArg, init) {
|
2654 | var dispatcher = resolveDispatcher();
|
2655 | return dispatcher.useReducer(reducer, initialArg, init);
|
2656 | }
|
2657 |
|
2658 | function useRef(initialValue) {
|
2659 | var dispatcher = resolveDispatcher();
|
2660 | return dispatcher.useRef(initialValue);
|
2661 | }
|
2662 |
|
2663 | function useEffect(create, inputs) {
|
2664 | var dispatcher = resolveDispatcher();
|
2665 | return dispatcher.useEffect(create, inputs);
|
2666 | }
|
2667 |
|
2668 | function useLayoutEffect(create, inputs) {
|
2669 | var dispatcher = resolveDispatcher();
|
2670 | return dispatcher.useLayoutEffect(create, inputs);
|
2671 | }
|
2672 |
|
2673 | function useCallback(callback, inputs) {
|
2674 | var dispatcher = resolveDispatcher();
|
2675 | return dispatcher.useCallback(callback, inputs);
|
2676 | }
|
2677 |
|
2678 | function useMemo(create, inputs) {
|
2679 | var dispatcher = resolveDispatcher();
|
2680 | return dispatcher.useMemo(create, inputs);
|
2681 | }
|
2682 |
|
2683 | function useImperativeHandle(ref, create, inputs) {
|
2684 | var dispatcher = resolveDispatcher();
|
2685 | return dispatcher.useImperativeHandle(ref, create, inputs);
|
2686 | }
|
2687 |
|
2688 | function useDebugValue(value, formatterFn) {
|
2689 | {
|
2690 | var dispatcher = resolveDispatcher();
|
2691 | return dispatcher.useDebugValue(value, formatterFn);
|
2692 | }
|
2693 | }
|
2694 |
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 | var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
2705 |
|
2706 | var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 | var printWarning$1 = function() {};
|
2718 |
|
2719 | {
|
2720 | var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
2721 | var loggedTypeFailures = {};
|
2722 |
|
2723 | printWarning$1 = function(text) {
|
2724 | var message = 'Warning: ' + text;
|
2725 | if (typeof console !== 'undefined') {
|
2726 | console.error(message);
|
2727 | }
|
2728 | try {
|
2729 |
|
2730 |
|
2731 |
|
2732 | throw new Error(message);
|
2733 | } catch (x) {}
|
2734 | };
|
2735 | }
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 |
|
2748 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
2749 | {
|
2750 | for (var typeSpecName in typeSpecs) {
|
2751 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
2752 | var error;
|
2753 |
|
2754 |
|
2755 |
|
2756 | try {
|
2757 |
|
2758 |
|
2759 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
2760 | var err = Error(
|
2761 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
2762 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
2763 | );
|
2764 | err.name = 'Invariant Violation';
|
2765 | throw err;
|
2766 | }
|
2767 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
2768 | } catch (ex) {
|
2769 | error = ex;
|
2770 | }
|
2771 | if (error && !(error instanceof Error)) {
|
2772 | printWarning$1(
|
2773 | (componentName || 'React class') + ': type specification of ' +
|
2774 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
2775 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
2776 | 'You may have forgotten to pass an argument to the type checker ' +
|
2777 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
2778 | 'shape all require an argument).'
|
2779 | );
|
2780 |
|
2781 | }
|
2782 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
2783 |
|
2784 |
|
2785 | loggedTypeFailures[error.message] = true;
|
2786 |
|
2787 | var stack = getStack ? getStack() : '';
|
2788 |
|
2789 | printWarning$1(
|
2790 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
2791 | );
|
2792 | }
|
2793 | }
|
2794 | }
|
2795 | }
|
2796 | }
|
2797 |
|
2798 | var checkPropTypes_1 = checkPropTypes;
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 | var propTypesMisspellWarningShown = void 0;
|
2808 |
|
2809 | {
|
2810 | propTypesMisspellWarningShown = false;
|
2811 | }
|
2812 |
|
2813 | function getDeclarationErrorAddendum() {
|
2814 | if (ReactCurrentOwner.current) {
|
2815 | var name = getComponentName(ReactCurrentOwner.current.type);
|
2816 | if (name) {
|
2817 | return '\n\nCheck the render method of `' + name + '`.';
|
2818 | }
|
2819 | }
|
2820 | return '';
|
2821 | }
|
2822 |
|
2823 | function getSourceInfoErrorAddendum(elementProps) {
|
2824 | if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
2825 | var source = elementProps.__source;
|
2826 | var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
2827 | var lineNumber = source.lineNumber;
|
2828 | return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
2829 | }
|
2830 | return '';
|
2831 | }
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 | var ownerHasKeyUseWarning = {};
|
2839 |
|
2840 | function getCurrentComponentErrorInfo(parentType) {
|
2841 | var info = getDeclarationErrorAddendum();
|
2842 |
|
2843 | if (!info) {
|
2844 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
2845 | if (parentName) {
|
2846 | info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
2847 | }
|
2848 | }
|
2849 | return info;
|
2850 | }
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 | function validateExplicitKey(element, parentType) {
|
2864 | if (!element._store || element._store.validated || element.key != null) {
|
2865 | return;
|
2866 | }
|
2867 | element._store.validated = true;
|
2868 |
|
2869 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2870 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
2871 | return;
|
2872 | }
|
2873 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 | var childOwner = '';
|
2879 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
2880 |
|
2881 | childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
2882 | }
|
2883 |
|
2884 | setCurrentlyValidatingElement(element);
|
2885 | {
|
2886 | 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);
|
2887 | }
|
2888 | setCurrentlyValidatingElement(null);
|
2889 | }
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 | function validateChildKeys(node, parentType) {
|
2901 | if (typeof node !== 'object') {
|
2902 | return;
|
2903 | }
|
2904 | if (Array.isArray(node)) {
|
2905 | for (var i = 0; i < node.length; i++) {
|
2906 | var child = node[i];
|
2907 | if (isValidElement(child)) {
|
2908 | validateExplicitKey(child, parentType);
|
2909 | }
|
2910 | }
|
2911 | } else if (isValidElement(node)) {
|
2912 |
|
2913 | if (node._store) {
|
2914 | node._store.validated = true;
|
2915 | }
|
2916 | } else if (node) {
|
2917 | var iteratorFn = getIteratorFn(node);
|
2918 | if (typeof iteratorFn === 'function') {
|
2919 |
|
2920 |
|
2921 | if (iteratorFn !== node.entries) {
|
2922 | var iterator = iteratorFn.call(node);
|
2923 | var step = void 0;
|
2924 | while (!(step = iterator.next()).done) {
|
2925 | if (isValidElement(step.value)) {
|
2926 | validateExplicitKey(step.value, parentType);
|
2927 | }
|
2928 | }
|
2929 | }
|
2930 | }
|
2931 | }
|
2932 | }
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 | function validatePropTypes(element) {
|
2941 | var type = element.type;
|
2942 | if (type === null || type === undefined || typeof type === 'string') {
|
2943 | return;
|
2944 | }
|
2945 | var name = getComponentName(type);
|
2946 | var propTypes = void 0;
|
2947 | if (typeof type === 'function') {
|
2948 | propTypes = type.propTypes;
|
2949 | } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
2950 |
|
2951 |
|
2952 | type.$$typeof === REACT_MEMO_TYPE)) {
|
2953 | propTypes = type.propTypes;
|
2954 | } else {
|
2955 | return;
|
2956 | }
|
2957 | if (propTypes) {
|
2958 | setCurrentlyValidatingElement(element);
|
2959 | checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
2960 | setCurrentlyValidatingElement(null);
|
2961 | } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
2962 | propTypesMisspellWarningShown = true;
|
2963 | warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
2964 | }
|
2965 | if (typeof type.getDefaultProps === 'function') {
|
2966 | !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
2967 | }
|
2968 | }
|
2969 |
|
2970 |
|
2971 |
|
2972 |
|
2973 |
|
2974 | function validateFragmentProps(fragment) {
|
2975 | setCurrentlyValidatingElement(fragment);
|
2976 |
|
2977 | var keys = Object.keys(fragment.props);
|
2978 | for (var i = 0; i < keys.length; i++) {
|
2979 | var key = keys[i];
|
2980 | if (key !== 'children' && key !== 'key') {
|
2981 | warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
2982 | break;
|
2983 | }
|
2984 | }
|
2985 |
|
2986 | if (fragment.ref !== null) {
|
2987 | warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
2988 | }
|
2989 |
|
2990 | setCurrentlyValidatingElement(null);
|
2991 | }
|
2992 |
|
2993 | function createElementWithValidation(type, props, children) {
|
2994 | var validType = isValidElementType(type);
|
2995 |
|
2996 |
|
2997 |
|
2998 | if (!validType) {
|
2999 | var info = '';
|
3000 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
3001 | 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.";
|
3002 | }
|
3003 |
|
3004 | var sourceInfo = getSourceInfoErrorAddendum(props);
|
3005 | if (sourceInfo) {
|
3006 | info += sourceInfo;
|
3007 | } else {
|
3008 | info += getDeclarationErrorAddendum();
|
3009 | }
|
3010 |
|
3011 | var typeString = void 0;
|
3012 | if (type === null) {
|
3013 | typeString = 'null';
|
3014 | } else if (Array.isArray(type)) {
|
3015 | typeString = 'array';
|
3016 | } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
3017 | typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
3018 | info = ' Did you accidentally export a JSX literal instead of a component?';
|
3019 | } else {
|
3020 | typeString = typeof type;
|
3021 | }
|
3022 |
|
3023 | 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);
|
3024 | }
|
3025 |
|
3026 | var element = createElement.apply(this, arguments);
|
3027 |
|
3028 |
|
3029 |
|
3030 | if (element == null) {
|
3031 | return element;
|
3032 | }
|
3033 |
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 | if (validType) {
|
3040 | for (var i = 2; i < arguments.length; i++) {
|
3041 | validateChildKeys(arguments[i], type);
|
3042 | }
|
3043 | }
|
3044 |
|
3045 | if (type === REACT_FRAGMENT_TYPE) {
|
3046 | validateFragmentProps(element);
|
3047 | } else {
|
3048 | validatePropTypes(element);
|
3049 | }
|
3050 |
|
3051 | return element;
|
3052 | }
|
3053 |
|
3054 | function createFactoryWithValidation(type) {
|
3055 | var validatedFactory = createElementWithValidation.bind(null, type);
|
3056 | validatedFactory.type = type;
|
3057 |
|
3058 | {
|
3059 | Object.defineProperty(validatedFactory, 'type', {
|
3060 | enumerable: false,
|
3061 | get: function () {
|
3062 | lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
3063 | Object.defineProperty(this, 'type', {
|
3064 | value: type
|
3065 | });
|
3066 | return type;
|
3067 | }
|
3068 | });
|
3069 | }
|
3070 |
|
3071 | return validatedFactory;
|
3072 | }
|
3073 |
|
3074 | function cloneElementWithValidation(element, props, children) {
|
3075 | var newElement = cloneElement.apply(this, arguments);
|
3076 | for (var i = 2; i < arguments.length; i++) {
|
3077 | validateChildKeys(arguments[i], newElement.type);
|
3078 | }
|
3079 | validatePropTypes(newElement);
|
3080 | return newElement;
|
3081 | }
|
3082 |
|
3083 | var React = {
|
3084 | Children: {
|
3085 | map: mapChildren,
|
3086 | forEach: forEachChildren,
|
3087 | count: countChildren,
|
3088 | toArray: toArray,
|
3089 | only: onlyChild
|
3090 | },
|
3091 |
|
3092 | createRef: createRef,
|
3093 | Component: Component,
|
3094 | PureComponent: PureComponent,
|
3095 |
|
3096 | createContext: createContext,
|
3097 | forwardRef: forwardRef,
|
3098 | lazy: lazy,
|
3099 | memo: memo,
|
3100 |
|
3101 | useCallback: useCallback,
|
3102 | useContext: useContext,
|
3103 | useEffect: useEffect,
|
3104 | useImperativeHandle: useImperativeHandle,
|
3105 | useDebugValue: useDebugValue,
|
3106 | useLayoutEffect: useLayoutEffect,
|
3107 | useMemo: useMemo,
|
3108 | useReducer: useReducer,
|
3109 | useRef: useRef,
|
3110 | useState: useState,
|
3111 |
|
3112 | Fragment: REACT_FRAGMENT_TYPE,
|
3113 | StrictMode: REACT_STRICT_MODE_TYPE,
|
3114 | Suspense: REACT_SUSPENSE_TYPE,
|
3115 |
|
3116 | createElement: createElementWithValidation,
|
3117 | cloneElement: cloneElementWithValidation,
|
3118 | createFactory: createFactoryWithValidation,
|
3119 | isValidElement: isValidElement,
|
3120 |
|
3121 | version: ReactVersion,
|
3122 |
|
3123 | unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
3124 | unstable_Profiler: REACT_PROFILER_TYPE,
|
3125 |
|
3126 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
3127 | };
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 | if (enableStableConcurrentModeAPIs) {
|
3135 | React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
3136 | React.Profiler = REACT_PROFILER_TYPE;
|
3137 | React.unstable_ConcurrentMode = undefined;
|
3138 | React.unstable_Profiler = undefined;
|
3139 | }
|
3140 |
|
3141 |
|
3142 |
|
3143 | var React$2 = Object.freeze({
|
3144 | default: React
|
3145 | });
|
3146 |
|
3147 | var React$3 = ( React$2 && React ) || React$2;
|
3148 |
|
3149 |
|
3150 |
|
3151 | var react = React$3.default || React$3;
|
3152 |
|
3153 | return react;
|
3154 |
|
3155 | })));
|