1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | if (process.env.NODE_ENV !== "production") {
|
14 | (function() {
|
15 | 'use strict';
|
16 |
|
17 | var React = require('react');
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
24 | var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
25 | var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
26 | var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
27 | var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
28 | var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
29 | var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
30 | var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
31 | var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
32 | var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
33 | var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
34 | var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
35 | var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
36 | var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
37 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
38 | function getIteratorFn(maybeIterable) {
|
39 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
40 | return null;
|
41 | }
|
42 |
|
43 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
44 |
|
45 | if (typeof maybeIterator === 'function') {
|
46 | return maybeIterator;
|
47 | }
|
48 |
|
49 | return null;
|
50 | }
|
51 |
|
52 | var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
53 |
|
54 | function error(format) {
|
55 | {
|
56 | {
|
57 | for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
58 | args[_key2 - 1] = arguments[_key2];
|
59 | }
|
60 |
|
61 | printWarning('error', format, args);
|
62 | }
|
63 | }
|
64 | }
|
65 |
|
66 | function printWarning(level, format, args) {
|
67 |
|
68 |
|
69 | {
|
70 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
71 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
72 |
|
73 | if (stack !== '') {
|
74 | format += '%s';
|
75 | args = args.concat([stack]);
|
76 | }
|
77 |
|
78 |
|
79 | var argsWithFormat = args.map(function (item) {
|
80 | return String(item);
|
81 | });
|
82 |
|
83 | argsWithFormat.unshift('Warning: ' + format);
|
84 |
|
85 |
|
86 |
|
87 | Function.prototype.apply.call(console[level], console, argsWithFormat);
|
88 | }
|
89 | }
|
90 |
|
91 |
|
92 |
|
93 | var enableScopeAPI = false;
|
94 | var enableCacheElement = false;
|
95 | var enableTransitionTracing = false;
|
96 |
|
97 | var enableLegacyHidden = false;
|
98 |
|
99 |
|
100 |
|
101 | var enableDebugTracing = false;
|
102 |
|
103 | var REACT_MODULE_REFERENCE;
|
104 |
|
105 | {
|
106 | REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
107 | }
|
108 |
|
109 | function isValidElementType(type) {
|
110 | if (typeof type === 'string' || typeof type === 'function') {
|
111 | return true;
|
112 | }
|
113 |
|
114 |
|
115 | if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
116 | return true;
|
117 | }
|
118 |
|
119 | if (typeof type === 'object' && type !== null) {
|
120 | if (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 ||
|
121 |
|
122 |
|
123 |
|
124 | type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
125 | return true;
|
126 | }
|
127 | }
|
128 |
|
129 | return false;
|
130 | }
|
131 |
|
132 | function getWrappedName(outerType, innerType, wrapperName) {
|
133 | var displayName = outerType.displayName;
|
134 |
|
135 | if (displayName) {
|
136 | return displayName;
|
137 | }
|
138 |
|
139 | var functionName = innerType.displayName || innerType.name || '';
|
140 | return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
141 | }
|
142 |
|
143 |
|
144 | function getContextName(type) {
|
145 | return type.displayName || 'Context';
|
146 | }
|
147 |
|
148 |
|
149 | function getComponentNameFromType(type) {
|
150 | if (type == null) {
|
151 |
|
152 | return null;
|
153 | }
|
154 |
|
155 | {
|
156 | if (typeof type.tag === 'number') {
|
157 | error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
158 | }
|
159 | }
|
160 |
|
161 | if (typeof type === 'function') {
|
162 | return type.displayName || type.name || null;
|
163 | }
|
164 |
|
165 | if (typeof type === 'string') {
|
166 | return type;
|
167 | }
|
168 |
|
169 | switch (type) {
|
170 | case REACT_FRAGMENT_TYPE:
|
171 | return 'Fragment';
|
172 |
|
173 | case REACT_PORTAL_TYPE:
|
174 | return 'Portal';
|
175 |
|
176 | case REACT_PROFILER_TYPE:
|
177 | return 'Profiler';
|
178 |
|
179 | case REACT_STRICT_MODE_TYPE:
|
180 | return 'StrictMode';
|
181 |
|
182 | case REACT_SUSPENSE_TYPE:
|
183 | return 'Suspense';
|
184 |
|
185 | case REACT_SUSPENSE_LIST_TYPE:
|
186 | return 'SuspenseList';
|
187 |
|
188 | }
|
189 |
|
190 | if (typeof type === 'object') {
|
191 | switch (type.$$typeof) {
|
192 | case REACT_CONTEXT_TYPE:
|
193 | var context = type;
|
194 | return getContextName(context) + '.Consumer';
|
195 |
|
196 | case REACT_PROVIDER_TYPE:
|
197 | var provider = type;
|
198 | return getContextName(provider._context) + '.Provider';
|
199 |
|
200 | case REACT_FORWARD_REF_TYPE:
|
201 | return getWrappedName(type, type.render, 'ForwardRef');
|
202 |
|
203 | case REACT_MEMO_TYPE:
|
204 | var outerName = type.displayName || null;
|
205 |
|
206 | if (outerName !== null) {
|
207 | return outerName;
|
208 | }
|
209 |
|
210 | return getComponentNameFromType(type.type) || 'Memo';
|
211 |
|
212 | case REACT_LAZY_TYPE:
|
213 | {
|
214 | var lazyComponent = type;
|
215 | var payload = lazyComponent._payload;
|
216 | var init = lazyComponent._init;
|
217 |
|
218 | try {
|
219 | return getComponentNameFromType(init(payload));
|
220 | } catch (x) {
|
221 | return null;
|
222 | }
|
223 | }
|
224 |
|
225 |
|
226 | }
|
227 | }
|
228 |
|
229 | return null;
|
230 | }
|
231 |
|
232 | var assign = Object.assign;
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | var disabledDepth = 0;
|
239 | var prevLog;
|
240 | var prevInfo;
|
241 | var prevWarn;
|
242 | var prevError;
|
243 | var prevGroup;
|
244 | var prevGroupCollapsed;
|
245 | var prevGroupEnd;
|
246 |
|
247 | function disabledLog() {}
|
248 |
|
249 | disabledLog.__reactDisabledLog = true;
|
250 | function disableLogs() {
|
251 | {
|
252 | if (disabledDepth === 0) {
|
253 |
|
254 | prevLog = console.log;
|
255 | prevInfo = console.info;
|
256 | prevWarn = console.warn;
|
257 | prevError = console.error;
|
258 | prevGroup = console.group;
|
259 | prevGroupCollapsed = console.groupCollapsed;
|
260 | prevGroupEnd = console.groupEnd;
|
261 |
|
262 | var props = {
|
263 | configurable: true,
|
264 | enumerable: true,
|
265 | value: disabledLog,
|
266 | writable: true
|
267 | };
|
268 |
|
269 | Object.defineProperties(console, {
|
270 | info: props,
|
271 | log: props,
|
272 | warn: props,
|
273 | error: props,
|
274 | group: props,
|
275 | groupCollapsed: props,
|
276 | groupEnd: props
|
277 | });
|
278 |
|
279 | }
|
280 |
|
281 | disabledDepth++;
|
282 | }
|
283 | }
|
284 | function reenableLogs() {
|
285 | {
|
286 | disabledDepth--;
|
287 |
|
288 | if (disabledDepth === 0) {
|
289 |
|
290 | var props = {
|
291 | configurable: true,
|
292 | enumerable: true,
|
293 | writable: true
|
294 | };
|
295 |
|
296 | Object.defineProperties(console, {
|
297 | log: assign({}, props, {
|
298 | value: prevLog
|
299 | }),
|
300 | info: assign({}, props, {
|
301 | value: prevInfo
|
302 | }),
|
303 | warn: assign({}, props, {
|
304 | value: prevWarn
|
305 | }),
|
306 | error: assign({}, props, {
|
307 | value: prevError
|
308 | }),
|
309 | group: assign({}, props, {
|
310 | value: prevGroup
|
311 | }),
|
312 | groupCollapsed: assign({}, props, {
|
313 | value: prevGroupCollapsed
|
314 | }),
|
315 | groupEnd: assign({}, props, {
|
316 | value: prevGroupEnd
|
317 | })
|
318 | });
|
319 |
|
320 | }
|
321 |
|
322 | if (disabledDepth < 0) {
|
323 | error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
324 | }
|
325 | }
|
326 | }
|
327 |
|
328 | var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
329 | var prefix;
|
330 | function describeBuiltInComponentFrame(name, source, ownerFn) {
|
331 | {
|
332 | if (prefix === undefined) {
|
333 |
|
334 | try {
|
335 | throw Error();
|
336 | } catch (x) {
|
337 | var match = x.stack.trim().match(/\n( *(at )?)/);
|
338 | prefix = match && match[1] || '';
|
339 | }
|
340 | }
|
341 |
|
342 |
|
343 | return '\n' + prefix + name;
|
344 | }
|
345 | }
|
346 | var reentry = false;
|
347 | var componentFrameCache;
|
348 |
|
349 | {
|
350 | var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
351 | componentFrameCache = new PossiblyWeakMap();
|
352 | }
|
353 |
|
354 | function describeNativeComponentFrame(fn, construct) {
|
355 |
|
356 | if ( !fn || reentry) {
|
357 | return '';
|
358 | }
|
359 |
|
360 | {
|
361 | var frame = componentFrameCache.get(fn);
|
362 |
|
363 | if (frame !== undefined) {
|
364 | return frame;
|
365 | }
|
366 | }
|
367 |
|
368 | var control;
|
369 | reentry = true;
|
370 | var previousPrepareStackTrace = Error.prepareStackTrace;
|
371 |
|
372 | Error.prepareStackTrace = undefined;
|
373 | var previousDispatcher;
|
374 |
|
375 | {
|
376 | previousDispatcher = ReactCurrentDispatcher.current;
|
377 |
|
378 |
|
379 | ReactCurrentDispatcher.current = null;
|
380 | disableLogs();
|
381 | }
|
382 |
|
383 | try {
|
384 |
|
385 | if (construct) {
|
386 |
|
387 | var Fake = function () {
|
388 | throw Error();
|
389 | };
|
390 |
|
391 |
|
392 | Object.defineProperty(Fake.prototype, 'props', {
|
393 | set: function () {
|
394 |
|
395 |
|
396 | throw Error();
|
397 | }
|
398 | });
|
399 |
|
400 | if (typeof Reflect === 'object' && Reflect.construct) {
|
401 |
|
402 |
|
403 | try {
|
404 | Reflect.construct(Fake, []);
|
405 | } catch (x) {
|
406 | control = x;
|
407 | }
|
408 |
|
409 | Reflect.construct(fn, [], Fake);
|
410 | } else {
|
411 | try {
|
412 | Fake.call();
|
413 | } catch (x) {
|
414 | control = x;
|
415 | }
|
416 |
|
417 | fn.call(Fake.prototype);
|
418 | }
|
419 | } else {
|
420 | try {
|
421 | throw Error();
|
422 | } catch (x) {
|
423 | control = x;
|
424 | }
|
425 |
|
426 | fn();
|
427 | }
|
428 | } catch (sample) {
|
429 |
|
430 | if (sample && control && typeof sample.stack === 'string') {
|
431 |
|
432 |
|
433 | var sampleLines = sample.stack.split('\n');
|
434 | var controlLines = control.stack.split('\n');
|
435 | var s = sampleLines.length - 1;
|
436 | var c = controlLines.length - 1;
|
437 |
|
438 | while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 | c--;
|
446 | }
|
447 |
|
448 | for (; s >= 1 && c >= 0; s--, c--) {
|
449 |
|
450 |
|
451 | if (sampleLines[s] !== controlLines[c]) {
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 | if (s !== 1 || c !== 1) {
|
458 | do {
|
459 | s--;
|
460 | c--;
|
461 |
|
462 |
|
463 | if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
464 |
|
465 | var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
466 |
|
467 |
|
468 |
|
469 |
|
470 | if (fn.displayName && _frame.includes('<anonymous>')) {
|
471 | _frame = _frame.replace('<anonymous>', fn.displayName);
|
472 | }
|
473 |
|
474 | {
|
475 | if (typeof fn === 'function') {
|
476 | componentFrameCache.set(fn, _frame);
|
477 | }
|
478 | }
|
479 |
|
480 |
|
481 | return _frame;
|
482 | }
|
483 | } while (s >= 1 && c >= 0);
|
484 | }
|
485 |
|
486 | break;
|
487 | }
|
488 | }
|
489 | }
|
490 | } finally {
|
491 | reentry = false;
|
492 |
|
493 | {
|
494 | ReactCurrentDispatcher.current = previousDispatcher;
|
495 | reenableLogs();
|
496 | }
|
497 |
|
498 | Error.prepareStackTrace = previousPrepareStackTrace;
|
499 | }
|
500 |
|
501 |
|
502 | var name = fn ? fn.displayName || fn.name : '';
|
503 | var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
504 |
|
505 | {
|
506 | if (typeof fn === 'function') {
|
507 | componentFrameCache.set(fn, syntheticFrame);
|
508 | }
|
509 | }
|
510 |
|
511 | return syntheticFrame;
|
512 | }
|
513 | function describeFunctionComponentFrame(fn, source, ownerFn) {
|
514 | {
|
515 | return describeNativeComponentFrame(fn, false);
|
516 | }
|
517 | }
|
518 |
|
519 | function shouldConstruct(Component) {
|
520 | var prototype = Component.prototype;
|
521 | return !!(prototype && prototype.isReactComponent);
|
522 | }
|
523 |
|
524 | function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
525 |
|
526 | if (type == null) {
|
527 | return '';
|
528 | }
|
529 |
|
530 | if (typeof type === 'function') {
|
531 | {
|
532 | return describeNativeComponentFrame(type, shouldConstruct(type));
|
533 | }
|
534 | }
|
535 |
|
536 | if (typeof type === 'string') {
|
537 | return describeBuiltInComponentFrame(type);
|
538 | }
|
539 |
|
540 | switch (type) {
|
541 | case REACT_SUSPENSE_TYPE:
|
542 | return describeBuiltInComponentFrame('Suspense');
|
543 |
|
544 | case REACT_SUSPENSE_LIST_TYPE:
|
545 | return describeBuiltInComponentFrame('SuspenseList');
|
546 | }
|
547 |
|
548 | if (typeof type === 'object') {
|
549 | switch (type.$$typeof) {
|
550 | case REACT_FORWARD_REF_TYPE:
|
551 | return describeFunctionComponentFrame(type.render);
|
552 |
|
553 | case REACT_MEMO_TYPE:
|
554 |
|
555 | return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
556 |
|
557 | case REACT_LAZY_TYPE:
|
558 | {
|
559 | var lazyComponent = type;
|
560 | var payload = lazyComponent._payload;
|
561 | var init = lazyComponent._init;
|
562 |
|
563 | try {
|
564 |
|
565 | return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
566 | } catch (x) {}
|
567 | }
|
568 | }
|
569 | }
|
570 |
|
571 | return '';
|
572 | }
|
573 |
|
574 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
575 |
|
576 | var loggedTypeFailures = {};
|
577 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
578 |
|
579 | function setCurrentlyValidatingElement(element) {
|
580 | {
|
581 | if (element) {
|
582 | var owner = element._owner;
|
583 | var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
584 | ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
585 | } else {
|
586 | ReactDebugCurrentFrame.setExtraStackFrame(null);
|
587 | }
|
588 | }
|
589 | }
|
590 |
|
591 | function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
592 | {
|
593 |
|
594 | var has = Function.call.bind(hasOwnProperty);
|
595 |
|
596 | for (var typeSpecName in typeSpecs) {
|
597 | if (has(typeSpecs, typeSpecName)) {
|
598 | var error$1 = void 0;
|
599 |
|
600 |
|
601 |
|
602 | try {
|
603 |
|
604 |
|
605 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
606 |
|
607 | var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
608 | err.name = 'Invariant Violation';
|
609 | throw err;
|
610 | }
|
611 |
|
612 | error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
613 | } catch (ex) {
|
614 | error$1 = ex;
|
615 | }
|
616 |
|
617 | if (error$1 && !(error$1 instanceof Error)) {
|
618 | setCurrentlyValidatingElement(element);
|
619 |
|
620 | error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
621 |
|
622 | setCurrentlyValidatingElement(null);
|
623 | }
|
624 |
|
625 | if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
626 |
|
627 |
|
628 | loggedTypeFailures[error$1.message] = true;
|
629 | setCurrentlyValidatingElement(element);
|
630 |
|
631 | error('Failed %s type: %s', location, error$1.message);
|
632 |
|
633 | setCurrentlyValidatingElement(null);
|
634 | }
|
635 | }
|
636 | }
|
637 | }
|
638 | }
|
639 |
|
640 | var isArrayImpl = Array.isArray;
|
641 |
|
642 | function isArray(a) {
|
643 | return isArrayImpl(a);
|
644 | }
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | function typeName(value) {
|
657 | {
|
658 |
|
659 | var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
660 | var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
661 | return type;
|
662 | }
|
663 | }
|
664 |
|
665 |
|
666 | function willCoercionThrow(value) {
|
667 | {
|
668 | try {
|
669 | testStringCoercion(value);
|
670 | return false;
|
671 | } catch (e) {
|
672 | return true;
|
673 | }
|
674 | }
|
675 | }
|
676 |
|
677 | function testStringCoercion(value) {
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 | return '' + value;
|
702 | }
|
703 | function checkKeyStringCoercion(value) {
|
704 | {
|
705 | if (willCoercionThrow(value)) {
|
706 | error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
707 |
|
708 | return testStringCoercion(value);
|
709 | }
|
710 | }
|
711 | }
|
712 |
|
713 | var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
714 | var RESERVED_PROPS = {
|
715 | key: true,
|
716 | ref: true,
|
717 | __self: true,
|
718 | __source: true
|
719 | };
|
720 | var specialPropKeyWarningShown;
|
721 | var specialPropRefWarningShown;
|
722 | var didWarnAboutStringRefs;
|
723 |
|
724 | {
|
725 | didWarnAboutStringRefs = {};
|
726 | }
|
727 |
|
728 | function hasValidRef(config) {
|
729 | {
|
730 | if (hasOwnProperty.call(config, 'ref')) {
|
731 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
732 |
|
733 | if (getter && getter.isReactWarning) {
|
734 | return false;
|
735 | }
|
736 | }
|
737 | }
|
738 |
|
739 | return config.ref !== undefined;
|
740 | }
|
741 |
|
742 | function hasValidKey(config) {
|
743 | {
|
744 | if (hasOwnProperty.call(config, 'key')) {
|
745 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
746 |
|
747 | if (getter && getter.isReactWarning) {
|
748 | return false;
|
749 | }
|
750 | }
|
751 | }
|
752 |
|
753 | return config.key !== undefined;
|
754 | }
|
755 |
|
756 | function warnIfStringRefCannotBeAutoConverted(config, self) {
|
757 | {
|
758 | if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
759 | var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
760 |
|
761 | if (!didWarnAboutStringRefs[componentName]) {
|
762 | error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
763 |
|
764 | didWarnAboutStringRefs[componentName] = true;
|
765 | }
|
766 | }
|
767 | }
|
768 | }
|
769 |
|
770 | function defineKeyPropWarningGetter(props, displayName) {
|
771 | {
|
772 | var warnAboutAccessingKey = function () {
|
773 | if (!specialPropKeyWarningShown) {
|
774 | specialPropKeyWarningShown = true;
|
775 |
|
776 | error('%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://reactjs.org/link/special-props)', displayName);
|
777 | }
|
778 | };
|
779 |
|
780 | warnAboutAccessingKey.isReactWarning = true;
|
781 | Object.defineProperty(props, 'key', {
|
782 | get: warnAboutAccessingKey,
|
783 | configurable: true
|
784 | });
|
785 | }
|
786 | }
|
787 |
|
788 | function defineRefPropWarningGetter(props, displayName) {
|
789 | {
|
790 | var warnAboutAccessingRef = function () {
|
791 | if (!specialPropRefWarningShown) {
|
792 | specialPropRefWarningShown = true;
|
793 |
|
794 | error('%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://reactjs.org/link/special-props)', displayName);
|
795 | }
|
796 | };
|
797 |
|
798 | warnAboutAccessingRef.isReactWarning = true;
|
799 | Object.defineProperty(props, 'ref', {
|
800 | get: warnAboutAccessingRef,
|
801 | configurable: true
|
802 | });
|
803 | }
|
804 | }
|
805 | /**
|
806 | * Factory method to create a new React element. This no longer adheres to
|
807 | * the class pattern, so do not use new to call it. Also, instanceof check
|
808 | * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
809 | * if something is a React Element.
|
810 | *
|
811 | * @param {*} type
|
812 | * @param {*} props
|
813 | * @param {*} key
|
814 | * @param {string|object} ref
|
815 | * @param {*} owner
|
816 | * @param {*} self A *temporary* helper to detect places where `this` is
|
817 | * different from the `owner` when React.createElement is called, so that we
|
818 | * can warn. We want to get rid of owner and replace string `ref`s with arrow
|
819 | * functions, and as long as `this` and owner are the same, there will be no
|
820 | * change in behavior.
|
821 | * @param {*} source An annotation object (added by a transpiler or otherwise)
|
822 | * indicating filename, line number, and/or other information.
|
823 | * @internal
|
824 | */
|
825 |
|
826 |
|
827 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
828 | var element = {
|
829 |
|
830 | $$typeof: REACT_ELEMENT_TYPE,
|
831 |
|
832 | type: type,
|
833 | key: key,
|
834 | ref: ref,
|
835 | props: props,
|
836 |
|
837 | _owner: owner
|
838 | };
|
839 |
|
840 | {
|
841 |
|
842 |
|
843 |
|
844 |
|
845 | element._store = {};
|
846 |
|
847 |
|
848 |
|
849 |
|
850 | Object.defineProperty(element._store, 'validated', {
|
851 | configurable: false,
|
852 | enumerable: false,
|
853 | writable: true,
|
854 | value: false
|
855 | });
|
856 |
|
857 | Object.defineProperty(element, '_self', {
|
858 | configurable: false,
|
859 | enumerable: false,
|
860 | writable: false,
|
861 | value: self
|
862 | });
|
863 |
|
864 |
|
865 | Object.defineProperty(element, '_source', {
|
866 | configurable: false,
|
867 | enumerable: false,
|
868 | writable: false,
|
869 | value: source
|
870 | });
|
871 |
|
872 | if (Object.freeze) {
|
873 | Object.freeze(element.props);
|
874 | Object.freeze(element);
|
875 | }
|
876 | }
|
877 |
|
878 | return element;
|
879 | };
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 | function jsxDEV(type, config, maybeKey, source, self) {
|
888 | {
|
889 | var propName;
|
890 |
|
891 | var props = {};
|
892 | var key = null;
|
893 | var ref = null;
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 | if (maybeKey !== undefined) {
|
901 | {
|
902 | checkKeyStringCoercion(maybeKey);
|
903 | }
|
904 |
|
905 | key = '' + maybeKey;
|
906 | }
|
907 |
|
908 | if (hasValidKey(config)) {
|
909 | {
|
910 | checkKeyStringCoercion(config.key);
|
911 | }
|
912 |
|
913 | key = '' + config.key;
|
914 | }
|
915 |
|
916 | if (hasValidRef(config)) {
|
917 | ref = config.ref;
|
918 | warnIfStringRefCannotBeAutoConverted(config, self);
|
919 | }
|
920 |
|
921 |
|
922 | for (propName in config) {
|
923 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
924 | props[propName] = config[propName];
|
925 | }
|
926 | }
|
927 |
|
928 |
|
929 | if (type && type.defaultProps) {
|
930 | var defaultProps = type.defaultProps;
|
931 |
|
932 | for (propName in defaultProps) {
|
933 | if (props[propName] === undefined) {
|
934 | props[propName] = defaultProps[propName];
|
935 | }
|
936 | }
|
937 | }
|
938 |
|
939 | if (key || ref) {
|
940 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
941 |
|
942 | if (key) {
|
943 | defineKeyPropWarningGetter(props, displayName);
|
944 | }
|
945 |
|
946 | if (ref) {
|
947 | defineRefPropWarningGetter(props, displayName);
|
948 | }
|
949 | }
|
950 |
|
951 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
952 | }
|
953 | }
|
954 |
|
955 | var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
956 | var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
957 |
|
958 | function setCurrentlyValidatingElement$1(element) {
|
959 | {
|
960 | if (element) {
|
961 | var owner = element._owner;
|
962 | var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
963 | ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
964 | } else {
|
965 | ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
966 | }
|
967 | }
|
968 | }
|
969 |
|
970 | var propTypesMisspellWarningShown;
|
971 |
|
972 | {
|
973 | propTypesMisspellWarningShown = false;
|
974 | }
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 | function isValidElement(object) {
|
985 | {
|
986 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
987 | }
|
988 | }
|
989 |
|
990 | function getDeclarationErrorAddendum() {
|
991 | {
|
992 | if (ReactCurrentOwner$1.current) {
|
993 | var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
994 |
|
995 | if (name) {
|
996 | return '\n\nCheck the render method of `' + name + '`.';
|
997 | }
|
998 | }
|
999 |
|
1000 | return '';
|
1001 | }
|
1002 | }
|
1003 |
|
1004 | function getSourceInfoErrorAddendum(source) {
|
1005 | {
|
1006 | if (source !== undefined) {
|
1007 | var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
1008 | var lineNumber = source.lineNumber;
|
1009 | return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
1010 | }
|
1011 |
|
1012 | return '';
|
1013 | }
|
1014 | }
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 | var ownerHasKeyUseWarning = {};
|
1023 |
|
1024 | function getCurrentComponentErrorInfo(parentType) {
|
1025 | {
|
1026 | var info = getDeclarationErrorAddendum();
|
1027 |
|
1028 | if (!info) {
|
1029 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
1030 |
|
1031 | if (parentName) {
|
1032 | info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
1033 | }
|
1034 | }
|
1035 |
|
1036 | return info;
|
1037 | }
|
1038 | }
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 | function validateExplicitKey(element, parentType) {
|
1053 | {
|
1054 | if (!element._store || element._store.validated || element.key != null) {
|
1055 | return;
|
1056 | }
|
1057 |
|
1058 | element._store.validated = true;
|
1059 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1060 |
|
1061 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
1062 | return;
|
1063 | }
|
1064 |
|
1065 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
1066 |
|
1067 |
|
1068 |
|
1069 | var childOwner = '';
|
1070 |
|
1071 | if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
1072 |
|
1073 | childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
1074 | }
|
1075 |
|
1076 | setCurrentlyValidatingElement$1(element);
|
1077 |
|
1078 | error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
1079 |
|
1080 | setCurrentlyValidatingElement$1(null);
|
1081 | }
|
1082 | }
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 | function validateChildKeys(node, parentType) {
|
1095 | {
|
1096 | if (typeof node !== 'object') {
|
1097 | return;
|
1098 | }
|
1099 |
|
1100 | if (isArray(node)) {
|
1101 | for (var i = 0; i < node.length; i++) {
|
1102 | var child = node[i];
|
1103 |
|
1104 | if (isValidElement(child)) {
|
1105 | validateExplicitKey(child, parentType);
|
1106 | }
|
1107 | }
|
1108 | } else if (isValidElement(node)) {
|
1109 |
|
1110 | if (node._store) {
|
1111 | node._store.validated = true;
|
1112 | }
|
1113 | } else if (node) {
|
1114 | var iteratorFn = getIteratorFn(node);
|
1115 |
|
1116 | if (typeof iteratorFn === 'function') {
|
1117 |
|
1118 |
|
1119 | if (iteratorFn !== node.entries) {
|
1120 | var iterator = iteratorFn.call(node);
|
1121 | var step;
|
1122 |
|
1123 | while (!(step = iterator.next()).done) {
|
1124 | if (isValidElement(step.value)) {
|
1125 | validateExplicitKey(step.value, parentType);
|
1126 | }
|
1127 | }
|
1128 | }
|
1129 | }
|
1130 | }
|
1131 | }
|
1132 | }
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 | function validatePropTypes(element) {
|
1142 | {
|
1143 | var type = element.type;
|
1144 |
|
1145 | if (type === null || type === undefined || typeof type === 'string') {
|
1146 | return;
|
1147 | }
|
1148 |
|
1149 | var propTypes;
|
1150 |
|
1151 | if (typeof type === 'function') {
|
1152 | propTypes = type.propTypes;
|
1153 | } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
1154 |
|
1155 | type.$$typeof === REACT_MEMO_TYPE)) {
|
1156 | propTypes = type.propTypes;
|
1157 | } else {
|
1158 | return;
|
1159 | }
|
1160 |
|
1161 | if (propTypes) {
|
1162 |
|
1163 | var name = getComponentNameFromType(type);
|
1164 | checkPropTypes(propTypes, element.props, 'prop', name, element);
|
1165 | } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
1166 | propTypesMisspellWarningShown = true;
|
1167 |
|
1168 | var _name = getComponentNameFromType(type);
|
1169 |
|
1170 | error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
1171 | }
|
1172 |
|
1173 | if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
1174 | error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
1175 | }
|
1176 | }
|
1177 | }
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 | function validateFragmentProps(fragment) {
|
1185 | {
|
1186 | var keys = Object.keys(fragment.props);
|
1187 |
|
1188 | for (var i = 0; i < keys.length; i++) {
|
1189 | var key = keys[i];
|
1190 |
|
1191 | if (key !== 'children' && key !== 'key') {
|
1192 | setCurrentlyValidatingElement$1(fragment);
|
1193 |
|
1194 | error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
1195 |
|
1196 | setCurrentlyValidatingElement$1(null);
|
1197 | break;
|
1198 | }
|
1199 | }
|
1200 |
|
1201 | if (fragment.ref !== null) {
|
1202 | setCurrentlyValidatingElement$1(fragment);
|
1203 |
|
1204 | error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
1205 |
|
1206 | setCurrentlyValidatingElement$1(null);
|
1207 | }
|
1208 | }
|
1209 | }
|
1210 |
|
1211 | var didWarnAboutKeySpread = {};
|
1212 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
1213 | {
|
1214 | var validType = isValidElementType(type);
|
1215 |
|
1216 |
|
1217 | if (!validType) {
|
1218 | var info = '';
|
1219 |
|
1220 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
1221 | 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.";
|
1222 | }
|
1223 |
|
1224 | var sourceInfo = getSourceInfoErrorAddendum(source);
|
1225 |
|
1226 | if (sourceInfo) {
|
1227 | info += sourceInfo;
|
1228 | } else {
|
1229 | info += getDeclarationErrorAddendum();
|
1230 | }
|
1231 |
|
1232 | var typeString;
|
1233 |
|
1234 | if (type === null) {
|
1235 | typeString = 'null';
|
1236 | } else if (isArray(type)) {
|
1237 | typeString = 'array';
|
1238 | } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
1239 | typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
1240 | info = ' Did you accidentally export a JSX literal instead of a component?';
|
1241 | } else {
|
1242 | typeString = typeof type;
|
1243 | }
|
1244 |
|
1245 | error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
1246 | }
|
1247 |
|
1248 | var element = jsxDEV(type, props, key, source, self);
|
1249 |
|
1250 |
|
1251 | if (element == null) {
|
1252 | return element;
|
1253 | }
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 | if (validType) {
|
1261 | var children = props.children;
|
1262 |
|
1263 | if (children !== undefined) {
|
1264 | if (isStaticChildren) {
|
1265 | if (isArray(children)) {
|
1266 | for (var i = 0; i < children.length; i++) {
|
1267 | validateChildKeys(children[i], type);
|
1268 | }
|
1269 |
|
1270 | if (Object.freeze) {
|
1271 | Object.freeze(children);
|
1272 | }
|
1273 | } else {
|
1274 | error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
1275 | }
|
1276 | } else {
|
1277 | validateChildKeys(children, type);
|
1278 | }
|
1279 | }
|
1280 | }
|
1281 |
|
1282 | {
|
1283 | if (hasOwnProperty.call(props, 'key')) {
|
1284 | var componentName = getComponentNameFromType(type);
|
1285 | var keys = Object.keys(props).filter(function (k) {
|
1286 | return k !== 'key';
|
1287 | });
|
1288 | var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
1289 |
|
1290 | if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
1291 | var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
1292 |
|
1293 | error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
1294 |
|
1295 | didWarnAboutKeySpread[componentName + beforeExample] = true;
|
1296 | }
|
1297 | }
|
1298 | }
|
1299 |
|
1300 | if (type === REACT_FRAGMENT_TYPE) {
|
1301 | validateFragmentProps(element);
|
1302 | } else {
|
1303 | validatePropTypes(element);
|
1304 | }
|
1305 |
|
1306 | return element;
|
1307 | }
|
1308 | }
|
1309 |
|
1310 | var jsxDEV$1 = jsxWithValidation ;
|
1311 |
|
1312 | exports.Fragment = REACT_FRAGMENT_TYPE;
|
1313 | exports.jsxDEV = jsxDEV$1;
|
1314 | })();
|
1315 | }
|