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