react.react-server.development.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  1. /**
  2. * @license React
  3. * react.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 noop() {}
  14. function getIteratorFn(maybeIterable) {
  15. if (null === maybeIterable || "object" !== typeof maybeIterable)
  16. return null;
  17. maybeIterable =
  18. (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
  19. maybeIterable["@@iterator"];
  20. return "function" === typeof maybeIterable ? maybeIterable : null;
  21. }
  22. function testStringCoercion(value) {
  23. return "" + value;
  24. }
  25. function checkKeyStringCoercion(value) {
  26. try {
  27. testStringCoercion(value);
  28. var JSCompiler_inline_result = !1;
  29. } catch (e) {
  30. JSCompiler_inline_result = !0;
  31. }
  32. if (JSCompiler_inline_result) {
  33. JSCompiler_inline_result = console;
  34. var JSCompiler_temp_const = JSCompiler_inline_result.error;
  35. var JSCompiler_inline_result$jscomp$0 =
  36. ("function" === typeof Symbol &&
  37. Symbol.toStringTag &&
  38. value[Symbol.toStringTag]) ||
  39. value.constructor.name ||
  40. "Object";
  41. JSCompiler_temp_const.call(
  42. JSCompiler_inline_result,
  43. "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
  44. JSCompiler_inline_result$jscomp$0
  45. );
  46. return testStringCoercion(value);
  47. }
  48. }
  49. function getComponentNameFromType(type) {
  50. if (null == type) return null;
  51. if ("function" === typeof type)
  52. return type.$$typeof === REACT_CLIENT_REFERENCE
  53. ? null
  54. : type.displayName || type.name || null;
  55. if ("string" === typeof type) return type;
  56. switch (type) {
  57. case REACT_FRAGMENT_TYPE:
  58. return "Fragment";
  59. case REACT_PROFILER_TYPE:
  60. return "Profiler";
  61. case REACT_STRICT_MODE_TYPE:
  62. return "StrictMode";
  63. case REACT_SUSPENSE_TYPE:
  64. return "Suspense";
  65. case REACT_SUSPENSE_LIST_TYPE:
  66. return "SuspenseList";
  67. case REACT_ACTIVITY_TYPE:
  68. return "Activity";
  69. }
  70. if ("object" === typeof type)
  71. switch (
  72. ("number" === typeof type.tag &&
  73. console.error(
  74. "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
  75. ),
  76. type.$$typeof)
  77. ) {
  78. case REACT_PORTAL_TYPE:
  79. return "Portal";
  80. case REACT_CONTEXT_TYPE:
  81. return type.displayName || "Context";
  82. case REACT_CONSUMER_TYPE:
  83. return (type._context.displayName || "Context") + ".Consumer";
  84. case REACT_FORWARD_REF_TYPE:
  85. var innerType = type.render;
  86. type = type.displayName;
  87. type ||
  88. ((type = innerType.displayName || innerType.name || ""),
  89. (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
  90. return type;
  91. case REACT_MEMO_TYPE:
  92. return (
  93. (innerType = type.displayName || null),
  94. null !== innerType
  95. ? innerType
  96. : getComponentNameFromType(type.type) || "Memo"
  97. );
  98. case REACT_LAZY_TYPE:
  99. innerType = type._payload;
  100. type = type._init;
  101. try {
  102. return getComponentNameFromType(type(innerType));
  103. } catch (x) {}
  104. }
  105. return null;
  106. }
  107. function getTaskName(type) {
  108. if (type === REACT_FRAGMENT_TYPE) return "<>";
  109. if (
  110. "object" === typeof type &&
  111. null !== type &&
  112. type.$$typeof === REACT_LAZY_TYPE
  113. )
  114. return "<...>";
  115. try {
  116. var name = getComponentNameFromType(type);
  117. return name ? "<" + name + ">" : "<...>";
  118. } catch (x) {
  119. return "<...>";
  120. }
  121. }
  122. function getOwner() {
  123. var dispatcher = ReactSharedInternals.A;
  124. return null === dispatcher ? null : dispatcher.getOwner();
  125. }
  126. function UnknownOwner() {
  127. return Error("react-stack-top-frame");
  128. }
  129. function hasValidKey(config) {
  130. if (hasOwnProperty.call(config, "key")) {
  131. var getter = Object.getOwnPropertyDescriptor(config, "key").get;
  132. if (getter && getter.isReactWarning) return !1;
  133. }
  134. return void 0 !== config.key;
  135. }
  136. function defineKeyPropWarningGetter(props, displayName) {
  137. function warnAboutAccessingKey() {
  138. specialPropKeyWarningShown ||
  139. ((specialPropKeyWarningShown = !0),
  140. console.error(
  141. "%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)",
  142. displayName
  143. ));
  144. }
  145. warnAboutAccessingKey.isReactWarning = !0;
  146. Object.defineProperty(props, "key", {
  147. get: warnAboutAccessingKey,
  148. configurable: !0
  149. });
  150. }
  151. function elementRefGetterWithDeprecationWarning() {
  152. var componentName = getComponentNameFromType(this.type);
  153. didWarnAboutElementRef[componentName] ||
  154. ((didWarnAboutElementRef[componentName] = !0),
  155. console.error(
  156. "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."
  157. ));
  158. componentName = this.props.ref;
  159. return void 0 !== componentName ? componentName : null;
  160. }
  161. function ReactElement(type, key, props, owner, debugStack, debugTask) {
  162. var refProp = props.ref;
  163. type = {
  164. $$typeof: REACT_ELEMENT_TYPE,
  165. type: type,
  166. key: key,
  167. props: props,
  168. _owner: owner
  169. };
  170. null !== (void 0 !== refProp ? refProp : null)
  171. ? Object.defineProperty(type, "ref", {
  172. enumerable: !1,
  173. get: elementRefGetterWithDeprecationWarning
  174. })
  175. : Object.defineProperty(type, "ref", { enumerable: !1, value: null });
  176. type._store = {};
  177. Object.defineProperty(type._store, "validated", {
  178. configurable: !1,
  179. enumerable: !1,
  180. writable: !0,
  181. value: 0
  182. });
  183. Object.defineProperty(type, "_debugInfo", {
  184. configurable: !1,
  185. enumerable: !1,
  186. writable: !0,
  187. value: null
  188. });
  189. Object.defineProperty(type, "_debugStack", {
  190. configurable: !1,
  191. enumerable: !1,
  192. writable: !0,
  193. value: debugStack
  194. });
  195. Object.defineProperty(type, "_debugTask", {
  196. configurable: !1,
  197. enumerable: !1,
  198. writable: !0,
  199. value: debugTask
  200. });
  201. Object.freeze && (Object.freeze(type.props), Object.freeze(type));
  202. return type;
  203. }
  204. function cloneAndReplaceKey(oldElement, newKey) {
  205. newKey = ReactElement(
  206. oldElement.type,
  207. newKey,
  208. oldElement.props,
  209. oldElement._owner,
  210. oldElement._debugStack,
  211. oldElement._debugTask
  212. );
  213. oldElement._store &&
  214. (newKey._store.validated = oldElement._store.validated);
  215. return newKey;
  216. }
  217. function validateChildKeys(node) {
  218. isValidElement(node)
  219. ? node._store && (node._store.validated = 1)
  220. : "object" === typeof node &&
  221. null !== node &&
  222. node.$$typeof === REACT_LAZY_TYPE &&
  223. ("fulfilled" === node._payload.status
  224. ? isValidElement(node._payload.value) &&
  225. node._payload.value._store &&
  226. (node._payload.value._store.validated = 1)
  227. : node._store && (node._store.validated = 1));
  228. }
  229. function isValidElement(object) {
  230. return (
  231. "object" === typeof object &&
  232. null !== object &&
  233. object.$$typeof === REACT_ELEMENT_TYPE
  234. );
  235. }
  236. function escape(key) {
  237. var escaperLookup = { "=": "=0", ":": "=2" };
  238. return (
  239. "$" +
  240. key.replace(/[=:]/g, function (match) {
  241. return escaperLookup[match];
  242. })
  243. );
  244. }
  245. function getElementKey(element, index) {
  246. return "object" === typeof element &&
  247. null !== element &&
  248. null != element.key
  249. ? (checkKeyStringCoercion(element.key), escape("" + element.key))
  250. : index.toString(36);
  251. }
  252. function resolveThenable(thenable) {
  253. switch (thenable.status) {
  254. case "fulfilled":
  255. return thenable.value;
  256. case "rejected":
  257. throw thenable.reason;
  258. default:
  259. switch (
  260. ("string" === typeof thenable.status
  261. ? thenable.then(noop, noop)
  262. : ((thenable.status = "pending"),
  263. thenable.then(
  264. function (fulfilledValue) {
  265. "pending" === thenable.status &&
  266. ((thenable.status = "fulfilled"),
  267. (thenable.value = fulfilledValue));
  268. },
  269. function (error) {
  270. "pending" === thenable.status &&
  271. ((thenable.status = "rejected"),
  272. (thenable.reason = error));
  273. }
  274. )),
  275. thenable.status)
  276. ) {
  277. case "fulfilled":
  278. return thenable.value;
  279. case "rejected":
  280. throw thenable.reason;
  281. }
  282. }
  283. throw thenable;
  284. }
  285. function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
  286. var type = typeof children;
  287. if ("undefined" === type || "boolean" === type) children = null;
  288. var invokeCallback = !1;
  289. if (null === children) invokeCallback = !0;
  290. else
  291. switch (type) {
  292. case "bigint":
  293. case "string":
  294. case "number":
  295. invokeCallback = !0;
  296. break;
  297. case "object":
  298. switch (children.$$typeof) {
  299. case REACT_ELEMENT_TYPE:
  300. case REACT_PORTAL_TYPE:
  301. invokeCallback = !0;
  302. break;
  303. case REACT_LAZY_TYPE:
  304. return (
  305. (invokeCallback = children._init),
  306. mapIntoArray(
  307. invokeCallback(children._payload),
  308. array,
  309. escapedPrefix,
  310. nameSoFar,
  311. callback
  312. )
  313. );
  314. }
  315. }
  316. if (invokeCallback) {
  317. invokeCallback = children;
  318. callback = callback(invokeCallback);
  319. var childKey =
  320. "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
  321. isArrayImpl(callback)
  322. ? ((escapedPrefix = ""),
  323. null != childKey &&
  324. (escapedPrefix =
  325. childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
  326. mapIntoArray(callback, array, escapedPrefix, "", function (c) {
  327. return c;
  328. }))
  329. : null != callback &&
  330. (isValidElement(callback) &&
  331. (null != callback.key &&
  332. ((invokeCallback && invokeCallback.key === callback.key) ||
  333. checkKeyStringCoercion(callback.key)),
  334. (escapedPrefix = cloneAndReplaceKey(
  335. callback,
  336. escapedPrefix +
  337. (null == callback.key ||
  338. (invokeCallback && invokeCallback.key === callback.key)
  339. ? ""
  340. : ("" + callback.key).replace(
  341. userProvidedKeyEscapeRegex,
  342. "$&/"
  343. ) + "/") +
  344. childKey
  345. )),
  346. "" !== nameSoFar &&
  347. null != invokeCallback &&
  348. isValidElement(invokeCallback) &&
  349. null == invokeCallback.key &&
  350. invokeCallback._store &&
  351. !invokeCallback._store.validated &&
  352. (escapedPrefix._store.validated = 2),
  353. (callback = escapedPrefix)),
  354. array.push(callback));
  355. return 1;
  356. }
  357. invokeCallback = 0;
  358. childKey = "" === nameSoFar ? "." : nameSoFar + ":";
  359. if (isArrayImpl(children))
  360. for (var i = 0; i < children.length; i++)
  361. (nameSoFar = children[i]),
  362. (type = childKey + getElementKey(nameSoFar, i)),
  363. (invokeCallback += mapIntoArray(
  364. nameSoFar,
  365. array,
  366. escapedPrefix,
  367. type,
  368. callback
  369. ));
  370. else if (((i = getIteratorFn(children)), "function" === typeof i))
  371. for (
  372. i === children.entries &&
  373. (didWarnAboutMaps ||
  374. console.warn(
  375. "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
  376. ),
  377. (didWarnAboutMaps = !0)),
  378. children = i.call(children),
  379. i = 0;
  380. !(nameSoFar = children.next()).done;
  381. )
  382. (nameSoFar = nameSoFar.value),
  383. (type = childKey + getElementKey(nameSoFar, i++)),
  384. (invokeCallback += mapIntoArray(
  385. nameSoFar,
  386. array,
  387. escapedPrefix,
  388. type,
  389. callback
  390. ));
  391. else if ("object" === type) {
  392. if ("function" === typeof children.then)
  393. return mapIntoArray(
  394. resolveThenable(children),
  395. array,
  396. escapedPrefix,
  397. nameSoFar,
  398. callback
  399. );
  400. array = String(children);
  401. throw Error(
  402. "Objects are not valid as a React child (found: " +
  403. ("[object Object]" === array
  404. ? "object with keys {" + Object.keys(children).join(", ") + "}"
  405. : array) +
  406. "). If you meant to render a collection of children, use an array instead."
  407. );
  408. }
  409. return invokeCallback;
  410. }
  411. function mapChildren(children, func, context) {
  412. if (null == children) return children;
  413. var result = [],
  414. count = 0;
  415. mapIntoArray(children, result, "", "", function (child) {
  416. return func.call(context, child, count++);
  417. });
  418. return result;
  419. }
  420. function resolveDispatcher() {
  421. var dispatcher = ReactSharedInternals.H;
  422. null === dispatcher &&
  423. console.error(
  424. "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
  425. );
  426. return dispatcher;
  427. }
  428. function lazyInitializer(payload) {
  429. if (-1 === payload._status) {
  430. var ioInfo = payload._ioInfo;
  431. null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
  432. ioInfo = payload._result;
  433. var thenable = ioInfo();
  434. thenable.then(
  435. function (moduleObject) {
  436. if (0 === payload._status || -1 === payload._status) {
  437. payload._status = 1;
  438. payload._result = moduleObject;
  439. var _ioInfo = payload._ioInfo;
  440. null != _ioInfo && (_ioInfo.end = performance.now());
  441. void 0 === thenable.status &&
  442. ((thenable.status = "fulfilled"),
  443. (thenable.value = moduleObject));
  444. }
  445. },
  446. function (error) {
  447. if (0 === payload._status || -1 === payload._status) {
  448. payload._status = 2;
  449. payload._result = error;
  450. var _ioInfo2 = payload._ioInfo;
  451. null != _ioInfo2 && (_ioInfo2.end = performance.now());
  452. void 0 === thenable.status &&
  453. ((thenable.status = "rejected"), (thenable.reason = error));
  454. }
  455. }
  456. );
  457. ioInfo = payload._ioInfo;
  458. if (null != ioInfo) {
  459. ioInfo.value = thenable;
  460. var displayName = thenable.displayName;
  461. "string" === typeof displayName && (ioInfo.name = displayName);
  462. }
  463. -1 === payload._status &&
  464. ((payload._status = 0), (payload._result = thenable));
  465. }
  466. if (1 === payload._status)
  467. return (
  468. (ioInfo = payload._result),
  469. void 0 === ioInfo &&
  470. console.error(
  471. "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
  472. ioInfo
  473. ),
  474. "default" in ioInfo ||
  475. console.error(
  476. "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
  477. ioInfo
  478. ),
  479. ioInfo.default
  480. );
  481. throw payload._result;
  482. }
  483. function createCacheRoot() {
  484. return new WeakMap();
  485. }
  486. function createCacheNode() {
  487. return { s: 0, v: void 0, o: null, p: null };
  488. }
  489. var ReactSharedInternals = {
  490. H: null,
  491. A: null,
  492. getCurrentStack: null,
  493. recentlyCreatedOwnerStacks: 0
  494. },
  495. isArrayImpl = Array.isArray,
  496. REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
  497. REACT_PORTAL_TYPE = Symbol.for("react.portal"),
  498. REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
  499. REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
  500. REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
  501. REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
  502. REACT_CONTEXT_TYPE = Symbol.for("react.context"),
  503. REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
  504. REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
  505. REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
  506. REACT_MEMO_TYPE = Symbol.for("react.memo"),
  507. REACT_LAZY_TYPE = Symbol.for("react.lazy"),
  508. REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
  509. MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
  510. REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
  511. hasOwnProperty = Object.prototype.hasOwnProperty,
  512. assign = Object.assign,
  513. createTask = console.createTask
  514. ? console.createTask
  515. : function () {
  516. return null;
  517. },
  518. createFakeCallStack = {
  519. react_stack_bottom_frame: function (callStackForError) {
  520. return callStackForError();
  521. }
  522. },
  523. specialPropKeyWarningShown,
  524. didWarnAboutOldJSXRuntime;
  525. var didWarnAboutElementRef = {};
  526. var unknownOwnerDebugStack =
  527. createFakeCallStack.react_stack_bottom_frame.bind(
  528. createFakeCallStack,
  529. UnknownOwner
  530. )();
  531. var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
  532. var didWarnAboutMaps = !1,
  533. userProvidedKeyEscapeRegex = /\/+/g;
  534. exports.Children = {
  535. map: mapChildren,
  536. forEach: function (children, forEachFunc, forEachContext) {
  537. mapChildren(
  538. children,
  539. function () {
  540. forEachFunc.apply(this, arguments);
  541. },
  542. forEachContext
  543. );
  544. },
  545. count: function (children) {
  546. var n = 0;
  547. mapChildren(children, function () {
  548. n++;
  549. });
  550. return n;
  551. },
  552. toArray: function (children) {
  553. return (
  554. mapChildren(children, function (child) {
  555. return child;
  556. }) || []
  557. );
  558. },
  559. only: function (children) {
  560. if (!isValidElement(children))
  561. throw Error(
  562. "React.Children.only expected to receive a single React element child."
  563. );
  564. return children;
  565. }
  566. };
  567. exports.Fragment = REACT_FRAGMENT_TYPE;
  568. exports.Profiler = REACT_PROFILER_TYPE;
  569. exports.StrictMode = REACT_STRICT_MODE_TYPE;
  570. exports.Suspense = REACT_SUSPENSE_TYPE;
  571. exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
  572. ReactSharedInternals;
  573. exports.cache = function (fn) {
  574. return function () {
  575. var dispatcher = ReactSharedInternals.A;
  576. if (!dispatcher) return fn.apply(null, arguments);
  577. var fnMap = dispatcher.getCacheForType(createCacheRoot);
  578. dispatcher = fnMap.get(fn);
  579. void 0 === dispatcher &&
  580. ((dispatcher = createCacheNode()), fnMap.set(fn, dispatcher));
  581. fnMap = 0;
  582. for (var l = arguments.length; fnMap < l; fnMap++) {
  583. var arg = arguments[fnMap];
  584. if (
  585. "function" === typeof arg ||
  586. ("object" === typeof arg && null !== arg)
  587. ) {
  588. var objectCache = dispatcher.o;
  589. null === objectCache &&
  590. (dispatcher.o = objectCache = new WeakMap());
  591. dispatcher = objectCache.get(arg);
  592. void 0 === dispatcher &&
  593. ((dispatcher = createCacheNode()),
  594. objectCache.set(arg, dispatcher));
  595. } else
  596. (objectCache = dispatcher.p),
  597. null === objectCache && (dispatcher.p = objectCache = new Map()),
  598. (dispatcher = objectCache.get(arg)),
  599. void 0 === dispatcher &&
  600. ((dispatcher = createCacheNode()),
  601. objectCache.set(arg, dispatcher));
  602. }
  603. if (1 === dispatcher.s) return dispatcher.v;
  604. if (2 === dispatcher.s) throw dispatcher.v;
  605. try {
  606. var result = fn.apply(null, arguments);
  607. fnMap = dispatcher;
  608. fnMap.s = 1;
  609. return (fnMap.v = result);
  610. } catch (error) {
  611. throw (
  612. ((result = dispatcher), (result.s = 2), (result.v = error), error)
  613. );
  614. }
  615. };
  616. };
  617. exports.cacheSignal = function () {
  618. var dispatcher = ReactSharedInternals.A;
  619. return dispatcher ? dispatcher.cacheSignal() : null;
  620. };
  621. exports.captureOwnerStack = function () {
  622. var getCurrentStack = ReactSharedInternals.getCurrentStack;
  623. return null === getCurrentStack ? null : getCurrentStack();
  624. };
  625. exports.cloneElement = function (element, config, children) {
  626. if (null === element || void 0 === element)
  627. throw Error(
  628. "The argument must be a React element, but you passed " +
  629. element +
  630. "."
  631. );
  632. var props = assign({}, element.props),
  633. key = element.key,
  634. owner = element._owner;
  635. if (null != config) {
  636. var JSCompiler_inline_result;
  637. a: {
  638. if (
  639. hasOwnProperty.call(config, "ref") &&
  640. (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
  641. config,
  642. "ref"
  643. ).get) &&
  644. JSCompiler_inline_result.isReactWarning
  645. ) {
  646. JSCompiler_inline_result = !1;
  647. break a;
  648. }
  649. JSCompiler_inline_result = void 0 !== config.ref;
  650. }
  651. JSCompiler_inline_result && (owner = getOwner());
  652. hasValidKey(config) &&
  653. (checkKeyStringCoercion(config.key), (key = "" + config.key));
  654. for (propName in config)
  655. !hasOwnProperty.call(config, propName) ||
  656. "key" === propName ||
  657. "__self" === propName ||
  658. "__source" === propName ||
  659. ("ref" === propName && void 0 === config.ref) ||
  660. (props[propName] = config[propName]);
  661. }
  662. var propName = arguments.length - 2;
  663. if (1 === propName) props.children = children;
  664. else if (1 < propName) {
  665. JSCompiler_inline_result = Array(propName);
  666. for (var i = 0; i < propName; i++)
  667. JSCompiler_inline_result[i] = arguments[i + 2];
  668. props.children = JSCompiler_inline_result;
  669. }
  670. props = ReactElement(
  671. element.type,
  672. key,
  673. props,
  674. owner,
  675. element._debugStack,
  676. element._debugTask
  677. );
  678. for (key = 2; key < arguments.length; key++)
  679. validateChildKeys(arguments[key]);
  680. return props;
  681. };
  682. exports.createElement = function (type, config, children) {
  683. for (var i = 2; i < arguments.length; i++)
  684. validateChildKeys(arguments[i]);
  685. i = {};
  686. var key = null;
  687. if (null != config)
  688. for (propName in (didWarnAboutOldJSXRuntime ||
  689. !("__self" in config) ||
  690. "key" in config ||
  691. ((didWarnAboutOldJSXRuntime = !0),
  692. console.warn(
  693. "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
  694. )),
  695. hasValidKey(config) &&
  696. (checkKeyStringCoercion(config.key), (key = "" + config.key)),
  697. config))
  698. hasOwnProperty.call(config, propName) &&
  699. "key" !== propName &&
  700. "__self" !== propName &&
  701. "__source" !== propName &&
  702. (i[propName] = config[propName]);
  703. var childrenLength = arguments.length - 2;
  704. if (1 === childrenLength) i.children = children;
  705. else if (1 < childrenLength) {
  706. for (
  707. var childArray = Array(childrenLength), _i = 0;
  708. _i < childrenLength;
  709. _i++
  710. )
  711. childArray[_i] = arguments[_i + 2];
  712. Object.freeze && Object.freeze(childArray);
  713. i.children = childArray;
  714. }
  715. if (type && type.defaultProps)
  716. for (propName in ((childrenLength = type.defaultProps), childrenLength))
  717. void 0 === i[propName] && (i[propName] = childrenLength[propName]);
  718. key &&
  719. defineKeyPropWarningGetter(
  720. i,
  721. "function" === typeof type
  722. ? type.displayName || type.name || "Unknown"
  723. : type
  724. );
  725. var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
  726. return ReactElement(
  727. type,
  728. key,
  729. i,
  730. getOwner(),
  731. propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
  732. propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
  733. );
  734. };
  735. exports.createRef = function () {
  736. var refObject = { current: null };
  737. Object.seal(refObject);
  738. return refObject;
  739. };
  740. exports.forwardRef = function (render) {
  741. null != render && render.$$typeof === REACT_MEMO_TYPE
  742. ? console.error(
  743. "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
  744. )
  745. : "function" !== typeof render
  746. ? console.error(
  747. "forwardRef requires a render function but was given %s.",
  748. null === render ? "null" : typeof render
  749. )
  750. : 0 !== render.length &&
  751. 2 !== render.length &&
  752. console.error(
  753. "forwardRef render functions accept exactly two parameters: props and ref. %s",
  754. 1 === render.length
  755. ? "Did you forget to use the ref parameter?"
  756. : "Any additional parameter will be undefined."
  757. );
  758. null != render &&
  759. null != render.defaultProps &&
  760. console.error(
  761. "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
  762. );
  763. var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render },
  764. ownName;
  765. Object.defineProperty(elementType, "displayName", {
  766. enumerable: !1,
  767. configurable: !0,
  768. get: function () {
  769. return ownName;
  770. },
  771. set: function (name) {
  772. ownName = name;
  773. render.name ||
  774. render.displayName ||
  775. (Object.defineProperty(render, "name", { value: name }),
  776. (render.displayName = name));
  777. }
  778. });
  779. return elementType;
  780. };
  781. exports.isValidElement = isValidElement;
  782. exports.lazy = function (ctor) {
  783. ctor = { _status: -1, _result: ctor };
  784. var lazyType = {
  785. $$typeof: REACT_LAZY_TYPE,
  786. _payload: ctor,
  787. _init: lazyInitializer
  788. },
  789. ioInfo = {
  790. name: "lazy",
  791. start: -1,
  792. end: -1,
  793. value: null,
  794. owner: null,
  795. debugStack: Error("react-stack-top-frame"),
  796. debugTask: console.createTask ? console.createTask("lazy()") : null
  797. };
  798. ctor._ioInfo = ioInfo;
  799. lazyType._debugInfo = [{ awaited: ioInfo }];
  800. return lazyType;
  801. };
  802. exports.memo = function (type, compare) {
  803. null == type &&
  804. console.error(
  805. "memo: The first argument must be a component. Instead received: %s",
  806. null === type ? "null" : typeof type
  807. );
  808. compare = {
  809. $$typeof: REACT_MEMO_TYPE,
  810. type: type,
  811. compare: void 0 === compare ? null : compare
  812. };
  813. var ownName;
  814. Object.defineProperty(compare, "displayName", {
  815. enumerable: !1,
  816. configurable: !0,
  817. get: function () {
  818. return ownName;
  819. },
  820. set: function (name) {
  821. ownName = name;
  822. type.name ||
  823. type.displayName ||
  824. (Object.defineProperty(type, "name", { value: name }),
  825. (type.displayName = name));
  826. }
  827. });
  828. return compare;
  829. };
  830. exports.use = function (usable) {
  831. return resolveDispatcher().use(usable);
  832. };
  833. exports.useCallback = function (callback, deps) {
  834. return resolveDispatcher().useCallback(callback, deps);
  835. };
  836. exports.useDebugValue = function (value, formatterFn) {
  837. return resolveDispatcher().useDebugValue(value, formatterFn);
  838. };
  839. exports.useId = function () {
  840. return resolveDispatcher().useId();
  841. };
  842. exports.useMemo = function (create, deps) {
  843. return resolveDispatcher().useMemo(create, deps);
  844. };
  845. exports.version = "19.2.4";
  846. })();