Use strict equality (===) to prevent type coercion bugs
if (process.env.NODE_ENV !== "production") {
1/** @license React v17.0.0-rc.32 * react-jsx-dev-runtime.development.js3 *4 * Copyright (c) Meta Platforms, Inc. and affiliates.5 *6 * This source code is licensed under the MIT license found in the7 * LICENSE file in the root directory of this source tree.8 */910'use strict';1112if (process.env.NODE_ENV !== "production") {13 (function() {14'use strict';1516var React = require('react');17var _assign = require('object-assign');1819// ATTENTION20// When adding new symbols to this file,21// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'22// The Symbol used to tag the ReactElement-like types. If there is no native Symbol23// nor polyfill, then a plain number is used for performance.24var REACT_ELEMENT_TYPE = 0xeac7;25var REACT_PORTAL_TYPE = 0xeaca;26exports.Fragment = 0xeacb;27var REACT_STRICT_MODE_TYPE = 0xeacc;28var REACT_PROFILER_TYPE = 0xead2;29var REACT_PROVIDER_TYPE = 0xeacd;30var REACT_CONTEXT_TYPE = 0xeace;31var REACT_FORWARD_REF_TYPE = 0xead0;32var REACT_SUSPENSE_TYPE = 0xead1;33var REACT_SUSPENSE_LIST_TYPE = 0xead8;34var REACT_MEMO_TYPE = 0xead3;35var REACT_LAZY_TYPE = 0xead4;36var REACT_BLOCK_TYPE = 0xead9;37var REACT_SERVER_BLOCK_TYPE = 0xeada;38var REACT_FUNDAMENTAL_TYPE = 0xead5;39var REACT_SCOPE_TYPE = 0xead7;40var REACT_OPAQUE_ID_TYPE = 0xeae0;41var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;42var REACT_OFFSCREEN_TYPE = 0xeae2;43var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;4445if (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}6869var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;70var FAUX_ITERATOR_SYMBOL = '@@iterator';71function getIteratorFn(maybeIterable) {72 if (maybeIterable === null || typeof maybeIterable !== 'object') {73 return null;74 }7576 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];7778 if (typeof maybeIterator === 'function') {79 return maybeIterator;80 }8182 return null;83}8485var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;8687function 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 }9293 printWarning('error', format, args);94 }95}9697function printWarning(level, format, args) {98 // When changing this logic, you might want to also99 // update consoleWithStackDev.www.js as well.100 {101 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;102 var stack = ReactDebugCurrentFrame.getStackAddendum();103104 if (stack !== '') {105 format += '%s';106 args = args.concat([stack]);107 }108109 var argsWithFormat = args.map(function (item) {110 return '' + item;111 }); // Careful: RN currently depends on this prefix112113 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it114 // breaks IE9: https://github.com/facebook/react/issues/13610115 // eslint-disable-next-line react-internal/no-production-logging116117 Function.prototype.apply.call(console[level], console, argsWithFormat);118 }119}120121// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.122123var enableScopeAPI = false; // Experimental Create Event Handle API.124125function isValidElementType(type) {126 if (typeof type === 'string' || typeof type === 'function') {127 return true;128 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).129130131 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 }134135 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 }140141 return false;142}143144function getWrappedName(outerType, innerType, wrapperName) {145 var functionName = innerType.displayName || innerType.name || '';146 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);147}148149function getContextName(type) {150 return type.displayName || 'Context';151}152153function getComponentName(type) {154 if (type == null) {155 // Host root, text node or just invalid type.156 return null;157 }158159 {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 }164165 if (typeof type === 'function') {166 return type.displayName || type.name || null;167 }168169 if (typeof type === 'string') {170 return type;171 }172173 switch (type) {174 case exports.Fragment:175 return 'Fragment';176177 case REACT_PORTAL_TYPE:178 return 'Portal';179180 case REACT_PROFILER_TYPE:181 return 'Profiler';182183 case REACT_STRICT_MODE_TYPE:184 return 'StrictMode';185186 case REACT_SUSPENSE_TYPE:187 return 'Suspense';188189 case REACT_SUSPENSE_LIST_TYPE:190 return 'SuspenseList';191 }192193 if (typeof type === 'object') {194 switch (type.$$typeof) {195 case REACT_CONTEXT_TYPE:196 var context = type;197 return getContextName(context) + '.Consumer';198199 case REACT_PROVIDER_TYPE:200 var provider = type;201 return getContextName(provider._context) + '.Provider';202203 case REACT_FORWARD_REF_TYPE:204 return getWrappedName(type, type.render, 'ForwardRef');205206 case REACT_MEMO_TYPE:207 return getComponentName(type.type);208209 case REACT_BLOCK_TYPE:210 return getComponentName(type._render);211212 case REACT_LAZY_TYPE:213 {214 var lazyComponent = type;215 var payload = lazyComponent._payload;216 var init = lazyComponent._init;217218 try {219 return getComponentName(init(payload));220 } catch (x) {221 return null;222 }223 }224 }225 }226227 return null;228}229230// Helpers to patch console.logs to avoid logging during side-effect free231// replaying on render function. This currently only patches the object232// lazily which won't cover if the log function was extracted eagerly.233// We could also eagerly patch the method.234var disabledDepth = 0;235var prevLog;236var prevInfo;237var prevWarn;238var prevError;239var prevGroup;240var prevGroupCollapsed;241var prevGroupEnd;242243function disabledLog() {}244245disabledLog.__reactDisabledLog = true;246function disableLogs() {247 {248 if (disabledDepth === 0) {249 /* eslint-disable react-internal/no-production-logging */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; // https://github.com/facebook/react/issues/19099257258 var props = {259 configurable: true,260 enumerable: true,261 value: disabledLog,262 writable: true263 }; // $FlowFixMe Flow thinks console is immutable.264265 Object.defineProperties(console, {266 info: props,267 log: props,268 warn: props,269 error: props,270 group: props,271 groupCollapsed: props,272 groupEnd: props273 });274 /* eslint-enable react-internal/no-production-logging */275 }276277 disabledDepth++;278 }279}280function reenableLogs() {281 {282 disabledDepth--;283284 if (disabledDepth === 0) {285 /* eslint-disable react-internal/no-production-logging */286 var props = {287 configurable: true,288 enumerable: true,289 writable: true290 }; // $FlowFixMe Flow thinks console is immutable.291292 Object.defineProperties(console, {293 log: _assign({}, props, {294 value: prevLog295 }),296 info: _assign({}, props, {297 value: prevInfo298 }),299 warn: _assign({}, props, {300 value: prevWarn301 }),302 error: _assign({}, props, {303 value: prevError304 }),305 group: _assign({}, props, {306 value: prevGroup307 }),308 groupCollapsed: _assign({}, props, {309 value: prevGroupCollapsed310 }),311 groupEnd: _assign({}, props, {312 value: prevGroupEnd313 })314 });315 /* eslint-enable react-internal/no-production-logging */316 }317318 if (disabledDepth < 0) {319 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');320 }321 }322}323324var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;325var prefix;326function describeBuiltInComponentFrame(name, source, ownerFn) {327 {328 if (prefix === undefined) {329 // Extract the VM specific prefix used by each line.330 try {331 throw Error();332 } catch (x) {333 var match = x.stack.trim().match(/\n( *(at )?)/);334 prefix = match && match[1] || '';335 }336 } // We use the prefix to ensure our stacks line up with native stack frames.337338339 return '\n' + prefix + name;340 }341}342var reentry = false;343var componentFrameCache;344345{346 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;347 componentFrameCache = new PossiblyWeakMap();348}349350function describeNativeComponentFrame(fn, construct) {351 // If something asked for a stack inside a fake render, it should get ignored.352 if (!fn || reentry) {353 return '';354 }355356 {357 var frame = componentFrameCache.get(fn);358359 if (frame !== undefined) {360 return frame;361 }362 }363364 var control;365 reentry = true;366 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.367368 Error.prepareStackTrace = undefined;369 var previousDispatcher;370371 {372 previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function373 // for warnings.374375 ReactCurrentDispatcher.current = null;376 disableLogs();377 }378379 try {380 // This should throw.381 if (construct) {382 // Something should be setting the props in the constructor.383 var Fake = function () {384 throw Error();385 }; // $FlowFixMe386387388 Object.defineProperty(Fake.prototype, 'props', {389 set: function () {390 // We use a throwing setter instead of frozen or non-writable props391 // because that won't throw in a non-strict mode function.392 throw Error();393 }394 });395396 if (typeof Reflect === 'object' && Reflect.construct) {397 // We construct a different control for this case to include any extra398 // frames added by the construct call.399 try {400 Reflect.construct(Fake, []);401 } catch (x) {402 control = x;403 }404405 Reflect.construct(fn, [], Fake);406 } else {407 try {408 Fake.call();409 } catch (x) {410 control = x;411 }412413 fn.call(Fake.prototype);414 }415 } else {416 try {417 throw Error();418 } catch (x) {419 control = x;420 }421422 fn();423 }424 } catch (sample) {425 // This is inlined manually because closure doesn't do it for us.426 if (sample && control && typeof sample.stack === 'string') {427 // This extracts the first frame from the sample that isn't also in the control.428 // Skipping one frame that we assume is the frame that calls the two.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;433434 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {435 // We expect at least one stack frame to be shared.436 // Typically this will be the root most one. However, stack frames may be437 // cut off due to maximum stack limits. In this case, one maybe cut off438 // earlier than the other. We assume that the sample is longer or the same439 // and there for cut off earlier. So we should find the root most frame in440 // the sample somewhere in the control.441 c--;442 }443444 for (; s >= 1 && c >= 0; s--, c--) {445 // Next we find the first one that isn't the same which should be the446 // frame that called our sample function and the control.447 if (sampleLines[s] !== controlLines[c]) {448 // In V8, the first line is describing the message but other VMs don't.449 // If we're about to return the first line, and the control is also on the same450 // line, that's a pretty good indicator that our sample threw at same line as451 // the control. I.e. before we entered the sample frame. So we ignore this result.452 // This can happen if you passed a class to function component, or non-function.453 if (s !== 1 || c !== 1) {454 do {455 s--;456 c--; // We may still have similar intermediate frames from the construct call.457 // The next one that isn't the same should be our match though.458459 if (c < 0 || sampleLines[s] !== controlLines[c]) {460 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.461 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');462463 {464 if (typeof fn === 'function') {465 componentFrameCache.set(fn, _frame);466 }467 } // Return the line we found.468469470 return _frame;471 }472 } while (s >= 1 && c >= 0);473 }474475 break;476 }477 }478 }479 } finally {480 reentry = false;481482 {483 ReactCurrentDispatcher.current = previousDispatcher;484 reenableLogs();485 }486487 Error.prepareStackTrace = previousPrepareStackTrace;488 } // Fallback to just using the name if we couldn't make it throw.489490491 var name = fn ? fn.displayName || fn.name : '';492 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';493494 {495 if (typeof fn === 'function') {496 componentFrameCache.set(fn, syntheticFrame);497 }498 }499500 return syntheticFrame;501}502function describeFunctionComponentFrame(fn, source, ownerFn) {503 {504 return describeNativeComponentFrame(fn, false);505 }506}507508function shouldConstruct(Component) {509 var prototype = Component.prototype;510 return !!(prototype && prototype.isReactComponent);511}512513function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {514515 if (type == null) {516 return '';517 }518519 if (typeof type === 'function') {520 {521 return describeNativeComponentFrame(type, shouldConstruct(type));522 }523 }524525 if (typeof type === 'string') {526 return describeBuiltInComponentFrame(type);527 }528529 switch (type) {530 case REACT_SUSPENSE_TYPE:531 return describeBuiltInComponentFrame('Suspense');532533 case REACT_SUSPENSE_LIST_TYPE:534 return describeBuiltInComponentFrame('SuspenseList');535 }536537 if (typeof type === 'object') {538 switch (type.$$typeof) {539 case REACT_FORWARD_REF_TYPE:540 return describeFunctionComponentFrame(type.render);541542 case REACT_MEMO_TYPE:543 // Memo may contain any component type so we recursively resolve it.544 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);545546 case REACT_BLOCK_TYPE:547 return describeFunctionComponentFrame(type._render);548549 case REACT_LAZY_TYPE:550 {551 var lazyComponent = type;552 var payload = lazyComponent._payload;553 var init = lazyComponent._init;554555 try {556 // Lazy may contain any component type so we recursively resolve it.557 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);558 } catch (x) {}559 }560 }561 }562563 return '';564}565566var loggedTypeFailures = {};567var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;568569function 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}580581function checkPropTypes(typeSpecs, values, location, componentName, element) {582 {583 // $FlowFixMe This is okay but Flow doesn't know it.584 var has = Function.call.bind(Object.prototype.hasOwnProperty);585586 for (var typeSpecName in typeSpecs) {587 if (has(typeSpecs, typeSpecName)) {588 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to589 // fail the render phase where it didn't fail before. So we log it.590 // After these have been cleaned up, we'll let them throw.591592 try {593 // This is intentionally an invariant that gets caught. It's the same594 // behavior as without this statement except with a better message.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 }600601 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 }605606 if (error$1 && !(error$1 instanceof Error)) {607 setCurrentlyValidatingElement(element);608609 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);610611 setCurrentlyValidatingElement(null);612 }613614 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {615 // Only monitor this failure once because there tends to be a lot of the616 // same error.617 loggedTypeFailures[error$1.message] = true;618 setCurrentlyValidatingElement(element);619620 error('Failed %s type: %s', location, error$1.message);621622 setCurrentlyValidatingElement(null);623 }624 }625 }626 }627}628629var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;630var hasOwnProperty = Object.prototype.hasOwnProperty;631var RESERVED_PROPS = {632 key: true,633 ref: true,634 __self: true,635 __source: true636};637var specialPropKeyWarningShown;638var specialPropRefWarningShown;639var didWarnAboutStringRefs;640641{642 didWarnAboutStringRefs = {};643}644645function hasValidRef(config) {646 {647 if (hasOwnProperty.call(config, 'ref')) {648 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;649650 if (getter && getter.isReactWarning) {651 return false;652 }653 }654 }655656 return config.ref !== undefined;657}658659function hasValidKey(config) {660 {661 if (hasOwnProperty.call(config, 'key')) {662 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;663664 if (getter && getter.isReactWarning) {665 return false;666 }667 }668 }669670 return config.key !== undefined;671}672673function warnIfStringRefCannotBeAutoConverted(config, self) {674 {675 if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {676 var componentName = getComponentName(ReactCurrentOwner.current.type);677678 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);680681 didWarnAboutStringRefs[componentName] = true;682 }683 }684 }685}686687function defineKeyPropWarningGetter(props, displayName) {688 {689 var warnAboutAccessingKey = function () {690 if (!specialPropKeyWarningShown) {691 specialPropKeyWarningShown = true;692693 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 };696697 warnAboutAccessingKey.isReactWarning = true;698 Object.defineProperty(props, 'key', {699 get: warnAboutAccessingKey,700 configurable: true701 });702 }703}704705function defineRefPropWarningGetter(props, displayName) {706 {707 var warnAboutAccessingRef = function () {708 if (!specialPropRefWarningShown) {709 specialPropRefWarningShown = true;710711 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 };714715 warnAboutAccessingRef.isReactWarning = true;716 Object.defineProperty(props, 'ref', {717 get: warnAboutAccessingRef,718 configurable: true719 });720 }721}722/**723 * Factory method to create a new React element. This no longer adheres to724 * the class pattern, so do not use new to call it. Also, instanceof check725 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check726 * if something is a React Element.727 *728 * @param {*} type729 * @param {*} props730 * @param {*} key731 * @param {string|object} ref732 * @param {*} owner733 * @param {*} self A *temporary* helper to detect places where `this` is734 * different from the `owner` when React.createElement is called, so that we735 * can warn. We want to get rid of owner and replace string `ref`s with arrow736 * functions, and as long as `this` and owner are the same, there will be no737 * 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 * @internal741 */742743744var ReactElement = function (type, key, ref, self, source, owner, props) {745 var element = {746 // This tag allows us to uniquely identify this as a React Element747 $$typeof: REACT_ELEMENT_TYPE,748 // Built-in properties that belong on the element749 type: type,750 key: key,751 ref: ref,752 props: props,753 // Record the component responsible for creating this element.754 _owner: owner755 };756757 {758 // The validation flag is currently mutative. We put it on759 // an external backing store so that we can freeze the whole object.760 // This can be replaced with a WeakMap once they are implemented in761 // commonly used development environments.762 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make763 // the validation flag non-enumerable (where possible, which should764 // include every environment we run tests in), so the test framework765 // ignores it.766767 Object.defineProperty(element._store, 'validated', {768 configurable: false,769 enumerable: false,770 writable: true,771 value: false772 }); // self and source are DEV only properties.773774 Object.defineProperty(element, '_self', {775 configurable: false,776 enumerable: false,777 writable: false,778 value: self779 }); // Two elements created in two different places should be considered780 // equal for testing purposes and therefore we hide it from enumeration.781782 Object.defineProperty(element, '_source', {783 configurable: false,784 enumerable: false,785 writable: false,786 value: source787 });788789 if (Object.freeze) {790 Object.freeze(element.props);791 Object.freeze(element);792 }793 }794795 return element;796};797/**798 * https://github.com/reactjs/rfcs/pull/107799 * @param {*} type800 * @param {object} props801 * @param {string} key802 */803804function jsxDEV(type, config, maybeKey, source, self) {805 {806 var propName; // Reserved names are extracted807808 var props = {};809 var key = null;810 var ref = null; // Currently, key can be spread in as a prop. This causes a potential811 // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />812 // or <div key="Hi" {...props} /> ). We want to deprecate key spread,813 // but as an intermediary step, we will use jsxDEV for everything except814 // <div {...props} key="Hi" />, because we aren't currently able to tell if815 // key is explicitly declared to be undefined or not.816817 if (maybeKey !== undefined) {818 key = '' + maybeKey;819 }820821 if (hasValidKey(config)) {822 key = '' + config.key;823 }824825 if (hasValidRef(config)) {826 ref = config.ref;827 warnIfStringRefCannotBeAutoConverted(config, self);828 } // Remaining properties are added to a new props object829830831 for (propName in config) {832 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {833 props[propName] = config[propName];834 }835 } // Resolve default props836837838 if (type && type.defaultProps) {839 var defaultProps = type.defaultProps;840841 for (propName in defaultProps) {842 if (props[propName] === undefined) {843 props[propName] = defaultProps[propName];844 }845 }846 }847848 if (key || ref) {849 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;850851 if (key) {852 defineKeyPropWarningGetter(props, displayName);853 }854855 if (ref) {856 defineRefPropWarningGetter(props, displayName);857 }858 }859860 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);861 }862}863864var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;865var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;866867function 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}878879var propTypesMisspellWarningShown;880881{882 propTypesMisspellWarningShown = false;883}884/**885 * Verifies the object is a ReactElement.886 * See https://reactjs.org/docs/react-api.html#isvalidelement887 * @param {?object} object888 * @return {boolean} True if `object` is a ReactElement.889 * @final890 */891892function isValidElement(object) {893 {894 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;895 }896}897898function getDeclarationErrorAddendum() {899 {900 if (ReactCurrentOwner$1.current) {901 var name = getComponentName(ReactCurrentOwner$1.current.type);902903 if (name) {904 return '\n\nCheck the render method of `' + name + '`.';905 }906 }907908 return '';909 }910}911912function 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 }919920 return '';921 }922}923/**924 * Warn if there's no key explicitly set on dynamic arrays of children or925 * object keys are not valid. This allows us to keep track of children between926 * updates.927 */928929930var ownerHasKeyUseWarning = {};931932function getCurrentComponentErrorInfo(parentType) {933 {934 var info = getDeclarationErrorAddendum();935936 if (!info) {937 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;938939 if (parentName) {940 info = "\n\nCheck the top-level render call using <" + parentName + ">.";941 }942 }943944 return info;945 }946}947/**948 * Warn if the element doesn't have an explicit key assigned to it.949 * This element is in an array. The array could grow and shrink or be950 * reordered. All children that haven't already been validated are required to951 * have a "key" property assigned to it. Error statuses are cached so a warning952 * will only be shown once.953 *954 * @internal955 * @param {ReactElement} element Element that requires a key.956 * @param {*} parentType element's parent's type.957 */958959960function validateExplicitKey(element, parentType) {961 {962 if (!element._store || element._store.validated || element.key != null) {963 return;964 }965966 element._store.validated = true;967 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);968969 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {970 return;971 }972973 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a974 // property, it may be the creator of the child that's responsible for975 // assigning it a key.976977 var childOwner = '';978979 if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {980 // Give the component that originally created this child.981 childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";982 }983984 setCurrentlyValidatingElement$1(element);985986 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);987988 setCurrentlyValidatingElement$1(null);989 }990}991/**992 * Ensure that every element either is passed in a static location, in an993 * array with an explicit keys property defined, or in an object literal994 * with valid key property.995 *996 * @internal997 * @param {ReactNode} node Statically passed child of any type.998 * @param {*} parentType node's parent's type.999 */100010011002function validateChildKeys(node, parentType) {1003 {1004 if (typeof node !== 'object') {1005 return;1006 }10071008 if (Array.isArray(node)) {1009 for (var i = 0; i < node.length; i++) {1010 var child = node[i];10111012 if (isValidElement(child)) {1013 validateExplicitKey(child, parentType);1014 }1015 }1016 } else if (isValidElement(node)) {1017 // This element was passed in a valid location.1018 if (node._store) {1019 node._store.validated = true;1020 }1021 } else if (node) {1022 var iteratorFn = getIteratorFn(node);10231024 if (typeof iteratorFn === 'function') {1025 // Entry iterators used to provide implicit keys,1026 // but now we print a separate warning for them later.1027 if (iteratorFn !== node.entries) {1028 var iterator = iteratorFn.call(node);1029 var step;10301031 while (!(step = iterator.next()).done) {1032 if (isValidElement(step.value)) {1033 validateExplicitKey(step.value, parentType);1034 }1035 }1036 }1037 }1038 }1039 }1040}1041/**1042 * Given an element, validate that its props follow the propTypes definition,1043 * provided by the type.1044 *1045 * @param {ReactElement} element1046 */104710481049function validatePropTypes(element) {1050 {1051 var type = element.type;10521053 if (type === null || type === undefined || typeof type === 'string') {1054 return;1055 }10561057 var propTypes;10581059 if (typeof type === 'function') {1060 propTypes = type.propTypes;1061 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.1062 // Inner props are checked in the reconciler.1063 type.$$typeof === REACT_MEMO_TYPE)) {1064 propTypes = type.propTypes;1065 } else {1066 return;1067 }10681069 if (propTypes) {1070 // Intentionally inside to avoid triggering lazy initializers:1071 var name = getComponentName(type);1072 checkPropTypes(propTypes, element.props, 'prop', name, element);1073 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {1074 propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:10751076 var _name = getComponentName(type);10771078 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');1079 }10801081 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 * Given a fragment, validate that it can only be provided with fragment props1088 * @param {ReactElement} fragment1089 */109010911092function validateFragmentProps(fragment) {1093 {1094 var keys = Object.keys(fragment.props);10951096 for (var i = 0; i < keys.length; i++) {1097 var key = keys[i];10981099 if (key !== 'children' && key !== 'key') {1100 setCurrentlyValidatingElement$1(fragment);11011102 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);11031104 setCurrentlyValidatingElement$1(null);1105 break;1106 }1107 }11081109 if (fragment.ref !== null) {1110 setCurrentlyValidatingElement$1(fragment);11111112 error('Invalid attribute `ref` supplied to `React.Fragment`.');11131114 setCurrentlyValidatingElement$1(null);1115 }1116 }1117}11181119function jsxWithValidation(type, props, key, isStaticChildren, source, self) {1120 {1121 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to1122 // succeed and there will likely be errors in render.11231124 if (!validType) {1125 var info = '';11261127 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 }11301131 var sourceInfo = getSourceInfoErrorAddendum(source);11321133 if (sourceInfo) {1134 info += sourceInfo;1135 } else {1136 info += getDeclarationErrorAddendum();1137 }11381139 var typeString;11401141 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 }11511152 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 }11541155 var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.1156 // TODO: Drop this when these are no longer allowed as the type argument.11571158 if (element == null) {1159 return element;1160 } // Skip key warning if the type isn't valid since our key validation logic1161 // doesn't expect a non-string/function type and can throw confusing errors.1162 // We don't want exception behavior to differ between dev and prod.1163 // (Rendering will throw with a helpful message and as soon as the type is1164 // fixed, the key warnings will appear.)116511661167 if (validType) {1168 var children = props.children;11691170 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 }11761177 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 }11881189 if (type === exports.Fragment) {1190 validateFragmentProps(element);1191 } else {1192 validatePropTypes(element);1193 }11941195 return element;1196 }1197} // These two functions exist to still get child warnings in dev11981199var jsxDEV$1 = jsxWithValidation ;12001201exports.jsxDEV = jsxDEV$1;1202 })();1203}
Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.