react-jsx-dev-runtime.react-server.development.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. /**
  2. * @license React
  3. * react-jsx-dev-runtime.react-server.development.js
  4. *
  5. * Copyright (c) Meta Platforms, Inc. and 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. "production" !== process.env.NODE_ENV &&
  12. (function () {
  13. function getComponentNameFromType(type) {
  14. if (null == type) return null;
  15. if ("function" === typeof type)
  16. return type.$$typeof === REACT_CLIENT_REFERENCE
  17. ? null
  18. : type.displayName || type.name || null;
  19. if ("string" === typeof type) return type;
  20. switch (type) {
  21. case REACT_FRAGMENT_TYPE:
  22. return "Fragment";
  23. case REACT_PROFILER_TYPE:
  24. return "Profiler";
  25. case REACT_STRICT_MODE_TYPE:
  26. return "StrictMode";
  27. case REACT_SUSPENSE_TYPE:
  28. return "Suspense";
  29. case REACT_SUSPENSE_LIST_TYPE:
  30. return "SuspenseList";
  31. case REACT_ACTIVITY_TYPE:
  32. return "Activity";
  33. }
  34. if ("object" === typeof type)
  35. switch (
  36. ("number" === typeof type.tag &&
  37. console.error(
  38. "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
  39. ),
  40. type.$$typeof)
  41. ) {
  42. case REACT_PORTAL_TYPE:
  43. return "Portal";
  44. case REACT_CONTEXT_TYPE:
  45. return type.displayName || "Context";
  46. case REACT_CONSUMER_TYPE:
  47. return (type._context.displayName || "Context") + ".Consumer";
  48. case REACT_FORWARD_REF_TYPE:
  49. var innerType = type.render;
  50. type = type.displayName;
  51. type ||
  52. ((type = innerType.displayName || innerType.name || ""),
  53. (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
  54. return type;
  55. case REACT_MEMO_TYPE:
  56. return (
  57. (innerType = type.displayName || null),
  58. null !== innerType
  59. ? innerType
  60. : getComponentNameFromType(type.type) || "Memo"
  61. );
  62. case REACT_LAZY_TYPE:
  63. innerType = type._payload;
  64. type = type._init;
  65. try {
  66. return getComponentNameFromType(type(innerType));
  67. } catch (x) {}
  68. }
  69. return null;
  70. }
  71. function testStringCoercion(value) {
  72. return "" + value;
  73. }
  74. function checkKeyStringCoercion(value) {
  75. try {
  76. testStringCoercion(value);
  77. var JSCompiler_inline_result = !1;
  78. } catch (e) {
  79. JSCompiler_inline_result = !0;
  80. }
  81. if (JSCompiler_inline_result) {
  82. JSCompiler_inline_result = console;
  83. var JSCompiler_temp_const = JSCompiler_inline_result.error;
  84. var JSCompiler_inline_result$jscomp$0 =
  85. ("function" === typeof Symbol &&
  86. Symbol.toStringTag &&
  87. value[Symbol.toStringTag]) ||
  88. value.constructor.name ||
  89. "Object";
  90. JSCompiler_temp_const.call(
  91. JSCompiler_inline_result,
  92. "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
  93. JSCompiler_inline_result$jscomp$0
  94. );
  95. return testStringCoercion(value);
  96. }
  97. }
  98. function getTaskName(type) {
  99. if (type === REACT_FRAGMENT_TYPE) return "<>";
  100. if (
  101. "object" === typeof type &&
  102. null !== type &&
  103. type.$$typeof === REACT_LAZY_TYPE
  104. )
  105. return "<...>";
  106. try {
  107. var name = getComponentNameFromType(type);
  108. return name ? "<" + name + ">" : "<...>";
  109. } catch (x) {
  110. return "<...>";
  111. }
  112. }
  113. function getOwner() {
  114. var dispatcher = ReactSharedInternalsServer.A;
  115. return null === dispatcher ? null : dispatcher.getOwner();
  116. }
  117. function UnknownOwner() {
  118. return Error("react-stack-top-frame");
  119. }
  120. function hasValidKey(config) {
  121. if (hasOwnProperty.call(config, "key")) {
  122. var getter = Object.getOwnPropertyDescriptor(config, "key").get;
  123. if (getter && getter.isReactWarning) return !1;
  124. }
  125. return void 0 !== config.key;
  126. }
  127. function defineKeyPropWarningGetter(props, displayName) {
  128. function warnAboutAccessingKey() {
  129. specialPropKeyWarningShown ||
  130. ((specialPropKeyWarningShown = !0),
  131. console.error(
  132. "%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://react.dev/link/special-props)",
  133. displayName
  134. ));
  135. }
  136. warnAboutAccessingKey.isReactWarning = !0;
  137. Object.defineProperty(props, "key", {
  138. get: warnAboutAccessingKey,
  139. configurable: !0
  140. });
  141. }
  142. function elementRefGetterWithDeprecationWarning() {
  143. var componentName = getComponentNameFromType(this.type);
  144. didWarnAboutElementRef[componentName] ||
  145. ((didWarnAboutElementRef[componentName] = !0),
  146. console.error(
  147. "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
  148. ));
  149. componentName = this.props.ref;
  150. return void 0 !== componentName ? componentName : null;
  151. }
  152. function ReactElement(type, key, props, owner, debugStack, debugTask) {
  153. var refProp = props.ref;
  154. type = {
  155. $$typeof: REACT_ELEMENT_TYPE,
  156. type: type,
  157. key: key,
  158. props: props,
  159. _owner: owner
  160. };
  161. null !== (void 0 !== refProp ? refProp : null)
  162. ? Object.defineProperty(type, "ref", {
  163. enumerable: !1,
  164. get: elementRefGetterWithDeprecationWarning
  165. })
  166. : Object.defineProperty(type, "ref", { enumerable: !1, value: null });
  167. type._store = {};
  168. Object.defineProperty(type._store, "validated", {
  169. configurable: !1,
  170. enumerable: !1,
  171. writable: !0,
  172. value: 0
  173. });
  174. Object.defineProperty(type, "_debugInfo", {
  175. configurable: !1,
  176. enumerable: !1,
  177. writable: !0,
  178. value: null
  179. });
  180. Object.defineProperty(type, "_debugStack", {
  181. configurable: !1,
  182. enumerable: !1,
  183. writable: !0,
  184. value: debugStack
  185. });
  186. Object.defineProperty(type, "_debugTask", {
  187. configurable: !1,
  188. enumerable: !1,
  189. writable: !0,
  190. value: debugTask
  191. });
  192. Object.freeze && (Object.freeze(type.props), Object.freeze(type));
  193. return type;
  194. }
  195. function jsxDEVImpl(
  196. type,
  197. config,
  198. maybeKey,
  199. isStaticChildren,
  200. debugStack,
  201. debugTask
  202. ) {
  203. var children = config.children;
  204. if (void 0 !== children)
  205. if (isStaticChildren)
  206. if (isArrayImpl(children)) {
  207. for (
  208. isStaticChildren = 0;
  209. isStaticChildren < children.length;
  210. isStaticChildren++
  211. )
  212. validateChildKeys(children[isStaticChildren]);
  213. Object.freeze && Object.freeze(children);
  214. } else
  215. console.error(
  216. "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
  217. );
  218. else validateChildKeys(children);
  219. if (hasOwnProperty.call(config, "key")) {
  220. children = getComponentNameFromType(type);
  221. var keys = Object.keys(config).filter(function (k) {
  222. return "key" !== k;
  223. });
  224. isStaticChildren =
  225. 0 < keys.length
  226. ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
  227. : "{key: someKey}";
  228. didWarnAboutKeySpread[children + isStaticChildren] ||
  229. ((keys =
  230. 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
  231. console.error(
  232. 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
  233. isStaticChildren,
  234. children,
  235. keys,
  236. children
  237. ),
  238. (didWarnAboutKeySpread[children + isStaticChildren] = !0));
  239. }
  240. children = null;
  241. void 0 !== maybeKey &&
  242. (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
  243. hasValidKey(config) &&
  244. (checkKeyStringCoercion(config.key), (children = "" + config.key));
  245. if ("key" in config) {
  246. maybeKey = {};
  247. for (var propName in config)
  248. "key" !== propName && (maybeKey[propName] = config[propName]);
  249. } else maybeKey = config;
  250. children &&
  251. defineKeyPropWarningGetter(
  252. maybeKey,
  253. "function" === typeof type
  254. ? type.displayName || type.name || "Unknown"
  255. : type
  256. );
  257. return ReactElement(
  258. type,
  259. children,
  260. maybeKey,
  261. getOwner(),
  262. debugStack,
  263. debugTask
  264. );
  265. }
  266. function validateChildKeys(node) {
  267. isValidElement(node)
  268. ? node._store && (node._store.validated = 1)
  269. : "object" === typeof node &&
  270. null !== node &&
  271. node.$$typeof === REACT_LAZY_TYPE &&
  272. ("fulfilled" === node._payload.status
  273. ? isValidElement(node._payload.value) &&
  274. node._payload.value._store &&
  275. (node._payload.value._store.validated = 1)
  276. : node._store && (node._store.validated = 1));
  277. }
  278. function isValidElement(object) {
  279. return (
  280. "object" === typeof object &&
  281. null !== object &&
  282. object.$$typeof === REACT_ELEMENT_TYPE
  283. );
  284. }
  285. var React = require("react"),
  286. REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
  287. REACT_PORTAL_TYPE = Symbol.for("react.portal"),
  288. REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
  289. REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
  290. REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
  291. REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
  292. REACT_CONTEXT_TYPE = Symbol.for("react.context"),
  293. REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
  294. REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
  295. REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
  296. REACT_MEMO_TYPE = Symbol.for("react.memo"),
  297. REACT_LAZY_TYPE = Symbol.for("react.lazy"),
  298. REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
  299. REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
  300. ReactSharedInternalsServer =
  301. React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
  302. if (!ReactSharedInternalsServer)
  303. throw Error(
  304. 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
  305. );
  306. var hasOwnProperty = Object.prototype.hasOwnProperty,
  307. isArrayImpl = Array.isArray,
  308. createTask = console.createTask
  309. ? console.createTask
  310. : function () {
  311. return null;
  312. };
  313. React = {
  314. react_stack_bottom_frame: function (callStackForError) {
  315. return callStackForError();
  316. }
  317. };
  318. var specialPropKeyWarningShown;
  319. var didWarnAboutElementRef = {};
  320. var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
  321. React,
  322. UnknownOwner
  323. )();
  324. var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
  325. var didWarnAboutKeySpread = {};
  326. exports.Fragment = REACT_FRAGMENT_TYPE;
  327. exports.jsx = function (type, config, maybeKey) {
  328. var trackActualOwner =
  329. 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
  330. return jsxDEVImpl(
  331. type,
  332. config,
  333. maybeKey,
  334. !1,
  335. trackActualOwner
  336. ? Error("react-stack-top-frame")
  337. : unknownOwnerDebugStack,
  338. trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
  339. );
  340. };
  341. exports.jsxDEV = function (type, config, maybeKey, isStaticChildren) {
  342. var trackActualOwner =
  343. 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
  344. return jsxDEVImpl(
  345. type,
  346. config,
  347. maybeKey,
  348. isStaticChildren,
  349. trackActualOwner
  350. ? Error("react-stack-top-frame")
  351. : unknownOwnerDebugStack,
  352. trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
  353. );
  354. };
  355. exports.jsxs = function (type, config, maybeKey) {
  356. var trackActualOwner =
  357. 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
  358. return jsxDEVImpl(
  359. type,
  360. config,
  361. maybeKey,
  362. !0,
  363. trackActualOwner
  364. ? Error("react-stack-top-frame")
  365. : unknownOwnerDebugStack,
  366. trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
  367. );
  368. };
  369. })();