react-jsx-runtime.development.js 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314
  1. /**
  2. * @license React
  3. * react-jsx-runtime.development.js
  4. *
  5. * Copyright (c) Facebook, Inc. and its affiliates.
  6. *
  7. * This source code is licensed under the MIT license found in the
  8. * LICENSE file in the root directory of this source tree.
  9. */
  10. 'use strict';
  11. if (process.env.NODE_ENV !== "production") {
  12. (function() {
  13. 'use strict';
  14. var React = require('react');
  15. // ATTENTION
  16. // When adding new symbols to this file,
  17. // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
  18. // The Symbol used to tag the ReactElement-like types.
  19. var REACT_ELEMENT_TYPE = Symbol.for('react.element');
  20. var REACT_PORTAL_TYPE = Symbol.for('react.portal');
  21. var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
  22. var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
  23. var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
  24. var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
  25. var REACT_CONTEXT_TYPE = Symbol.for('react.context');
  26. var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
  27. var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
  28. var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
  29. var REACT_MEMO_TYPE = Symbol.for('react.memo');
  30. var REACT_LAZY_TYPE = Symbol.for('react.lazy');
  31. var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
  32. var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
  33. var FAUX_ITERATOR_SYMBOL = '@@iterator';
  34. function getIteratorFn(maybeIterable) {
  35. if (maybeIterable === null || typeof maybeIterable !== 'object') {
  36. return null;
  37. }
  38. var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
  39. if (typeof maybeIterator === 'function') {
  40. return maybeIterator;
  41. }
  42. return null;
  43. }
  44. var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
  45. function error(format) {
  46. {
  47. {
  48. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  49. args[_key2 - 1] = arguments[_key2];
  50. }
  51. printWarning('error', format, args);
  52. }
  53. }
  54. }
  55. function printWarning(level, format, args) {
  56. // When changing this logic, you might want to also
  57. // update consoleWithStackDev.www.js as well.
  58. {
  59. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  60. var stack = ReactDebugCurrentFrame.getStackAddendum();
  61. if (stack !== '') {
  62. format += '%s';
  63. args = args.concat([stack]);
  64. } // eslint-disable-next-line react-internal/safe-string-coercion
  65. var argsWithFormat = args.map(function (item) {
  66. return String(item);
  67. }); // Careful: RN currently depends on this prefix
  68. argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
  69. // breaks IE9: https://github.com/facebook/react/issues/13610
  70. // eslint-disable-next-line react-internal/no-production-logging
  71. Function.prototype.apply.call(console[level], console, argsWithFormat);
  72. }
  73. }
  74. // -----------------------------------------------------------------------------
  75. var enableScopeAPI = false; // Experimental Create Event Handle API.
  76. var enableCacheElement = false;
  77. var enableTransitionTracing = false; // No known bugs, but needs performance testing
  78. var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
  79. // stuff. Intended to enable React core members to more easily debug scheduling
  80. // issues in DEV builds.
  81. var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
  82. var REACT_MODULE_REFERENCE;
  83. {
  84. REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
  85. }
  86. function isValidElementType(type) {
  87. if (typeof type === 'string' || typeof type === 'function') {
  88. return true;
  89. } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
  90. 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 ) {
  91. return true;
  92. }
  93. if (typeof type === 'object' && type !== null) {
  94. 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 || // This needs to include all possible module reference object
  95. // types supported by any Flight configuration anywhere since
  96. // we don't know which Flight build this will end up being used
  97. // with.
  98. type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
  99. return true;
  100. }
  101. }
  102. return false;
  103. }
  104. function getWrappedName(outerType, innerType, wrapperName) {
  105. var displayName = outerType.displayName;
  106. if (displayName) {
  107. return displayName;
  108. }
  109. var functionName = innerType.displayName || innerType.name || '';
  110. return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
  111. } // Keep in sync with react-reconciler/getComponentNameFromFiber
  112. function getContextName(type) {
  113. return type.displayName || 'Context';
  114. } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
  115. function getComponentNameFromType(type) {
  116. if (type == null) {
  117. // Host root, text node or just invalid type.
  118. return null;
  119. }
  120. {
  121. if (typeof type.tag === 'number') {
  122. error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
  123. }
  124. }
  125. if (typeof type === 'function') {
  126. return type.displayName || type.name || null;
  127. }
  128. if (typeof type === 'string') {
  129. return type;
  130. }
  131. switch (type) {
  132. case REACT_FRAGMENT_TYPE:
  133. return 'Fragment';
  134. case REACT_PORTAL_TYPE:
  135. return 'Portal';
  136. case REACT_PROFILER_TYPE:
  137. return 'Profiler';
  138. case REACT_STRICT_MODE_TYPE:
  139. return 'StrictMode';
  140. case REACT_SUSPENSE_TYPE:
  141. return 'Suspense';
  142. case REACT_SUSPENSE_LIST_TYPE:
  143. return 'SuspenseList';
  144. }
  145. if (typeof type === 'object') {
  146. switch (type.$$typeof) {
  147. case REACT_CONTEXT_TYPE:
  148. var context = type;
  149. return getContextName(context) + '.Consumer';
  150. case REACT_PROVIDER_TYPE:
  151. var provider = type;
  152. return getContextName(provider._context) + '.Provider';
  153. case REACT_FORWARD_REF_TYPE:
  154. return getWrappedName(type, type.render, 'ForwardRef');
  155. case REACT_MEMO_TYPE:
  156. var outerName = type.displayName || null;
  157. if (outerName !== null) {
  158. return outerName;
  159. }
  160. return getComponentNameFromType(type.type) || 'Memo';
  161. case REACT_LAZY_TYPE:
  162. {
  163. var lazyComponent = type;
  164. var payload = lazyComponent._payload;
  165. var init = lazyComponent._init;
  166. try {
  167. return getComponentNameFromType(init(payload));
  168. } catch (x) {
  169. return null;
  170. }
  171. }
  172. // eslint-disable-next-line no-fallthrough
  173. }
  174. }
  175. return null;
  176. }
  177. var assign = Object.assign;
  178. // Helpers to patch console.logs to avoid logging during side-effect free
  179. // replaying on render function. This currently only patches the object
  180. // lazily which won't cover if the log function was extracted eagerly.
  181. // We could also eagerly patch the method.
  182. var disabledDepth = 0;
  183. var prevLog;
  184. var prevInfo;
  185. var prevWarn;
  186. var prevError;
  187. var prevGroup;
  188. var prevGroupCollapsed;
  189. var prevGroupEnd;
  190. function disabledLog() {}
  191. disabledLog.__reactDisabledLog = true;
  192. function disableLogs() {
  193. {
  194. if (disabledDepth === 0) {
  195. /* eslint-disable react-internal/no-production-logging */
  196. prevLog = console.log;
  197. prevInfo = console.info;
  198. prevWarn = console.warn;
  199. prevError = console.error;
  200. prevGroup = console.group;
  201. prevGroupCollapsed = console.groupCollapsed;
  202. prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
  203. var props = {
  204. configurable: true,
  205. enumerable: true,
  206. value: disabledLog,
  207. writable: true
  208. }; // $FlowFixMe Flow thinks console is immutable.
  209. Object.defineProperties(console, {
  210. info: props,
  211. log: props,
  212. warn: props,
  213. error: props,
  214. group: props,
  215. groupCollapsed: props,
  216. groupEnd: props
  217. });
  218. /* eslint-enable react-internal/no-production-logging */
  219. }
  220. disabledDepth++;
  221. }
  222. }
  223. function reenableLogs() {
  224. {
  225. disabledDepth--;
  226. if (disabledDepth === 0) {
  227. /* eslint-disable react-internal/no-production-logging */
  228. var props = {
  229. configurable: true,
  230. enumerable: true,
  231. writable: true
  232. }; // $FlowFixMe Flow thinks console is immutable.
  233. Object.defineProperties(console, {
  234. log: assign({}, props, {
  235. value: prevLog
  236. }),
  237. info: assign({}, props, {
  238. value: prevInfo
  239. }),
  240. warn: assign({}, props, {
  241. value: prevWarn
  242. }),
  243. error: assign({}, props, {
  244. value: prevError
  245. }),
  246. group: assign({}, props, {
  247. value: prevGroup
  248. }),
  249. groupCollapsed: assign({}, props, {
  250. value: prevGroupCollapsed
  251. }),
  252. groupEnd: assign({}, props, {
  253. value: prevGroupEnd
  254. })
  255. });
  256. /* eslint-enable react-internal/no-production-logging */
  257. }
  258. if (disabledDepth < 0) {
  259. error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
  260. }
  261. }
  262. }
  263. var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
  264. var prefix;
  265. function describeBuiltInComponentFrame(name, source, ownerFn) {
  266. {
  267. if (prefix === undefined) {
  268. // Extract the VM specific prefix used by each line.
  269. try {
  270. throw Error();
  271. } catch (x) {
  272. var match = x.stack.trim().match(/\n( *(at )?)/);
  273. prefix = match && match[1] || '';
  274. }
  275. } // We use the prefix to ensure our stacks line up with native stack frames.
  276. return '\n' + prefix + name;
  277. }
  278. }
  279. var reentry = false;
  280. var componentFrameCache;
  281. {
  282. var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
  283. componentFrameCache = new PossiblyWeakMap();
  284. }
  285. function describeNativeComponentFrame(fn, construct) {
  286. // If something asked for a stack inside a fake render, it should get ignored.
  287. if ( !fn || reentry) {
  288. return '';
  289. }
  290. {
  291. var frame = componentFrameCache.get(fn);
  292. if (frame !== undefined) {
  293. return frame;
  294. }
  295. }
  296. var control;
  297. reentry = true;
  298. var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
  299. Error.prepareStackTrace = undefined;
  300. var previousDispatcher;
  301. {
  302. previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
  303. // for warnings.
  304. ReactCurrentDispatcher.current = null;
  305. disableLogs();
  306. }
  307. try {
  308. // This should throw.
  309. if (construct) {
  310. // Something should be setting the props in the constructor.
  311. var Fake = function () {
  312. throw Error();
  313. }; // $FlowFixMe
  314. Object.defineProperty(Fake.prototype, 'props', {
  315. set: function () {
  316. // We use a throwing setter instead of frozen or non-writable props
  317. // because that won't throw in a non-strict mode function.
  318. throw Error();
  319. }
  320. });
  321. if (typeof Reflect === 'object' && Reflect.construct) {
  322. // We construct a different control for this case to include any extra
  323. // frames added by the construct call.
  324. try {
  325. Reflect.construct(Fake, []);
  326. } catch (x) {
  327. control = x;
  328. }
  329. Reflect.construct(fn, [], Fake);
  330. } else {
  331. try {
  332. Fake.call();
  333. } catch (x) {
  334. control = x;
  335. }
  336. fn.call(Fake.prototype);
  337. }
  338. } else {
  339. try {
  340. throw Error();
  341. } catch (x) {
  342. control = x;
  343. }
  344. fn();
  345. }
  346. } catch (sample) {
  347. // This is inlined manually because closure doesn't do it for us.
  348. if (sample && control && typeof sample.stack === 'string') {
  349. // This extracts the first frame from the sample that isn't also in the control.
  350. // Skipping one frame that we assume is the frame that calls the two.
  351. var sampleLines = sample.stack.split('\n');
  352. var controlLines = control.stack.split('\n');
  353. var s = sampleLines.length - 1;
  354. var c = controlLines.length - 1;
  355. while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
  356. // We expect at least one stack frame to be shared.
  357. // Typically this will be the root most one. However, stack frames may be
  358. // cut off due to maximum stack limits. In this case, one maybe cut off
  359. // earlier than the other. We assume that the sample is longer or the same
  360. // and there for cut off earlier. So we should find the root most frame in
  361. // the sample somewhere in the control.
  362. c--;
  363. }
  364. for (; s >= 1 && c >= 0; s--, c--) {
  365. // Next we find the first one that isn't the same which should be the
  366. // frame that called our sample function and the control.
  367. if (sampleLines[s] !== controlLines[c]) {
  368. // In V8, the first line is describing the message but other VMs don't.
  369. // If we're about to return the first line, and the control is also on the same
  370. // line, that's a pretty good indicator that our sample threw at same line as
  371. // the control. I.e. before we entered the sample frame. So we ignore this result.
  372. // This can happen if you passed a class to function component, or non-function.
  373. if (s !== 1 || c !== 1) {
  374. do {
  375. s--;
  376. c--; // We may still have similar intermediate frames from the construct call.
  377. // The next one that isn't the same should be our match though.
  378. if (c < 0 || sampleLines[s] !== controlLines[c]) {
  379. // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
  380. var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
  381. // but we have a user-provided "displayName"
  382. // splice it in to make the stack more readable.
  383. if (fn.displayName && _frame.includes('<anonymous>')) {
  384. _frame = _frame.replace('<anonymous>', fn.displayName);
  385. }
  386. {
  387. if (typeof fn === 'function') {
  388. componentFrameCache.set(fn, _frame);
  389. }
  390. } // Return the line we found.
  391. return _frame;
  392. }
  393. } while (s >= 1 && c >= 0);
  394. }
  395. break;
  396. }
  397. }
  398. }
  399. } finally {
  400. reentry = false;
  401. {
  402. ReactCurrentDispatcher.current = previousDispatcher;
  403. reenableLogs();
  404. }
  405. Error.prepareStackTrace = previousPrepareStackTrace;
  406. } // Fallback to just using the name if we couldn't make it throw.
  407. var name = fn ? fn.displayName || fn.name : '';
  408. var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
  409. {
  410. if (typeof fn === 'function') {
  411. componentFrameCache.set(fn, syntheticFrame);
  412. }
  413. }
  414. return syntheticFrame;
  415. }
  416. function describeFunctionComponentFrame(fn, source, ownerFn) {
  417. {
  418. return describeNativeComponentFrame(fn, false);
  419. }
  420. }
  421. function shouldConstruct(Component) {
  422. var prototype = Component.prototype;
  423. return !!(prototype && prototype.isReactComponent);
  424. }
  425. function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
  426. if (type == null) {
  427. return '';
  428. }
  429. if (typeof type === 'function') {
  430. {
  431. return describeNativeComponentFrame(type, shouldConstruct(type));
  432. }
  433. }
  434. if (typeof type === 'string') {
  435. return describeBuiltInComponentFrame(type);
  436. }
  437. switch (type) {
  438. case REACT_SUSPENSE_TYPE:
  439. return describeBuiltInComponentFrame('Suspense');
  440. case REACT_SUSPENSE_LIST_TYPE:
  441. return describeBuiltInComponentFrame('SuspenseList');
  442. }
  443. if (typeof type === 'object') {
  444. switch (type.$$typeof) {
  445. case REACT_FORWARD_REF_TYPE:
  446. return describeFunctionComponentFrame(type.render);
  447. case REACT_MEMO_TYPE:
  448. // Memo may contain any component type so we recursively resolve it.
  449. return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
  450. case REACT_LAZY_TYPE:
  451. {
  452. var lazyComponent = type;
  453. var payload = lazyComponent._payload;
  454. var init = lazyComponent._init;
  455. try {
  456. // Lazy may contain any component type so we recursively resolve it.
  457. return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
  458. } catch (x) {}
  459. }
  460. }
  461. }
  462. return '';
  463. }
  464. var hasOwnProperty = Object.prototype.hasOwnProperty;
  465. var loggedTypeFailures = {};
  466. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  467. function setCurrentlyValidatingElement(element) {
  468. {
  469. if (element) {
  470. var owner = element._owner;
  471. var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
  472. ReactDebugCurrentFrame.setExtraStackFrame(stack);
  473. } else {
  474. ReactDebugCurrentFrame.setExtraStackFrame(null);
  475. }
  476. }
  477. }
  478. function checkPropTypes(typeSpecs, values, location, componentName, element) {
  479. {
  480. // $FlowFixMe This is okay but Flow doesn't know it.
  481. var has = Function.call.bind(hasOwnProperty);
  482. for (var typeSpecName in typeSpecs) {
  483. if (has(typeSpecs, typeSpecName)) {
  484. var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
  485. // fail the render phase where it didn't fail before. So we log it.
  486. // After these have been cleaned up, we'll let them throw.
  487. try {
  488. // This is intentionally an invariant that gets caught. It's the same
  489. // behavior as without this statement except with a better message.
  490. if (typeof typeSpecs[typeSpecName] !== 'function') {
  491. // eslint-disable-next-line react-internal/prod-error-codes
  492. 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`.');
  493. err.name = 'Invariant Violation';
  494. throw err;
  495. }
  496. error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
  497. } catch (ex) {
  498. error$1 = ex;
  499. }
  500. if (error$1 && !(error$1 instanceof Error)) {
  501. setCurrentlyValidatingElement(element);
  502. 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);
  503. setCurrentlyValidatingElement(null);
  504. }
  505. if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
  506. // Only monitor this failure once because there tends to be a lot of the
  507. // same error.
  508. loggedTypeFailures[error$1.message] = true;
  509. setCurrentlyValidatingElement(element);
  510. error('Failed %s type: %s', location, error$1.message);
  511. setCurrentlyValidatingElement(null);
  512. }
  513. }
  514. }
  515. }
  516. }
  517. var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
  518. function isArray(a) {
  519. return isArrayImpl(a);
  520. }
  521. /*
  522. * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
  523. * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
  524. *
  525. * The functions in this module will throw an easier-to-understand,
  526. * easier-to-debug exception with a clear errors message message explaining the
  527. * problem. (Instead of a confusing exception thrown inside the implementation
  528. * of the `value` object).
  529. */
  530. // $FlowFixMe only called in DEV, so void return is not possible.
  531. function typeName(value) {
  532. {
  533. // toStringTag is needed for namespaced types like Temporal.Instant
  534. var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
  535. var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
  536. return type;
  537. }
  538. } // $FlowFixMe only called in DEV, so void return is not possible.
  539. function willCoercionThrow(value) {
  540. {
  541. try {
  542. testStringCoercion(value);
  543. return false;
  544. } catch (e) {
  545. return true;
  546. }
  547. }
  548. }
  549. function testStringCoercion(value) {
  550. // If you ended up here by following an exception call stack, here's what's
  551. // happened: you supplied an object or symbol value to React (as a prop, key,
  552. // DOM attribute, CSS property, string ref, etc.) and when React tried to
  553. // coerce it to a string using `'' + value`, an exception was thrown.
  554. //
  555. // The most common types that will cause this exception are `Symbol` instances
  556. // and Temporal objects like `Temporal.Instant`. But any object that has a
  557. // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
  558. // exception. (Library authors do this to prevent users from using built-in
  559. // numeric operators like `+` or comparison operators like `>=` because custom
  560. // methods are needed to perform accurate arithmetic or comparison.)
  561. //
  562. // To fix the problem, coerce this object or symbol value to a string before
  563. // passing it to React. The most reliable way is usually `String(value)`.
  564. //
  565. // To find which value is throwing, check the browser or debugger console.
  566. // Before this exception was thrown, there should be `console.error` output
  567. // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
  568. // problem and how that type was used: key, atrribute, input value prop, etc.
  569. // In most cases, this console output also shows the component and its
  570. // ancestor components where the exception happened.
  571. //
  572. // eslint-disable-next-line react-internal/safe-string-coercion
  573. return '' + value;
  574. }
  575. function checkKeyStringCoercion(value) {
  576. {
  577. if (willCoercionThrow(value)) {
  578. error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
  579. return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
  580. }
  581. }
  582. }
  583. var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
  584. var RESERVED_PROPS = {
  585. key: true,
  586. ref: true,
  587. __self: true,
  588. __source: true
  589. };
  590. var specialPropKeyWarningShown;
  591. var specialPropRefWarningShown;
  592. var didWarnAboutStringRefs;
  593. {
  594. didWarnAboutStringRefs = {};
  595. }
  596. function hasValidRef(config) {
  597. {
  598. if (hasOwnProperty.call(config, 'ref')) {
  599. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  600. if (getter && getter.isReactWarning) {
  601. return false;
  602. }
  603. }
  604. }
  605. return config.ref !== undefined;
  606. }
  607. function hasValidKey(config) {
  608. {
  609. if (hasOwnProperty.call(config, 'key')) {
  610. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  611. if (getter && getter.isReactWarning) {
  612. return false;
  613. }
  614. }
  615. }
  616. return config.key !== undefined;
  617. }
  618. function warnIfStringRefCannotBeAutoConverted(config, self) {
  619. {
  620. if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
  621. var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
  622. if (!didWarnAboutStringRefs[componentName]) {
  623. 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);
  624. didWarnAboutStringRefs[componentName] = true;
  625. }
  626. }
  627. }
  628. }
  629. function defineKeyPropWarningGetter(props, displayName) {
  630. {
  631. var warnAboutAccessingKey = function () {
  632. if (!specialPropKeyWarningShown) {
  633. specialPropKeyWarningShown = true;
  634. 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);
  635. }
  636. };
  637. warnAboutAccessingKey.isReactWarning = true;
  638. Object.defineProperty(props, 'key', {
  639. get: warnAboutAccessingKey,
  640. configurable: true
  641. });
  642. }
  643. }
  644. function defineRefPropWarningGetter(props, displayName) {
  645. {
  646. var warnAboutAccessingRef = function () {
  647. if (!specialPropRefWarningShown) {
  648. specialPropRefWarningShown = true;
  649. 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);
  650. }
  651. };
  652. warnAboutAccessingRef.isReactWarning = true;
  653. Object.defineProperty(props, 'ref', {
  654. get: warnAboutAccessingRef,
  655. configurable: true
  656. });
  657. }
  658. }
  659. /**
  660. * Factory method to create a new React element. This no longer adheres to
  661. * the class pattern, so do not use new to call it. Also, instanceof check
  662. * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
  663. * if something is a React Element.
  664. *
  665. * @param {*} type
  666. * @param {*} props
  667. * @param {*} key
  668. * @param {string|object} ref
  669. * @param {*} owner
  670. * @param {*} self A *temporary* helper to detect places where `this` is
  671. * different from the `owner` when React.createElement is called, so that we
  672. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  673. * functions, and as long as `this` and owner are the same, there will be no
  674. * change in behavior.
  675. * @param {*} source An annotation object (added by a transpiler or otherwise)
  676. * indicating filename, line number, and/or other information.
  677. * @internal
  678. */
  679. var ReactElement = function (type, key, ref, self, source, owner, props) {
  680. var element = {
  681. // This tag allows us to uniquely identify this as a React Element
  682. $$typeof: REACT_ELEMENT_TYPE,
  683. // Built-in properties that belong on the element
  684. type: type,
  685. key: key,
  686. ref: ref,
  687. props: props,
  688. // Record the component responsible for creating this element.
  689. _owner: owner
  690. };
  691. {
  692. // The validation flag is currently mutative. We put it on
  693. // an external backing store so that we can freeze the whole object.
  694. // This can be replaced with a WeakMap once they are implemented in
  695. // commonly used development environments.
  696. element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
  697. // the validation flag non-enumerable (where possible, which should
  698. // include every environment we run tests in), so the test framework
  699. // ignores it.
  700. Object.defineProperty(element._store, 'validated', {
  701. configurable: false,
  702. enumerable: false,
  703. writable: true,
  704. value: false
  705. }); // self and source are DEV only properties.
  706. Object.defineProperty(element, '_self', {
  707. configurable: false,
  708. enumerable: false,
  709. writable: false,
  710. value: self
  711. }); // Two elements created in two different places should be considered
  712. // equal for testing purposes and therefore we hide it from enumeration.
  713. Object.defineProperty(element, '_source', {
  714. configurable: false,
  715. enumerable: false,
  716. writable: false,
  717. value: source
  718. });
  719. if (Object.freeze) {
  720. Object.freeze(element.props);
  721. Object.freeze(element);
  722. }
  723. }
  724. return element;
  725. };
  726. /**
  727. * https://github.com/reactjs/rfcs/pull/107
  728. * @param {*} type
  729. * @param {object} props
  730. * @param {string} key
  731. */
  732. function jsxDEV(type, config, maybeKey, source, self) {
  733. {
  734. var propName; // Reserved names are extracted
  735. var props = {};
  736. var key = null;
  737. var ref = null; // Currently, key can be spread in as a prop. This causes a potential
  738. // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
  739. // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
  740. // but as an intermediary step, we will use jsxDEV for everything except
  741. // <div {...props} key="Hi" />, because we aren't currently able to tell if
  742. // key is explicitly declared to be undefined or not.
  743. if (maybeKey !== undefined) {
  744. {
  745. checkKeyStringCoercion(maybeKey);
  746. }
  747. key = '' + maybeKey;
  748. }
  749. if (hasValidKey(config)) {
  750. {
  751. checkKeyStringCoercion(config.key);
  752. }
  753. key = '' + config.key;
  754. }
  755. if (hasValidRef(config)) {
  756. ref = config.ref;
  757. warnIfStringRefCannotBeAutoConverted(config, self);
  758. } // Remaining properties are added to a new props object
  759. for (propName in config) {
  760. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  761. props[propName] = config[propName];
  762. }
  763. } // Resolve default props
  764. if (type && type.defaultProps) {
  765. var defaultProps = type.defaultProps;
  766. for (propName in defaultProps) {
  767. if (props[propName] === undefined) {
  768. props[propName] = defaultProps[propName];
  769. }
  770. }
  771. }
  772. if (key || ref) {
  773. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  774. if (key) {
  775. defineKeyPropWarningGetter(props, displayName);
  776. }
  777. if (ref) {
  778. defineRefPropWarningGetter(props, displayName);
  779. }
  780. }
  781. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  782. }
  783. }
  784. var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
  785. var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
  786. function setCurrentlyValidatingElement$1(element) {
  787. {
  788. if (element) {
  789. var owner = element._owner;
  790. var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
  791. ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
  792. } else {
  793. ReactDebugCurrentFrame$1.setExtraStackFrame(null);
  794. }
  795. }
  796. }
  797. var propTypesMisspellWarningShown;
  798. {
  799. propTypesMisspellWarningShown = false;
  800. }
  801. /**
  802. * Verifies the object is a ReactElement.
  803. * See https://reactjs.org/docs/react-api.html#isvalidelement
  804. * @param {?object} object
  805. * @return {boolean} True if `object` is a ReactElement.
  806. * @final
  807. */
  808. function isValidElement(object) {
  809. {
  810. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  811. }
  812. }
  813. function getDeclarationErrorAddendum() {
  814. {
  815. if (ReactCurrentOwner$1.current) {
  816. var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
  817. if (name) {
  818. return '\n\nCheck the render method of `' + name + '`.';
  819. }
  820. }
  821. return '';
  822. }
  823. }
  824. function getSourceInfoErrorAddendum(source) {
  825. {
  826. if (source !== undefined) {
  827. var fileName = source.fileName.replace(/^.*[\\\/]/, '');
  828. var lineNumber = source.lineNumber;
  829. return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
  830. }
  831. return '';
  832. }
  833. }
  834. /**
  835. * Warn if there's no key explicitly set on dynamic arrays of children or
  836. * object keys are not valid. This allows us to keep track of children between
  837. * updates.
  838. */
  839. var ownerHasKeyUseWarning = {};
  840. function getCurrentComponentErrorInfo(parentType) {
  841. {
  842. var info = getDeclarationErrorAddendum();
  843. if (!info) {
  844. var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
  845. if (parentName) {
  846. info = "\n\nCheck the top-level render call using <" + parentName + ">.";
  847. }
  848. }
  849. return info;
  850. }
  851. }
  852. /**
  853. * Warn if the element doesn't have an explicit key assigned to it.
  854. * This element is in an array. The array could grow and shrink or be
  855. * reordered. All children that haven't already been validated are required to
  856. * have a "key" property assigned to it. Error statuses are cached so a warning
  857. * will only be shown once.
  858. *
  859. * @internal
  860. * @param {ReactElement} element Element that requires a key.
  861. * @param {*} parentType element's parent's type.
  862. */
  863. function validateExplicitKey(element, parentType) {
  864. {
  865. if (!element._store || element._store.validated || element.key != null) {
  866. return;
  867. }
  868. element._store.validated = true;
  869. var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
  870. if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
  871. return;
  872. }
  873. ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
  874. // property, it may be the creator of the child that's responsible for
  875. // assigning it a key.
  876. var childOwner = '';
  877. if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
  878. // Give the component that originally created this child.
  879. childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
  880. }
  881. setCurrentlyValidatingElement$1(element);
  882. 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);
  883. setCurrentlyValidatingElement$1(null);
  884. }
  885. }
  886. /**
  887. * Ensure that every element either is passed in a static location, in an
  888. * array with an explicit keys property defined, or in an object literal
  889. * with valid key property.
  890. *
  891. * @internal
  892. * @param {ReactNode} node Statically passed child of any type.
  893. * @param {*} parentType node's parent's type.
  894. */
  895. function validateChildKeys(node, parentType) {
  896. {
  897. if (typeof node !== 'object') {
  898. return;
  899. }
  900. if (isArray(node)) {
  901. for (var i = 0; i < node.length; i++) {
  902. var child = node[i];
  903. if (isValidElement(child)) {
  904. validateExplicitKey(child, parentType);
  905. }
  906. }
  907. } else if (isValidElement(node)) {
  908. // This element was passed in a valid location.
  909. if (node._store) {
  910. node._store.validated = true;
  911. }
  912. } else if (node) {
  913. var iteratorFn = getIteratorFn(node);
  914. if (typeof iteratorFn === 'function') {
  915. // Entry iterators used to provide implicit keys,
  916. // but now we print a separate warning for them later.
  917. if (iteratorFn !== node.entries) {
  918. var iterator = iteratorFn.call(node);
  919. var step;
  920. while (!(step = iterator.next()).done) {
  921. if (isValidElement(step.value)) {
  922. validateExplicitKey(step.value, parentType);
  923. }
  924. }
  925. }
  926. }
  927. }
  928. }
  929. }
  930. /**
  931. * Given an element, validate that its props follow the propTypes definition,
  932. * provided by the type.
  933. *
  934. * @param {ReactElement} element
  935. */
  936. function validatePropTypes(element) {
  937. {
  938. var type = element.type;
  939. if (type === null || type === undefined || typeof type === 'string') {
  940. return;
  941. }
  942. var propTypes;
  943. if (typeof type === 'function') {
  944. propTypes = type.propTypes;
  945. } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
  946. // Inner props are checked in the reconciler.
  947. type.$$typeof === REACT_MEMO_TYPE)) {
  948. propTypes = type.propTypes;
  949. } else {
  950. return;
  951. }
  952. if (propTypes) {
  953. // Intentionally inside to avoid triggering lazy initializers:
  954. var name = getComponentNameFromType(type);
  955. checkPropTypes(propTypes, element.props, 'prop', name, element);
  956. } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
  957. propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
  958. var _name = getComponentNameFromType(type);
  959. error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
  960. }
  961. if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
  962. error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
  963. }
  964. }
  965. }
  966. /**
  967. * Given a fragment, validate that it can only be provided with fragment props
  968. * @param {ReactElement} fragment
  969. */
  970. function validateFragmentProps(fragment) {
  971. {
  972. var keys = Object.keys(fragment.props);
  973. for (var i = 0; i < keys.length; i++) {
  974. var key = keys[i];
  975. if (key !== 'children' && key !== 'key') {
  976. setCurrentlyValidatingElement$1(fragment);
  977. error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
  978. setCurrentlyValidatingElement$1(null);
  979. break;
  980. }
  981. }
  982. if (fragment.ref !== null) {
  983. setCurrentlyValidatingElement$1(fragment);
  984. error('Invalid attribute `ref` supplied to `React.Fragment`.');
  985. setCurrentlyValidatingElement$1(null);
  986. }
  987. }
  988. }
  989. function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
  990. {
  991. var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
  992. // succeed and there will likely be errors in render.
  993. if (!validType) {
  994. var info = '';
  995. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  996. 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.";
  997. }
  998. var sourceInfo = getSourceInfoErrorAddendum(source);
  999. if (sourceInfo) {
  1000. info += sourceInfo;
  1001. } else {
  1002. info += getDeclarationErrorAddendum();
  1003. }
  1004. var typeString;
  1005. if (type === null) {
  1006. typeString = 'null';
  1007. } else if (isArray(type)) {
  1008. typeString = 'array';
  1009. } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
  1010. typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
  1011. info = ' Did you accidentally export a JSX literal instead of a component?';
  1012. } else {
  1013. typeString = typeof type;
  1014. }
  1015. 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);
  1016. }
  1017. var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
  1018. // TODO: Drop this when these are no longer allowed as the type argument.
  1019. if (element == null) {
  1020. return element;
  1021. } // Skip key warning if the type isn't valid since our key validation logic
  1022. // doesn't expect a non-string/function type and can throw confusing errors.
  1023. // We don't want exception behavior to differ between dev and prod.
  1024. // (Rendering will throw with a helpful message and as soon as the type is
  1025. // fixed, the key warnings will appear.)
  1026. if (validType) {
  1027. var children = props.children;
  1028. if (children !== undefined) {
  1029. if (isStaticChildren) {
  1030. if (isArray(children)) {
  1031. for (var i = 0; i < children.length; i++) {
  1032. validateChildKeys(children[i], type);
  1033. }
  1034. if (Object.freeze) {
  1035. Object.freeze(children);
  1036. }
  1037. } else {
  1038. 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.');
  1039. }
  1040. } else {
  1041. validateChildKeys(children, type);
  1042. }
  1043. }
  1044. }
  1045. if (type === REACT_FRAGMENT_TYPE) {
  1046. validateFragmentProps(element);
  1047. } else {
  1048. validatePropTypes(element);
  1049. }
  1050. return element;
  1051. }
  1052. } // These two functions exist to still get child warnings in dev
  1053. // even with the prod transform. This means that jsxDEV is purely
  1054. // opt-in behavior for better messages but that we won't stop
  1055. // giving you warnings if you use production apis.
  1056. function jsxWithValidationStatic(type, props, key) {
  1057. {
  1058. return jsxWithValidation(type, props, key, true);
  1059. }
  1060. }
  1061. function jsxWithValidationDynamic(type, props, key) {
  1062. {
  1063. return jsxWithValidation(type, props, key, false);
  1064. }
  1065. }
  1066. var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
  1067. // for now we can ship identical prod functions
  1068. var jsxs = jsxWithValidationStatic ;
  1069. exports.Fragment = REACT_FRAGMENT_TYPE;
  1070. exports.jsx = jsx;
  1071. exports.jsxs = jsxs;
  1072. })();
  1073. }