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