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