diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index cda1457139e48..21fb7cb0767c9 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -f8de255e94540f9018d8196b3a34da500707c39b +5309f102854475030fb91ab732141411b49c1126 diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index a7dca3ed77cf3..4f84c9442b3c1 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-classic-3ad03410"; +var ReactVersion = "18.3.0-www-classic-ef8c27b4"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 8a5f4a1e1f73e..3571e0eb0294e 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-modern-761d713e"; +var ReactVersion = "18.3.0-www-modern-8f2253b3"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index baa2442d2353c..3f2acfd678b70 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -649,4 +649,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-14f80a86"; +exports.version = "18.3.0-www-classic-bb5eb625"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index b34d8f1afdd01..ad2de59a89a29 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -641,4 +641,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-aa2fcc30"; +exports.version = "18.3.0-www-modern-fb2ee8b7"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index 20dd87c37cfe6..5f9ee302afa26 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -660,7 +660,7 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-7784bb55"; +exports.version = "18.3.0-www-classic-14fbbcad"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 495c7471411d9..395d0154d41ba 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-classic-71ac99e3"; +var ReactVersion = "18.3.0-www-classic-0351539c"; var LegacyRoot = 0; var ConcurrentRoot = 1; diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 31acb587c37b4..6f7c851a9e49f 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-modern-3f0beb5f"; +var ReactVersion = "18.3.0-www-modern-8f2253b3"; var LegacyRoot = 0; var ConcurrentRoot = 1; diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index a90b9f42d90fc..2f0ce3751ec66 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -10193,7 +10193,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-classic-6456653a", + version: "18.3.0-www-classic-e9bbdab3", rendererPackageName: "react-art" }; var internals$jscomp$inline_1323 = { @@ -10224,7 +10224,7 @@ var internals$jscomp$inline_1323 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-6456653a" + reconcilerVersion: "18.3.0-www-classic-e9bbdab3" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1324 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index f7077a039086d..ca5a7452c67b4 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -9858,7 +9858,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-modern-aa16ddda", + version: "18.3.0-www-modern-fb2ee8b7", rendererPackageName: "react-art" }; var internals$jscomp$inline_1303 = { @@ -9889,7 +9889,7 @@ var internals$jscomp$inline_1303 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-aa16ddda" + reconcilerVersion: "18.3.0-www-modern-fb2ee8b7" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1304 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index 33a665f25e0b9..e40aa7c876c60 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -34197,7 +34197,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-b88f6baf"; +var ReactVersion = "18.3.0-www-classic-5baf6ff7"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 135ab9e64c50d..5cbbd31fb5253 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -34042,7 +34042,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-aa16ddda"; +var ReactVersion = "18.3.0-www-modern-63d79e46"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index e2265a9a85b41..3680555d31f71 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -16653,7 +16653,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1827 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-c16ecf65", + version: "18.3.0-www-classic-0351539c", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2201 = { @@ -16683,7 +16683,7 @@ var internals$jscomp$inline_2201 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-c16ecf65" + reconcilerVersion: "18.3.0-www-classic-0351539c" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2202 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16926,4 +16926,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-c16ecf65"; +exports.version = "18.3.0-www-classic-0351539c"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 6fd02a3a60b5a..3ad9b213f531c 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -17428,7 +17428,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1912 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-9b66dabc", + version: "18.3.0-www-classic-e9bbdab3", rendererPackageName: "react-dom" }; (function (internals) { @@ -17472,7 +17472,7 @@ var devToolsConfig$jscomp$inline_1912 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-9b66dabc" + reconcilerVersion: "18.3.0-www-classic-e9bbdab3" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -17702,7 +17702,7 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-9b66dabc"; +exports.version = "18.3.0-www-classic-e9bbdab3"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index fcb0abda7bb6d..feac4b641d412 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -16949,7 +16949,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1871 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-d9798121", + version: "18.3.0-www-modern-e23887cd", rendererPackageName: "react-dom" }; (function (internals) { @@ -16994,7 +16994,7 @@ var devToolsConfig$jscomp$inline_1871 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-d9798121" + reconcilerVersion: "18.3.0-www-modern-e23887cd" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -17152,7 +17152,7 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-d9798121"; +exports.version = "18.3.0-www-modern-e23887cd"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 530a21a6f3329..3040036f70e06 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-classic-5070839c"; +var ReactVersion = "18.3.0-www-classic-6fc3b80a"; // This refers to a WWW module. var warningWWW = require("warning"); diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index df52b0af67ca8..d1c84a6a2cf3d 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-modern-8c5679db"; +var ReactVersion = "18.3.0-www-modern-044bfa2a"; // This refers to a WWW module. var warningWWW = require("warning"); diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 58cf14d6216b8..1ff521af74760 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -4011,4 +4011,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-classic-de54f0a0"; +exports.version = "18.3.0-www-classic-cf2c1840"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index d5171d429de6a..f8d5688fbd625 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -3909,4 +3909,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-modern-ef656b14"; +exports.version = "18.3.0-www-modern-c8d57b01"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 400dba2c39b6a..871405c3eb1d9 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -16982,7 +16982,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1856 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-71ac99e3", + version: "18.3.0-www-classic-aeada19b", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2235 = { @@ -17012,7 +17012,7 @@ var internals$jscomp$inline_2235 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-71ac99e3" + reconcilerVersion: "18.3.0-www-classic-aeada19b" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2236 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17406,4 +17406,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-71ac99e3"; +exports.version = "18.3.0-www-classic-aeada19b"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 6e395db240f11..1bc9603737d1d 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -16564,7 +16564,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1815 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-761d713e", + version: "18.3.0-www-modern-8f2253b3", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2199 = { @@ -16595,7 +16595,7 @@ var internals$jscomp$inline_2199 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-761d713e" + reconcilerVersion: "18.3.0-www-modern-8f2253b3" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2200 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16917,4 +16917,4 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-761d713e"; +exports.version = "18.3.0-www-modern-8f2253b3"; diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.classic.js b/compiled/facebook-www/ReactFlightDOMRelayClient-dev.classic.js deleted file mode 100644 index fc8355bd43546..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.classic.js +++ /dev/null @@ -1,1607 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -'use strict'; - -if (__DEV__) { - (function() { -"use strict"; - -var ReactFlightDOMRelayClientIntegration = require("ReactFlightDOMRelayClientIntegration"); -var ReactDOM = require("react-dom"); -var React = require("react"); - -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); -} - -function resolveClientReference(bundlerConfig, metadata) { - return ReactFlightDOMRelayClientIntegration.resolveClientReference(metadata); -} - -function parseModelRecursively(response, parentObj, key, value) { - if (typeof value === "string") { - return parseModelString(response, parentObj, key, value); - } - - if (typeof value === "object" && value !== null) { - if (isArray(value)) { - var parsedValue = []; - - for (var i = 0; i < value.length; i++) { - parsedValue[i] = parseModelRecursively( - response, - value, - "" + i, - value[i] - ); - } - - return parseModelTuple(response, parsedValue); - } else { - var _parsedValue = {}; - - for (var innerKey in value) { - _parsedValue[innerKey] = parseModelRecursively( - response, - value, - innerKey, - value[innerKey] - ); - } - - return _parsedValue; - } - } - - return value; -} - -var dummy = {}; -function parseModel(response, json) { - return parseModelRecursively(response, dummy, "", json); -} - -var ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -// This client file is in the shared folder because it applies to both SSR and browser contexts. -var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher; -function dispatchHint(code, model) { - var dispatcher = ReactDOMCurrentDispatcher.current; - - if (dispatcher) { - var href, options; - - if (typeof model === "string") { - href = model; - } else { - href = model[0]; - options = model[1]; - } - - switch (code) { - case "D": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - dispatcher.prefetchDNS(href, options); - return; - } - - case "C": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - dispatcher.preconnect(href, options); - return; - } - - case "L": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - // $FlowFixMe[incompatible-call] options are not refined to their types by code - dispatcher.preload(href, options); - return; - } - - case "I": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - // $FlowFixMe[incompatible-call] options are not refined to their types by code - dispatcher.preinit(href, options); - return; - } - } - } -} - -// This refers to a WWW module. -var warningWWW = require("warning"); -function error(format) { - { - { - for ( - var _len2 = arguments.length, - args = new Array(_len2 > 1 ? _len2 - 1 : 0), - _key2 = 1; - _key2 < _len2; - _key2++ - ) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning("error", format, args); - } - } -} - -function printWarning(level, format, args) { - { - var React = require("react"); - - var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Defensive in case this is fired before React is initialized. - - if (ReactSharedInternals != null) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== "") { - format += "%s"; - args.push(stack); - } - } // TODO: don't ignore level and pass it down somewhere too. - - args.unshift(format); - args.unshift(false); - warningWWW.apply(null, args); - } -} - -// ATTENTION -// When adding new symbols to this file, -// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' -// The Symbol used to tag the ReactElement-like types. -var REACT_ELEMENT_TYPE = Symbol.for("react.element"); -var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); -var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); -var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); -var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); -var REACT_MEMO_TYPE = Symbol.for("react.memo"); -var REACT_LAZY_TYPE = Symbol.for("react.lazy"); -var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" -); -var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = "@@iterator"; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== "object") { - return null; - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === "function") { - return maybeIterator; - } - - return null; -} - -// in case they error. - -var jsxPropsParents = new WeakMap(); -var jsxChildrenParents = new WeakMap(); - -function isObjectPrototype(object) { - if (!object) { - return false; - } - - var ObjectPrototype = Object.prototype; - - if (object === ObjectPrototype) { - return true; - } // It might be an object from a different Realm which is - // still just a plain simple object. - - if (Object.getPrototypeOf(object)) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - if (!(names[i] in ObjectPrototype)) { - return false; - } - } - - return true; -} - -function isSimpleObject(object) { - if (!isObjectPrototype(Object.getPrototypeOf(object))) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - var descriptor = Object.getOwnPropertyDescriptor(object, names[i]); - - if (!descriptor) { - return false; - } - - if (!descriptor.enumerable) { - if ( - (names[i] === "key" || names[i] === "ref") && - typeof descriptor.get === "function" - ) { - // React adds key and ref getters to props objects to issue warnings. - // Those getters will not be transferred to the client, but that's ok, - // so we'll special case them. - continue; - } - - return false; - } - } - - return true; -} -function objectName(object) { - // $FlowFixMe[method-unbinding] - var name = Object.prototype.toString.call(object); - return name.replace(/^\[object (.*)\]$/, function (m, p0) { - return p0; - }); -} - -function describeKeyForErrorMessage(key) { - var encodedKey = JSON.stringify(key); - return '"' + key + '"' === encodedKey ? key : encodedKey; -} - -function describeValueForErrorMessage(value) { - switch (typeof value) { - case "string": { - return JSON.stringify( - value.length <= 10 ? value : value.slice(0, 10) + "..." - ); - } - - case "object": { - if (isArray(value)) { - return "[...]"; - } - - var name = objectName(value); - - if (name === "Object") { - return "{...}"; - } - - return name; - } - - case "function": - return "function"; - - default: - // eslint-disable-next-line react-internal/safe-string-coercion - return String(value); - } -} - -function describeElementType(type) { - if (typeof type === "string") { - return type; - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return "Suspense"; - - case REACT_SUSPENSE_LIST_TYPE: - return "SuspenseList"; - } - - if (typeof type === "object") { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeElementType(type.render); - - case REACT_MEMO_TYPE: - return describeElementType(type.type); - - case REACT_LAZY_TYPE: { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeElementType(init(payload)); - } catch (x) {} - } - } - } - - return ""; -} - -function describeObjectForErrorMessage(objectOrArray, expandedName) { - var objKind = objectName(objectOrArray); - - if (objKind !== "Object" && objKind !== "Array") { - return objKind; - } - - var str = ""; - var start = -1; - var length = 0; - - if (isArray(objectOrArray)) { - if (jsxChildrenParents.has(objectOrArray)) { - // Print JSX Children - var type = jsxChildrenParents.get(objectOrArray); - str = "<" + describeElementType(type) + ">"; - var array = objectOrArray; - - for (var i = 0; i < array.length; i++) { - var value = array[i]; - var substr = void 0; - - if (typeof value === "string") { - substr = value; - } else if (typeof value === "object" && value !== null) { - substr = "{" + describeObjectForErrorMessage(value) + "}"; - } else { - substr = "{" + describeValueForErrorMessage(value) + "}"; - } - - if ("" + i === expandedName) { - start = str.length; - length = substr.length; - str += substr; - } else if (substr.length < 15 && str.length + substr.length < 40) { - str += substr; - } else { - str += "{...}"; - } - } - - str += ""; - } else { - // Print Array - str = "["; - var _array = objectOrArray; - - for (var _i = 0; _i < _array.length; _i++) { - if (_i > 0) { - str += ", "; - } - - var _value = _array[_i]; - - var _substr = void 0; - - if (typeof _value === "object" && _value !== null) { - _substr = describeObjectForErrorMessage(_value); - } else { - _substr = describeValueForErrorMessage(_value); - } - - if ("" + _i === expandedName) { - start = str.length; - length = _substr.length; - str += _substr; - } else if (_substr.length < 10 && str.length + _substr.length < 40) { - str += _substr; - } else { - str += "..."; - } - } - - str += "]"; - } - } else { - if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) { - str = "<" + describeElementType(objectOrArray.type) + "/>"; - } else if (jsxPropsParents.has(objectOrArray)) { - // Print JSX - var _type = jsxPropsParents.get(objectOrArray); - - str = "<" + (describeElementType(_type) || "..."); - var object = objectOrArray; - var names = Object.keys(object); - - for (var _i2 = 0; _i2 < names.length; _i2++) { - str += " "; - var name = names[_i2]; - str += describeKeyForErrorMessage(name) + "="; - var _value2 = object[name]; - - var _substr2 = void 0; - - if ( - name === expandedName && - typeof _value2 === "object" && - _value2 !== null - ) { - _substr2 = describeObjectForErrorMessage(_value2); - } else { - _substr2 = describeValueForErrorMessage(_value2); - } - - if (typeof _value2 !== "string") { - _substr2 = "{" + _substr2 + "}"; - } - - if (name === expandedName) { - start = str.length; - length = _substr2.length; - str += _substr2; - } else if (_substr2.length < 10 && str.length + _substr2.length < 40) { - str += _substr2; - } else { - str += "..."; - } - } - - str += ">"; - } else { - // Print Object - str = "{"; - var _object = objectOrArray; - - var _names = Object.keys(_object); - - for (var _i3 = 0; _i3 < _names.length; _i3++) { - if (_i3 > 0) { - str += ", "; - } - - var _name = _names[_i3]; - str += describeKeyForErrorMessage(_name) + ": "; - var _value3 = _object[_name]; - - var _substr3 = void 0; - - if (typeof _value3 === "object" && _value3 !== null) { - _substr3 = describeObjectForErrorMessage(_value3); - } else { - _substr3 = describeValueForErrorMessage(_value3); - } - - if (_name === expandedName) { - start = str.length; - length = _substr3.length; - str += _substr3; - } else if (_substr3.length < 10 && str.length + _substr3.length < 40) { - str += _substr3; - } else { - str += "..."; - } - } - - str += "}"; - } - } - - if (expandedName === undefined) { - return str; - } - - if (start > -1 && length > 0) { - var highlight = " ".repeat(start) + "^".repeat(length); - return "\n " + str + "\n " + highlight; - } - - return "\n " + str; -} - -var knownServerReferences = new WeakMap(); // Serializable values -// Thenable -// function serializeByValueID(id: number): string { -// return '$' + id.toString(16); -// } - -function serializePromiseID(id) { - return "$@" + id.toString(16); -} - -function serializeServerReferenceID(id) { - return "$F" + id.toString(16); -} - -function serializeSymbolReference(name) { - return "$S" + name; -} - -function serializeFormDataReference(id) { - // Why K? F is "Function". D is "Date". What else? - return "$K" + id.toString(16); -} - -function serializeNumber(number) { - if (Number.isFinite(number)) { - if (number === 0 && 1 / number === -Infinity) { - return "$-0"; - } else { - return number; - } - } else { - if (number === Infinity) { - return "$Infinity"; - } else if (number === -Infinity) { - return "$-Infinity"; - } else { - return "$NaN"; - } - } -} - -function serializeUndefined() { - return "$undefined"; -} - -function serializeDateFromDateJSON(dateJSON) { - // JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString. - // We need only tack on a $D prefix. - return "$D" + dateJSON; -} - -function serializeBigInt(n) { - return "$n" + n.toString(10); -} - -function escapeStringValue(value) { - if (value[0] === "$") { - // We need to escape $ prefixed strings since we use those to encode - // references to IDs and as special symbol values. - return "$" + value; - } else { - return value; - } -} - -function processReply(root, formFieldPrefix, resolve, reject) { - var nextPartId = 1; - var pendingParts = 0; - var formData = null; - - function resolveToJSON(key, value) { - var parent = this; // Make sure that `parent[key]` wasn't JSONified before `value` was passed to us - - { - // $FlowFixMe[incompatible-use] - var originalValue = parent[key]; - - if ( - typeof originalValue === "object" && - originalValue !== value && - !(originalValue instanceof Date) - ) { - if (objectName(originalValue) !== "Object") { - error( - "Only plain objects can be passed to Server Functions from the Client. " + - "%s objects are not supported.%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } else { - error( - "Only plain objects can be passed to Server Functions from the Client. " + - "Objects with toJSON methods are not supported. Convert it manually " + - "to a simple value before passing it to props.%s", - describeObjectForErrorMessage(parent, key) - ); - } - } - } - - if (value === null) { - return null; - } - - if (typeof value === "object") { - // $FlowFixMe[method-unbinding] - if (typeof value.then === "function") { - // We assume that any object with a .then property is a "Thenable" type, - // or a Promise type. Either of which can be represented by a Promise. - if (formData === null) { - // Upgrade to use FormData to allow us to stream this value. - formData = new FormData(); - } - - pendingParts++; - var promiseId = nextPartId++; - var thenable = value; - thenable.then( - function (partValue) { - var partJSON = JSON.stringify(partValue, resolveToJSON); // $FlowFixMe[incompatible-type] We know it's not null because we assigned it above. - - var data = formData; // eslint-disable-next-line react-internal/safe-string-coercion - - data.append(formFieldPrefix + promiseId, partJSON); - pendingParts--; - - if (pendingParts === 0) { - resolve(data); - } - }, - function (reason) { - // In the future we could consider serializing this as an error - // that throws on the server instead. - reject(reason); - } - ); - return serializePromiseID(promiseId); - } // TODO: Should we the Object.prototype.toString.call() to test for cross-realm objects? - - if (value instanceof FormData) { - if (formData === null) { - // Upgrade to use FormData to allow us to use rich objects as its values. - formData = new FormData(); - } - - var data = formData; - var refId = nextPartId++; // Copy all the form fields with a prefix for this reference. - // These must come first in the form order because we assume that all the - // fields are available before this is referenced. - - var prefix = formFieldPrefix + refId + "_"; // $FlowFixMe[prop-missing]: FormData has forEach. - - value.forEach(function (originalValue, originalKey) { - data.append(prefix + originalKey, originalValue); - }); - return serializeFormDataReference(refId); - } - - if (!isArray(value)) { - var iteratorFn = getIteratorFn(value); - - if (iteratorFn) { - return Array.from(value); - } - } - - { - if (value !== null && !isArray(value)) { - // Verify that this is a simple plain object. - if (value.$$typeof === REACT_ELEMENT_TYPE) { - error( - "React Element cannot be passed to Server Functions from the Client.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (value.$$typeof === REACT_LAZY_TYPE) { - error( - "React Lazy cannot be passed to Server Functions from the Client.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (value.$$typeof === REACT_PROVIDER_TYPE) { - error( - "React Context Providers cannot be passed to Server Functions from the Client.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (objectName(value) !== "Object") { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "%s objects are not supported.%s", - objectName(value), - describeObjectForErrorMessage(parent, key) - ); - } else if (!isSimpleObject(value)) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Classes or other objects with methods are not supported.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(value); - - if (symbols.length > 0) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Objects with symbol properties like %s are not supported.%s", - symbols[0].description, - describeObjectForErrorMessage(parent, key) - ); - } - } - } - } // $FlowFixMe[incompatible-return] - - return value; - } - - if (typeof value === "string") { - // TODO: Maybe too clever. If we support URL there's no similar trick. - if (value[value.length - 1] === "Z") { - // Possibly a Date, whose toJSON automatically calls toISOString - // $FlowFixMe[incompatible-use] - var _originalValue = parent[key]; - - if (_originalValue instanceof Date) { - return serializeDateFromDateJSON(value); - } - } - - return escapeStringValue(value); - } - - if (typeof value === "boolean") { - return value; - } - - if (typeof value === "number") { - return serializeNumber(value); - } - - if (typeof value === "undefined") { - return serializeUndefined(); - } - - if (typeof value === "function") { - var metaData = knownServerReferences.get(value); - - if (metaData !== undefined) { - var metaDataJSON = JSON.stringify(metaData, resolveToJSON); - - if (formData === null) { - // Upgrade to use FormData to allow us to stream this value. - formData = new FormData(); - } // The reference to this function came from the same client so we can pass it back. - - var _refId = nextPartId++; // eslint-disable-next-line react-internal/safe-string-coercion - - formData.set(formFieldPrefix + _refId, metaDataJSON); - return serializeServerReferenceID(_refId); - } - - throw new Error( - "Client Functions cannot be passed directly to Server Functions. " + - "Only Functions passed from the Server can be passed back again." - ); - } - - if (typeof value === "symbol") { - // $FlowFixMe[incompatible-type] `description` might be undefined - var name = value.description; - - if (Symbol.for(name) !== value) { - throw new Error( - "Only global symbols received from Symbol.for(...) can be passed to Server Functions. " + - ("The symbol Symbol.for(" + // $FlowFixMe[incompatible-type] `description` might be undefined - value.description + - ") cannot be found among global symbols.") - ); - } - - return serializeSymbolReference(name); - } - - if (typeof value === "bigint") { - return serializeBigInt(value); - } - - throw new Error( - "Type " + - typeof value + - " is not supported as an argument to a Server Function." - ); - } // $FlowFixMe[incompatible-type] it's not going to be undefined because we'll encode it. - - var json = JSON.stringify(root, resolveToJSON); - - if (formData === null) { - // If it's a simple data structure, we just use plain JSON. - resolve(json); - } else { - // Otherwise, we use FormData to let us stream in the result. - formData.set(formFieldPrefix + "0", json); - - if (pendingParts === 0) { - // $FlowFixMe[incompatible-call] this has already been refined. - resolve(formData); - } - } -} -var boundCache = new WeakMap(); - -function encodeFormData(reference) { - var resolve, reject; // We need to have a handle on the thenable so that we can synchronously set - // its status from processReply, when it can complete synchronously. - - var thenable = new Promise(function (res, rej) { - resolve = res; - reject = rej; - }); - processReply( - reference, - "", - function (body) { - if (typeof body === "string") { - var data = new FormData(); - data.append("0", body); - body = data; - } - - var fulfilled = thenable; - fulfilled.status = "fulfilled"; - fulfilled.value = body; - resolve(body); - }, - function (e) { - var rejected = thenable; - rejected.status = "rejected"; - rejected.reason = e; - reject(e); - } - ); - return thenable; -} - -function encodeFormAction(identifierPrefix) { - var reference = knownServerReferences.get(this); - - if (!reference) { - throw new Error( - "Tried to encode a Server Action from a different instance than the encoder is from. " + - "This is a bug in React." - ); - } - - var data = null; - var name; - var boundPromise = reference.bound; - - if (boundPromise !== null) { - var thenable = boundCache.get(reference); - - if (!thenable) { - thenable = encodeFormData(reference); - boundCache.set(reference, thenable); - } - - if (thenable.status === "rejected") { - throw thenable.reason; - } else if (thenable.status !== "fulfilled") { - throw thenable; - } - - var encodedFormData = thenable.value; // This is hacky but we need the identifier prefix to be added to - // all fields but the suspense cache would break since we might get - // a new identifier each time. So we just append it at the end instead. - - var prefixedData = new FormData(); // $FlowFixMe[prop-missing] - - encodedFormData.forEach(function (value, key) { - prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value); - }); - data = prefixedData; // We encode the name of the prefix containing the data. - - name = "$ACTION_REF_" + identifierPrefix; - } else { - // This is the simple case so we can just encode the ID. - name = "$ACTION_ID_" + reference.id; - } - - return { - name: name, - method: "POST", - encType: "multipart/form-data", - data: data - }; -} - -var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -var ContextRegistry = ReactSharedInternals.ContextRegistry; -function getOrCreateServerContext(globalName) { - if (!ContextRegistry[globalName]) { - ContextRegistry[globalName] = React.createServerContext( - globalName, // $FlowFixMe[incompatible-call] function signature doesn't reflect the symbol value - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ); - } - - return ContextRegistry[globalName]; -} - -var PENDING = "pending"; -var BLOCKED = "blocked"; -var RESOLVED_MODEL = "resolved_model"; -var RESOLVED_MODULE = "resolved_module"; -var INITIALIZED = "fulfilled"; -var ERRORED = "rejected"; // $FlowFixMe[missing-this-annot] - -function Chunk(status, value, reason, response) { - this.status = status; - this.value = value; - this.reason = reason; - this._response = response; -} // We subclass Promise.prototype so that we get other methods like .catch - -Chunk.prototype = Object.create(Promise.prototype); // TODO: This doesn't return a new Promise chain unlike the real .then - -Chunk.prototype.then = function (resolve, reject) { - var chunk = this; // If we have resolved content, we try to initialize it first which - // might put us back into one of the other states. - - switch (chunk.status) { - case RESOLVED_MODEL: - initializeModelChunk(chunk); - break; - - case RESOLVED_MODULE: - initializeModuleChunk(chunk); - break; - } // The status might have changed after initialization. - - switch (chunk.status) { - case INITIALIZED: - resolve(chunk.value); - break; - - case PENDING: - case BLOCKED: - if (resolve) { - if (chunk.value === null) { - chunk.value = []; - } - - chunk.value.push(resolve); - } - - if (reject) { - if (chunk.reason === null) { - chunk.reason = []; - } - - chunk.reason.push(reject); - } - - break; - - default: - reject(chunk.reason); - break; - } -}; - -function readChunk(chunk) { - // If we have resolved content, we try to initialize it first which - // might put us back into one of the other states. - switch (chunk.status) { - case RESOLVED_MODEL: - initializeModelChunk(chunk); - break; - - case RESOLVED_MODULE: - initializeModuleChunk(chunk); - break; - } // The status might have changed after initialization. - - switch (chunk.status) { - case INITIALIZED: - return chunk.value; - - case PENDING: - case BLOCKED: - // eslint-disable-next-line no-throw-literal - throw chunk; - - default: - throw chunk.reason; - } -} - -function getRoot(response) { - var chunk = getChunk(response, 0); - return chunk; -} - -function createPendingChunk(response) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(PENDING, null, null, response); -} - -function createBlockedChunk(response) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(BLOCKED, null, null, response); -} - -function createErrorChunk(response, error) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(ERRORED, null, error, response); -} - -function wakeChunk(listeners, value) { - for (var i = 0; i < listeners.length; i++) { - var listener = listeners[i]; - listener(value); - } -} - -function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { - switch (chunk.status) { - case INITIALIZED: - wakeChunk(resolveListeners, chunk.value); - break; - - case PENDING: - case BLOCKED: - chunk.value = resolveListeners; - chunk.reason = rejectListeners; - break; - - case ERRORED: - if (rejectListeners) { - wakeChunk(rejectListeners, chunk.reason); - } - - break; - } -} - -function triggerErrorOnChunk(chunk, error) { - if (chunk.status !== PENDING && chunk.status !== BLOCKED) { - // We already resolved. We didn't expect to see this. - return; - } - - var listeners = chunk.reason; - var erroredChunk = chunk; - erroredChunk.status = ERRORED; - erroredChunk.reason = error; - - if (listeners !== null) { - wakeChunk(listeners, error); - } -} - -function createResolvedModelChunk(response, value) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(RESOLVED_MODEL, value, null, response); -} - -function createResolvedModuleChunk(response, value) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(RESOLVED_MODULE, value, null, response); -} - -function resolveModelChunk(chunk, value) { - if (chunk.status !== PENDING) { - // We already resolved. We didn't expect to see this. - return; - } - - var resolveListeners = chunk.value; - var rejectListeners = chunk.reason; - var resolvedChunk = chunk; - resolvedChunk.status = RESOLVED_MODEL; - resolvedChunk.value = value; - - if (resolveListeners !== null) { - // This is unfortunate that we're reading this eagerly if - // we already have listeners attached since they might no - // longer be rendered or might not be the highest pri. - initializeModelChunk(resolvedChunk); // The status might have changed after initialization. - - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners); - } -} - -function resolveModuleChunk(chunk, value) { - if (chunk.status !== PENDING && chunk.status !== BLOCKED) { - // We already resolved. We didn't expect to see this. - return; - } - - var resolveListeners = chunk.value; - var rejectListeners = chunk.reason; - var resolvedChunk = chunk; - resolvedChunk.status = RESOLVED_MODULE; - resolvedChunk.value = value; - - if (resolveListeners !== null) { - initializeModuleChunk(resolvedChunk); - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners); - } -} - -var initializingChunk = null; -var initializingChunkBlockedModel = null; - -function initializeModelChunk(chunk) { - var prevChunk = initializingChunk; - var prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; - - try { - var value = parseModel(chunk._response, chunk.value); - - if ( - initializingChunkBlockedModel !== null && - initializingChunkBlockedModel.deps > 0 - ) { - initializingChunkBlockedModel.value = value; // We discovered new dependencies on modules that are not yet resolved. - // We have to go the BLOCKED state until they're resolved. - - var blockedChunk = chunk; - blockedChunk.status = BLOCKED; - blockedChunk.value = null; - blockedChunk.reason = null; - } else { - var initializedChunk = chunk; - initializedChunk.status = INITIALIZED; - initializedChunk.value = value; - } - } catch (error) { - var erroredChunk = chunk; - erroredChunk.status = ERRORED; - erroredChunk.reason = error; - } finally { - initializingChunk = prevChunk; - initializingChunkBlockedModel = prevBlocked; - } -} - -function initializeModuleChunk(chunk) { - try { - var value = ReactFlightDOMRelayClientIntegration.requireModule(chunk.value); - var initializedChunk = chunk; - initializedChunk.status = INITIALIZED; - initializedChunk.value = value; - } catch (error) { - var erroredChunk = chunk; - erroredChunk.status = ERRORED; - erroredChunk.reason = error; - } -} // Report that any missing chunks in the model is now going to throw this -// error upon read. Also notify any pending promises. - -function reportGlobalError(response, error) { - response._chunks.forEach(function (chunk) { - // If this chunk was already resolved or errored, it won't - // trigger an error but if it wasn't then we need to - // because we won't be getting any new data to resolve it. - if (chunk.status === PENDING) { - triggerErrorOnChunk(chunk, error); - } - }); -} - -function createElement(type, key, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: null, - props: props, - // Record the component responsible for creating this element. - _owner: null - }; - - { - // We don't really need to add any of these but keeping them for good measure. - // Unfortunately, _store is enumerable in jest matchers so for equality to - // work, I need to keep it or make _store non-enumerable in the other file. - element._store = {}; - Object.defineProperty(element._store, "validated", { - configurable: false, - enumerable: false, - writable: true, - value: true // This element has already been validated on the server. - }); - Object.defineProperty(element, "_self", { - configurable: false, - enumerable: false, - writable: false, - value: null - }); - Object.defineProperty(element, "_source", { - configurable: false, - enumerable: false, - writable: false, - value: null - }); - } - - return element; -} - -function createLazyChunkWrapper(chunk) { - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: chunk, - _init: readChunk - }; - return lazyType; -} - -function getChunk(response, id) { - var chunks = response._chunks; - var chunk = chunks.get(id); - - if (!chunk) { - chunk = createPendingChunk(response); - chunks.set(id, chunk); - } - - return chunk; -} - -function createModelResolver(chunk, parentObject, key) { - var blocked; - - if (initializingChunkBlockedModel) { - blocked = initializingChunkBlockedModel; - blocked.deps++; - } else { - blocked = initializingChunkBlockedModel = { - deps: 1, - value: null - }; - } - - return function (value) { - parentObject[key] = value; - blocked.deps--; - - if (blocked.deps === 0) { - if (chunk.status !== BLOCKED) { - return; - } - - var resolveListeners = chunk.value; - var initializedChunk = chunk; - initializedChunk.status = INITIALIZED; - initializedChunk.value = blocked.value; - - if (resolveListeners !== null) { - wakeChunk(resolveListeners, blocked.value); - } - } - }; -} - -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; -} - -function createServerReferenceProxy(response, metaData) { - var callServer = response._callServer; - - var proxy = function () { - // $FlowFixMe[method-unbinding] - var args = Array.prototype.slice.call(arguments); - var p = metaData.bound; - - if (!p) { - return callServer(metaData.id, args); - } - - if (p.status === INITIALIZED) { - var bound = p.value; - return callServer(metaData.id, bound.concat(args)); - } // Since this is a fake Promise whose .then doesn't chain, we have to wrap it. - // TODO: Remove the wrapper once that's fixed. - - return Promise.resolve(p).then(function (bound) { - return callServer(metaData.id, bound.concat(args)); - }); - }; // Expose encoder for use by SSR. - // TODO: Only expose this in SSR builds and not the browser client. - - proxy.$$FORM_ACTION = encodeFormAction; - knownServerReferences.set(proxy, metaData); - return proxy; -} - -function parseModelString(response, parentObject, key, value) { - if (value[0] === "$") { - if (value === "$") { - // A very common symbol. - return REACT_ELEMENT_TYPE; - } - - switch (value[1]) { - case "$": { - // This was an escaped string value. - return value.slice(1); - } - - case "L": { - // Lazy node - var id = parseInt(value.slice(2), 16); - var chunk = getChunk(response, id); // We create a React.lazy wrapper around any lazy values. - // When passed into React, we'll know how to suspend on this. - - return createLazyChunkWrapper(chunk); - } - - case "@": { - // Promise - var _id = parseInt(value.slice(2), 16); - - var _chunk = getChunk(response, _id); - - return _chunk; - } - - case "S": { - // Symbol - return Symbol.for(value.slice(2)); - } - - case "P": { - // Server Context Provider - return getOrCreateServerContext(value.slice(2)).Provider; - } - - case "F": { - // Server Reference - var _id2 = parseInt(value.slice(2), 16); - - var _chunk2 = getChunk(response, _id2); - - switch (_chunk2.status) { - case RESOLVED_MODEL: - initializeModelChunk(_chunk2); - break; - } // The status might have changed after initialization. - - switch (_chunk2.status) { - case INITIALIZED: { - var metadata = _chunk2.value; - return createServerReferenceProxy(response, metadata); - } - // We always encode it first in the stream so it won't be pending. - - default: - throw _chunk2.reason; - } - } - - case "I": { - // $Infinity - return Infinity; - } - - case "-": { - // $-0 or $-Infinity - if (value === "$-0") { - return -0; - } else { - return -Infinity; - } - } - - case "N": { - // $NaN - return NaN; - } - - case "u": { - // matches "$undefined" - // Special encoding for `undefined` which can't be serialized as JSON otherwise. - return undefined; - } - - case "D": { - // Date - return new Date(Date.parse(value.slice(2))); - } - - case "n": { - // BigInt - return BigInt(value.slice(2)); - } - - default: { - // We assume that anything else is a reference ID. - var _id3 = parseInt(value.slice(1), 16); - - var _chunk3 = getChunk(response, _id3); - - switch (_chunk3.status) { - case RESOLVED_MODEL: - initializeModelChunk(_chunk3); - break; - - case RESOLVED_MODULE: - initializeModuleChunk(_chunk3); - break; - } // The status might have changed after initialization. - - switch (_chunk3.status) { - case INITIALIZED: - return _chunk3.value; - - case PENDING: - case BLOCKED: - var parentChunk = initializingChunk; - - _chunk3.then( - createModelResolver(parentChunk, parentObject, key), - createModelReject(parentChunk) - ); - - return null; - - default: - throw _chunk3.reason; - } - } - } - } - - return value; -} -function parseModelTuple(response, value) { - var tuple = value; - - if (tuple[0] === REACT_ELEMENT_TYPE) { - // TODO: Consider having React just directly accept these arrays as elements. - // Or even change the ReactElement type to be an array. - return createElement(tuple[1], tuple[2], tuple[3]); - } - - return value; -} - -function missingCall() { - throw new Error( - 'Trying to call a function from "use server" but the callServer option ' + - "was not implemented in your router runtime." - ); -} - -function createResponse(bundlerConfig, callServer) { - var chunks = new Map(); - var response = { - _bundlerConfig: bundlerConfig, - _callServer: callServer !== undefined ? callServer : missingCall, - _chunks: chunks - }; - return response; -} -function resolveModel(response, id, model) { - var chunks = response._chunks; - var chunk = chunks.get(id); - - if (!chunk) { - chunks.set(id, createResolvedModelChunk(response, model)); - } else { - resolveModelChunk(chunk, model); - } -} -function resolveModule(response, id, model) { - var chunks = response._chunks; - var chunk = chunks.get(id); - var clientReferenceMetadata = parseModel(response, model); - var clientReference = resolveClientReference( - response._bundlerConfig, - clientReferenceMetadata - ); // TODO: Add an option to encode modules that are lazy loaded. - // For now we preload all modules as early as possible since it's likely - // that we'll need them. - - var promise = - ReactFlightDOMRelayClientIntegration.preloadModule(clientReference); - - if (promise) { - var blockedChunk; - - if (!chunk) { - // Technically, we should just treat promise as the chunk in this - // case. Because it'll just behave as any other promise. - blockedChunk = createBlockedChunk(response); - chunks.set(id, blockedChunk); - } else { - // This can't actually happen because we don't have any forward - // references to modules. - blockedChunk = chunk; - blockedChunk.status = BLOCKED; - } - - promise.then( - function () { - return resolveModuleChunk(blockedChunk, clientReference); - }, - function (error) { - return triggerErrorOnChunk(blockedChunk, error); - } - ); - } else { - if (!chunk) { - chunks.set(id, createResolvedModuleChunk(response, clientReference)); - } else { - // This can't actually happen because we don't have any forward - // references to modules. - resolveModuleChunk(chunk, clientReference); - } - } -} -function resolveErrorDev(response, id, digest, message, stack) { - var error = new Error( - message || - "An error occurred in the Server Components render but no message was provided" - ); - error.stack = stack; - error.digest = digest; - var errorWithDigest = error; - var chunks = response._chunks; - var chunk = chunks.get(id); - - if (!chunk) { - chunks.set(id, createErrorChunk(response, errorWithDigest)); - } else { - triggerErrorOnChunk(chunk, errorWithDigest); - } -} -function resolveHint(response, code, model) { - var hintModel = parseModel(response, model); - dispatchHint(code, hintModel); -} -function close(response) { - // In case there are any remaining unresolved chunks, they won't - // be resolved now. So we need to issue an error to those. - // Ideally we should be able to early bail out if we kept a - // ref count of pending chunks. - reportGlobalError(response, new Error("Connection closed.")); -} - -function resolveRow(response, chunk) { - if (chunk[0] === "O") { - // $FlowFixMe[incompatible-call] unable to refine on array indices - resolveModel(response, chunk[1], chunk[2]); - } else if (chunk[0] === "I") { - // $FlowFixMe[incompatible-call] unable to refine on array indices - resolveModule(response, chunk[1], chunk[2]); - } else if (chunk[0] === "H") { - // $FlowFixMe[incompatible-call] unable to refine on array indices - resolveHint(response, chunk[1], chunk[2]); - } else { - { - resolveErrorDev( - response, // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - chunk[1], // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - // $FlowFixMe[prop-missing] - // $FlowFixMe[incompatible-use] - chunk[2].digest, // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - // $FlowFixMe[incompatible-use] - chunk[2].message || "", // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - // $FlowFixMe[incompatible-use] - chunk[2].stack || "" - ); - } - } -} - -exports.close = close; -exports.createResponse = createResponse; -exports.getRoot = getRoot; -exports.resolveRow = resolveRow; - - })(); -} diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.modern.js b/compiled/facebook-www/ReactFlightDOMRelayClient-dev.modern.js deleted file mode 100644 index fc8355bd43546..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.modern.js +++ /dev/null @@ -1,1607 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -'use strict'; - -if (__DEV__) { - (function() { -"use strict"; - -var ReactFlightDOMRelayClientIntegration = require("ReactFlightDOMRelayClientIntegration"); -var ReactDOM = require("react-dom"); -var React = require("react"); - -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); -} - -function resolveClientReference(bundlerConfig, metadata) { - return ReactFlightDOMRelayClientIntegration.resolveClientReference(metadata); -} - -function parseModelRecursively(response, parentObj, key, value) { - if (typeof value === "string") { - return parseModelString(response, parentObj, key, value); - } - - if (typeof value === "object" && value !== null) { - if (isArray(value)) { - var parsedValue = []; - - for (var i = 0; i < value.length; i++) { - parsedValue[i] = parseModelRecursively( - response, - value, - "" + i, - value[i] - ); - } - - return parseModelTuple(response, parsedValue); - } else { - var _parsedValue = {}; - - for (var innerKey in value) { - _parsedValue[innerKey] = parseModelRecursively( - response, - value, - innerKey, - value[innerKey] - ); - } - - return _parsedValue; - } - } - - return value; -} - -var dummy = {}; -function parseModel(response, json) { - return parseModelRecursively(response, dummy, "", json); -} - -var ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -// This client file is in the shared folder because it applies to both SSR and browser contexts. -var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher; -function dispatchHint(code, model) { - var dispatcher = ReactDOMCurrentDispatcher.current; - - if (dispatcher) { - var href, options; - - if (typeof model === "string") { - href = model; - } else { - href = model[0]; - options = model[1]; - } - - switch (code) { - case "D": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - dispatcher.prefetchDNS(href, options); - return; - } - - case "C": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - dispatcher.preconnect(href, options); - return; - } - - case "L": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - // $FlowFixMe[incompatible-call] options are not refined to their types by code - dispatcher.preload(href, options); - return; - } - - case "I": { - // $FlowFixMe[prop-missing] options are not refined to their types by code - // $FlowFixMe[incompatible-call] options are not refined to their types by code - dispatcher.preinit(href, options); - return; - } - } - } -} - -// This refers to a WWW module. -var warningWWW = require("warning"); -function error(format) { - { - { - for ( - var _len2 = arguments.length, - args = new Array(_len2 > 1 ? _len2 - 1 : 0), - _key2 = 1; - _key2 < _len2; - _key2++ - ) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning("error", format, args); - } - } -} - -function printWarning(level, format, args) { - { - var React = require("react"); - - var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Defensive in case this is fired before React is initialized. - - if (ReactSharedInternals != null) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== "") { - format += "%s"; - args.push(stack); - } - } // TODO: don't ignore level and pass it down somewhere too. - - args.unshift(format); - args.unshift(false); - warningWWW.apply(null, args); - } -} - -// ATTENTION -// When adding new symbols to this file, -// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' -// The Symbol used to tag the ReactElement-like types. -var REACT_ELEMENT_TYPE = Symbol.for("react.element"); -var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); -var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); -var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); -var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); -var REACT_MEMO_TYPE = Symbol.for("react.memo"); -var REACT_LAZY_TYPE = Symbol.for("react.lazy"); -var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" -); -var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = "@@iterator"; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== "object") { - return null; - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === "function") { - return maybeIterator; - } - - return null; -} - -// in case they error. - -var jsxPropsParents = new WeakMap(); -var jsxChildrenParents = new WeakMap(); - -function isObjectPrototype(object) { - if (!object) { - return false; - } - - var ObjectPrototype = Object.prototype; - - if (object === ObjectPrototype) { - return true; - } // It might be an object from a different Realm which is - // still just a plain simple object. - - if (Object.getPrototypeOf(object)) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - if (!(names[i] in ObjectPrototype)) { - return false; - } - } - - return true; -} - -function isSimpleObject(object) { - if (!isObjectPrototype(Object.getPrototypeOf(object))) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - var descriptor = Object.getOwnPropertyDescriptor(object, names[i]); - - if (!descriptor) { - return false; - } - - if (!descriptor.enumerable) { - if ( - (names[i] === "key" || names[i] === "ref") && - typeof descriptor.get === "function" - ) { - // React adds key and ref getters to props objects to issue warnings. - // Those getters will not be transferred to the client, but that's ok, - // so we'll special case them. - continue; - } - - return false; - } - } - - return true; -} -function objectName(object) { - // $FlowFixMe[method-unbinding] - var name = Object.prototype.toString.call(object); - return name.replace(/^\[object (.*)\]$/, function (m, p0) { - return p0; - }); -} - -function describeKeyForErrorMessage(key) { - var encodedKey = JSON.stringify(key); - return '"' + key + '"' === encodedKey ? key : encodedKey; -} - -function describeValueForErrorMessage(value) { - switch (typeof value) { - case "string": { - return JSON.stringify( - value.length <= 10 ? value : value.slice(0, 10) + "..." - ); - } - - case "object": { - if (isArray(value)) { - return "[...]"; - } - - var name = objectName(value); - - if (name === "Object") { - return "{...}"; - } - - return name; - } - - case "function": - return "function"; - - default: - // eslint-disable-next-line react-internal/safe-string-coercion - return String(value); - } -} - -function describeElementType(type) { - if (typeof type === "string") { - return type; - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return "Suspense"; - - case REACT_SUSPENSE_LIST_TYPE: - return "SuspenseList"; - } - - if (typeof type === "object") { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeElementType(type.render); - - case REACT_MEMO_TYPE: - return describeElementType(type.type); - - case REACT_LAZY_TYPE: { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeElementType(init(payload)); - } catch (x) {} - } - } - } - - return ""; -} - -function describeObjectForErrorMessage(objectOrArray, expandedName) { - var objKind = objectName(objectOrArray); - - if (objKind !== "Object" && objKind !== "Array") { - return objKind; - } - - var str = ""; - var start = -1; - var length = 0; - - if (isArray(objectOrArray)) { - if (jsxChildrenParents.has(objectOrArray)) { - // Print JSX Children - var type = jsxChildrenParents.get(objectOrArray); - str = "<" + describeElementType(type) + ">"; - var array = objectOrArray; - - for (var i = 0; i < array.length; i++) { - var value = array[i]; - var substr = void 0; - - if (typeof value === "string") { - substr = value; - } else if (typeof value === "object" && value !== null) { - substr = "{" + describeObjectForErrorMessage(value) + "}"; - } else { - substr = "{" + describeValueForErrorMessage(value) + "}"; - } - - if ("" + i === expandedName) { - start = str.length; - length = substr.length; - str += substr; - } else if (substr.length < 15 && str.length + substr.length < 40) { - str += substr; - } else { - str += "{...}"; - } - } - - str += ""; - } else { - // Print Array - str = "["; - var _array = objectOrArray; - - for (var _i = 0; _i < _array.length; _i++) { - if (_i > 0) { - str += ", "; - } - - var _value = _array[_i]; - - var _substr = void 0; - - if (typeof _value === "object" && _value !== null) { - _substr = describeObjectForErrorMessage(_value); - } else { - _substr = describeValueForErrorMessage(_value); - } - - if ("" + _i === expandedName) { - start = str.length; - length = _substr.length; - str += _substr; - } else if (_substr.length < 10 && str.length + _substr.length < 40) { - str += _substr; - } else { - str += "..."; - } - } - - str += "]"; - } - } else { - if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) { - str = "<" + describeElementType(objectOrArray.type) + "/>"; - } else if (jsxPropsParents.has(objectOrArray)) { - // Print JSX - var _type = jsxPropsParents.get(objectOrArray); - - str = "<" + (describeElementType(_type) || "..."); - var object = objectOrArray; - var names = Object.keys(object); - - for (var _i2 = 0; _i2 < names.length; _i2++) { - str += " "; - var name = names[_i2]; - str += describeKeyForErrorMessage(name) + "="; - var _value2 = object[name]; - - var _substr2 = void 0; - - if ( - name === expandedName && - typeof _value2 === "object" && - _value2 !== null - ) { - _substr2 = describeObjectForErrorMessage(_value2); - } else { - _substr2 = describeValueForErrorMessage(_value2); - } - - if (typeof _value2 !== "string") { - _substr2 = "{" + _substr2 + "}"; - } - - if (name === expandedName) { - start = str.length; - length = _substr2.length; - str += _substr2; - } else if (_substr2.length < 10 && str.length + _substr2.length < 40) { - str += _substr2; - } else { - str += "..."; - } - } - - str += ">"; - } else { - // Print Object - str = "{"; - var _object = objectOrArray; - - var _names = Object.keys(_object); - - for (var _i3 = 0; _i3 < _names.length; _i3++) { - if (_i3 > 0) { - str += ", "; - } - - var _name = _names[_i3]; - str += describeKeyForErrorMessage(_name) + ": "; - var _value3 = _object[_name]; - - var _substr3 = void 0; - - if (typeof _value3 === "object" && _value3 !== null) { - _substr3 = describeObjectForErrorMessage(_value3); - } else { - _substr3 = describeValueForErrorMessage(_value3); - } - - if (_name === expandedName) { - start = str.length; - length = _substr3.length; - str += _substr3; - } else if (_substr3.length < 10 && str.length + _substr3.length < 40) { - str += _substr3; - } else { - str += "..."; - } - } - - str += "}"; - } - } - - if (expandedName === undefined) { - return str; - } - - if (start > -1 && length > 0) { - var highlight = " ".repeat(start) + "^".repeat(length); - return "\n " + str + "\n " + highlight; - } - - return "\n " + str; -} - -var knownServerReferences = new WeakMap(); // Serializable values -// Thenable -// function serializeByValueID(id: number): string { -// return '$' + id.toString(16); -// } - -function serializePromiseID(id) { - return "$@" + id.toString(16); -} - -function serializeServerReferenceID(id) { - return "$F" + id.toString(16); -} - -function serializeSymbolReference(name) { - return "$S" + name; -} - -function serializeFormDataReference(id) { - // Why K? F is "Function". D is "Date". What else? - return "$K" + id.toString(16); -} - -function serializeNumber(number) { - if (Number.isFinite(number)) { - if (number === 0 && 1 / number === -Infinity) { - return "$-0"; - } else { - return number; - } - } else { - if (number === Infinity) { - return "$Infinity"; - } else if (number === -Infinity) { - return "$-Infinity"; - } else { - return "$NaN"; - } - } -} - -function serializeUndefined() { - return "$undefined"; -} - -function serializeDateFromDateJSON(dateJSON) { - // JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString. - // We need only tack on a $D prefix. - return "$D" + dateJSON; -} - -function serializeBigInt(n) { - return "$n" + n.toString(10); -} - -function escapeStringValue(value) { - if (value[0] === "$") { - // We need to escape $ prefixed strings since we use those to encode - // references to IDs and as special symbol values. - return "$" + value; - } else { - return value; - } -} - -function processReply(root, formFieldPrefix, resolve, reject) { - var nextPartId = 1; - var pendingParts = 0; - var formData = null; - - function resolveToJSON(key, value) { - var parent = this; // Make sure that `parent[key]` wasn't JSONified before `value` was passed to us - - { - // $FlowFixMe[incompatible-use] - var originalValue = parent[key]; - - if ( - typeof originalValue === "object" && - originalValue !== value && - !(originalValue instanceof Date) - ) { - if (objectName(originalValue) !== "Object") { - error( - "Only plain objects can be passed to Server Functions from the Client. " + - "%s objects are not supported.%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } else { - error( - "Only plain objects can be passed to Server Functions from the Client. " + - "Objects with toJSON methods are not supported. Convert it manually " + - "to a simple value before passing it to props.%s", - describeObjectForErrorMessage(parent, key) - ); - } - } - } - - if (value === null) { - return null; - } - - if (typeof value === "object") { - // $FlowFixMe[method-unbinding] - if (typeof value.then === "function") { - // We assume that any object with a .then property is a "Thenable" type, - // or a Promise type. Either of which can be represented by a Promise. - if (formData === null) { - // Upgrade to use FormData to allow us to stream this value. - formData = new FormData(); - } - - pendingParts++; - var promiseId = nextPartId++; - var thenable = value; - thenable.then( - function (partValue) { - var partJSON = JSON.stringify(partValue, resolveToJSON); // $FlowFixMe[incompatible-type] We know it's not null because we assigned it above. - - var data = formData; // eslint-disable-next-line react-internal/safe-string-coercion - - data.append(formFieldPrefix + promiseId, partJSON); - pendingParts--; - - if (pendingParts === 0) { - resolve(data); - } - }, - function (reason) { - // In the future we could consider serializing this as an error - // that throws on the server instead. - reject(reason); - } - ); - return serializePromiseID(promiseId); - } // TODO: Should we the Object.prototype.toString.call() to test for cross-realm objects? - - if (value instanceof FormData) { - if (formData === null) { - // Upgrade to use FormData to allow us to use rich objects as its values. - formData = new FormData(); - } - - var data = formData; - var refId = nextPartId++; // Copy all the form fields with a prefix for this reference. - // These must come first in the form order because we assume that all the - // fields are available before this is referenced. - - var prefix = formFieldPrefix + refId + "_"; // $FlowFixMe[prop-missing]: FormData has forEach. - - value.forEach(function (originalValue, originalKey) { - data.append(prefix + originalKey, originalValue); - }); - return serializeFormDataReference(refId); - } - - if (!isArray(value)) { - var iteratorFn = getIteratorFn(value); - - if (iteratorFn) { - return Array.from(value); - } - } - - { - if (value !== null && !isArray(value)) { - // Verify that this is a simple plain object. - if (value.$$typeof === REACT_ELEMENT_TYPE) { - error( - "React Element cannot be passed to Server Functions from the Client.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (value.$$typeof === REACT_LAZY_TYPE) { - error( - "React Lazy cannot be passed to Server Functions from the Client.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (value.$$typeof === REACT_PROVIDER_TYPE) { - error( - "React Context Providers cannot be passed to Server Functions from the Client.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (objectName(value) !== "Object") { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "%s objects are not supported.%s", - objectName(value), - describeObjectForErrorMessage(parent, key) - ); - } else if (!isSimpleObject(value)) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Classes or other objects with methods are not supported.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(value); - - if (symbols.length > 0) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Objects with symbol properties like %s are not supported.%s", - symbols[0].description, - describeObjectForErrorMessage(parent, key) - ); - } - } - } - } // $FlowFixMe[incompatible-return] - - return value; - } - - if (typeof value === "string") { - // TODO: Maybe too clever. If we support URL there's no similar trick. - if (value[value.length - 1] === "Z") { - // Possibly a Date, whose toJSON automatically calls toISOString - // $FlowFixMe[incompatible-use] - var _originalValue = parent[key]; - - if (_originalValue instanceof Date) { - return serializeDateFromDateJSON(value); - } - } - - return escapeStringValue(value); - } - - if (typeof value === "boolean") { - return value; - } - - if (typeof value === "number") { - return serializeNumber(value); - } - - if (typeof value === "undefined") { - return serializeUndefined(); - } - - if (typeof value === "function") { - var metaData = knownServerReferences.get(value); - - if (metaData !== undefined) { - var metaDataJSON = JSON.stringify(metaData, resolveToJSON); - - if (formData === null) { - // Upgrade to use FormData to allow us to stream this value. - formData = new FormData(); - } // The reference to this function came from the same client so we can pass it back. - - var _refId = nextPartId++; // eslint-disable-next-line react-internal/safe-string-coercion - - formData.set(formFieldPrefix + _refId, metaDataJSON); - return serializeServerReferenceID(_refId); - } - - throw new Error( - "Client Functions cannot be passed directly to Server Functions. " + - "Only Functions passed from the Server can be passed back again." - ); - } - - if (typeof value === "symbol") { - // $FlowFixMe[incompatible-type] `description` might be undefined - var name = value.description; - - if (Symbol.for(name) !== value) { - throw new Error( - "Only global symbols received from Symbol.for(...) can be passed to Server Functions. " + - ("The symbol Symbol.for(" + // $FlowFixMe[incompatible-type] `description` might be undefined - value.description + - ") cannot be found among global symbols.") - ); - } - - return serializeSymbolReference(name); - } - - if (typeof value === "bigint") { - return serializeBigInt(value); - } - - throw new Error( - "Type " + - typeof value + - " is not supported as an argument to a Server Function." - ); - } // $FlowFixMe[incompatible-type] it's not going to be undefined because we'll encode it. - - var json = JSON.stringify(root, resolveToJSON); - - if (formData === null) { - // If it's a simple data structure, we just use plain JSON. - resolve(json); - } else { - // Otherwise, we use FormData to let us stream in the result. - formData.set(formFieldPrefix + "0", json); - - if (pendingParts === 0) { - // $FlowFixMe[incompatible-call] this has already been refined. - resolve(formData); - } - } -} -var boundCache = new WeakMap(); - -function encodeFormData(reference) { - var resolve, reject; // We need to have a handle on the thenable so that we can synchronously set - // its status from processReply, when it can complete synchronously. - - var thenable = new Promise(function (res, rej) { - resolve = res; - reject = rej; - }); - processReply( - reference, - "", - function (body) { - if (typeof body === "string") { - var data = new FormData(); - data.append("0", body); - body = data; - } - - var fulfilled = thenable; - fulfilled.status = "fulfilled"; - fulfilled.value = body; - resolve(body); - }, - function (e) { - var rejected = thenable; - rejected.status = "rejected"; - rejected.reason = e; - reject(e); - } - ); - return thenable; -} - -function encodeFormAction(identifierPrefix) { - var reference = knownServerReferences.get(this); - - if (!reference) { - throw new Error( - "Tried to encode a Server Action from a different instance than the encoder is from. " + - "This is a bug in React." - ); - } - - var data = null; - var name; - var boundPromise = reference.bound; - - if (boundPromise !== null) { - var thenable = boundCache.get(reference); - - if (!thenable) { - thenable = encodeFormData(reference); - boundCache.set(reference, thenable); - } - - if (thenable.status === "rejected") { - throw thenable.reason; - } else if (thenable.status !== "fulfilled") { - throw thenable; - } - - var encodedFormData = thenable.value; // This is hacky but we need the identifier prefix to be added to - // all fields but the suspense cache would break since we might get - // a new identifier each time. So we just append it at the end instead. - - var prefixedData = new FormData(); // $FlowFixMe[prop-missing] - - encodedFormData.forEach(function (value, key) { - prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value); - }); - data = prefixedData; // We encode the name of the prefix containing the data. - - name = "$ACTION_REF_" + identifierPrefix; - } else { - // This is the simple case so we can just encode the ID. - name = "$ACTION_ID_" + reference.id; - } - - return { - name: name, - method: "POST", - encType: "multipart/form-data", - data: data - }; -} - -var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -var ContextRegistry = ReactSharedInternals.ContextRegistry; -function getOrCreateServerContext(globalName) { - if (!ContextRegistry[globalName]) { - ContextRegistry[globalName] = React.createServerContext( - globalName, // $FlowFixMe[incompatible-call] function signature doesn't reflect the symbol value - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ); - } - - return ContextRegistry[globalName]; -} - -var PENDING = "pending"; -var BLOCKED = "blocked"; -var RESOLVED_MODEL = "resolved_model"; -var RESOLVED_MODULE = "resolved_module"; -var INITIALIZED = "fulfilled"; -var ERRORED = "rejected"; // $FlowFixMe[missing-this-annot] - -function Chunk(status, value, reason, response) { - this.status = status; - this.value = value; - this.reason = reason; - this._response = response; -} // We subclass Promise.prototype so that we get other methods like .catch - -Chunk.prototype = Object.create(Promise.prototype); // TODO: This doesn't return a new Promise chain unlike the real .then - -Chunk.prototype.then = function (resolve, reject) { - var chunk = this; // If we have resolved content, we try to initialize it first which - // might put us back into one of the other states. - - switch (chunk.status) { - case RESOLVED_MODEL: - initializeModelChunk(chunk); - break; - - case RESOLVED_MODULE: - initializeModuleChunk(chunk); - break; - } // The status might have changed after initialization. - - switch (chunk.status) { - case INITIALIZED: - resolve(chunk.value); - break; - - case PENDING: - case BLOCKED: - if (resolve) { - if (chunk.value === null) { - chunk.value = []; - } - - chunk.value.push(resolve); - } - - if (reject) { - if (chunk.reason === null) { - chunk.reason = []; - } - - chunk.reason.push(reject); - } - - break; - - default: - reject(chunk.reason); - break; - } -}; - -function readChunk(chunk) { - // If we have resolved content, we try to initialize it first which - // might put us back into one of the other states. - switch (chunk.status) { - case RESOLVED_MODEL: - initializeModelChunk(chunk); - break; - - case RESOLVED_MODULE: - initializeModuleChunk(chunk); - break; - } // The status might have changed after initialization. - - switch (chunk.status) { - case INITIALIZED: - return chunk.value; - - case PENDING: - case BLOCKED: - // eslint-disable-next-line no-throw-literal - throw chunk; - - default: - throw chunk.reason; - } -} - -function getRoot(response) { - var chunk = getChunk(response, 0); - return chunk; -} - -function createPendingChunk(response) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(PENDING, null, null, response); -} - -function createBlockedChunk(response) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(BLOCKED, null, null, response); -} - -function createErrorChunk(response, error) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(ERRORED, null, error, response); -} - -function wakeChunk(listeners, value) { - for (var i = 0; i < listeners.length; i++) { - var listener = listeners[i]; - listener(value); - } -} - -function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { - switch (chunk.status) { - case INITIALIZED: - wakeChunk(resolveListeners, chunk.value); - break; - - case PENDING: - case BLOCKED: - chunk.value = resolveListeners; - chunk.reason = rejectListeners; - break; - - case ERRORED: - if (rejectListeners) { - wakeChunk(rejectListeners, chunk.reason); - } - - break; - } -} - -function triggerErrorOnChunk(chunk, error) { - if (chunk.status !== PENDING && chunk.status !== BLOCKED) { - // We already resolved. We didn't expect to see this. - return; - } - - var listeners = chunk.reason; - var erroredChunk = chunk; - erroredChunk.status = ERRORED; - erroredChunk.reason = error; - - if (listeners !== null) { - wakeChunk(listeners, error); - } -} - -function createResolvedModelChunk(response, value) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(RESOLVED_MODEL, value, null, response); -} - -function createResolvedModuleChunk(response, value) { - // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors - return new Chunk(RESOLVED_MODULE, value, null, response); -} - -function resolveModelChunk(chunk, value) { - if (chunk.status !== PENDING) { - // We already resolved. We didn't expect to see this. - return; - } - - var resolveListeners = chunk.value; - var rejectListeners = chunk.reason; - var resolvedChunk = chunk; - resolvedChunk.status = RESOLVED_MODEL; - resolvedChunk.value = value; - - if (resolveListeners !== null) { - // This is unfortunate that we're reading this eagerly if - // we already have listeners attached since they might no - // longer be rendered or might not be the highest pri. - initializeModelChunk(resolvedChunk); // The status might have changed after initialization. - - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners); - } -} - -function resolveModuleChunk(chunk, value) { - if (chunk.status !== PENDING && chunk.status !== BLOCKED) { - // We already resolved. We didn't expect to see this. - return; - } - - var resolveListeners = chunk.value; - var rejectListeners = chunk.reason; - var resolvedChunk = chunk; - resolvedChunk.status = RESOLVED_MODULE; - resolvedChunk.value = value; - - if (resolveListeners !== null) { - initializeModuleChunk(resolvedChunk); - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners); - } -} - -var initializingChunk = null; -var initializingChunkBlockedModel = null; - -function initializeModelChunk(chunk) { - var prevChunk = initializingChunk; - var prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; - - try { - var value = parseModel(chunk._response, chunk.value); - - if ( - initializingChunkBlockedModel !== null && - initializingChunkBlockedModel.deps > 0 - ) { - initializingChunkBlockedModel.value = value; // We discovered new dependencies on modules that are not yet resolved. - // We have to go the BLOCKED state until they're resolved. - - var blockedChunk = chunk; - blockedChunk.status = BLOCKED; - blockedChunk.value = null; - blockedChunk.reason = null; - } else { - var initializedChunk = chunk; - initializedChunk.status = INITIALIZED; - initializedChunk.value = value; - } - } catch (error) { - var erroredChunk = chunk; - erroredChunk.status = ERRORED; - erroredChunk.reason = error; - } finally { - initializingChunk = prevChunk; - initializingChunkBlockedModel = prevBlocked; - } -} - -function initializeModuleChunk(chunk) { - try { - var value = ReactFlightDOMRelayClientIntegration.requireModule(chunk.value); - var initializedChunk = chunk; - initializedChunk.status = INITIALIZED; - initializedChunk.value = value; - } catch (error) { - var erroredChunk = chunk; - erroredChunk.status = ERRORED; - erroredChunk.reason = error; - } -} // Report that any missing chunks in the model is now going to throw this -// error upon read. Also notify any pending promises. - -function reportGlobalError(response, error) { - response._chunks.forEach(function (chunk) { - // If this chunk was already resolved or errored, it won't - // trigger an error but if it wasn't then we need to - // because we won't be getting any new data to resolve it. - if (chunk.status === PENDING) { - triggerErrorOnChunk(chunk, error); - } - }); -} - -function createElement(type, key, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: null, - props: props, - // Record the component responsible for creating this element. - _owner: null - }; - - { - // We don't really need to add any of these but keeping them for good measure. - // Unfortunately, _store is enumerable in jest matchers so for equality to - // work, I need to keep it or make _store non-enumerable in the other file. - element._store = {}; - Object.defineProperty(element._store, "validated", { - configurable: false, - enumerable: false, - writable: true, - value: true // This element has already been validated on the server. - }); - Object.defineProperty(element, "_self", { - configurable: false, - enumerable: false, - writable: false, - value: null - }); - Object.defineProperty(element, "_source", { - configurable: false, - enumerable: false, - writable: false, - value: null - }); - } - - return element; -} - -function createLazyChunkWrapper(chunk) { - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: chunk, - _init: readChunk - }; - return lazyType; -} - -function getChunk(response, id) { - var chunks = response._chunks; - var chunk = chunks.get(id); - - if (!chunk) { - chunk = createPendingChunk(response); - chunks.set(id, chunk); - } - - return chunk; -} - -function createModelResolver(chunk, parentObject, key) { - var blocked; - - if (initializingChunkBlockedModel) { - blocked = initializingChunkBlockedModel; - blocked.deps++; - } else { - blocked = initializingChunkBlockedModel = { - deps: 1, - value: null - }; - } - - return function (value) { - parentObject[key] = value; - blocked.deps--; - - if (blocked.deps === 0) { - if (chunk.status !== BLOCKED) { - return; - } - - var resolveListeners = chunk.value; - var initializedChunk = chunk; - initializedChunk.status = INITIALIZED; - initializedChunk.value = blocked.value; - - if (resolveListeners !== null) { - wakeChunk(resolveListeners, blocked.value); - } - } - }; -} - -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; -} - -function createServerReferenceProxy(response, metaData) { - var callServer = response._callServer; - - var proxy = function () { - // $FlowFixMe[method-unbinding] - var args = Array.prototype.slice.call(arguments); - var p = metaData.bound; - - if (!p) { - return callServer(metaData.id, args); - } - - if (p.status === INITIALIZED) { - var bound = p.value; - return callServer(metaData.id, bound.concat(args)); - } // Since this is a fake Promise whose .then doesn't chain, we have to wrap it. - // TODO: Remove the wrapper once that's fixed. - - return Promise.resolve(p).then(function (bound) { - return callServer(metaData.id, bound.concat(args)); - }); - }; // Expose encoder for use by SSR. - // TODO: Only expose this in SSR builds and not the browser client. - - proxy.$$FORM_ACTION = encodeFormAction; - knownServerReferences.set(proxy, metaData); - return proxy; -} - -function parseModelString(response, parentObject, key, value) { - if (value[0] === "$") { - if (value === "$") { - // A very common symbol. - return REACT_ELEMENT_TYPE; - } - - switch (value[1]) { - case "$": { - // This was an escaped string value. - return value.slice(1); - } - - case "L": { - // Lazy node - var id = parseInt(value.slice(2), 16); - var chunk = getChunk(response, id); // We create a React.lazy wrapper around any lazy values. - // When passed into React, we'll know how to suspend on this. - - return createLazyChunkWrapper(chunk); - } - - case "@": { - // Promise - var _id = parseInt(value.slice(2), 16); - - var _chunk = getChunk(response, _id); - - return _chunk; - } - - case "S": { - // Symbol - return Symbol.for(value.slice(2)); - } - - case "P": { - // Server Context Provider - return getOrCreateServerContext(value.slice(2)).Provider; - } - - case "F": { - // Server Reference - var _id2 = parseInt(value.slice(2), 16); - - var _chunk2 = getChunk(response, _id2); - - switch (_chunk2.status) { - case RESOLVED_MODEL: - initializeModelChunk(_chunk2); - break; - } // The status might have changed after initialization. - - switch (_chunk2.status) { - case INITIALIZED: { - var metadata = _chunk2.value; - return createServerReferenceProxy(response, metadata); - } - // We always encode it first in the stream so it won't be pending. - - default: - throw _chunk2.reason; - } - } - - case "I": { - // $Infinity - return Infinity; - } - - case "-": { - // $-0 or $-Infinity - if (value === "$-0") { - return -0; - } else { - return -Infinity; - } - } - - case "N": { - // $NaN - return NaN; - } - - case "u": { - // matches "$undefined" - // Special encoding for `undefined` which can't be serialized as JSON otherwise. - return undefined; - } - - case "D": { - // Date - return new Date(Date.parse(value.slice(2))); - } - - case "n": { - // BigInt - return BigInt(value.slice(2)); - } - - default: { - // We assume that anything else is a reference ID. - var _id3 = parseInt(value.slice(1), 16); - - var _chunk3 = getChunk(response, _id3); - - switch (_chunk3.status) { - case RESOLVED_MODEL: - initializeModelChunk(_chunk3); - break; - - case RESOLVED_MODULE: - initializeModuleChunk(_chunk3); - break; - } // The status might have changed after initialization. - - switch (_chunk3.status) { - case INITIALIZED: - return _chunk3.value; - - case PENDING: - case BLOCKED: - var parentChunk = initializingChunk; - - _chunk3.then( - createModelResolver(parentChunk, parentObject, key), - createModelReject(parentChunk) - ); - - return null; - - default: - throw _chunk3.reason; - } - } - } - } - - return value; -} -function parseModelTuple(response, value) { - var tuple = value; - - if (tuple[0] === REACT_ELEMENT_TYPE) { - // TODO: Consider having React just directly accept these arrays as elements. - // Or even change the ReactElement type to be an array. - return createElement(tuple[1], tuple[2], tuple[3]); - } - - return value; -} - -function missingCall() { - throw new Error( - 'Trying to call a function from "use server" but the callServer option ' + - "was not implemented in your router runtime." - ); -} - -function createResponse(bundlerConfig, callServer) { - var chunks = new Map(); - var response = { - _bundlerConfig: bundlerConfig, - _callServer: callServer !== undefined ? callServer : missingCall, - _chunks: chunks - }; - return response; -} -function resolveModel(response, id, model) { - var chunks = response._chunks; - var chunk = chunks.get(id); - - if (!chunk) { - chunks.set(id, createResolvedModelChunk(response, model)); - } else { - resolveModelChunk(chunk, model); - } -} -function resolveModule(response, id, model) { - var chunks = response._chunks; - var chunk = chunks.get(id); - var clientReferenceMetadata = parseModel(response, model); - var clientReference = resolveClientReference( - response._bundlerConfig, - clientReferenceMetadata - ); // TODO: Add an option to encode modules that are lazy loaded. - // For now we preload all modules as early as possible since it's likely - // that we'll need them. - - var promise = - ReactFlightDOMRelayClientIntegration.preloadModule(clientReference); - - if (promise) { - var blockedChunk; - - if (!chunk) { - // Technically, we should just treat promise as the chunk in this - // case. Because it'll just behave as any other promise. - blockedChunk = createBlockedChunk(response); - chunks.set(id, blockedChunk); - } else { - // This can't actually happen because we don't have any forward - // references to modules. - blockedChunk = chunk; - blockedChunk.status = BLOCKED; - } - - promise.then( - function () { - return resolveModuleChunk(blockedChunk, clientReference); - }, - function (error) { - return triggerErrorOnChunk(blockedChunk, error); - } - ); - } else { - if (!chunk) { - chunks.set(id, createResolvedModuleChunk(response, clientReference)); - } else { - // This can't actually happen because we don't have any forward - // references to modules. - resolveModuleChunk(chunk, clientReference); - } - } -} -function resolveErrorDev(response, id, digest, message, stack) { - var error = new Error( - message || - "An error occurred in the Server Components render but no message was provided" - ); - error.stack = stack; - error.digest = digest; - var errorWithDigest = error; - var chunks = response._chunks; - var chunk = chunks.get(id); - - if (!chunk) { - chunks.set(id, createErrorChunk(response, errorWithDigest)); - } else { - triggerErrorOnChunk(chunk, errorWithDigest); - } -} -function resolveHint(response, code, model) { - var hintModel = parseModel(response, model); - dispatchHint(code, hintModel); -} -function close(response) { - // In case there are any remaining unresolved chunks, they won't - // be resolved now. So we need to issue an error to those. - // Ideally we should be able to early bail out if we kept a - // ref count of pending chunks. - reportGlobalError(response, new Error("Connection closed.")); -} - -function resolveRow(response, chunk) { - if (chunk[0] === "O") { - // $FlowFixMe[incompatible-call] unable to refine on array indices - resolveModel(response, chunk[1], chunk[2]); - } else if (chunk[0] === "I") { - // $FlowFixMe[incompatible-call] unable to refine on array indices - resolveModule(response, chunk[1], chunk[2]); - } else if (chunk[0] === "H") { - // $FlowFixMe[incompatible-call] unable to refine on array indices - resolveHint(response, chunk[1], chunk[2]); - } else { - { - resolveErrorDev( - response, // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - chunk[1], // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - // $FlowFixMe[prop-missing] - // $FlowFixMe[incompatible-use] - chunk[2].digest, // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - // $FlowFixMe[incompatible-use] - chunk[2].message || "", // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples. - // $FlowFixMe[incompatible-use] - chunk[2].stack || "" - ); - } - } -} - -exports.close = close; -exports.createResponse = createResponse; -exports.getRoot = getRoot; -exports.resolveRow = resolveRow; - - })(); -} diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.classic.js b/compiled/facebook-www/ReactFlightDOMRelayClient-prod.classic.js deleted file mode 100644 index e83f145a5d7f1..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.classic.js +++ /dev/null @@ -1,594 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -"use strict"; -var ReactFlightDOMRelayClientIntegration = require("ReactFlightDOMRelayClientIntegration"), - ReactDOM = require("react-dom"), - React = require("react"); -function formatProdErrorMessage(code) { - for ( - var url = "https://reactjs.org/docs/error-decoder.html?invariant=" + code, - i = 1; - i < arguments.length; - i++ - ) - url += "&args[]=" + encodeURIComponent(arguments[i]); - return ( - "Minified React error #" + - code + - "; visit " + - url + - " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." - ); -} -var isArrayImpl = Array.isArray; -function parseModelRecursively(response, parentObj, key, value) { - if ("string" === typeof value) - return parseModelString(response, parentObj, key, value); - if ("object" === typeof value && null !== value) { - if (isArrayImpl(value)) { - var parsedValue = []; - for (parentObj = 0; parentObj < value.length; parentObj++) - parsedValue[parentObj] = parseModelRecursively( - response, - value, - "" + parentObj, - value[parentObj] - ); - response = - parsedValue[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: parsedValue[1], - key: parsedValue[2], - ref: null, - props: parsedValue[3], - _owner: null - } - : parsedValue; - return response; - } - parentObj = {}; - for (parsedValue in value) - parentObj[parsedValue] = parseModelRecursively( - response, - value, - parsedValue, - value[parsedValue] - ); - return parentObj; - } - return value; -} -var dummy = {}, - ReactDOMCurrentDispatcher = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher, - REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" - ), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -function getIteratorFn(maybeIterable) { - if (null === maybeIterable || "object" !== typeof maybeIterable) return null; - maybeIterable = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable["@@iterator"]; - return "function" === typeof maybeIterable ? maybeIterable : null; -} -var knownServerReferences = new WeakMap(); -function serializeNumber(number) { - return Number.isFinite(number) - ? 0 === number && -Infinity === 1 / number - ? "$-0" - : number - : Infinity === number - ? "$Infinity" - : -Infinity === number - ? "$-Infinity" - : "$NaN"; -} -function processReply(root, formFieldPrefix, resolve, reject) { - function resolveToJSON(key, value) { - if (null === value) return null; - if ("object" === typeof value) { - if ("function" === typeof value.then) { - null === formData && (formData = new FormData()); - pendingParts++; - var promiseId = nextPartId++; - value.then( - function (partValue) { - partValue = JSON.stringify(partValue, resolveToJSON); - var data = formData; - data.append(formFieldPrefix + promiseId, partValue); - pendingParts--; - 0 === pendingParts && resolve(data); - }, - function (reason) { - reject(reason); - } - ); - return "$@" + promiseId.toString(16); - } - if (value instanceof FormData) { - null === formData && (formData = new FormData()); - var data = formData; - key = nextPartId++; - var prefix = formFieldPrefix + key + "_"; - value.forEach(function (originalValue, originalKey) { - data.append(prefix + originalKey, originalValue); - }); - return "$K" + key.toString(16); - } - return !isArrayImpl(value) && getIteratorFn(value) - ? Array.from(value) - : value; - } - if ("string" === typeof value) { - if ("Z" === value[value.length - 1] && this[key] instanceof Date) - return "$D" + value; - value = "$" === value[0] ? "$" + value : value; - return value; - } - if ("boolean" === typeof value) return value; - if ("number" === typeof value) return serializeNumber(value); - if ("undefined" === typeof value) return "$undefined"; - if ("function" === typeof value) { - value = knownServerReferences.get(value); - if (void 0 !== value) - return ( - (value = JSON.stringify(value, resolveToJSON)), - null === formData && (formData = new FormData()), - (key = nextPartId++), - formData.set(formFieldPrefix + key, value), - "$F" + key.toString(16) - ); - throw Error(formatProdErrorMessage(469)); - } - if ("symbol" === typeof value) { - key = value.description; - if (Symbol.for(key) !== value) - throw Error(formatProdErrorMessage(470, value.description)); - return "$S" + key; - } - if ("bigint" === typeof value) return "$n" + value.toString(10); - throw Error(formatProdErrorMessage(472, typeof value)); - } - var nextPartId = 1, - pendingParts = 0, - formData = null; - root = JSON.stringify(root, resolveToJSON); - null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), - 0 === pendingParts && resolve(formData)); -} -var boundCache = new WeakMap(); -function encodeFormData(reference) { - var resolve, - reject, - thenable = new Promise(function (res, rej) { - resolve = res; - reject = rej; - }); - processReply( - reference, - "", - function (body) { - if ("string" === typeof body) { - var data = new FormData(); - data.append("0", body); - body = data; - } - thenable.status = "fulfilled"; - thenable.value = body; - resolve(body); - }, - function (e) { - thenable.status = "rejected"; - thenable.reason = e; - reject(e); - } - ); - return thenable; -} -function encodeFormAction(identifierPrefix) { - var reference = knownServerReferences.get(this); - if (!reference) throw Error(formatProdErrorMessage(481)); - var data = null; - if (null !== reference.bound) { - data = boundCache.get(reference); - data || - ((data = encodeFormData(reference)), boundCache.set(reference, data)); - if ("rejected" === data.status) throw data.reason; - if ("fulfilled" !== data.status) throw data; - reference = data.value; - var prefixedData = new FormData(); - reference.forEach(function (value, key) { - prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value); - }); - data = prefixedData; - reference = "$ACTION_REF_" + identifierPrefix; - } else reference = "$ACTION_ID_" + reference.id; - return { - name: reference, - method: "POST", - encType: "multipart/form-data", - data: data - }; -} -var ContextRegistry = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ContextRegistry; -function Chunk(status, value, reason, response) { - this.status = status; - this.value = value; - this.reason = reason; - this._response = response; -} -Chunk.prototype = Object.create(Promise.prototype); -Chunk.prototype.then = function (resolve, reject) { - switch (this.status) { - case "resolved_model": - initializeModelChunk(this); - break; - case "resolved_module": - initializeModuleChunk(this); - } - switch (this.status) { - case "fulfilled": - resolve(this.value); - break; - case "pending": - case "blocked": - resolve && - (null === this.value && (this.value = []), this.value.push(resolve)); - reject && - (null === this.reason && (this.reason = []), this.reason.push(reject)); - break; - default: - reject(this.reason); - } -}; -function readChunk(chunk) { - switch (chunk.status) { - case "resolved_model": - initializeModelChunk(chunk); - break; - case "resolved_module": - initializeModuleChunk(chunk); - } - switch (chunk.status) { - case "fulfilled": - return chunk.value; - case "pending": - case "blocked": - throw chunk; - default: - throw chunk.reason; - } -} -function wakeChunk(listeners, value) { - for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value); -} -function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { - switch (chunk.status) { - case "fulfilled": - wakeChunk(resolveListeners, chunk.value); - break; - case "pending": - case "blocked": - chunk.value = resolveListeners; - chunk.reason = rejectListeners; - break; - case "rejected": - rejectListeners && wakeChunk(rejectListeners, chunk.reason); - } -} -function triggerErrorOnChunk(chunk, error) { - if ("pending" === chunk.status || "blocked" === chunk.status) { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && wakeChunk(listeners, error); - } -} -function resolveModuleChunk(chunk, value) { - if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; - chunk.status = "resolved_module"; - chunk.value = value; - null !== resolveListeners && - (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); - } -} -var initializingChunk = null, - initializingChunkBlockedModel = null; -function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; - try { - var value = parseModelRecursively(chunk._response, dummy, "", chunk.value); - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ? ((initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"), - (chunk.value = null), - (chunk.reason = null)) - : ((chunk.status = "fulfilled"), (chunk.value = value)); - } catch (error) { - (chunk.status = "rejected"), (chunk.reason = error); - } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); - } -} -function initializeModuleChunk(chunk) { - try { - var value = ReactFlightDOMRelayClientIntegration.requireModule(chunk.value); - chunk.status = "fulfilled"; - chunk.value = value; - } catch (error) { - (chunk.status = "rejected"), (chunk.reason = error); - } -} -function reportGlobalError(response, error) { - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); -} -function getChunk(response, id) { - var chunks = response._chunks, - chunk = chunks.get(id); - chunk || - ((chunk = new Chunk("pending", null, null, response)), - chunks.set(id, chunk)); - return chunk; -} -function createModelResolver(chunk, parentObject, key) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - blocked.deps++; - } else blocked = initializingChunkBlockedModel = { deps: 1, value: null }; - return function (value) { - parentObject[key] = value; - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; -} -function createServerReferenceProxy(response, metaData) { - function proxy() { - var args = Array.prototype.slice.call(arguments), - p = metaData.bound; - return p - ? "fulfilled" === p.status - ? callServer(metaData.id, p.value.concat(args)) - : Promise.resolve(p).then(function (bound) { - return callServer(metaData.id, bound.concat(args)); - }) - : callServer(metaData.id, args); - } - var callServer = response._callServer; - proxy.$$FORM_ACTION = encodeFormAction; - knownServerReferences.set(proxy, metaData); - return proxy; -} -function parseModelString(response, parentObject, key, value) { - if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; - switch (value[1]) { - case "$": - return value.slice(1); - case "L": - return ( - (parentObject = parseInt(value.slice(2), 16)), - (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } - ); - case "@": - return ( - (parentObject = parseInt(value.slice(2), 16)), - getChunk(response, parentObject) - ); - case "S": - return Symbol.for(value.slice(2)); - case "P": - return ( - (response = value.slice(2)), - ContextRegistry[response] || - (ContextRegistry[response] = React.createServerContext( - response, - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - )), - ContextRegistry[response].Provider - ); - case "F": - parentObject = parseInt(value.slice(2), 16); - parentObject = getChunk(response, parentObject); - switch (parentObject.status) { - case "resolved_model": - initializeModelChunk(parentObject); - } - switch (parentObject.status) { - case "fulfilled": - return createServerReferenceProxy(response, parentObject.value); - default: - throw parentObject.reason; - } - case "I": - return Infinity; - case "-": - return "$-0" === value ? -0 : -Infinity; - case "N": - return NaN; - case "u": - return; - case "D": - return new Date(Date.parse(value.slice(2))); - case "n": - return BigInt(value.slice(2)); - default: - value = parseInt(value.slice(1), 16); - response = getChunk(response, value); - switch (response.status) { - case "resolved_model": - initializeModelChunk(response); - break; - case "resolved_module": - initializeModuleChunk(response); - } - switch (response.status) { - case "fulfilled": - return response.value; - case "pending": - case "blocked": - return ( - (value = initializingChunk), - response.then( - createModelResolver(value, parentObject, key), - createModelReject(value) - ), - null - ); - default: - throw response.reason; - } - } - } - return value; -} -function missingCall() { - throw Error(formatProdErrorMessage(466)); -} -function resolveModule(response, id, model) { - var chunks = response._chunks, - chunk = chunks.get(id); - model = parseModelRecursively(response, dummy, "", model); - var clientReference = - ReactFlightDOMRelayClientIntegration.resolveClientReference(model); - if ( - (model = - ReactFlightDOMRelayClientIntegration.preloadModule(clientReference)) - ) { - if (chunk) { - var blockedChunk = chunk; - blockedChunk.status = "blocked"; - } else - (blockedChunk = new Chunk("blocked", null, null, response)), - chunks.set(id, blockedChunk); - model.then( - function () { - return resolveModuleChunk(blockedChunk, clientReference); - }, - function (error) { - return triggerErrorOnChunk(blockedChunk, error); - } - ); - } else - chunk - ? resolveModuleChunk(chunk, clientReference) - : chunks.set( - id, - new Chunk("resolved_module", clientReference, null, response) - ); -} -exports.close = function (response) { - reportGlobalError(response, Error(formatProdErrorMessage(412))); -}; -exports.createResponse = function (bundlerConfig, callServer) { - var chunks = new Map(); - return { - _bundlerConfig: bundlerConfig, - _callServer: void 0 !== callServer ? callServer : missingCall, - _chunks: chunks - }; -}; -exports.getRoot = function (response) { - return getChunk(response, 0); -}; -exports.resolveRow = function (response, chunk$jscomp$0) { - if ("O" === chunk$jscomp$0[0]) { - var id = chunk$jscomp$0[1], - model = chunk$jscomp$0[2]; - chunk$jscomp$0 = response._chunks; - var chunk = chunk$jscomp$0.get(id); - chunk - ? "pending" === chunk.status && - ((response = chunk.value), - (chunk$jscomp$0 = chunk.reason), - (chunk.status = "resolved_model"), - (chunk.value = model), - null !== response && - (initializeModelChunk(chunk), - wakeChunkIfInitialized(chunk, response, chunk$jscomp$0))) - : chunk$jscomp$0.set( - id, - new Chunk("resolved_model", model, null, response) - ); - } else if ("I" === chunk$jscomp$0[0]) - resolveModule(response, chunk$jscomp$0[1], chunk$jscomp$0[2]); - else if ("H" === chunk$jscomp$0[0]) { - if ( - ((model = chunk$jscomp$0[1]), - (response = parseModelRecursively( - response, - dummy, - "", - chunk$jscomp$0[2] - )), - (chunk$jscomp$0 = ReactDOMCurrentDispatcher.current)) - ) - switch ( - ("string" === typeof response - ? (id = response) - : ((id = response[0]), (chunk = response[1])), - model) - ) { - case "D": - chunk$jscomp$0.prefetchDNS(id, chunk); - break; - case "C": - chunk$jscomp$0.preconnect(id, chunk); - break; - case "L": - chunk$jscomp$0.preload(id, chunk); - break; - case "I": - chunk$jscomp$0.preinit(id, chunk); - } - } else - (model = chunk$jscomp$0[1]), - (chunk$jscomp$0 = chunk$jscomp$0[2].digest), - (chunk = Error(formatProdErrorMessage(441))), - (chunk.stack = "Error: " + chunk.message), - (chunk.digest = chunk$jscomp$0), - (chunk$jscomp$0 = response._chunks), - (id = chunk$jscomp$0.get(model)) - ? triggerErrorOnChunk(id, chunk) - : chunk$jscomp$0.set( - model, - new Chunk("rejected", null, chunk, response) - ); -}; diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.modern.js b/compiled/facebook-www/ReactFlightDOMRelayClient-prod.modern.js deleted file mode 100644 index e83f145a5d7f1..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.modern.js +++ /dev/null @@ -1,594 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -"use strict"; -var ReactFlightDOMRelayClientIntegration = require("ReactFlightDOMRelayClientIntegration"), - ReactDOM = require("react-dom"), - React = require("react"); -function formatProdErrorMessage(code) { - for ( - var url = "https://reactjs.org/docs/error-decoder.html?invariant=" + code, - i = 1; - i < arguments.length; - i++ - ) - url += "&args[]=" + encodeURIComponent(arguments[i]); - return ( - "Minified React error #" + - code + - "; visit " + - url + - " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." - ); -} -var isArrayImpl = Array.isArray; -function parseModelRecursively(response, parentObj, key, value) { - if ("string" === typeof value) - return parseModelString(response, parentObj, key, value); - if ("object" === typeof value && null !== value) { - if (isArrayImpl(value)) { - var parsedValue = []; - for (parentObj = 0; parentObj < value.length; parentObj++) - parsedValue[parentObj] = parseModelRecursively( - response, - value, - "" + parentObj, - value[parentObj] - ); - response = - parsedValue[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: parsedValue[1], - key: parsedValue[2], - ref: null, - props: parsedValue[3], - _owner: null - } - : parsedValue; - return response; - } - parentObj = {}; - for (parsedValue in value) - parentObj[parsedValue] = parseModelRecursively( - response, - value, - parsedValue, - value[parsedValue] - ); - return parentObj; - } - return value; -} -var dummy = {}, - ReactDOMCurrentDispatcher = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher, - REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" - ), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -function getIteratorFn(maybeIterable) { - if (null === maybeIterable || "object" !== typeof maybeIterable) return null; - maybeIterable = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable["@@iterator"]; - return "function" === typeof maybeIterable ? maybeIterable : null; -} -var knownServerReferences = new WeakMap(); -function serializeNumber(number) { - return Number.isFinite(number) - ? 0 === number && -Infinity === 1 / number - ? "$-0" - : number - : Infinity === number - ? "$Infinity" - : -Infinity === number - ? "$-Infinity" - : "$NaN"; -} -function processReply(root, formFieldPrefix, resolve, reject) { - function resolveToJSON(key, value) { - if (null === value) return null; - if ("object" === typeof value) { - if ("function" === typeof value.then) { - null === formData && (formData = new FormData()); - pendingParts++; - var promiseId = nextPartId++; - value.then( - function (partValue) { - partValue = JSON.stringify(partValue, resolveToJSON); - var data = formData; - data.append(formFieldPrefix + promiseId, partValue); - pendingParts--; - 0 === pendingParts && resolve(data); - }, - function (reason) { - reject(reason); - } - ); - return "$@" + promiseId.toString(16); - } - if (value instanceof FormData) { - null === formData && (formData = new FormData()); - var data = formData; - key = nextPartId++; - var prefix = formFieldPrefix + key + "_"; - value.forEach(function (originalValue, originalKey) { - data.append(prefix + originalKey, originalValue); - }); - return "$K" + key.toString(16); - } - return !isArrayImpl(value) && getIteratorFn(value) - ? Array.from(value) - : value; - } - if ("string" === typeof value) { - if ("Z" === value[value.length - 1] && this[key] instanceof Date) - return "$D" + value; - value = "$" === value[0] ? "$" + value : value; - return value; - } - if ("boolean" === typeof value) return value; - if ("number" === typeof value) return serializeNumber(value); - if ("undefined" === typeof value) return "$undefined"; - if ("function" === typeof value) { - value = knownServerReferences.get(value); - if (void 0 !== value) - return ( - (value = JSON.stringify(value, resolveToJSON)), - null === formData && (formData = new FormData()), - (key = nextPartId++), - formData.set(formFieldPrefix + key, value), - "$F" + key.toString(16) - ); - throw Error(formatProdErrorMessage(469)); - } - if ("symbol" === typeof value) { - key = value.description; - if (Symbol.for(key) !== value) - throw Error(formatProdErrorMessage(470, value.description)); - return "$S" + key; - } - if ("bigint" === typeof value) return "$n" + value.toString(10); - throw Error(formatProdErrorMessage(472, typeof value)); - } - var nextPartId = 1, - pendingParts = 0, - formData = null; - root = JSON.stringify(root, resolveToJSON); - null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), - 0 === pendingParts && resolve(formData)); -} -var boundCache = new WeakMap(); -function encodeFormData(reference) { - var resolve, - reject, - thenable = new Promise(function (res, rej) { - resolve = res; - reject = rej; - }); - processReply( - reference, - "", - function (body) { - if ("string" === typeof body) { - var data = new FormData(); - data.append("0", body); - body = data; - } - thenable.status = "fulfilled"; - thenable.value = body; - resolve(body); - }, - function (e) { - thenable.status = "rejected"; - thenable.reason = e; - reject(e); - } - ); - return thenable; -} -function encodeFormAction(identifierPrefix) { - var reference = knownServerReferences.get(this); - if (!reference) throw Error(formatProdErrorMessage(481)); - var data = null; - if (null !== reference.bound) { - data = boundCache.get(reference); - data || - ((data = encodeFormData(reference)), boundCache.set(reference, data)); - if ("rejected" === data.status) throw data.reason; - if ("fulfilled" !== data.status) throw data; - reference = data.value; - var prefixedData = new FormData(); - reference.forEach(function (value, key) { - prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value); - }); - data = prefixedData; - reference = "$ACTION_REF_" + identifierPrefix; - } else reference = "$ACTION_ID_" + reference.id; - return { - name: reference, - method: "POST", - encType: "multipart/form-data", - data: data - }; -} -var ContextRegistry = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ContextRegistry; -function Chunk(status, value, reason, response) { - this.status = status; - this.value = value; - this.reason = reason; - this._response = response; -} -Chunk.prototype = Object.create(Promise.prototype); -Chunk.prototype.then = function (resolve, reject) { - switch (this.status) { - case "resolved_model": - initializeModelChunk(this); - break; - case "resolved_module": - initializeModuleChunk(this); - } - switch (this.status) { - case "fulfilled": - resolve(this.value); - break; - case "pending": - case "blocked": - resolve && - (null === this.value && (this.value = []), this.value.push(resolve)); - reject && - (null === this.reason && (this.reason = []), this.reason.push(reject)); - break; - default: - reject(this.reason); - } -}; -function readChunk(chunk) { - switch (chunk.status) { - case "resolved_model": - initializeModelChunk(chunk); - break; - case "resolved_module": - initializeModuleChunk(chunk); - } - switch (chunk.status) { - case "fulfilled": - return chunk.value; - case "pending": - case "blocked": - throw chunk; - default: - throw chunk.reason; - } -} -function wakeChunk(listeners, value) { - for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value); -} -function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { - switch (chunk.status) { - case "fulfilled": - wakeChunk(resolveListeners, chunk.value); - break; - case "pending": - case "blocked": - chunk.value = resolveListeners; - chunk.reason = rejectListeners; - break; - case "rejected": - rejectListeners && wakeChunk(rejectListeners, chunk.reason); - } -} -function triggerErrorOnChunk(chunk, error) { - if ("pending" === chunk.status || "blocked" === chunk.status) { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && wakeChunk(listeners, error); - } -} -function resolveModuleChunk(chunk, value) { - if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; - chunk.status = "resolved_module"; - chunk.value = value; - null !== resolveListeners && - (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); - } -} -var initializingChunk = null, - initializingChunkBlockedModel = null; -function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; - try { - var value = parseModelRecursively(chunk._response, dummy, "", chunk.value); - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ? ((initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"), - (chunk.value = null), - (chunk.reason = null)) - : ((chunk.status = "fulfilled"), (chunk.value = value)); - } catch (error) { - (chunk.status = "rejected"), (chunk.reason = error); - } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); - } -} -function initializeModuleChunk(chunk) { - try { - var value = ReactFlightDOMRelayClientIntegration.requireModule(chunk.value); - chunk.status = "fulfilled"; - chunk.value = value; - } catch (error) { - (chunk.status = "rejected"), (chunk.reason = error); - } -} -function reportGlobalError(response, error) { - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); -} -function getChunk(response, id) { - var chunks = response._chunks, - chunk = chunks.get(id); - chunk || - ((chunk = new Chunk("pending", null, null, response)), - chunks.set(id, chunk)); - return chunk; -} -function createModelResolver(chunk, parentObject, key) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - blocked.deps++; - } else blocked = initializingChunkBlockedModel = { deps: 1, value: null }; - return function (value) { - parentObject[key] = value; - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; -} -function createServerReferenceProxy(response, metaData) { - function proxy() { - var args = Array.prototype.slice.call(arguments), - p = metaData.bound; - return p - ? "fulfilled" === p.status - ? callServer(metaData.id, p.value.concat(args)) - : Promise.resolve(p).then(function (bound) { - return callServer(metaData.id, bound.concat(args)); - }) - : callServer(metaData.id, args); - } - var callServer = response._callServer; - proxy.$$FORM_ACTION = encodeFormAction; - knownServerReferences.set(proxy, metaData); - return proxy; -} -function parseModelString(response, parentObject, key, value) { - if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; - switch (value[1]) { - case "$": - return value.slice(1); - case "L": - return ( - (parentObject = parseInt(value.slice(2), 16)), - (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } - ); - case "@": - return ( - (parentObject = parseInt(value.slice(2), 16)), - getChunk(response, parentObject) - ); - case "S": - return Symbol.for(value.slice(2)); - case "P": - return ( - (response = value.slice(2)), - ContextRegistry[response] || - (ContextRegistry[response] = React.createServerContext( - response, - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - )), - ContextRegistry[response].Provider - ); - case "F": - parentObject = parseInt(value.slice(2), 16); - parentObject = getChunk(response, parentObject); - switch (parentObject.status) { - case "resolved_model": - initializeModelChunk(parentObject); - } - switch (parentObject.status) { - case "fulfilled": - return createServerReferenceProxy(response, parentObject.value); - default: - throw parentObject.reason; - } - case "I": - return Infinity; - case "-": - return "$-0" === value ? -0 : -Infinity; - case "N": - return NaN; - case "u": - return; - case "D": - return new Date(Date.parse(value.slice(2))); - case "n": - return BigInt(value.slice(2)); - default: - value = parseInt(value.slice(1), 16); - response = getChunk(response, value); - switch (response.status) { - case "resolved_model": - initializeModelChunk(response); - break; - case "resolved_module": - initializeModuleChunk(response); - } - switch (response.status) { - case "fulfilled": - return response.value; - case "pending": - case "blocked": - return ( - (value = initializingChunk), - response.then( - createModelResolver(value, parentObject, key), - createModelReject(value) - ), - null - ); - default: - throw response.reason; - } - } - } - return value; -} -function missingCall() { - throw Error(formatProdErrorMessage(466)); -} -function resolveModule(response, id, model) { - var chunks = response._chunks, - chunk = chunks.get(id); - model = parseModelRecursively(response, dummy, "", model); - var clientReference = - ReactFlightDOMRelayClientIntegration.resolveClientReference(model); - if ( - (model = - ReactFlightDOMRelayClientIntegration.preloadModule(clientReference)) - ) { - if (chunk) { - var blockedChunk = chunk; - blockedChunk.status = "blocked"; - } else - (blockedChunk = new Chunk("blocked", null, null, response)), - chunks.set(id, blockedChunk); - model.then( - function () { - return resolveModuleChunk(blockedChunk, clientReference); - }, - function (error) { - return triggerErrorOnChunk(blockedChunk, error); - } - ); - } else - chunk - ? resolveModuleChunk(chunk, clientReference) - : chunks.set( - id, - new Chunk("resolved_module", clientReference, null, response) - ); -} -exports.close = function (response) { - reportGlobalError(response, Error(formatProdErrorMessage(412))); -}; -exports.createResponse = function (bundlerConfig, callServer) { - var chunks = new Map(); - return { - _bundlerConfig: bundlerConfig, - _callServer: void 0 !== callServer ? callServer : missingCall, - _chunks: chunks - }; -}; -exports.getRoot = function (response) { - return getChunk(response, 0); -}; -exports.resolveRow = function (response, chunk$jscomp$0) { - if ("O" === chunk$jscomp$0[0]) { - var id = chunk$jscomp$0[1], - model = chunk$jscomp$0[2]; - chunk$jscomp$0 = response._chunks; - var chunk = chunk$jscomp$0.get(id); - chunk - ? "pending" === chunk.status && - ((response = chunk.value), - (chunk$jscomp$0 = chunk.reason), - (chunk.status = "resolved_model"), - (chunk.value = model), - null !== response && - (initializeModelChunk(chunk), - wakeChunkIfInitialized(chunk, response, chunk$jscomp$0))) - : chunk$jscomp$0.set( - id, - new Chunk("resolved_model", model, null, response) - ); - } else if ("I" === chunk$jscomp$0[0]) - resolveModule(response, chunk$jscomp$0[1], chunk$jscomp$0[2]); - else if ("H" === chunk$jscomp$0[0]) { - if ( - ((model = chunk$jscomp$0[1]), - (response = parseModelRecursively( - response, - dummy, - "", - chunk$jscomp$0[2] - )), - (chunk$jscomp$0 = ReactDOMCurrentDispatcher.current)) - ) - switch ( - ("string" === typeof response - ? (id = response) - : ((id = response[0]), (chunk = response[1])), - model) - ) { - case "D": - chunk$jscomp$0.prefetchDNS(id, chunk); - break; - case "C": - chunk$jscomp$0.preconnect(id, chunk); - break; - case "L": - chunk$jscomp$0.preload(id, chunk); - break; - case "I": - chunk$jscomp$0.preinit(id, chunk); - } - } else - (model = chunk$jscomp$0[1]), - (chunk$jscomp$0 = chunk$jscomp$0[2].digest), - (chunk = Error(formatProdErrorMessage(441))), - (chunk.stack = "Error: " + chunk.message), - (chunk.digest = chunk$jscomp$0), - (chunk$jscomp$0 = response._chunks), - (id = chunk$jscomp$0.get(model)) - ? triggerErrorOnChunk(id, chunk) - : chunk$jscomp$0.set( - model, - new Chunk("rejected", null, chunk, response) - ); -}; diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.classic.js b/compiled/facebook-www/ReactFlightDOMRelayServer-dev.classic.js deleted file mode 100644 index c337be5701096..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.classic.js +++ /dev/null @@ -1,2369 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -'use strict'; - -if (__DEV__) { - (function() { -"use strict"; - -var JSResourceReferenceImpl = require("JSResourceReferenceImpl"); -var ReactFlightDOMRelayServerIntegration = require("ReactFlightDOMRelayServerIntegration"); -var ReactDOM = require("react-dom"); -var React = require("react"); - -// This refers to a WWW module. -var warningWWW = require("warning"); -function error(format) { - { - { - for ( - var _len2 = arguments.length, - args = new Array(_len2 > 1 ? _len2 - 1 : 0), - _key2 = 1; - _key2 < _len2; - _key2++ - ) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning("error", format, args); - } - } -} - -function printWarning(level, format, args) { - { - var React = require("react"); - - var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Defensive in case this is fired before React is initialized. - - if (ReactSharedInternals != null) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== "") { - format += "%s"; - args.push(stack); - } - } // TODO: don't ignore level and pass it down somewhere too. - - args.unshift(format); - args.unshift(false); - warningWWW.apply(null, args); - } -} - -// $FlowFixMe[method-unbinding] -var hasOwnProperty = Object.prototype.hasOwnProperty; - -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); -} - -function isClientReference(reference) { - return reference instanceof JSResourceReferenceImpl; -} -function getClientReferenceKey(reference) { - // We use the reference object itself as the key because we assume the - // object will be cached by the bundler runtime. - return reference; -} -function resolveClientReferenceMetadata(config, resource) { - return ReactFlightDOMRelayServerIntegration.resolveClientReferenceMetadata( - config, - resource - ); -} -function processErrorChunkDev(request, id, digest, message, stack) { - return [ - "E", - id, - { - digest: digest, - message: message, - stack: stack - } - ]; -} - -function convertModelToJSON(request, parent, key, model) { - var json = resolveModelToJSON(request, parent, key, model); - - if (typeof json === "object" && json !== null) { - if (isArray(json)) { - var jsonArray = []; - - for (var i = 0; i < json.length; i++) { - jsonArray[i] = convertModelToJSON(request, json, "" + i, json[i]); - } - - return jsonArray; - } else { - var jsonObj = {}; - - for (var nextKey in json) { - if (hasOwnProperty.call(json, nextKey)) { - jsonObj[nextKey] = convertModelToJSON( - request, - json, - nextKey, - json[nextKey] - ); - } - } - - return jsonObj; - } - } - - return json; -} - -function processModelChunk(request, id, model) { - var json = convertModelToJSON(request, {}, "", model); - return ["O", id, json]; -} -function processReferenceChunk(request, id, reference) { - return ["O", id, reference]; -} -function processImportChunk(request, id, clientReferenceMetadata) { - // The clientReferenceMetadata is already a JSON serializable value. - return ["I", id, clientReferenceMetadata]; -} -function processHintChunk(request, id, code, model) { - // The hint is already a JSON serializable value. - return ["H", code, model]; -} -function scheduleWork(callback) { - callback(); -} -function writeChunkAndReturn(destination, chunk) { - // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type. - ReactFlightDOMRelayServerIntegration.emitRow(destination, chunk); - return true; -} -function closeWithError(destination, error) { - ReactFlightDOMRelayServerIntegration.close(destination); -} - -var ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -// Re-export dynamic flags from the www version. -require("ReactFeatureFlags"); - -var ReactDOMFlightServerDispatcher = { - prefetchDNS: prefetchDNS, - preconnect: preconnect, - preload: preload, - preinit: preinit -}; - -function prefetchDNS(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var key = "D" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - - if (options) { - emitHint(request, "D", [href, options]); - } else { - emitHint(request, "D", href); - } - } - } - } -} - -function preconnect(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var crossOrigin = - options == null || typeof options.crossOrigin !== "string" - ? null - : options.crossOrigin === "use-credentials" - ? "use-credentials" - : ""; - var key = - "C" + (crossOrigin === null ? "null" : crossOrigin) + "|" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - - if (options) { - emitHint(request, "C", [href, options]); - } else { - emitHint(request, "C", href); - } - } - } - } -} - -function preload(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var key = "L" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - emitHint(request, "L", [href, options]); - } - } - } -} - -function preinit(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var key = "I" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - emitHint(request, "I", [href, options]); - } - } - } -} - -var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher; -function prepareHostDispatcher() { - ReactDOMCurrentDispatcher.current = ReactDOMFlightServerDispatcher; -} // Used to distinguish these contexts from ones used in other renderers. -function createHints() { - return new Set(); -} - -// ATTENTION -// When adding new symbols to this file, -// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' -// The Symbol used to tag the ReactElement-like types. -var REACT_ELEMENT_TYPE = Symbol.for("react.element"); -var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); -var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); -var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"); -var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); -var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); -var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); -var REACT_MEMO_TYPE = Symbol.for("react.memo"); -var REACT_LAZY_TYPE = Symbol.for("react.lazy"); -var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" -); -var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); -var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = "@@iterator"; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== "object") { - return null; - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === "function") { - return maybeIterator; - } - - return null; -} - -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} // Used to store the parent path of all context overrides in a shared linked list. -// Forming a reverse tree. -// The structure of a context snapshot is an implementation of this file. -// Currently, it's implemented as tracking the current active node. - -var rootContextSnapshot = null; // We assume that this runtime owns the "current" field on all ReactContext instances. -// This global (actually thread local) state represents what state all those "current", -// fields are currently in. - -var currentActiveSnapshot = null; - -function popNode(prev) { - { - prev.context._currentValue = prev.parentValue; - } -} - -function pushNode(next) { - { - next.context._currentValue = next.value; - } -} - -function popToNearestCommonAncestor(prev, next) { - if (prev === next); - else { - popNode(prev); - var parentPrev = prev.parent; - var parentNext = next.parent; - - if (parentPrev === null) { - if (parentNext !== null) { - throw new Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - } - } else { - if (parentNext === null) { - throw new Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - } - - popToNearestCommonAncestor(parentPrev, parentNext); // On the way back, we push the new ones that weren't common. - - pushNode(next); - } - } -} - -function popAllPrevious(prev) { - popNode(prev); - var parentPrev = prev.parent; - - if (parentPrev !== null) { - popAllPrevious(parentPrev); - } -} - -function pushAllNext(next) { - var parentNext = next.parent; - - if (parentNext !== null) { - pushAllNext(parentNext); - } - - pushNode(next); -} - -function popPreviousToCommonLevel(prev, next) { - popNode(prev); - var parentPrev = prev.parent; - - if (parentPrev === null) { - throw new Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - } - - if (parentPrev.depth === next.depth) { - // We found the same level. Now we just need to find a shared ancestor. - popToNearestCommonAncestor(parentPrev, next); - } else { - // We must still be deeper. - popPreviousToCommonLevel(parentPrev, next); - } -} - -function popNextToCommonLevel(prev, next) { - var parentNext = next.parent; - - if (parentNext === null) { - throw new Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - } - - if (prev.depth === parentNext.depth) { - // We found the same level. Now we just need to find a shared ancestor. - popToNearestCommonAncestor(prev, parentNext); - } else { - // We must still be deeper. - popNextToCommonLevel(prev, parentNext); - } - - pushNode(next); -} // Perform context switching to the new snapshot. -// To make it cheap to read many contexts, while not suspending, we make the switch eagerly by -// updating all the context's current values. That way reads, always just read the current value. -// At the cost of updating contexts even if they're never read by this subtree. - -function switchContext(newSnapshot) { - // The basic algorithm we need to do is to pop back any contexts that are no longer on the stack. - // We also need to update any new contexts that are now on the stack with the deepest value. - // The easiest way to update new contexts is to just reapply them in reverse order from the - // perspective of the backpointers. To avoid allocating a lot when switching, we use the stack - // for that. Therefore this algorithm is recursive. - // 1) First we pop which ever snapshot tree was deepest. Popping old contexts as we go. - // 2) Then we find the nearest common ancestor from there. Popping old contexts as we go. - // 3) Then we reapply new contexts on the way back up the stack. - var prev = currentActiveSnapshot; - var next = newSnapshot; - - if (prev !== next) { - if (prev === null) { - // $FlowFixMe[incompatible-call]: This has to be non-null since it's not equal to prev. - pushAllNext(next); - } else if (next === null) { - popAllPrevious(prev); - } else if (prev.depth === next.depth) { - popToNearestCommonAncestor(prev, next); - } else if (prev.depth > next.depth) { - popPreviousToCommonLevel(prev, next); - } else { - popNextToCommonLevel(prev, next); - } - - currentActiveSnapshot = next; - } -} -function pushProvider(context, nextValue) { - var prevValue; - - { - prevValue = context._currentValue; - context._currentValue = nextValue; - - { - if ( - context._currentRenderer !== undefined && - context._currentRenderer !== null && - context._currentRenderer !== rendererSigil - ) { - error( - "Detected multiple renderers concurrently rendering the " + - "same context provider. This is currently unsupported." - ); - } - - context._currentRenderer = rendererSigil; - } - } - - var prevNode = currentActiveSnapshot; - var newNode = { - parent: prevNode, - depth: prevNode === null ? 0 : prevNode.depth + 1, - context: context, - parentValue: prevValue, - value: nextValue - }; - currentActiveSnapshot = newNode; - return newNode; -} -function popProvider() { - var prevSnapshot = currentActiveSnapshot; - - if (prevSnapshot === null) { - throw new Error( - "Tried to pop a Context at the root of the app. This is a bug in React." - ); - } - - { - var value = prevSnapshot.parentValue; - - if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - prevSnapshot.context._currentValue = prevSnapshot.context._defaultValue; - } else { - prevSnapshot.context._currentValue = value; - } - } - - return (currentActiveSnapshot = prevSnapshot.parent); -} -function getActiveContext() { - return currentActiveSnapshot; -} -function readContext$1(context) { - var value = context._currentValue; - return value; -} - -// Corresponds to ReactFiberWakeable and ReactFizzWakeable modules. Generally, -// changes to one module should be reflected in the others. -// TODO: Rename this module and the corresponding Fiber one to "Thenable" -// instead of "Wakeable". Or some other more appropriate name. -// An error that is thrown (e.g. by `use`) to trigger Suspense. If we -// detect this is caught by userspace, we'll log a warning in development. -var SuspenseException = new Error( - "Suspense Exception: This is not a real error! It's an implementation " + - "detail of `use` to interrupt the current render. You must either " + - "rethrow it immediately, or move the `use` call outside of the " + - "`try/catch` block. Capturing without rethrowing will lead to " + - "unexpected behavior.\n\n" + - "To handle async errors, wrap your component in an error boundary, or " + - "call the promise's `.catch` method and pass the result to `use`" -); -function createThenableState() { - // The ThenableState is created the first time a component suspends. If it - // suspends again, we'll reuse the same state. - return []; -} - -function noop() {} - -function trackUsedThenable(thenableState, thenable, index) { - var previous = thenableState[index]; - - if (previous === undefined) { - thenableState.push(thenable); - } else { - if (previous !== thenable) { - // Reuse the previous thenable, and drop the new one. We can assume - // they represent the same value, because components are idempotent. - // Avoid an unhandled rejection errors for the Promises that we'll - // intentionally ignore. - thenable.then(noop, noop); - thenable = previous; - } - } // We use an expando to track the status and result of a thenable so that we - // can synchronously unwrap the value. Think of this as an extension of the - // Promise API, or a custom interface that is a superset of Thenable. - // - // If the thenable doesn't have a status, set it to "pending" and attach - // a listener that will update its status and result when it resolves. - - switch (thenable.status) { - case "fulfilled": { - var fulfilledValue = thenable.value; - return fulfilledValue; - } - - case "rejected": { - var rejectedError = thenable.reason; - throw rejectedError; - } - - default: { - if (typeof thenable.status === "string"); - else { - var pendingThenable = thenable; - pendingThenable.status = "pending"; - pendingThenable.then( - function (fulfilledValue) { - if (thenable.status === "pending") { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if (thenable.status === "pending") { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ); // Check one more time in case the thenable resolved synchronously - - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } - - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } - } - } // Suspend. - // - // Throwing here is an implementation detail that allows us to unwind the - // call stack. But we shouldn't allow it to leak into userspace. Throw an - // opaque placeholder value instead of the actual thenable. If it doesn't - // get captured by the work loop, log a warning, because that means - // something in userspace must have caught it. - - suspendedThenable = thenable; - throw SuspenseException; - } - } -} // This is used to track the actual thenable that suspended so it can be -// passed to the rest of the Suspense implementation — which, for historical -// reasons, expects to receive a thenable. - -var suspendedThenable = null; -function getSuspendedThenable() { - // This is called right after `use` suspends by throwing an exception. `use` - // throws an opaque value instead of the thenable itself so that it can't be - // caught in userspace. Then the work loop accesses the actual thenable using - // this function. - if (suspendedThenable === null) { - throw new Error( - "Expected a suspended thenable. This is a bug in React. Please file " + - "an issue." - ); - } - - var thenable = suspendedThenable; - suspendedThenable = null; - return thenable; -} - -var currentRequest$1 = null; -var thenableIndexCounter = 0; -var thenableState = null; -function prepareToUseHooksForRequest(request) { - currentRequest$1 = request; -} -function resetHooksForRequest() { - currentRequest$1 = null; -} -function prepareToUseHooksForComponent(prevThenableState) { - thenableIndexCounter = 0; - thenableState = prevThenableState; -} -function getThenableStateAfterSuspending() { - var state = thenableState; - thenableState = null; - return state; -} - -function readContext(context) { - { - if (context.$$typeof !== REACT_SERVER_CONTEXT_TYPE) { - if (isClientReference(context)) { - error("Cannot read a Client Context from a Server Component."); - } else { - error("Only createServerContext is supported in Server Components."); - } - } - - if (currentRequest$1 === null) { - error( - "Context can only be read while React is rendering. " + - "In classes, you can read it in the render method or getDerivedStateFromProps. " + - "In function components, you can read it directly in the function body, but not " + - "inside Hooks like useReducer() or useMemo()." - ); - } - } - - return readContext$1(context); -} - -var HooksDispatcher = { - useMemo: function (nextCreate) { - return nextCreate(); - }, - useCallback: function (callback) { - return callback; - }, - useDebugValue: function () {}, - useDeferredValue: unsupportedHook, - useTransition: unsupportedHook, - readContext: readContext, - useContext: readContext, - useReducer: unsupportedHook, - useRef: unsupportedHook, - useState: unsupportedHook, - useInsertionEffect: unsupportedHook, - useLayoutEffect: unsupportedHook, - useImperativeHandle: unsupportedHook, - useEffect: unsupportedHook, - useId: useId, - useMutableSource: unsupportedHook, - useSyncExternalStore: unsupportedHook, - useCacheRefresh: function () { - return unsupportedRefresh; - }, - useMemoCache: function (size) { - var data = new Array(size); - - for (var i = 0; i < size; i++) { - data[i] = REACT_MEMO_CACHE_SENTINEL; - } - - return data; - }, - use: use -}; - -function unsupportedHook() { - throw new Error("This Hook is not supported in Server Components."); -} - -function unsupportedRefresh() { - throw new Error( - "Refreshing the cache is not supported in Server Components." - ); -} - -function useId() { - if (currentRequest$1 === null) { - throw new Error("useId can only be used while React is rendering"); - } - - var id = currentRequest$1.identifierCount++; // use 'S' for Flight components to distinguish from 'R' and 'r' in Fizz/Client - - return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":"; -} - -function use(usable) { - if ( - (usable !== null && typeof usable === "object") || - typeof usable === "function" - ) { - // $FlowFixMe[method-unbinding] - if (typeof usable.then === "function") { - // This is a thenable. - var thenable = usable; // Track the position of the thenable within this fiber. - - var index = thenableIndexCounter; - thenableIndexCounter += 1; - - if (thenableState === null) { - thenableState = createThenableState(); - } - - return trackUsedThenable(thenableState, thenable, index); - } else if (usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) { - var context = usable; - return readContext(context); - } - } - - { - if (isClientReference(usable)) { - error("Cannot use() an already resolved Client Reference."); - } - } // eslint-disable-next-line react-internal/safe-string-coercion - - throw new Error("An unsupported type was passed to use(): " + String(usable)); -} - -function createSignal() { - return new AbortController().signal; -} - -function resolveCache() { - var request = resolveRequest(); - - if (request) { - return getCache(request); - } - - return new Map(); -} - -var DefaultCacheDispatcher = { - getCacheSignal: function () { - var cache = resolveCache(); - var entry = cache.get(createSignal); - - if (entry === undefined) { - entry = createSignal(); - cache.set(createSignal, entry); - } - - return entry; - }, - getCacheForType: function (resourceType) { - var cache = resolveCache(); - var entry = cache.get(resourceType); - - if (entry === undefined) { - entry = resourceType(); // TODO: Warn if undefined? - - cache.set(resourceType, entry); - } - - return entry; - } -}; - -// in case they error. - -var jsxPropsParents = new WeakMap(); -var jsxChildrenParents = new WeakMap(); - -function isObjectPrototype(object) { - if (!object) { - return false; - } - - var ObjectPrototype = Object.prototype; - - if (object === ObjectPrototype) { - return true; - } // It might be an object from a different Realm which is - // still just a plain simple object. - - if (Object.getPrototypeOf(object)) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - if (!(names[i] in ObjectPrototype)) { - return false; - } - } - - return true; -} - -function isSimpleObject(object) { - if (!isObjectPrototype(Object.getPrototypeOf(object))) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - var descriptor = Object.getOwnPropertyDescriptor(object, names[i]); - - if (!descriptor) { - return false; - } - - if (!descriptor.enumerable) { - if ( - (names[i] === "key" || names[i] === "ref") && - typeof descriptor.get === "function" - ) { - // React adds key and ref getters to props objects to issue warnings. - // Those getters will not be transferred to the client, but that's ok, - // so we'll special case them. - continue; - } - - return false; - } - } - - return true; -} -function objectName(object) { - // $FlowFixMe[method-unbinding] - var name = Object.prototype.toString.call(object); - return name.replace(/^\[object (.*)\]$/, function (m, p0) { - return p0; - }); -} - -function describeKeyForErrorMessage(key) { - var encodedKey = JSON.stringify(key); - return '"' + key + '"' === encodedKey ? key : encodedKey; -} - -function describeValueForErrorMessage(value) { - switch (typeof value) { - case "string": { - return JSON.stringify( - value.length <= 10 ? value : value.slice(0, 10) + "..." - ); - } - - case "object": { - if (isArray(value)) { - return "[...]"; - } - - var name = objectName(value); - - if (name === "Object") { - return "{...}"; - } - - return name; - } - - case "function": - return "function"; - - default: - // eslint-disable-next-line react-internal/safe-string-coercion - return String(value); - } -} - -function describeElementType(type) { - if (typeof type === "string") { - return type; - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return "Suspense"; - - case REACT_SUSPENSE_LIST_TYPE: - return "SuspenseList"; - } - - if (typeof type === "object") { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeElementType(type.render); - - case REACT_MEMO_TYPE: - return describeElementType(type.type); - - case REACT_LAZY_TYPE: { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeElementType(init(payload)); - } catch (x) {} - } - } - } - - return ""; -} - -function describeObjectForErrorMessage(objectOrArray, expandedName) { - var objKind = objectName(objectOrArray); - - if (objKind !== "Object" && objKind !== "Array") { - return objKind; - } - - var str = ""; - var start = -1; - var length = 0; - - if (isArray(objectOrArray)) { - if (jsxChildrenParents.has(objectOrArray)) { - // Print JSX Children - var type = jsxChildrenParents.get(objectOrArray); - str = "<" + describeElementType(type) + ">"; - var array = objectOrArray; - - for (var i = 0; i < array.length; i++) { - var value = array[i]; - var substr = void 0; - - if (typeof value === "string") { - substr = value; - } else if (typeof value === "object" && value !== null) { - substr = "{" + describeObjectForErrorMessage(value) + "}"; - } else { - substr = "{" + describeValueForErrorMessage(value) + "}"; - } - - if ("" + i === expandedName) { - start = str.length; - length = substr.length; - str += substr; - } else if (substr.length < 15 && str.length + substr.length < 40) { - str += substr; - } else { - str += "{...}"; - } - } - - str += ""; - } else { - // Print Array - str = "["; - var _array = objectOrArray; - - for (var _i = 0; _i < _array.length; _i++) { - if (_i > 0) { - str += ", "; - } - - var _value = _array[_i]; - - var _substr = void 0; - - if (typeof _value === "object" && _value !== null) { - _substr = describeObjectForErrorMessage(_value); - } else { - _substr = describeValueForErrorMessage(_value); - } - - if ("" + _i === expandedName) { - start = str.length; - length = _substr.length; - str += _substr; - } else if (_substr.length < 10 && str.length + _substr.length < 40) { - str += _substr; - } else { - str += "..."; - } - } - - str += "]"; - } - } else { - if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) { - str = "<" + describeElementType(objectOrArray.type) + "/>"; - } else if (jsxPropsParents.has(objectOrArray)) { - // Print JSX - var _type = jsxPropsParents.get(objectOrArray); - - str = "<" + (describeElementType(_type) || "..."); - var object = objectOrArray; - var names = Object.keys(object); - - for (var _i2 = 0; _i2 < names.length; _i2++) { - str += " "; - var name = names[_i2]; - str += describeKeyForErrorMessage(name) + "="; - var _value2 = object[name]; - - var _substr2 = void 0; - - if ( - name === expandedName && - typeof _value2 === "object" && - _value2 !== null - ) { - _substr2 = describeObjectForErrorMessage(_value2); - } else { - _substr2 = describeValueForErrorMessage(_value2); - } - - if (typeof _value2 !== "string") { - _substr2 = "{" + _substr2 + "}"; - } - - if (name === expandedName) { - start = str.length; - length = _substr2.length; - str += _substr2; - } else if (_substr2.length < 10 && str.length + _substr2.length < 40) { - str += _substr2; - } else { - str += "..."; - } - } - - str += ">"; - } else { - // Print Object - str = "{"; - var _object = objectOrArray; - - var _names = Object.keys(_object); - - for (var _i3 = 0; _i3 < _names.length; _i3++) { - if (_i3 > 0) { - str += ", "; - } - - var _name = _names[_i3]; - str += describeKeyForErrorMessage(_name) + ": "; - var _value3 = _object[_name]; - - var _substr3 = void 0; - - if (typeof _value3 === "object" && _value3 !== null) { - _substr3 = describeObjectForErrorMessage(_value3); - } else { - _substr3 = describeValueForErrorMessage(_value3); - } - - if (_name === expandedName) { - start = str.length; - length = _substr3.length; - str += _substr3; - } else if (_substr3.length < 10 && str.length + _substr3.length < 40) { - str += _substr3; - } else { - str += "..."; - } - } - - str += "}"; - } - } - - if (expandedName === undefined) { - return str; - } - - if (start > -1 && length > 0) { - var highlight = " ".repeat(start) + "^".repeat(length); - return "\n " + str + "\n " + highlight; - } - - return "\n " + str; -} - -var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -var ContextRegistry = ReactSharedInternals.ContextRegistry; -function getOrCreateServerContext(globalName) { - if (!ContextRegistry[globalName]) { - ContextRegistry[globalName] = React.createServerContext( - globalName, // $FlowFixMe[incompatible-call] function signature doesn't reflect the symbol value - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ); - } - - return ContextRegistry[globalName]; -} - -// Thenable - -var PENDING = 0; -var COMPLETED = 1; -var ERRORED = 4; -var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; -var ReactCurrentCache = ReactSharedInternals.ReactCurrentCache; - -function defaultErrorHandler(error) { - console["error"](error); // Don't transform to our wrapper -} - -var OPEN = 0; -var CLOSING = 1; -var CLOSED = 2; -function createRequest( - model, - bundlerConfig, - onError, - context, - identifierPrefix -) { - if ( - ReactCurrentCache.current !== null && - ReactCurrentCache.current !== DefaultCacheDispatcher - ) { - throw new Error( - "Currently React only supports one RSC renderer at a time." - ); - } - - prepareHostDispatcher(); - ReactCurrentCache.current = DefaultCacheDispatcher; - var abortSet = new Set(); - var pingedTasks = []; - var hints = createHints(); - var request = { - status: OPEN, - flushScheduled: false, - fatalError: null, - destination: null, - bundlerConfig: bundlerConfig, - cache: new Map(), - nextChunkId: 0, - pendingChunks: 0, - hints: hints, - abortableTasks: abortSet, - pingedTasks: pingedTasks, - completedImportChunks: [], - completedHintChunks: [], - completedJSONChunks: [], - completedErrorChunks: [], - writtenSymbols: new Map(), - writtenClientReferences: new Map(), - writtenServerReferences: new Map(), - writtenProviders: new Map(), - identifierPrefix: identifierPrefix || "", - identifierCount: 1, - onError: onError === undefined ? defaultErrorHandler : onError, - // $FlowFixMe[missing-this-annot] - toJSON: function (key, value) { - return resolveModelToJSON(request, this, key, value); - } - }; - request.pendingChunks++; - var rootContext = createRootContext(context); - var rootTask = createTask(request, model, rootContext, abortSet); - pingedTasks.push(rootTask); - return request; -} -var currentRequest = null; -function resolveRequest() { - if (currentRequest) return currentRequest; - - return null; -} - -function createRootContext(reqContext) { - return importServerContexts(reqContext); -} - -var POP = {}; - -function serializeThenable(request, thenable) { - request.pendingChunks++; - var newTask = createTask( - request, - null, - getActiveContext(), - request.abortableTasks - ); - - switch (thenable.status) { - case "fulfilled": { - // We have the resolved value, we can go ahead and schedule it for serialization. - newTask.model = thenable.value; - pingTask(request, newTask); - return newTask.id; - } - - case "rejected": { - var x = thenable.reason; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt.message, - stack = _getErrorMessageAndSt.stack; - - emitErrorChunkDev(request, newTask.id, digest, message, stack); - } - - return newTask.id; - } - - default: { - if (typeof thenable.status === "string") { - // Only instrument the thenable if the status if not defined. If - // it's defined, but an unknown value, assume it's been instrumented by - // some custom userspace implementation. We treat it as "pending". - break; - } - - var pendingThenable = thenable; - pendingThenable.status = "pending"; - pendingThenable.then( - function (fulfilledValue) { - if (thenable.status === "pending") { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if (thenable.status === "pending") { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ); - break; - } - } - - thenable.then( - function (value) { - newTask.model = value; - pingTask(request, newTask); - }, - function (reason) { - newTask.status = ERRORED; // TODO: We should ideally do this inside performWork so it's scheduled - - var digest = logRecoverableError(request, reason); - - { - var _getErrorMessageAndSt2 = getErrorMessageAndStackDev(reason), - _message = _getErrorMessageAndSt2.message, - _stack = _getErrorMessageAndSt2.stack; - - emitErrorChunkDev(request, newTask.id, digest, _message, _stack); - } - - if (request.destination !== null) { - flushCompletedChunks(request, request.destination); - } - } - ); - return newTask.id; -} - -function emitHint(request, code, model) { - emitHintChunk(request, code, model); - enqueueFlush(request); -} -function getHints(request) { - return request.hints; -} -function getCache(request) { - return request.cache; -} - -function readThenable(thenable) { - if (thenable.status === "fulfilled") { - return thenable.value; - } else if (thenable.status === "rejected") { - throw thenable.reason; - } - - throw thenable; -} - -function createLazyWrapperAroundWakeable(wakeable) { - // This is a temporary fork of the `use` implementation until we accept - // promises everywhere. - var thenable = wakeable; - - switch (thenable.status) { - case "fulfilled": - case "rejected": - break; - - default: { - if (typeof thenable.status === "string") { - // Only instrument the thenable if the status if not defined. If - // it's defined, but an unknown value, assume it's been instrumented by - // some custom userspace implementation. We treat it as "pending". - break; - } - - var pendingThenable = thenable; - pendingThenable.status = "pending"; - pendingThenable.then( - function (fulfilledValue) { - if (thenable.status === "pending") { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if (thenable.status === "pending") { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ); - break; - } - } - - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: thenable, - _init: readThenable - }; - return lazyType; -} - -function attemptResolveElement( - request, - type, - key, - ref, - props, - prevThenableState -) { - if (ref !== null && ref !== undefined) { - // When the ref moves to the regular props object this will implicitly - // throw for functions. We could probably relax it to a DEV warning for other - // cases. - throw new Error( - "Refs cannot be used in Server Components, nor passed to Client Components." - ); - } - - { - jsxPropsParents.set(props, type); - - if (typeof props.children === "object" && props.children !== null) { - jsxChildrenParents.set(props.children, type); - } - } - - if (typeof type === "function") { - if (isClientReference(type)) { - // This is a reference to a Client Component. - return [REACT_ELEMENT_TYPE, type, key, props]; - } // This is a server-side component. - - prepareToUseHooksForComponent(prevThenableState); - var result = type(props); - - if ( - typeof result === "object" && - result !== null && - typeof result.then === "function" - ) { - // When the return value is in children position we can resolve it immediately, - // to its value without a wrapper if it's synchronously available. - var thenable = result; - - if (thenable.status === "fulfilled") { - return thenable.value; - } // TODO: Once we accept Promises as children on the client, we can just return - // the thenable here. - - return createLazyWrapperAroundWakeable(result); - } - - return result; - } else if (typeof type === "string") { - // This is a host element. E.g. HTML. - return [REACT_ELEMENT_TYPE, type, key, props]; - } else if (typeof type === "symbol") { - if (type === REACT_FRAGMENT_TYPE) { - // For key-less fragments, we add a small optimization to avoid serializing - // it as a wrapper. - // TODO: If a key is specified, we should propagate its key to any children. - // Same as if a Server Component has a key. - return props.children; - } // This might be a built-in React component. We'll let the client decide. - // Any built-in works as long as its props are serializable. - - return [REACT_ELEMENT_TYPE, type, key, props]; - } else if (type != null && typeof type === "object") { - if (isClientReference(type)) { - // This is a reference to a Client Component. - return [REACT_ELEMENT_TYPE, type, key, props]; - } - - switch (type.$$typeof) { - case REACT_LAZY_TYPE: { - var payload = type._payload; - var init = type._init; - var wrappedType = init(payload); - return attemptResolveElement( - request, - wrappedType, - key, - ref, - props, - prevThenableState - ); - } - - case REACT_FORWARD_REF_TYPE: { - var render = type.render; - prepareToUseHooksForComponent(prevThenableState); - return render(props, undefined); - } - - case REACT_MEMO_TYPE: { - return attemptResolveElement( - request, - type.type, - key, - ref, - props, - prevThenableState - ); - } - - case REACT_PROVIDER_TYPE: { - pushProvider(type._context, props.value); - - { - var extraKeys = Object.keys(props).filter(function (value) { - if (value === "children" || value === "value") { - return false; - } - - return true; - }); - - if (extraKeys.length !== 0) { - error( - "ServerContext can only have a value prop and children. Found: %s", - JSON.stringify(extraKeys) - ); - } - } - - return [ - REACT_ELEMENT_TYPE, - type, - key, // Rely on __popProvider being serialized last to pop the provider. - { - value: props.value, - children: props.children, - __pop: POP - } - ]; - } - } - } - - throw new Error( - "Unsupported Server Component type: " + describeValueForErrorMessage(type) - ); -} - -function pingTask(request, task) { - var pingedTasks = request.pingedTasks; - pingedTasks.push(task); - - if (pingedTasks.length === 1) { - request.flushScheduled = request.destination !== null; - scheduleWork(function () { - return performWork(request); - }); - } -} - -function createTask(request, model, context, abortSet) { - var id = request.nextChunkId++; - var task = { - id: id, - status: PENDING, - model: model, - context: context, - ping: function () { - return pingTask(request, task); - }, - thenableState: null - }; - abortSet.add(task); - return task; -} - -function serializeByValueID(id) { - return "$" + id.toString(16); -} - -function serializeLazyID(id) { - return "$L" + id.toString(16); -} - -function serializePromiseID(id) { - return "$@" + id.toString(16); -} - -function serializeSymbolReference(name) { - return "$S" + name; -} - -function serializeProviderReference(name) { - return "$P" + name; -} - -function serializeNumber(number) { - if (Number.isFinite(number)) { - if (number === 0 && 1 / number === -Infinity) { - return "$-0"; - } else { - return number; - } - } else { - if (number === Infinity) { - return "$Infinity"; - } else if (number === -Infinity) { - return "$-Infinity"; - } else { - return "$NaN"; - } - } -} - -function serializeUndefined() { - return "$undefined"; -} - -function serializeDateFromDateJSON(dateJSON) { - // JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString. - // We need only tack on a $D prefix. - return "$D" + dateJSON; -} - -function serializeBigInt(n) { - return "$n" + n.toString(10); -} - -function serializeClientReference(request, parent, key, clientReference) { - var clientReferenceKey = getClientReferenceKey(clientReference); - var writtenClientReferences = request.writtenClientReferences; - var existingId = writtenClientReferences.get(clientReferenceKey); - - if (existingId !== undefined) { - if (parent[0] === REACT_ELEMENT_TYPE && key === "1") { - // If we're encoding the "type" of an element, we can refer - // to that by a lazy reference instead of directly since React - // knows how to deal with lazy values. This lets us suspend - // on this component rather than its parent until the code has - // loaded. - return serializeLazyID(existingId); - } - - return serializeByValueID(existingId); - } - - try { - var clientReferenceMetadata = resolveClientReferenceMetadata( - request.bundlerConfig, - clientReference - ); - request.pendingChunks++; - var importId = request.nextChunkId++; - emitImportChunk(request, importId, clientReferenceMetadata); - writtenClientReferences.set(clientReferenceKey, importId); - - if (parent[0] === REACT_ELEMENT_TYPE && key === "1") { - // If we're encoding the "type" of an element, we can refer - // to that by a lazy reference instead of directly since React - // knows how to deal with lazy values. This lets us suspend - // on this component rather than its parent until the code has - // loaded. - return serializeLazyID(importId); - } - - return serializeByValueID(importId); - } catch (x) { - request.pendingChunks++; - var errorId = request.nextChunkId++; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt3 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt3.message, - stack = _getErrorMessageAndSt3.stack; - - emitErrorChunkDev(request, errorId, digest, message, stack); - } - - return serializeByValueID(errorId); - } -} - -function escapeStringValue(value) { - if (value[0] === "$") { - // We need to escape $ prefixed strings since we use those to encode - // references to IDs and as special symbol values. - return "$" + value; - } else { - return value; - } -} - -var insideContextProps = null; -var isInsideContextValue = false; -function resolveModelToJSON(request, parent, key, value) { - // Make sure that `parent[key]` wasn't JSONified before `value` was passed to us - { - // $FlowFixMe[incompatible-use] - var originalValue = parent[key]; - - if ( - typeof originalValue === "object" && - originalValue !== value && - !(originalValue instanceof Date) - ) { - if (objectName(originalValue) !== "Object") { - var jsxParentType = jsxChildrenParents.get(parent); - - if (typeof jsxParentType === "string") { - error( - "%s objects cannot be rendered as text children. Try formatting it using toString().%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } else { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "%s objects are not supported.%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } - } else { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Objects with toJSON methods are not supported. Convert it manually " + - "to a simple value before passing it to props.%s", - describeObjectForErrorMessage(parent, key) - ); - } - } - } // Special Symbols - - switch (value) { - case REACT_ELEMENT_TYPE: - return "$"; - } - - { - if ( - parent[0] === REACT_ELEMENT_TYPE && - parent[1] && - parent[1].$$typeof === REACT_PROVIDER_TYPE && - key === "3" - ) { - insideContextProps = value; - } else if (insideContextProps === parent && key === "value") { - isInsideContextValue = true; - } else if (insideContextProps === parent && key === "children") { - isInsideContextValue = false; - } - } // Resolve Server Components. - - while ( - typeof value === "object" && - value !== null && - (value.$$typeof === REACT_ELEMENT_TYPE || - value.$$typeof === REACT_LAZY_TYPE) - ) { - { - if (isInsideContextValue) { - error("React elements are not allowed in ServerContext"); - } - } - - try { - switch (value.$$typeof) { - case REACT_ELEMENT_TYPE: { - // TODO: Concatenate keys of parents onto children. - var element = value; // Attempt to render the Server Component. - - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - ); - break; - } - - case REACT_LAZY_TYPE: { - var payload = value._payload; - var init = value._init; - value = init(payload); - break; - } - } - } catch (thrownValue) { - var x = - thrownValue === SuspenseException // This is a special type of exception used for Suspense. For historical - ? // reasons, the rest of the Suspense implementation expects the thrown - // value to be a thenable, because before `use` existed that was the - // (unstable) API for suspending. This implementation detail can change - // later, once we deprecate the old API in favor of `use`. - getSuspendedThenable() - : thrownValue; // $FlowFixMe[method-unbinding] - - if (typeof x === "object" && x !== null && typeof x.then === "function") { - // Something suspended, we'll need to create a new task and resolve it later. - request.pendingChunks++; - var newTask = createTask( - request, - value, - getActiveContext(), - request.abortableTasks - ); - var ping = newTask.ping; - x.then(ping, ping); - newTask.thenableState = getThenableStateAfterSuspending(); - return serializeLazyID(newTask.id); - } else { - // Something errored. We'll still send everything we have up until this point. - // We'll replace this element with a lazy reference that throws on the client - // once it gets rendered. - request.pendingChunks++; - var errorId = request.nextChunkId++; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt4 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt4.message, - stack = _getErrorMessageAndSt4.stack; - - emitErrorChunkDev(request, errorId, digest, message, stack); - } - - return serializeLazyID(errorId); - } - } - } - - if (value === null) { - return null; - } - - if (typeof value === "object") { - if (isClientReference(value)) { - return serializeClientReference(request, parent, key, value); // $FlowFixMe[method-unbinding] - } else if (typeof value.then === "function") { - // We assume that any object with a .then property is a "Thenable" type, - // or a Promise type. Either of which can be represented by a Promise. - var promiseId = serializeThenable(request, value); - return serializePromiseID(promiseId); - } else if (value.$$typeof === REACT_PROVIDER_TYPE) { - var providerKey = value._context._globalName; - var writtenProviders = request.writtenProviders; - var providerId = writtenProviders.get(key); - - if (providerId === undefined) { - request.pendingChunks++; - providerId = request.nextChunkId++; - writtenProviders.set(providerKey, providerId); - emitProviderChunk(request, providerId, providerKey); - } - - return serializeByValueID(providerId); - } else if (value === POP) { - popProvider(); - - { - insideContextProps = null; - isInsideContextValue = false; - } - - return undefined; - } - - if (!isArray(value)) { - var iteratorFn = getIteratorFn(value); - - if (iteratorFn) { - return Array.from(value); - } - } - - { - if (value !== null && !isArray(value)) { - // Verify that this is a simple plain object. - if (objectName(value) !== "Object") { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "%s objects are not supported.%s", - objectName(value), - describeObjectForErrorMessage(parent, key) - ); - } else if (!isSimpleObject(value)) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Classes or other objects with methods are not supported.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(value); - - if (symbols.length > 0) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Objects with symbol properties like %s are not supported.%s", - symbols[0].description, - describeObjectForErrorMessage(parent, key) - ); - } - } - } - } // $FlowFixMe[incompatible-return] - - return value; - } - - if (typeof value === "string") { - // TODO: Maybe too clever. If we support URL there's no similar trick. - if (value[value.length - 1] === "Z") { - // Possibly a Date, whose toJSON automatically calls toISOString - // $FlowFixMe[incompatible-use] - var _originalValue = parent[key]; - - if (_originalValue instanceof Date) { - return serializeDateFromDateJSON(value); - } - } - - return escapeStringValue(value); - } - - if (typeof value === "boolean") { - return value; - } - - if (typeof value === "number") { - return serializeNumber(value); - } - - if (typeof value === "undefined") { - return serializeUndefined(); - } - - if (typeof value === "function") { - if (isClientReference(value)) { - return serializeClientReference(request, parent, key, value); - } - - if (/^on[A-Z]/.test(key)) { - throw new Error( - "Event handlers cannot be passed to Client Component props." + - describeObjectForErrorMessage(parent, key) + - "\nIf you need interactivity, consider converting part of this to a Client Component." - ); - } else { - throw new Error( - "Functions cannot be passed directly to Client Components " + - 'unless you explicitly expose it by marking it with "use server".' + - describeObjectForErrorMessage(parent, key) - ); - } - } - - if (typeof value === "symbol") { - var writtenSymbols = request.writtenSymbols; - var existingId = writtenSymbols.get(value); - - if (existingId !== undefined) { - return serializeByValueID(existingId); - } // $FlowFixMe[incompatible-type] `description` might be undefined - - var name = value.description; - - if (Symbol.for(name) !== value) { - throw new Error( - "Only global symbols received from Symbol.for(...) can be passed to Client Components. " + - ("The symbol Symbol.for(" + // $FlowFixMe[incompatible-type] `description` might be undefined - value.description + - ") cannot be found among global symbols.") + - describeObjectForErrorMessage(parent, key) - ); - } - - request.pendingChunks++; - var symbolId = request.nextChunkId++; - emitSymbolChunk(request, symbolId, name); - writtenSymbols.set(value, symbolId); - return serializeByValueID(symbolId); - } - - if (typeof value === "bigint") { - return serializeBigInt(value); - } - - throw new Error( - "Type " + - typeof value + - " is not supported in Client Component props." + - describeObjectForErrorMessage(parent, key) - ); -} - -function logRecoverableError(request, error) { - var onError = request.onError; - var errorDigest = onError(error); - - if (errorDigest != null && typeof errorDigest !== "string") { - // eslint-disable-next-line react-internal/prod-error-codes - throw new Error( - 'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + - typeof errorDigest + - '" instead' - ); - } - - return errorDigest || ""; -} - -function getErrorMessageAndStackDev(error) { - { - var message; - var stack = ""; - - try { - if (error instanceof Error) { - // eslint-disable-next-line react-internal/safe-string-coercion - message = String(error.message); // eslint-disable-next-line react-internal/safe-string-coercion - - stack = String(error.stack); - } else { - message = "Error: " + error; - } - } catch (x) { - message = "An error occurred but serializing the error message failed."; - } - - return { - message: message, - stack: stack - }; - } -} - -function fatalError(request, error) { - // This is called outside error handling code such as if an error happens in React internals. - if (request.destination !== null) { - request.status = CLOSED; - closeWithError(request.destination); - } else { - request.status = CLOSING; - request.fatalError = error; - } -} - -function emitErrorChunkDev(request, id, digest, message, stack) { - var processedChunk = processErrorChunkDev( - request, - id, - digest, - message, - stack - ); - request.completedErrorChunks.push(processedChunk); -} - -function emitImportChunk(request, id, clientReferenceMetadata) { - var processedChunk = processImportChunk(request, id, clientReferenceMetadata); - request.completedImportChunks.push(processedChunk); -} - -function emitHintChunk(request, code, model) { - var processedChunk = processHintChunk( - request, - request.nextChunkId++, - code, - model - ); - request.completedHintChunks.push(processedChunk); -} - -function emitSymbolChunk(request, id, name) { - var symbolReference = serializeSymbolReference(name); - var processedChunk = processReferenceChunk(request, id, symbolReference); - request.completedImportChunks.push(processedChunk); -} - -function emitProviderChunk(request, id, contextName) { - var contextReference = serializeProviderReference(contextName); - var processedChunk = processReferenceChunk(request, id, contextReference); - request.completedJSONChunks.push(processedChunk); -} - -function retryTask(request, task) { - if (task.status !== PENDING) { - // We completed this by other means before we had a chance to retry it. - return; - } - - switchContext(task.context); - - try { - var value = task.model; - - if ( - typeof value === "object" && - value !== null && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - // TODO: Concatenate keys of parents onto children. - var element = value; // When retrying a component, reuse the thenableState from the - // previous attempt. - - var prevThenableState = task.thenableState; // Attempt to render the Server Component. - // Doing this here lets us reuse this same task if the next component - // also suspends. - - task.model = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - prevThenableState - ); // Successfully finished this component. We're going to keep rendering - // using the same task, but we reset its thenable state before continuing. - - task.thenableState = null; // Keep rendering and reuse the same task. This inner loop is separate - // from the render above because we don't need to reset the thenable state - // until the next time something suspends and retries. - - while ( - typeof value === "object" && - value !== null && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - // TODO: Concatenate keys of parents onto children. - var nextElement = value; - task.model = value; - value = attemptResolveElement( - request, - nextElement.type, - nextElement.key, - nextElement.ref, - nextElement.props, - null - ); - } - } - - var processedChunk = processModelChunk(request, task.id, value); - request.completedJSONChunks.push(processedChunk); - request.abortableTasks.delete(task); - task.status = COMPLETED; - } catch (thrownValue) { - var x = - thrownValue === SuspenseException // This is a special type of exception used for Suspense. For historical - ? // reasons, the rest of the Suspense implementation expects the thrown - // value to be a thenable, because before `use` existed that was the - // (unstable) API for suspending. This implementation detail can change - // later, once we deprecate the old API in favor of `use`. - getSuspendedThenable() - : thrownValue; // $FlowFixMe[method-unbinding] - - if (typeof x === "object" && x !== null && typeof x.then === "function") { - // Something suspended again, let's pick it back up later. - var ping = task.ping; - x.then(ping, ping); - task.thenableState = getThenableStateAfterSuspending(); - return; - } else { - request.abortableTasks.delete(task); - task.status = ERRORED; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt5 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt5.message, - stack = _getErrorMessageAndSt5.stack; - - emitErrorChunkDev(request, task.id, digest, message, stack); - } - } - } -} - -function performWork(request) { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = HooksDispatcher; - var prevRequest = currentRequest; - currentRequest = request; - prepareToUseHooksForRequest(request); - - try { - var pingedTasks = request.pingedTasks; - request.pingedTasks = []; - - for (var i = 0; i < pingedTasks.length; i++) { - var task = pingedTasks[i]; - retryTask(request, task); - } - - if (request.destination !== null) { - flushCompletedChunks(request, request.destination); - } - } catch (error) { - logRecoverableError(request, error); - fatalError(request, error); - } finally { - ReactCurrentDispatcher.current = prevDispatcher; - resetHooksForRequest(); - currentRequest = prevRequest; - } -} - -function flushCompletedChunks(request, destination) { - try { - // We emit module chunks first in the stream so that - // they can be preloaded as early as possible. - var importsChunks = request.completedImportChunks; - var i = 0; - - for (; i < importsChunks.length; i++) { - request.pendingChunks--; - var chunk = importsChunks[i]; - var keepWriting = writeChunkAndReturn(destination, chunk); - - if (!keepWriting) { - request.destination = null; - i++; - break; - } - } - - importsChunks.splice(0, i); // Next comes hints. - - var hintChunks = request.completedHintChunks; - i = 0; - - for (; i < hintChunks.length; i++) { - var _chunk = hintChunks[i]; - - var _keepWriting = writeChunkAndReturn(destination, _chunk); - - if (!_keepWriting) { - request.destination = null; - i++; - break; - } - } - - hintChunks.splice(0, i); // Next comes model data. - - var jsonChunks = request.completedJSONChunks; - i = 0; - - for (; i < jsonChunks.length; i++) { - request.pendingChunks--; - var _chunk2 = jsonChunks[i]; - - var _keepWriting2 = writeChunkAndReturn(destination, _chunk2); - - if (!_keepWriting2) { - request.destination = null; - i++; - break; - } - } - - jsonChunks.splice(0, i); // Finally, errors are sent. The idea is that it's ok to delay - // any error messages and prioritize display of other parts of - // the page. - - var errorChunks = request.completedErrorChunks; - i = 0; - - for (; i < errorChunks.length; i++) { - request.pendingChunks--; - var _chunk3 = errorChunks[i]; - - var _keepWriting3 = writeChunkAndReturn(destination, _chunk3); - - if (!_keepWriting3) { - request.destination = null; - i++; - break; - } - } - - errorChunks.splice(0, i); - } finally { - request.flushScheduled = false; - } - - if (request.pendingChunks === 0) { - // We're done. - ReactFlightDOMRelayServerIntegration.close(destination); - } -} - -function startWork(request) { - request.flushScheduled = request.destination !== null; - - { - scheduleWork(function () { - return performWork(request); - }); - } -} - -function enqueueFlush(request) { - if ( - request.flushScheduled === false && // If there are pinged tasks we are going to flush anyway after work completes - request.pingedTasks.length === 0 && // If there is no destination there is nothing we can flush to. A flush will - // happen when we start flowing again - request.destination !== null - ) { - var destination = request.destination; - request.flushScheduled = true; - scheduleWork(function () { - return flushCompletedChunks(request, destination); - }); - } -} - -function startFlowing(request, destination) { - if (request.status === CLOSING) { - request.status = CLOSED; - closeWithError(destination); - return; - } - - if (request.status === CLOSED) { - return; - } - - if (request.destination !== null) { - // We're already flowing. - return; - } - - request.destination = destination; - - try { - flushCompletedChunks(request, destination); - } catch (error) { - logRecoverableError(request, error); - fatalError(request, error); - } -} // This is called to early terminate a request. It creates an error at all pending tasks. - -function importServerContexts(contexts) { - if (contexts) { - var prevContext = getActiveContext(); - switchContext(rootContextSnapshot); - - for (var i = 0; i < contexts.length; i++) { - var _contexts$i = contexts[i], - name = _contexts$i[0], - value = _contexts$i[1]; - var context = getOrCreateServerContext(name); - pushProvider(context, value); - } - - var importedContext = getActiveContext(); - switchContext(prevContext); - return importedContext; - } - - return rootContextSnapshot; -} - -function render(model, destination, config, options) { - var request = createRequest( - model, - config, - options ? options.onError : undefined, - undefined, // not currently set up to supply context overrides - options ? options.identifierPrefix : undefined - ); - startWork(request); - startFlowing(request, destination); -} - -exports.render = render; - - })(); -} diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.modern.js b/compiled/facebook-www/ReactFlightDOMRelayServer-dev.modern.js deleted file mode 100644 index c337be5701096..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.modern.js +++ /dev/null @@ -1,2369 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -'use strict'; - -if (__DEV__) { - (function() { -"use strict"; - -var JSResourceReferenceImpl = require("JSResourceReferenceImpl"); -var ReactFlightDOMRelayServerIntegration = require("ReactFlightDOMRelayServerIntegration"); -var ReactDOM = require("react-dom"); -var React = require("react"); - -// This refers to a WWW module. -var warningWWW = require("warning"); -function error(format) { - { - { - for ( - var _len2 = arguments.length, - args = new Array(_len2 > 1 ? _len2 - 1 : 0), - _key2 = 1; - _key2 < _len2; - _key2++ - ) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning("error", format, args); - } - } -} - -function printWarning(level, format, args) { - { - var React = require("react"); - - var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Defensive in case this is fired before React is initialized. - - if (ReactSharedInternals != null) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== "") { - format += "%s"; - args.push(stack); - } - } // TODO: don't ignore level and pass it down somewhere too. - - args.unshift(format); - args.unshift(false); - warningWWW.apply(null, args); - } -} - -// $FlowFixMe[method-unbinding] -var hasOwnProperty = Object.prototype.hasOwnProperty; - -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); -} - -function isClientReference(reference) { - return reference instanceof JSResourceReferenceImpl; -} -function getClientReferenceKey(reference) { - // We use the reference object itself as the key because we assume the - // object will be cached by the bundler runtime. - return reference; -} -function resolveClientReferenceMetadata(config, resource) { - return ReactFlightDOMRelayServerIntegration.resolveClientReferenceMetadata( - config, - resource - ); -} -function processErrorChunkDev(request, id, digest, message, stack) { - return [ - "E", - id, - { - digest: digest, - message: message, - stack: stack - } - ]; -} - -function convertModelToJSON(request, parent, key, model) { - var json = resolveModelToJSON(request, parent, key, model); - - if (typeof json === "object" && json !== null) { - if (isArray(json)) { - var jsonArray = []; - - for (var i = 0; i < json.length; i++) { - jsonArray[i] = convertModelToJSON(request, json, "" + i, json[i]); - } - - return jsonArray; - } else { - var jsonObj = {}; - - for (var nextKey in json) { - if (hasOwnProperty.call(json, nextKey)) { - jsonObj[nextKey] = convertModelToJSON( - request, - json, - nextKey, - json[nextKey] - ); - } - } - - return jsonObj; - } - } - - return json; -} - -function processModelChunk(request, id, model) { - var json = convertModelToJSON(request, {}, "", model); - return ["O", id, json]; -} -function processReferenceChunk(request, id, reference) { - return ["O", id, reference]; -} -function processImportChunk(request, id, clientReferenceMetadata) { - // The clientReferenceMetadata is already a JSON serializable value. - return ["I", id, clientReferenceMetadata]; -} -function processHintChunk(request, id, code, model) { - // The hint is already a JSON serializable value. - return ["H", code, model]; -} -function scheduleWork(callback) { - callback(); -} -function writeChunkAndReturn(destination, chunk) { - // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type. - ReactFlightDOMRelayServerIntegration.emitRow(destination, chunk); - return true; -} -function closeWithError(destination, error) { - ReactFlightDOMRelayServerIntegration.close(destination); -} - -var ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -// Re-export dynamic flags from the www version. -require("ReactFeatureFlags"); - -var ReactDOMFlightServerDispatcher = { - prefetchDNS: prefetchDNS, - preconnect: preconnect, - preload: preload, - preinit: preinit -}; - -function prefetchDNS(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var key = "D" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - - if (options) { - emitHint(request, "D", [href, options]); - } else { - emitHint(request, "D", href); - } - } - } - } -} - -function preconnect(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var crossOrigin = - options == null || typeof options.crossOrigin !== "string" - ? null - : options.crossOrigin === "use-credentials" - ? "use-credentials" - : ""; - var key = - "C" + (crossOrigin === null ? "null" : crossOrigin) + "|" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - - if (options) { - emitHint(request, "C", [href, options]); - } else { - emitHint(request, "C", href); - } - } - } - } -} - -function preload(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var key = "L" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - emitHint(request, "L", [href, options]); - } - } - } -} - -function preinit(href, options) { - { - if (typeof href === "string") { - var request = resolveRequest(); - - if (request) { - var hints = getHints(request); - var key = "I" + href; - - if (hints.has(key)) { - // duplicate hint - return; - } - - hints.add(key); - emitHint(request, "I", [href, options]); - } - } - } -} - -var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher; -function prepareHostDispatcher() { - ReactDOMCurrentDispatcher.current = ReactDOMFlightServerDispatcher; -} // Used to distinguish these contexts from ones used in other renderers. -function createHints() { - return new Set(); -} - -// ATTENTION -// When adding new symbols to this file, -// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' -// The Symbol used to tag the ReactElement-like types. -var REACT_ELEMENT_TYPE = Symbol.for("react.element"); -var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); -var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); -var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"); -var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); -var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); -var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); -var REACT_MEMO_TYPE = Symbol.for("react.memo"); -var REACT_LAZY_TYPE = Symbol.for("react.lazy"); -var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" -); -var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); -var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = "@@iterator"; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== "object") { - return null; - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === "function") { - return maybeIterator; - } - - return null; -} - -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} // Used to store the parent path of all context overrides in a shared linked list. -// Forming a reverse tree. -// The structure of a context snapshot is an implementation of this file. -// Currently, it's implemented as tracking the current active node. - -var rootContextSnapshot = null; // We assume that this runtime owns the "current" field on all ReactContext instances. -// This global (actually thread local) state represents what state all those "current", -// fields are currently in. - -var currentActiveSnapshot = null; - -function popNode(prev) { - { - prev.context._currentValue = prev.parentValue; - } -} - -function pushNode(next) { - { - next.context._currentValue = next.value; - } -} - -function popToNearestCommonAncestor(prev, next) { - if (prev === next); - else { - popNode(prev); - var parentPrev = prev.parent; - var parentNext = next.parent; - - if (parentPrev === null) { - if (parentNext !== null) { - throw new Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - } - } else { - if (parentNext === null) { - throw new Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - } - - popToNearestCommonAncestor(parentPrev, parentNext); // On the way back, we push the new ones that weren't common. - - pushNode(next); - } - } -} - -function popAllPrevious(prev) { - popNode(prev); - var parentPrev = prev.parent; - - if (parentPrev !== null) { - popAllPrevious(parentPrev); - } -} - -function pushAllNext(next) { - var parentNext = next.parent; - - if (parentNext !== null) { - pushAllNext(parentNext); - } - - pushNode(next); -} - -function popPreviousToCommonLevel(prev, next) { - popNode(prev); - var parentPrev = prev.parent; - - if (parentPrev === null) { - throw new Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - } - - if (parentPrev.depth === next.depth) { - // We found the same level. Now we just need to find a shared ancestor. - popToNearestCommonAncestor(parentPrev, next); - } else { - // We must still be deeper. - popPreviousToCommonLevel(parentPrev, next); - } -} - -function popNextToCommonLevel(prev, next) { - var parentNext = next.parent; - - if (parentNext === null) { - throw new Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - } - - if (prev.depth === parentNext.depth) { - // We found the same level. Now we just need to find a shared ancestor. - popToNearestCommonAncestor(prev, parentNext); - } else { - // We must still be deeper. - popNextToCommonLevel(prev, parentNext); - } - - pushNode(next); -} // Perform context switching to the new snapshot. -// To make it cheap to read many contexts, while not suspending, we make the switch eagerly by -// updating all the context's current values. That way reads, always just read the current value. -// At the cost of updating contexts even if they're never read by this subtree. - -function switchContext(newSnapshot) { - // The basic algorithm we need to do is to pop back any contexts that are no longer on the stack. - // We also need to update any new contexts that are now on the stack with the deepest value. - // The easiest way to update new contexts is to just reapply them in reverse order from the - // perspective of the backpointers. To avoid allocating a lot when switching, we use the stack - // for that. Therefore this algorithm is recursive. - // 1) First we pop which ever snapshot tree was deepest. Popping old contexts as we go. - // 2) Then we find the nearest common ancestor from there. Popping old contexts as we go. - // 3) Then we reapply new contexts on the way back up the stack. - var prev = currentActiveSnapshot; - var next = newSnapshot; - - if (prev !== next) { - if (prev === null) { - // $FlowFixMe[incompatible-call]: This has to be non-null since it's not equal to prev. - pushAllNext(next); - } else if (next === null) { - popAllPrevious(prev); - } else if (prev.depth === next.depth) { - popToNearestCommonAncestor(prev, next); - } else if (prev.depth > next.depth) { - popPreviousToCommonLevel(prev, next); - } else { - popNextToCommonLevel(prev, next); - } - - currentActiveSnapshot = next; - } -} -function pushProvider(context, nextValue) { - var prevValue; - - { - prevValue = context._currentValue; - context._currentValue = nextValue; - - { - if ( - context._currentRenderer !== undefined && - context._currentRenderer !== null && - context._currentRenderer !== rendererSigil - ) { - error( - "Detected multiple renderers concurrently rendering the " + - "same context provider. This is currently unsupported." - ); - } - - context._currentRenderer = rendererSigil; - } - } - - var prevNode = currentActiveSnapshot; - var newNode = { - parent: prevNode, - depth: prevNode === null ? 0 : prevNode.depth + 1, - context: context, - parentValue: prevValue, - value: nextValue - }; - currentActiveSnapshot = newNode; - return newNode; -} -function popProvider() { - var prevSnapshot = currentActiveSnapshot; - - if (prevSnapshot === null) { - throw new Error( - "Tried to pop a Context at the root of the app. This is a bug in React." - ); - } - - { - var value = prevSnapshot.parentValue; - - if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - prevSnapshot.context._currentValue = prevSnapshot.context._defaultValue; - } else { - prevSnapshot.context._currentValue = value; - } - } - - return (currentActiveSnapshot = prevSnapshot.parent); -} -function getActiveContext() { - return currentActiveSnapshot; -} -function readContext$1(context) { - var value = context._currentValue; - return value; -} - -// Corresponds to ReactFiberWakeable and ReactFizzWakeable modules. Generally, -// changes to one module should be reflected in the others. -// TODO: Rename this module and the corresponding Fiber one to "Thenable" -// instead of "Wakeable". Or some other more appropriate name. -// An error that is thrown (e.g. by `use`) to trigger Suspense. If we -// detect this is caught by userspace, we'll log a warning in development. -var SuspenseException = new Error( - "Suspense Exception: This is not a real error! It's an implementation " + - "detail of `use` to interrupt the current render. You must either " + - "rethrow it immediately, or move the `use` call outside of the " + - "`try/catch` block. Capturing without rethrowing will lead to " + - "unexpected behavior.\n\n" + - "To handle async errors, wrap your component in an error boundary, or " + - "call the promise's `.catch` method and pass the result to `use`" -); -function createThenableState() { - // The ThenableState is created the first time a component suspends. If it - // suspends again, we'll reuse the same state. - return []; -} - -function noop() {} - -function trackUsedThenable(thenableState, thenable, index) { - var previous = thenableState[index]; - - if (previous === undefined) { - thenableState.push(thenable); - } else { - if (previous !== thenable) { - // Reuse the previous thenable, and drop the new one. We can assume - // they represent the same value, because components are idempotent. - // Avoid an unhandled rejection errors for the Promises that we'll - // intentionally ignore. - thenable.then(noop, noop); - thenable = previous; - } - } // We use an expando to track the status and result of a thenable so that we - // can synchronously unwrap the value. Think of this as an extension of the - // Promise API, or a custom interface that is a superset of Thenable. - // - // If the thenable doesn't have a status, set it to "pending" and attach - // a listener that will update its status and result when it resolves. - - switch (thenable.status) { - case "fulfilled": { - var fulfilledValue = thenable.value; - return fulfilledValue; - } - - case "rejected": { - var rejectedError = thenable.reason; - throw rejectedError; - } - - default: { - if (typeof thenable.status === "string"); - else { - var pendingThenable = thenable; - pendingThenable.status = "pending"; - pendingThenable.then( - function (fulfilledValue) { - if (thenable.status === "pending") { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if (thenable.status === "pending") { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ); // Check one more time in case the thenable resolved synchronously - - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } - - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } - } - } // Suspend. - // - // Throwing here is an implementation detail that allows us to unwind the - // call stack. But we shouldn't allow it to leak into userspace. Throw an - // opaque placeholder value instead of the actual thenable. If it doesn't - // get captured by the work loop, log a warning, because that means - // something in userspace must have caught it. - - suspendedThenable = thenable; - throw SuspenseException; - } - } -} // This is used to track the actual thenable that suspended so it can be -// passed to the rest of the Suspense implementation — which, for historical -// reasons, expects to receive a thenable. - -var suspendedThenable = null; -function getSuspendedThenable() { - // This is called right after `use` suspends by throwing an exception. `use` - // throws an opaque value instead of the thenable itself so that it can't be - // caught in userspace. Then the work loop accesses the actual thenable using - // this function. - if (suspendedThenable === null) { - throw new Error( - "Expected a suspended thenable. This is a bug in React. Please file " + - "an issue." - ); - } - - var thenable = suspendedThenable; - suspendedThenable = null; - return thenable; -} - -var currentRequest$1 = null; -var thenableIndexCounter = 0; -var thenableState = null; -function prepareToUseHooksForRequest(request) { - currentRequest$1 = request; -} -function resetHooksForRequest() { - currentRequest$1 = null; -} -function prepareToUseHooksForComponent(prevThenableState) { - thenableIndexCounter = 0; - thenableState = prevThenableState; -} -function getThenableStateAfterSuspending() { - var state = thenableState; - thenableState = null; - return state; -} - -function readContext(context) { - { - if (context.$$typeof !== REACT_SERVER_CONTEXT_TYPE) { - if (isClientReference(context)) { - error("Cannot read a Client Context from a Server Component."); - } else { - error("Only createServerContext is supported in Server Components."); - } - } - - if (currentRequest$1 === null) { - error( - "Context can only be read while React is rendering. " + - "In classes, you can read it in the render method or getDerivedStateFromProps. " + - "In function components, you can read it directly in the function body, but not " + - "inside Hooks like useReducer() or useMemo()." - ); - } - } - - return readContext$1(context); -} - -var HooksDispatcher = { - useMemo: function (nextCreate) { - return nextCreate(); - }, - useCallback: function (callback) { - return callback; - }, - useDebugValue: function () {}, - useDeferredValue: unsupportedHook, - useTransition: unsupportedHook, - readContext: readContext, - useContext: readContext, - useReducer: unsupportedHook, - useRef: unsupportedHook, - useState: unsupportedHook, - useInsertionEffect: unsupportedHook, - useLayoutEffect: unsupportedHook, - useImperativeHandle: unsupportedHook, - useEffect: unsupportedHook, - useId: useId, - useMutableSource: unsupportedHook, - useSyncExternalStore: unsupportedHook, - useCacheRefresh: function () { - return unsupportedRefresh; - }, - useMemoCache: function (size) { - var data = new Array(size); - - for (var i = 0; i < size; i++) { - data[i] = REACT_MEMO_CACHE_SENTINEL; - } - - return data; - }, - use: use -}; - -function unsupportedHook() { - throw new Error("This Hook is not supported in Server Components."); -} - -function unsupportedRefresh() { - throw new Error( - "Refreshing the cache is not supported in Server Components." - ); -} - -function useId() { - if (currentRequest$1 === null) { - throw new Error("useId can only be used while React is rendering"); - } - - var id = currentRequest$1.identifierCount++; // use 'S' for Flight components to distinguish from 'R' and 'r' in Fizz/Client - - return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":"; -} - -function use(usable) { - if ( - (usable !== null && typeof usable === "object") || - typeof usable === "function" - ) { - // $FlowFixMe[method-unbinding] - if (typeof usable.then === "function") { - // This is a thenable. - var thenable = usable; // Track the position of the thenable within this fiber. - - var index = thenableIndexCounter; - thenableIndexCounter += 1; - - if (thenableState === null) { - thenableState = createThenableState(); - } - - return trackUsedThenable(thenableState, thenable, index); - } else if (usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) { - var context = usable; - return readContext(context); - } - } - - { - if (isClientReference(usable)) { - error("Cannot use() an already resolved Client Reference."); - } - } // eslint-disable-next-line react-internal/safe-string-coercion - - throw new Error("An unsupported type was passed to use(): " + String(usable)); -} - -function createSignal() { - return new AbortController().signal; -} - -function resolveCache() { - var request = resolveRequest(); - - if (request) { - return getCache(request); - } - - return new Map(); -} - -var DefaultCacheDispatcher = { - getCacheSignal: function () { - var cache = resolveCache(); - var entry = cache.get(createSignal); - - if (entry === undefined) { - entry = createSignal(); - cache.set(createSignal, entry); - } - - return entry; - }, - getCacheForType: function (resourceType) { - var cache = resolveCache(); - var entry = cache.get(resourceType); - - if (entry === undefined) { - entry = resourceType(); // TODO: Warn if undefined? - - cache.set(resourceType, entry); - } - - return entry; - } -}; - -// in case they error. - -var jsxPropsParents = new WeakMap(); -var jsxChildrenParents = new WeakMap(); - -function isObjectPrototype(object) { - if (!object) { - return false; - } - - var ObjectPrototype = Object.prototype; - - if (object === ObjectPrototype) { - return true; - } // It might be an object from a different Realm which is - // still just a plain simple object. - - if (Object.getPrototypeOf(object)) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - if (!(names[i] in ObjectPrototype)) { - return false; - } - } - - return true; -} - -function isSimpleObject(object) { - if (!isObjectPrototype(Object.getPrototypeOf(object))) { - return false; - } - - var names = Object.getOwnPropertyNames(object); - - for (var i = 0; i < names.length; i++) { - var descriptor = Object.getOwnPropertyDescriptor(object, names[i]); - - if (!descriptor) { - return false; - } - - if (!descriptor.enumerable) { - if ( - (names[i] === "key" || names[i] === "ref") && - typeof descriptor.get === "function" - ) { - // React adds key and ref getters to props objects to issue warnings. - // Those getters will not be transferred to the client, but that's ok, - // so we'll special case them. - continue; - } - - return false; - } - } - - return true; -} -function objectName(object) { - // $FlowFixMe[method-unbinding] - var name = Object.prototype.toString.call(object); - return name.replace(/^\[object (.*)\]$/, function (m, p0) { - return p0; - }); -} - -function describeKeyForErrorMessage(key) { - var encodedKey = JSON.stringify(key); - return '"' + key + '"' === encodedKey ? key : encodedKey; -} - -function describeValueForErrorMessage(value) { - switch (typeof value) { - case "string": { - return JSON.stringify( - value.length <= 10 ? value : value.slice(0, 10) + "..." - ); - } - - case "object": { - if (isArray(value)) { - return "[...]"; - } - - var name = objectName(value); - - if (name === "Object") { - return "{...}"; - } - - return name; - } - - case "function": - return "function"; - - default: - // eslint-disable-next-line react-internal/safe-string-coercion - return String(value); - } -} - -function describeElementType(type) { - if (typeof type === "string") { - return type; - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return "Suspense"; - - case REACT_SUSPENSE_LIST_TYPE: - return "SuspenseList"; - } - - if (typeof type === "object") { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeElementType(type.render); - - case REACT_MEMO_TYPE: - return describeElementType(type.type); - - case REACT_LAZY_TYPE: { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeElementType(init(payload)); - } catch (x) {} - } - } - } - - return ""; -} - -function describeObjectForErrorMessage(objectOrArray, expandedName) { - var objKind = objectName(objectOrArray); - - if (objKind !== "Object" && objKind !== "Array") { - return objKind; - } - - var str = ""; - var start = -1; - var length = 0; - - if (isArray(objectOrArray)) { - if (jsxChildrenParents.has(objectOrArray)) { - // Print JSX Children - var type = jsxChildrenParents.get(objectOrArray); - str = "<" + describeElementType(type) + ">"; - var array = objectOrArray; - - for (var i = 0; i < array.length; i++) { - var value = array[i]; - var substr = void 0; - - if (typeof value === "string") { - substr = value; - } else if (typeof value === "object" && value !== null) { - substr = "{" + describeObjectForErrorMessage(value) + "}"; - } else { - substr = "{" + describeValueForErrorMessage(value) + "}"; - } - - if ("" + i === expandedName) { - start = str.length; - length = substr.length; - str += substr; - } else if (substr.length < 15 && str.length + substr.length < 40) { - str += substr; - } else { - str += "{...}"; - } - } - - str += ""; - } else { - // Print Array - str = "["; - var _array = objectOrArray; - - for (var _i = 0; _i < _array.length; _i++) { - if (_i > 0) { - str += ", "; - } - - var _value = _array[_i]; - - var _substr = void 0; - - if (typeof _value === "object" && _value !== null) { - _substr = describeObjectForErrorMessage(_value); - } else { - _substr = describeValueForErrorMessage(_value); - } - - if ("" + _i === expandedName) { - start = str.length; - length = _substr.length; - str += _substr; - } else if (_substr.length < 10 && str.length + _substr.length < 40) { - str += _substr; - } else { - str += "..."; - } - } - - str += "]"; - } - } else { - if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) { - str = "<" + describeElementType(objectOrArray.type) + "/>"; - } else if (jsxPropsParents.has(objectOrArray)) { - // Print JSX - var _type = jsxPropsParents.get(objectOrArray); - - str = "<" + (describeElementType(_type) || "..."); - var object = objectOrArray; - var names = Object.keys(object); - - for (var _i2 = 0; _i2 < names.length; _i2++) { - str += " "; - var name = names[_i2]; - str += describeKeyForErrorMessage(name) + "="; - var _value2 = object[name]; - - var _substr2 = void 0; - - if ( - name === expandedName && - typeof _value2 === "object" && - _value2 !== null - ) { - _substr2 = describeObjectForErrorMessage(_value2); - } else { - _substr2 = describeValueForErrorMessage(_value2); - } - - if (typeof _value2 !== "string") { - _substr2 = "{" + _substr2 + "}"; - } - - if (name === expandedName) { - start = str.length; - length = _substr2.length; - str += _substr2; - } else if (_substr2.length < 10 && str.length + _substr2.length < 40) { - str += _substr2; - } else { - str += "..."; - } - } - - str += ">"; - } else { - // Print Object - str = "{"; - var _object = objectOrArray; - - var _names = Object.keys(_object); - - for (var _i3 = 0; _i3 < _names.length; _i3++) { - if (_i3 > 0) { - str += ", "; - } - - var _name = _names[_i3]; - str += describeKeyForErrorMessage(_name) + ": "; - var _value3 = _object[_name]; - - var _substr3 = void 0; - - if (typeof _value3 === "object" && _value3 !== null) { - _substr3 = describeObjectForErrorMessage(_value3); - } else { - _substr3 = describeValueForErrorMessage(_value3); - } - - if (_name === expandedName) { - start = str.length; - length = _substr3.length; - str += _substr3; - } else if (_substr3.length < 10 && str.length + _substr3.length < 40) { - str += _substr3; - } else { - str += "..."; - } - } - - str += "}"; - } - } - - if (expandedName === undefined) { - return str; - } - - if (start > -1 && length > 0) { - var highlight = " ".repeat(start) + "^".repeat(length); - return "\n " + str + "\n " + highlight; - } - - return "\n " + str; -} - -var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -var ContextRegistry = ReactSharedInternals.ContextRegistry; -function getOrCreateServerContext(globalName) { - if (!ContextRegistry[globalName]) { - ContextRegistry[globalName] = React.createServerContext( - globalName, // $FlowFixMe[incompatible-call] function signature doesn't reflect the symbol value - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ); - } - - return ContextRegistry[globalName]; -} - -// Thenable - -var PENDING = 0; -var COMPLETED = 1; -var ERRORED = 4; -var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; -var ReactCurrentCache = ReactSharedInternals.ReactCurrentCache; - -function defaultErrorHandler(error) { - console["error"](error); // Don't transform to our wrapper -} - -var OPEN = 0; -var CLOSING = 1; -var CLOSED = 2; -function createRequest( - model, - bundlerConfig, - onError, - context, - identifierPrefix -) { - if ( - ReactCurrentCache.current !== null && - ReactCurrentCache.current !== DefaultCacheDispatcher - ) { - throw new Error( - "Currently React only supports one RSC renderer at a time." - ); - } - - prepareHostDispatcher(); - ReactCurrentCache.current = DefaultCacheDispatcher; - var abortSet = new Set(); - var pingedTasks = []; - var hints = createHints(); - var request = { - status: OPEN, - flushScheduled: false, - fatalError: null, - destination: null, - bundlerConfig: bundlerConfig, - cache: new Map(), - nextChunkId: 0, - pendingChunks: 0, - hints: hints, - abortableTasks: abortSet, - pingedTasks: pingedTasks, - completedImportChunks: [], - completedHintChunks: [], - completedJSONChunks: [], - completedErrorChunks: [], - writtenSymbols: new Map(), - writtenClientReferences: new Map(), - writtenServerReferences: new Map(), - writtenProviders: new Map(), - identifierPrefix: identifierPrefix || "", - identifierCount: 1, - onError: onError === undefined ? defaultErrorHandler : onError, - // $FlowFixMe[missing-this-annot] - toJSON: function (key, value) { - return resolveModelToJSON(request, this, key, value); - } - }; - request.pendingChunks++; - var rootContext = createRootContext(context); - var rootTask = createTask(request, model, rootContext, abortSet); - pingedTasks.push(rootTask); - return request; -} -var currentRequest = null; -function resolveRequest() { - if (currentRequest) return currentRequest; - - return null; -} - -function createRootContext(reqContext) { - return importServerContexts(reqContext); -} - -var POP = {}; - -function serializeThenable(request, thenable) { - request.pendingChunks++; - var newTask = createTask( - request, - null, - getActiveContext(), - request.abortableTasks - ); - - switch (thenable.status) { - case "fulfilled": { - // We have the resolved value, we can go ahead and schedule it for serialization. - newTask.model = thenable.value; - pingTask(request, newTask); - return newTask.id; - } - - case "rejected": { - var x = thenable.reason; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt.message, - stack = _getErrorMessageAndSt.stack; - - emitErrorChunkDev(request, newTask.id, digest, message, stack); - } - - return newTask.id; - } - - default: { - if (typeof thenable.status === "string") { - // Only instrument the thenable if the status if not defined. If - // it's defined, but an unknown value, assume it's been instrumented by - // some custom userspace implementation. We treat it as "pending". - break; - } - - var pendingThenable = thenable; - pendingThenable.status = "pending"; - pendingThenable.then( - function (fulfilledValue) { - if (thenable.status === "pending") { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if (thenable.status === "pending") { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ); - break; - } - } - - thenable.then( - function (value) { - newTask.model = value; - pingTask(request, newTask); - }, - function (reason) { - newTask.status = ERRORED; // TODO: We should ideally do this inside performWork so it's scheduled - - var digest = logRecoverableError(request, reason); - - { - var _getErrorMessageAndSt2 = getErrorMessageAndStackDev(reason), - _message = _getErrorMessageAndSt2.message, - _stack = _getErrorMessageAndSt2.stack; - - emitErrorChunkDev(request, newTask.id, digest, _message, _stack); - } - - if (request.destination !== null) { - flushCompletedChunks(request, request.destination); - } - } - ); - return newTask.id; -} - -function emitHint(request, code, model) { - emitHintChunk(request, code, model); - enqueueFlush(request); -} -function getHints(request) { - return request.hints; -} -function getCache(request) { - return request.cache; -} - -function readThenable(thenable) { - if (thenable.status === "fulfilled") { - return thenable.value; - } else if (thenable.status === "rejected") { - throw thenable.reason; - } - - throw thenable; -} - -function createLazyWrapperAroundWakeable(wakeable) { - // This is a temporary fork of the `use` implementation until we accept - // promises everywhere. - var thenable = wakeable; - - switch (thenable.status) { - case "fulfilled": - case "rejected": - break; - - default: { - if (typeof thenable.status === "string") { - // Only instrument the thenable if the status if not defined. If - // it's defined, but an unknown value, assume it's been instrumented by - // some custom userspace implementation. We treat it as "pending". - break; - } - - var pendingThenable = thenable; - pendingThenable.status = "pending"; - pendingThenable.then( - function (fulfilledValue) { - if (thenable.status === "pending") { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if (thenable.status === "pending") { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ); - break; - } - } - - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: thenable, - _init: readThenable - }; - return lazyType; -} - -function attemptResolveElement( - request, - type, - key, - ref, - props, - prevThenableState -) { - if (ref !== null && ref !== undefined) { - // When the ref moves to the regular props object this will implicitly - // throw for functions. We could probably relax it to a DEV warning for other - // cases. - throw new Error( - "Refs cannot be used in Server Components, nor passed to Client Components." - ); - } - - { - jsxPropsParents.set(props, type); - - if (typeof props.children === "object" && props.children !== null) { - jsxChildrenParents.set(props.children, type); - } - } - - if (typeof type === "function") { - if (isClientReference(type)) { - // This is a reference to a Client Component. - return [REACT_ELEMENT_TYPE, type, key, props]; - } // This is a server-side component. - - prepareToUseHooksForComponent(prevThenableState); - var result = type(props); - - if ( - typeof result === "object" && - result !== null && - typeof result.then === "function" - ) { - // When the return value is in children position we can resolve it immediately, - // to its value without a wrapper if it's synchronously available. - var thenable = result; - - if (thenable.status === "fulfilled") { - return thenable.value; - } // TODO: Once we accept Promises as children on the client, we can just return - // the thenable here. - - return createLazyWrapperAroundWakeable(result); - } - - return result; - } else if (typeof type === "string") { - // This is a host element. E.g. HTML. - return [REACT_ELEMENT_TYPE, type, key, props]; - } else if (typeof type === "symbol") { - if (type === REACT_FRAGMENT_TYPE) { - // For key-less fragments, we add a small optimization to avoid serializing - // it as a wrapper. - // TODO: If a key is specified, we should propagate its key to any children. - // Same as if a Server Component has a key. - return props.children; - } // This might be a built-in React component. We'll let the client decide. - // Any built-in works as long as its props are serializable. - - return [REACT_ELEMENT_TYPE, type, key, props]; - } else if (type != null && typeof type === "object") { - if (isClientReference(type)) { - // This is a reference to a Client Component. - return [REACT_ELEMENT_TYPE, type, key, props]; - } - - switch (type.$$typeof) { - case REACT_LAZY_TYPE: { - var payload = type._payload; - var init = type._init; - var wrappedType = init(payload); - return attemptResolveElement( - request, - wrappedType, - key, - ref, - props, - prevThenableState - ); - } - - case REACT_FORWARD_REF_TYPE: { - var render = type.render; - prepareToUseHooksForComponent(prevThenableState); - return render(props, undefined); - } - - case REACT_MEMO_TYPE: { - return attemptResolveElement( - request, - type.type, - key, - ref, - props, - prevThenableState - ); - } - - case REACT_PROVIDER_TYPE: { - pushProvider(type._context, props.value); - - { - var extraKeys = Object.keys(props).filter(function (value) { - if (value === "children" || value === "value") { - return false; - } - - return true; - }); - - if (extraKeys.length !== 0) { - error( - "ServerContext can only have a value prop and children. Found: %s", - JSON.stringify(extraKeys) - ); - } - } - - return [ - REACT_ELEMENT_TYPE, - type, - key, // Rely on __popProvider being serialized last to pop the provider. - { - value: props.value, - children: props.children, - __pop: POP - } - ]; - } - } - } - - throw new Error( - "Unsupported Server Component type: " + describeValueForErrorMessage(type) - ); -} - -function pingTask(request, task) { - var pingedTasks = request.pingedTasks; - pingedTasks.push(task); - - if (pingedTasks.length === 1) { - request.flushScheduled = request.destination !== null; - scheduleWork(function () { - return performWork(request); - }); - } -} - -function createTask(request, model, context, abortSet) { - var id = request.nextChunkId++; - var task = { - id: id, - status: PENDING, - model: model, - context: context, - ping: function () { - return pingTask(request, task); - }, - thenableState: null - }; - abortSet.add(task); - return task; -} - -function serializeByValueID(id) { - return "$" + id.toString(16); -} - -function serializeLazyID(id) { - return "$L" + id.toString(16); -} - -function serializePromiseID(id) { - return "$@" + id.toString(16); -} - -function serializeSymbolReference(name) { - return "$S" + name; -} - -function serializeProviderReference(name) { - return "$P" + name; -} - -function serializeNumber(number) { - if (Number.isFinite(number)) { - if (number === 0 && 1 / number === -Infinity) { - return "$-0"; - } else { - return number; - } - } else { - if (number === Infinity) { - return "$Infinity"; - } else if (number === -Infinity) { - return "$-Infinity"; - } else { - return "$NaN"; - } - } -} - -function serializeUndefined() { - return "$undefined"; -} - -function serializeDateFromDateJSON(dateJSON) { - // JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString. - // We need only tack on a $D prefix. - return "$D" + dateJSON; -} - -function serializeBigInt(n) { - return "$n" + n.toString(10); -} - -function serializeClientReference(request, parent, key, clientReference) { - var clientReferenceKey = getClientReferenceKey(clientReference); - var writtenClientReferences = request.writtenClientReferences; - var existingId = writtenClientReferences.get(clientReferenceKey); - - if (existingId !== undefined) { - if (parent[0] === REACT_ELEMENT_TYPE && key === "1") { - // If we're encoding the "type" of an element, we can refer - // to that by a lazy reference instead of directly since React - // knows how to deal with lazy values. This lets us suspend - // on this component rather than its parent until the code has - // loaded. - return serializeLazyID(existingId); - } - - return serializeByValueID(existingId); - } - - try { - var clientReferenceMetadata = resolveClientReferenceMetadata( - request.bundlerConfig, - clientReference - ); - request.pendingChunks++; - var importId = request.nextChunkId++; - emitImportChunk(request, importId, clientReferenceMetadata); - writtenClientReferences.set(clientReferenceKey, importId); - - if (parent[0] === REACT_ELEMENT_TYPE && key === "1") { - // If we're encoding the "type" of an element, we can refer - // to that by a lazy reference instead of directly since React - // knows how to deal with lazy values. This lets us suspend - // on this component rather than its parent until the code has - // loaded. - return serializeLazyID(importId); - } - - return serializeByValueID(importId); - } catch (x) { - request.pendingChunks++; - var errorId = request.nextChunkId++; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt3 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt3.message, - stack = _getErrorMessageAndSt3.stack; - - emitErrorChunkDev(request, errorId, digest, message, stack); - } - - return serializeByValueID(errorId); - } -} - -function escapeStringValue(value) { - if (value[0] === "$") { - // We need to escape $ prefixed strings since we use those to encode - // references to IDs and as special symbol values. - return "$" + value; - } else { - return value; - } -} - -var insideContextProps = null; -var isInsideContextValue = false; -function resolveModelToJSON(request, parent, key, value) { - // Make sure that `parent[key]` wasn't JSONified before `value` was passed to us - { - // $FlowFixMe[incompatible-use] - var originalValue = parent[key]; - - if ( - typeof originalValue === "object" && - originalValue !== value && - !(originalValue instanceof Date) - ) { - if (objectName(originalValue) !== "Object") { - var jsxParentType = jsxChildrenParents.get(parent); - - if (typeof jsxParentType === "string") { - error( - "%s objects cannot be rendered as text children. Try formatting it using toString().%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } else { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "%s objects are not supported.%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } - } else { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Objects with toJSON methods are not supported. Convert it manually " + - "to a simple value before passing it to props.%s", - describeObjectForErrorMessage(parent, key) - ); - } - } - } // Special Symbols - - switch (value) { - case REACT_ELEMENT_TYPE: - return "$"; - } - - { - if ( - parent[0] === REACT_ELEMENT_TYPE && - parent[1] && - parent[1].$$typeof === REACT_PROVIDER_TYPE && - key === "3" - ) { - insideContextProps = value; - } else if (insideContextProps === parent && key === "value") { - isInsideContextValue = true; - } else if (insideContextProps === parent && key === "children") { - isInsideContextValue = false; - } - } // Resolve Server Components. - - while ( - typeof value === "object" && - value !== null && - (value.$$typeof === REACT_ELEMENT_TYPE || - value.$$typeof === REACT_LAZY_TYPE) - ) { - { - if (isInsideContextValue) { - error("React elements are not allowed in ServerContext"); - } - } - - try { - switch (value.$$typeof) { - case REACT_ELEMENT_TYPE: { - // TODO: Concatenate keys of parents onto children. - var element = value; // Attempt to render the Server Component. - - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - ); - break; - } - - case REACT_LAZY_TYPE: { - var payload = value._payload; - var init = value._init; - value = init(payload); - break; - } - } - } catch (thrownValue) { - var x = - thrownValue === SuspenseException // This is a special type of exception used for Suspense. For historical - ? // reasons, the rest of the Suspense implementation expects the thrown - // value to be a thenable, because before `use` existed that was the - // (unstable) API for suspending. This implementation detail can change - // later, once we deprecate the old API in favor of `use`. - getSuspendedThenable() - : thrownValue; // $FlowFixMe[method-unbinding] - - if (typeof x === "object" && x !== null && typeof x.then === "function") { - // Something suspended, we'll need to create a new task and resolve it later. - request.pendingChunks++; - var newTask = createTask( - request, - value, - getActiveContext(), - request.abortableTasks - ); - var ping = newTask.ping; - x.then(ping, ping); - newTask.thenableState = getThenableStateAfterSuspending(); - return serializeLazyID(newTask.id); - } else { - // Something errored. We'll still send everything we have up until this point. - // We'll replace this element with a lazy reference that throws on the client - // once it gets rendered. - request.pendingChunks++; - var errorId = request.nextChunkId++; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt4 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt4.message, - stack = _getErrorMessageAndSt4.stack; - - emitErrorChunkDev(request, errorId, digest, message, stack); - } - - return serializeLazyID(errorId); - } - } - } - - if (value === null) { - return null; - } - - if (typeof value === "object") { - if (isClientReference(value)) { - return serializeClientReference(request, parent, key, value); // $FlowFixMe[method-unbinding] - } else if (typeof value.then === "function") { - // We assume that any object with a .then property is a "Thenable" type, - // or a Promise type. Either of which can be represented by a Promise. - var promiseId = serializeThenable(request, value); - return serializePromiseID(promiseId); - } else if (value.$$typeof === REACT_PROVIDER_TYPE) { - var providerKey = value._context._globalName; - var writtenProviders = request.writtenProviders; - var providerId = writtenProviders.get(key); - - if (providerId === undefined) { - request.pendingChunks++; - providerId = request.nextChunkId++; - writtenProviders.set(providerKey, providerId); - emitProviderChunk(request, providerId, providerKey); - } - - return serializeByValueID(providerId); - } else if (value === POP) { - popProvider(); - - { - insideContextProps = null; - isInsideContextValue = false; - } - - return undefined; - } - - if (!isArray(value)) { - var iteratorFn = getIteratorFn(value); - - if (iteratorFn) { - return Array.from(value); - } - } - - { - if (value !== null && !isArray(value)) { - // Verify that this is a simple plain object. - if (objectName(value) !== "Object") { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "%s objects are not supported.%s", - objectName(value), - describeObjectForErrorMessage(parent, key) - ); - } else if (!isSimpleObject(value)) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Classes or other objects with methods are not supported.%s", - describeObjectForErrorMessage(parent, key) - ); - } else if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(value); - - if (symbols.length > 0) { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Objects with symbol properties like %s are not supported.%s", - symbols[0].description, - describeObjectForErrorMessage(parent, key) - ); - } - } - } - } // $FlowFixMe[incompatible-return] - - return value; - } - - if (typeof value === "string") { - // TODO: Maybe too clever. If we support URL there's no similar trick. - if (value[value.length - 1] === "Z") { - // Possibly a Date, whose toJSON automatically calls toISOString - // $FlowFixMe[incompatible-use] - var _originalValue = parent[key]; - - if (_originalValue instanceof Date) { - return serializeDateFromDateJSON(value); - } - } - - return escapeStringValue(value); - } - - if (typeof value === "boolean") { - return value; - } - - if (typeof value === "number") { - return serializeNumber(value); - } - - if (typeof value === "undefined") { - return serializeUndefined(); - } - - if (typeof value === "function") { - if (isClientReference(value)) { - return serializeClientReference(request, parent, key, value); - } - - if (/^on[A-Z]/.test(key)) { - throw new Error( - "Event handlers cannot be passed to Client Component props." + - describeObjectForErrorMessage(parent, key) + - "\nIf you need interactivity, consider converting part of this to a Client Component." - ); - } else { - throw new Error( - "Functions cannot be passed directly to Client Components " + - 'unless you explicitly expose it by marking it with "use server".' + - describeObjectForErrorMessage(parent, key) - ); - } - } - - if (typeof value === "symbol") { - var writtenSymbols = request.writtenSymbols; - var existingId = writtenSymbols.get(value); - - if (existingId !== undefined) { - return serializeByValueID(existingId); - } // $FlowFixMe[incompatible-type] `description` might be undefined - - var name = value.description; - - if (Symbol.for(name) !== value) { - throw new Error( - "Only global symbols received from Symbol.for(...) can be passed to Client Components. " + - ("The symbol Symbol.for(" + // $FlowFixMe[incompatible-type] `description` might be undefined - value.description + - ") cannot be found among global symbols.") + - describeObjectForErrorMessage(parent, key) - ); - } - - request.pendingChunks++; - var symbolId = request.nextChunkId++; - emitSymbolChunk(request, symbolId, name); - writtenSymbols.set(value, symbolId); - return serializeByValueID(symbolId); - } - - if (typeof value === "bigint") { - return serializeBigInt(value); - } - - throw new Error( - "Type " + - typeof value + - " is not supported in Client Component props." + - describeObjectForErrorMessage(parent, key) - ); -} - -function logRecoverableError(request, error) { - var onError = request.onError; - var errorDigest = onError(error); - - if (errorDigest != null && typeof errorDigest !== "string") { - // eslint-disable-next-line react-internal/prod-error-codes - throw new Error( - 'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + - typeof errorDigest + - '" instead' - ); - } - - return errorDigest || ""; -} - -function getErrorMessageAndStackDev(error) { - { - var message; - var stack = ""; - - try { - if (error instanceof Error) { - // eslint-disable-next-line react-internal/safe-string-coercion - message = String(error.message); // eslint-disable-next-line react-internal/safe-string-coercion - - stack = String(error.stack); - } else { - message = "Error: " + error; - } - } catch (x) { - message = "An error occurred but serializing the error message failed."; - } - - return { - message: message, - stack: stack - }; - } -} - -function fatalError(request, error) { - // This is called outside error handling code such as if an error happens in React internals. - if (request.destination !== null) { - request.status = CLOSED; - closeWithError(request.destination); - } else { - request.status = CLOSING; - request.fatalError = error; - } -} - -function emitErrorChunkDev(request, id, digest, message, stack) { - var processedChunk = processErrorChunkDev( - request, - id, - digest, - message, - stack - ); - request.completedErrorChunks.push(processedChunk); -} - -function emitImportChunk(request, id, clientReferenceMetadata) { - var processedChunk = processImportChunk(request, id, clientReferenceMetadata); - request.completedImportChunks.push(processedChunk); -} - -function emitHintChunk(request, code, model) { - var processedChunk = processHintChunk( - request, - request.nextChunkId++, - code, - model - ); - request.completedHintChunks.push(processedChunk); -} - -function emitSymbolChunk(request, id, name) { - var symbolReference = serializeSymbolReference(name); - var processedChunk = processReferenceChunk(request, id, symbolReference); - request.completedImportChunks.push(processedChunk); -} - -function emitProviderChunk(request, id, contextName) { - var contextReference = serializeProviderReference(contextName); - var processedChunk = processReferenceChunk(request, id, contextReference); - request.completedJSONChunks.push(processedChunk); -} - -function retryTask(request, task) { - if (task.status !== PENDING) { - // We completed this by other means before we had a chance to retry it. - return; - } - - switchContext(task.context); - - try { - var value = task.model; - - if ( - typeof value === "object" && - value !== null && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - // TODO: Concatenate keys of parents onto children. - var element = value; // When retrying a component, reuse the thenableState from the - // previous attempt. - - var prevThenableState = task.thenableState; // Attempt to render the Server Component. - // Doing this here lets us reuse this same task if the next component - // also suspends. - - task.model = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - prevThenableState - ); // Successfully finished this component. We're going to keep rendering - // using the same task, but we reset its thenable state before continuing. - - task.thenableState = null; // Keep rendering and reuse the same task. This inner loop is separate - // from the render above because we don't need to reset the thenable state - // until the next time something suspends and retries. - - while ( - typeof value === "object" && - value !== null && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - // TODO: Concatenate keys of parents onto children. - var nextElement = value; - task.model = value; - value = attemptResolveElement( - request, - nextElement.type, - nextElement.key, - nextElement.ref, - nextElement.props, - null - ); - } - } - - var processedChunk = processModelChunk(request, task.id, value); - request.completedJSONChunks.push(processedChunk); - request.abortableTasks.delete(task); - task.status = COMPLETED; - } catch (thrownValue) { - var x = - thrownValue === SuspenseException // This is a special type of exception used for Suspense. For historical - ? // reasons, the rest of the Suspense implementation expects the thrown - // value to be a thenable, because before `use` existed that was the - // (unstable) API for suspending. This implementation detail can change - // later, once we deprecate the old API in favor of `use`. - getSuspendedThenable() - : thrownValue; // $FlowFixMe[method-unbinding] - - if (typeof x === "object" && x !== null && typeof x.then === "function") { - // Something suspended again, let's pick it back up later. - var ping = task.ping; - x.then(ping, ping); - task.thenableState = getThenableStateAfterSuspending(); - return; - } else { - request.abortableTasks.delete(task); - task.status = ERRORED; - var digest = logRecoverableError(request, x); - - { - var _getErrorMessageAndSt5 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt5.message, - stack = _getErrorMessageAndSt5.stack; - - emitErrorChunkDev(request, task.id, digest, message, stack); - } - } - } -} - -function performWork(request) { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = HooksDispatcher; - var prevRequest = currentRequest; - currentRequest = request; - prepareToUseHooksForRequest(request); - - try { - var pingedTasks = request.pingedTasks; - request.pingedTasks = []; - - for (var i = 0; i < pingedTasks.length; i++) { - var task = pingedTasks[i]; - retryTask(request, task); - } - - if (request.destination !== null) { - flushCompletedChunks(request, request.destination); - } - } catch (error) { - logRecoverableError(request, error); - fatalError(request, error); - } finally { - ReactCurrentDispatcher.current = prevDispatcher; - resetHooksForRequest(); - currentRequest = prevRequest; - } -} - -function flushCompletedChunks(request, destination) { - try { - // We emit module chunks first in the stream so that - // they can be preloaded as early as possible. - var importsChunks = request.completedImportChunks; - var i = 0; - - for (; i < importsChunks.length; i++) { - request.pendingChunks--; - var chunk = importsChunks[i]; - var keepWriting = writeChunkAndReturn(destination, chunk); - - if (!keepWriting) { - request.destination = null; - i++; - break; - } - } - - importsChunks.splice(0, i); // Next comes hints. - - var hintChunks = request.completedHintChunks; - i = 0; - - for (; i < hintChunks.length; i++) { - var _chunk = hintChunks[i]; - - var _keepWriting = writeChunkAndReturn(destination, _chunk); - - if (!_keepWriting) { - request.destination = null; - i++; - break; - } - } - - hintChunks.splice(0, i); // Next comes model data. - - var jsonChunks = request.completedJSONChunks; - i = 0; - - for (; i < jsonChunks.length; i++) { - request.pendingChunks--; - var _chunk2 = jsonChunks[i]; - - var _keepWriting2 = writeChunkAndReturn(destination, _chunk2); - - if (!_keepWriting2) { - request.destination = null; - i++; - break; - } - } - - jsonChunks.splice(0, i); // Finally, errors are sent. The idea is that it's ok to delay - // any error messages and prioritize display of other parts of - // the page. - - var errorChunks = request.completedErrorChunks; - i = 0; - - for (; i < errorChunks.length; i++) { - request.pendingChunks--; - var _chunk3 = errorChunks[i]; - - var _keepWriting3 = writeChunkAndReturn(destination, _chunk3); - - if (!_keepWriting3) { - request.destination = null; - i++; - break; - } - } - - errorChunks.splice(0, i); - } finally { - request.flushScheduled = false; - } - - if (request.pendingChunks === 0) { - // We're done. - ReactFlightDOMRelayServerIntegration.close(destination); - } -} - -function startWork(request) { - request.flushScheduled = request.destination !== null; - - { - scheduleWork(function () { - return performWork(request); - }); - } -} - -function enqueueFlush(request) { - if ( - request.flushScheduled === false && // If there are pinged tasks we are going to flush anyway after work completes - request.pingedTasks.length === 0 && // If there is no destination there is nothing we can flush to. A flush will - // happen when we start flowing again - request.destination !== null - ) { - var destination = request.destination; - request.flushScheduled = true; - scheduleWork(function () { - return flushCompletedChunks(request, destination); - }); - } -} - -function startFlowing(request, destination) { - if (request.status === CLOSING) { - request.status = CLOSED; - closeWithError(destination); - return; - } - - if (request.status === CLOSED) { - return; - } - - if (request.destination !== null) { - // We're already flowing. - return; - } - - request.destination = destination; - - try { - flushCompletedChunks(request, destination); - } catch (error) { - logRecoverableError(request, error); - fatalError(request, error); - } -} // This is called to early terminate a request. It creates an error at all pending tasks. - -function importServerContexts(contexts) { - if (contexts) { - var prevContext = getActiveContext(); - switchContext(rootContextSnapshot); - - for (var i = 0; i < contexts.length; i++) { - var _contexts$i = contexts[i], - name = _contexts$i[0], - value = _contexts$i[1]; - var context = getOrCreateServerContext(name); - pushProvider(context, value); - } - - var importedContext = getActiveContext(); - switchContext(prevContext); - return importedContext; - } - - return rootContextSnapshot; -} - -function render(model, destination, config, options) { - var request = createRequest( - model, - config, - options ? options.onError : undefined, - undefined, // not currently set up to supply context overrides - options ? options.identifierPrefix : undefined - ); - startWork(request); - startFlowing(request, destination); -} - -exports.render = render; - - })(); -} diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.classic.js b/compiled/facebook-www/ReactFlightDOMRelayServer-prod.classic.js deleted file mode 100644 index 3d4b22dbbdc3e..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.classic.js +++ /dev/null @@ -1,1089 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -"use strict"; -var JSResourceReferenceImpl = require("JSResourceReferenceImpl"), - ReactFlightDOMRelayServerIntegration = require("ReactFlightDOMRelayServerIntegration"), - ReactDOM = require("react-dom"), - React = require("react"), - hasOwnProperty = Object.prototype.hasOwnProperty, - isArrayImpl = Array.isArray; -function convertModelToJSON(request, parent, key, model) { - parent = resolveModelToJSON(request, parent, key, model); - if ("object" === typeof parent && null !== parent) { - if (isArrayImpl(parent)) { - var jsonArray = []; - for (key = 0; key < parent.length; key++) - jsonArray[key] = convertModelToJSON( - request, - parent, - "" + key, - parent[key] - ); - return jsonArray; - } - key = {}; - for (jsonArray in parent) - hasOwnProperty.call(parent, jsonArray) && - (key[jsonArray] = convertModelToJSON( - request, - parent, - jsonArray, - parent[jsonArray] - )); - return key; - } - return parent; -} -function writeChunkAndReturn(destination, chunk) { - ReactFlightDOMRelayServerIntegration.emitRow(destination, chunk); - return !0; -} -var ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; -require("ReactFeatureFlags"); -var ReactDOMFlightServerDispatcher = { - prefetchDNS: prefetchDNS, - preconnect: preconnect, - preload: preload, - preinit: preinit -}; -function prefetchDNS(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - key = "D" + href; - hints.has(key) || - (hints.add(key), - options - ? emitHintChunk(request, "D", [href, options]) - : emitHintChunk(request, "D", href), - enqueueFlush(request)); - } - } -} -function preconnect(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - crossOrigin = - null == options || "string" !== typeof options.crossOrigin - ? null - : "use-credentials" === options.crossOrigin - ? "use-credentials" - : ""; - crossOrigin = - "C" + (null === crossOrigin ? "null" : crossOrigin) + "|" + href; - hints.has(crossOrigin) || - (hints.add(crossOrigin), - options - ? emitHintChunk(request, "C", [href, options]) - : emitHintChunk(request, "C", href), - enqueueFlush(request)); - } - } -} -function preload(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - key = "L" + href; - hints.has(key) || - (hints.add(key), - emitHintChunk(request, "L", [href, options]), - enqueueFlush(request)); - } - } -} -function preinit(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - key = "I" + href; - hints.has(key) || - (hints.add(key), - emitHintChunk(request, "I", [href, options]), - enqueueFlush(request)); - } - } -} -var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher, - REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_PROVIDER_TYPE = Symbol.for("react.provider"), - REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" - ), - REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator, - currentActiveSnapshot = null; -function popToNearestCommonAncestor(prev, next) { - if (prev !== next) { - prev.context._currentValue = prev.parentValue; - prev = prev.parent; - var parentNext = next.parent; - if (null === prev) { - if (null !== parentNext) - throw Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - } else { - if (null === parentNext) - throw Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - popToNearestCommonAncestor(prev, parentNext); - next.context._currentValue = next.value; - } - } -} -function popAllPrevious(prev) { - prev.context._currentValue = prev.parentValue; - prev = prev.parent; - null !== prev && popAllPrevious(prev); -} -function pushAllNext(next) { - var parentNext = next.parent; - null !== parentNext && pushAllNext(parentNext); - next.context._currentValue = next.value; -} -function popPreviousToCommonLevel(prev, next) { - prev.context._currentValue = prev.parentValue; - prev = prev.parent; - if (null === prev) - throw Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - prev.depth === next.depth - ? popToNearestCommonAncestor(prev, next) - : popPreviousToCommonLevel(prev, next); -} -function popNextToCommonLevel(prev, next) { - var parentNext = next.parent; - if (null === parentNext) - throw Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - prev.depth === parentNext.depth - ? popToNearestCommonAncestor(prev, parentNext) - : popNextToCommonLevel(prev, parentNext); - next.context._currentValue = next.value; -} -function switchContext(newSnapshot) { - var prev = currentActiveSnapshot; - prev !== newSnapshot && - (null === prev - ? pushAllNext(newSnapshot) - : null === newSnapshot - ? popAllPrevious(prev) - : prev.depth === newSnapshot.depth - ? popToNearestCommonAncestor(prev, newSnapshot) - : prev.depth > newSnapshot.depth - ? popPreviousToCommonLevel(prev, newSnapshot) - : popNextToCommonLevel(prev, newSnapshot), - (currentActiveSnapshot = newSnapshot)); -} -function pushProvider(context, nextValue) { - var prevValue = context._currentValue; - context._currentValue = nextValue; - var prevNode = currentActiveSnapshot; - return (currentActiveSnapshot = context = - { - parent: prevNode, - depth: null === prevNode ? 0 : prevNode.depth + 1, - context: context, - parentValue: prevValue, - value: nextValue - }); -} -var SuspenseException = Error( - "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`" -); -function noop() {} -function trackUsedThenable(thenableState, thenable, index) { - index = thenableState[index]; - void 0 === index - ? thenableState.push(thenable) - : index !== thenable && (thenable.then(noop, noop), (thenable = index)); - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), - (thenableState.status = "pending"), - thenableState.then( - function (fulfilledValue) { - if ("pending" === thenable.status) { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if ("pending" === thenable.status) { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } - suspendedThenable = thenable; - throw SuspenseException; - } -} -var suspendedThenable = null; -function getSuspendedThenable() { - if (null === suspendedThenable) - throw Error( - "Expected a suspended thenable. This is a bug in React. Please file an issue." - ); - var thenable = suspendedThenable; - suspendedThenable = null; - return thenable; -} -var currentRequest$1 = null, - thenableIndexCounter = 0, - thenableState = null; -function getThenableStateAfterSuspending() { - var state = thenableState; - thenableState = null; - return state; -} -function readContext(context) { - return context._currentValue; -} -var HooksDispatcher = { - useMemo: function (nextCreate) { - return nextCreate(); - }, - useCallback: function (callback) { - return callback; - }, - useDebugValue: function () {}, - useDeferredValue: unsupportedHook, - useTransition: unsupportedHook, - readContext: readContext, - useContext: readContext, - useReducer: unsupportedHook, - useRef: unsupportedHook, - useState: unsupportedHook, - useInsertionEffect: unsupportedHook, - useLayoutEffect: unsupportedHook, - useImperativeHandle: unsupportedHook, - useEffect: unsupportedHook, - useId: useId, - useMutableSource: unsupportedHook, - useSyncExternalStore: unsupportedHook, - useCacheRefresh: function () { - return unsupportedRefresh; - }, - useMemoCache: function (size) { - for (var data = Array(size), i = 0; i < size; i++) - data[i] = REACT_MEMO_CACHE_SENTINEL; - return data; - }, - use: use -}; -function unsupportedHook() { - throw Error("This Hook is not supported in Server Components."); -} -function unsupportedRefresh() { - throw Error("Refreshing the cache is not supported in Server Components."); -} -function useId() { - if (null === currentRequest$1) - throw Error("useId can only be used while React is rendering"); - var id = currentRequest$1.identifierCount++; - return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":"; -} -function use(usable) { - if ( - (null !== usable && "object" === typeof usable) || - "function" === typeof usable - ) { - if ("function" === typeof usable.then) { - var index = thenableIndexCounter; - thenableIndexCounter += 1; - null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index); - } - if (usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) - return usable._currentValue; - } - throw Error("An unsupported type was passed to use(): " + String(usable)); -} -function createSignal() { - return new AbortController().signal; -} -function resolveCache() { - var request = currentRequest ? currentRequest : null; - return request ? request.cache : new Map(); -} -var DefaultCacheDispatcher = { - getCacheSignal: function () { - var cache = resolveCache(), - entry = cache.get(createSignal); - void 0 === entry && - ((entry = createSignal()), cache.set(createSignal, entry)); - return entry; - }, - getCacheForType: function (resourceType) { - var cache = resolveCache(), - entry = cache.get(resourceType); - void 0 === entry && - ((entry = resourceType()), cache.set(resourceType, entry)); - return entry; - } -}; -function objectName(object) { - return Object.prototype.toString - .call(object) - .replace(/^\[object (.*)\]$/, function (m, p0) { - return p0; - }); -} -function describeValueForErrorMessage(value) { - switch (typeof value) { - case "string": - return JSON.stringify( - 10 >= value.length ? value : value.slice(0, 10) + "..." - ); - case "object": - if (isArrayImpl(value)) return "[...]"; - value = objectName(value); - return "Object" === value ? "{...}" : value; - case "function": - return "function"; - default: - return String(value); - } -} -function describeElementType(type) { - if ("string" === typeof type) return type; - switch (type) { - case REACT_SUSPENSE_TYPE: - return "Suspense"; - case REACT_SUSPENSE_LIST_TYPE: - return "SuspenseList"; - } - if ("object" === typeof type) - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeElementType(type.render); - case REACT_MEMO_TYPE: - return describeElementType(type.type); - case REACT_LAZY_TYPE: - var payload = type._payload; - type = type._init; - try { - return describeElementType(type(payload)); - } catch (x) {} - } - return ""; -} -function describeObjectForErrorMessage(objectOrArray, expandedName) { - var objKind = objectName(objectOrArray); - if ("Object" !== objKind && "Array" !== objKind) return objKind; - objKind = -1; - var length = 0; - if (isArrayImpl(objectOrArray)) { - var str = "["; - for (var i = 0; i < objectOrArray.length; i++) { - 0 < i && (str += ", "); - var value = objectOrArray[i]; - value = - "object" === typeof value && null !== value - ? describeObjectForErrorMessage(value) - : describeValueForErrorMessage(value); - "" + i === expandedName - ? ((objKind = str.length), (length = value.length), (str += value)) - : (str = - 10 > value.length && 40 > str.length + value.length - ? str + value - : str + "..."); - } - str += "]"; - } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) - str = "<" + describeElementType(objectOrArray.type) + "/>"; - else { - str = "{"; - i = Object.keys(objectOrArray); - for (value = 0; value < i.length; value++) { - 0 < value && (str += ", "); - var name = i[value], - encodedKey = JSON.stringify(name); - str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": "; - encodedKey = objectOrArray[name]; - encodedKey = - "object" === typeof encodedKey && null !== encodedKey - ? describeObjectForErrorMessage(encodedKey) - : describeValueForErrorMessage(encodedKey); - name === expandedName - ? ((objKind = str.length), - (length = encodedKey.length), - (str += encodedKey)) - : (str = - 10 > encodedKey.length && 40 > str.length + encodedKey.length - ? str + encodedKey - : str + "..."); - } - str += "}"; - } - return void 0 === expandedName - ? str - : -1 < objKind && 0 < length - ? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)), - "\n " + str + "\n " + objectOrArray) - : "\n " + str; -} -var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, - ContextRegistry = ReactSharedInternals.ContextRegistry, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache; -function defaultErrorHandler(error) { - console.error(error); -} -function createRequest( - model, - bundlerConfig, - onError, - context, - identifierPrefix -) { - if ( - null !== ReactCurrentCache.current && - ReactCurrentCache.current !== DefaultCacheDispatcher - ) - throw Error("Currently React only supports one RSC renderer at a time."); - ReactDOMCurrentDispatcher.current = ReactDOMFlightServerDispatcher; - ReactCurrentCache.current = DefaultCacheDispatcher; - var abortSet = new Set(), - pingedTasks = [], - hints = new Set(), - request = { - status: 0, - flushScheduled: !1, - fatalError: null, - destination: null, - bundlerConfig: bundlerConfig, - cache: new Map(), - nextChunkId: 0, - pendingChunks: 0, - hints: hints, - abortableTasks: abortSet, - pingedTasks: pingedTasks, - completedImportChunks: [], - completedHintChunks: [], - completedJSONChunks: [], - completedErrorChunks: [], - writtenSymbols: new Map(), - writtenClientReferences: new Map(), - writtenServerReferences: new Map(), - writtenProviders: new Map(), - identifierPrefix: identifierPrefix || "", - identifierCount: 1, - onError: void 0 === onError ? defaultErrorHandler : onError, - toJSON: function (key, value) { - return resolveModelToJSON(request, this, key, value); - } - }; - request.pendingChunks++; - bundlerConfig = importServerContexts(context); - model = createTask(request, model, bundlerConfig, abortSet); - pingedTasks.push(model); - return request; -} -var currentRequest = null, - POP = {}; -function serializeThenable(request, thenable) { - request.pendingChunks++; - var newTask = createTask( - request, - null, - currentActiveSnapshot, - request.abortableTasks - ); - switch (thenable.status) { - case "fulfilled": - return ( - (newTask.model = thenable.value), pingTask(request, newTask), newTask.id - ); - case "rejected": - var digest = logRecoverableError(request, thenable.reason); - emitErrorChunkProd(request, newTask.id, digest); - return newTask.id; - default: - "string" !== typeof thenable.status && - ((thenable.status = "pending"), - thenable.then( - function (fulfilledValue) { - "pending" === thenable.status && - ((thenable.status = "fulfilled"), - (thenable.value = fulfilledValue)); - }, - function (error) { - "pending" === thenable.status && - ((thenable.status = "rejected"), (thenable.reason = error)); - } - )); - } - thenable.then( - function (value) { - newTask.model = value; - pingTask(request, newTask); - }, - function (reason) { - newTask.status = 4; - reason = logRecoverableError(request, reason); - emitErrorChunkProd(request, newTask.id, reason); - null !== request.destination && - flushCompletedChunks(request, request.destination); - } - ); - return newTask.id; -} -function readThenable(thenable) { - if ("fulfilled" === thenable.status) return thenable.value; - if ("rejected" === thenable.status) throw thenable.reason; - throw thenable; -} -function createLazyWrapperAroundWakeable(wakeable) { - switch (wakeable.status) { - case "fulfilled": - case "rejected": - break; - default: - "string" !== typeof wakeable.status && - ((wakeable.status = "pending"), - wakeable.then( - function (fulfilledValue) { - "pending" === wakeable.status && - ((wakeable.status = "fulfilled"), - (wakeable.value = fulfilledValue)); - }, - function (error) { - "pending" === wakeable.status && - ((wakeable.status = "rejected"), (wakeable.reason = error)); - } - )); - } - return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; -} -function attemptResolveElement( - request, - type, - key, - ref, - props, - prevThenableState -) { - if (null !== ref && void 0 !== ref) - throw Error( - "Refs cannot be used in Server Components, nor passed to Client Components." - ); - if ("function" === typeof type) { - if (type instanceof JSResourceReferenceImpl) - return [REACT_ELEMENT_TYPE, type, key, props]; - thenableIndexCounter = 0; - thenableState = prevThenableState; - props = type(props); - return "object" === typeof props && - null !== props && - "function" === typeof props.then - ? "fulfilled" === props.status - ? props.value - : createLazyWrapperAroundWakeable(props) - : props; - } - if ("string" === typeof type) return [REACT_ELEMENT_TYPE, type, key, props]; - if ("symbol" === typeof type) - return type === REACT_FRAGMENT_TYPE - ? props.children - : [REACT_ELEMENT_TYPE, type, key, props]; - if (null != type && "object" === typeof type) { - if (type instanceof JSResourceReferenceImpl) - return [REACT_ELEMENT_TYPE, type, key, props]; - switch (type.$$typeof) { - case REACT_LAZY_TYPE: - var init = type._init; - type = init(type._payload); - return attemptResolveElement( - request, - type, - key, - ref, - props, - prevThenableState - ); - case REACT_FORWARD_REF_TYPE: - return ( - (request = type.render), - (thenableIndexCounter = 0), - (thenableState = prevThenableState), - request(props, void 0) - ); - case REACT_MEMO_TYPE: - return attemptResolveElement( - request, - type.type, - key, - ref, - props, - prevThenableState - ); - case REACT_PROVIDER_TYPE: - return ( - pushProvider(type._context, props.value), - [ - REACT_ELEMENT_TYPE, - type, - key, - { value: props.value, children: props.children, __pop: POP } - ] - ); - } - } - throw Error( - "Unsupported Server Component type: " + describeValueForErrorMessage(type) - ); -} -function pingTask(request, task) { - var pingedTasks = request.pingedTasks; - pingedTasks.push(task); - 1 === pingedTasks.length && - ((request.flushScheduled = null !== request.destination), - performWork(request)); -} -function createTask(request, model, context, abortSet) { - var task = { - id: request.nextChunkId++, - status: 0, - model: model, - context: context, - ping: function () { - return pingTask(request, task); - }, - thenableState: null - }; - abortSet.add(task); - return task; -} -function serializeClientReference(request, parent, key, clientReference) { - var writtenClientReferences = request.writtenClientReferences, - existingId = writtenClientReferences.get(clientReference); - if (void 0 !== existingId) - return parent[0] === REACT_ELEMENT_TYPE && "1" === key - ? "$L" + existingId.toString(16) - : "$" + existingId.toString(16); - try { - var clientReferenceMetadata = - ReactFlightDOMRelayServerIntegration.resolveClientReferenceMetadata( - request.bundlerConfig, - clientReference - ); - request.pendingChunks++; - var importId = request.nextChunkId++; - request.completedImportChunks.push([ - "I", - importId, - clientReferenceMetadata - ]); - writtenClientReferences.set(clientReference, importId); - return parent[0] === REACT_ELEMENT_TYPE && "1" === key - ? "$L" + importId.toString(16) - : "$" + importId.toString(16); - } catch (x) { - return ( - request.pendingChunks++, - (parent = request.nextChunkId++), - (key = logRecoverableError(request, x)), - emitErrorChunkProd(request, parent, key), - "$" + parent.toString(16) - ); - } -} -function resolveModelToJSON(request, parent, key, value) { - switch (value) { - case REACT_ELEMENT_TYPE: - return "$"; - } - for ( - ; - "object" === typeof value && - null !== value && - (value.$$typeof === REACT_ELEMENT_TYPE || - value.$$typeof === REACT_LAZY_TYPE); - - ) - try { - switch (value.$$typeof) { - case REACT_ELEMENT_TYPE: - var element = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - ); - break; - case REACT_LAZY_TYPE: - var init = value._init; - value = init(value._payload); - } - } catch (thrownValue) { - key = - thrownValue === SuspenseException - ? getSuspendedThenable() - : thrownValue; - if ( - "object" === typeof key && - null !== key && - "function" === typeof key.then - ) - return ( - request.pendingChunks++, - (request = createTask( - request, - value, - currentActiveSnapshot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - "$L" + request.id.toString(16) - ); - request.pendingChunks++; - value = request.nextChunkId++; - key = logRecoverableError(request, key); - emitErrorChunkProd(request, value, key); - return "$L" + value.toString(16); - } - if (null === value) return null; - if ("object" === typeof value) { - if (value instanceof JSResourceReferenceImpl) - return serializeClientReference(request, parent, key, value); - if ("function" === typeof value.then) - return "$@" + serializeThenable(request, value).toString(16); - if (value.$$typeof === REACT_PROVIDER_TYPE) - return ( - (value = value._context._globalName), - (parent = request.writtenProviders), - (key = parent.get(key)), - void 0 === key && - (request.pendingChunks++, - (key = request.nextChunkId++), - parent.set(value, key), - request.completedJSONChunks.push(["O", key, "$P" + value])), - "$" + key.toString(16) - ); - if (value === POP) { - request = currentActiveSnapshot; - if (null === request) - throw Error( - "Tried to pop a Context at the root of the app. This is a bug in React." - ); - value = request.parentValue; - request.context._currentValue = - value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? request.context._defaultValue - : value; - currentActiveSnapshot = request.parent; - return; - } - return !isArrayImpl(value) && - (null === value || "object" !== typeof value - ? (request = null) - : ((request = - (MAYBE_ITERATOR_SYMBOL && value[MAYBE_ITERATOR_SYMBOL]) || - value["@@iterator"]), - (request = "function" === typeof request ? request : null)), - request) - ? Array.from(value) - : value; - } - if ("string" === typeof value) { - if ("Z" === value[value.length - 1] && parent[key] instanceof Date) - return "$D" + value; - request = "$" === value[0] ? "$" + value : value; - return request; - } - if ("boolean" === typeof value) return value; - if ("number" === typeof value) - return ( - (request = value), - Number.isFinite(request) - ? 0 === request && -Infinity === 1 / request - ? "$-0" - : request - : Infinity === request - ? "$Infinity" - : -Infinity === request - ? "$-Infinity" - : "$NaN" - ); - if ("undefined" === typeof value) return "$undefined"; - if ("function" === typeof value) { - if (value instanceof JSResourceReferenceImpl) - return serializeClientReference(request, parent, key, value); - if (/^on[A-Z]/.test(key)) - throw Error( - "Event handlers cannot be passed to Client Component props." + - describeObjectForErrorMessage(parent, key) + - "\nIf you need interactivity, consider converting part of this to a Client Component." - ); - throw Error( - 'Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server".' + - describeObjectForErrorMessage(parent, key) - ); - } - if ("symbol" === typeof value) { - element = request.writtenSymbols; - init = element.get(value); - if (void 0 !== init) return "$" + init.toString(16); - init = value.description; - if (Symbol.for(init) !== value) - throw Error( - "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + - (value.description + ") cannot be found among global symbols.") + - describeObjectForErrorMessage(parent, key) - ); - request.pendingChunks++; - key = request.nextChunkId++; - request.completedImportChunks.push(["O", key, "$S" + init]); - element.set(value, key); - return "$" + key.toString(16); - } - if ("bigint" === typeof value) return "$n" + value.toString(10); - throw Error( - "Type " + - typeof value + - " is not supported in Client Component props." + - describeObjectForErrorMessage(parent, key) - ); -} -function logRecoverableError(request, error) { - request = request.onError; - error = request(error); - if (null != error && "string" !== typeof error) - throw Error( - 'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + - typeof error + - '" instead' - ); - return error || ""; -} -function fatalError(request, error) { - null !== request.destination - ? ((request.status = 2), - ReactFlightDOMRelayServerIntegration.close(request.destination)) - : ((request.status = 1), (request.fatalError = error)); -} -function emitErrorChunkProd(request, id, digest) { - request.completedErrorChunks.push(["E", id, { digest: digest }]); -} -function emitHintChunk(request, code, model) { - request.nextChunkId++; - request.completedHintChunks.push(["H", code, model]); -} -function performWork(request$jscomp$0) { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = HooksDispatcher; - var prevRequest = currentRequest; - currentRequest$1 = currentRequest = request$jscomp$0; - try { - var pingedTasks = request$jscomp$0.pingedTasks; - request$jscomp$0.pingedTasks = []; - for (var i = 0; i < pingedTasks.length; i++) { - var task = pingedTasks[i]; - var request = request$jscomp$0; - if (0 === task.status) { - switchContext(task.context); - try { - var value = task.model; - if ( - "object" === typeof value && - null !== value && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - var element = value, - prevThenableState = task.thenableState; - task.model = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - prevThenableState - ); - for ( - task.thenableState = null; - "object" === typeof value && - null !== value && - value.$$typeof === REACT_ELEMENT_TYPE; - - ) - (element = value), - (task.model = value), - (value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - )); - } - var id = task.id, - json = convertModelToJSON(request, {}, "", value); - request.completedJSONChunks.push(["O", id, json]); - request.abortableTasks.delete(task); - task.status = 1; - } catch (thrownValue) { - var x = - thrownValue === SuspenseException - ? getSuspendedThenable() - : thrownValue; - if ( - "object" === typeof x && - null !== x && - "function" === typeof x.then - ) { - var ping = task.ping; - x.then(ping, ping); - task.thenableState = getThenableStateAfterSuspending(); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x); - emitErrorChunkProd(request, task.id, digest); - } - } - } - } - null !== request$jscomp$0.destination && - flushCompletedChunks(request$jscomp$0, request$jscomp$0.destination); - } catch (error) { - logRecoverableError(request$jscomp$0, error), - fatalError(request$jscomp$0, error); - } finally { - (ReactCurrentDispatcher.current = prevDispatcher), - (currentRequest$1 = null), - (currentRequest = prevRequest); - } -} -function flushCompletedChunks(request, destination) { - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var jsonChunks = request.completedJSONChunks; - for (i = 0; i < jsonChunks.length; i++) - request.pendingChunks--, writeChunkAndReturn(destination, jsonChunks[i]); - jsonChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - request.flushScheduled = !1; - } - 0 === request.pendingChunks && - ReactFlightDOMRelayServerIntegration.close(destination); -} -function enqueueFlush(request) { - if ( - !1 === request.flushScheduled && - 0 === request.pingedTasks.length && - null !== request.destination - ) { - var destination = request.destination; - request.flushScheduled = !0; - flushCompletedChunks(request, destination); - } -} -function importServerContexts(contexts) { - if (contexts) { - var prevContext = currentActiveSnapshot; - switchContext(null); - for (var i = 0; i < contexts.length; i++) { - var _contexts$i = contexts[i], - name = _contexts$i[0]; - _contexts$i = _contexts$i[1]; - ContextRegistry[name] || - (ContextRegistry[name] = React.createServerContext( - name, - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - )); - pushProvider(ContextRegistry[name], _contexts$i); - } - contexts = currentActiveSnapshot; - switchContext(prevContext); - return contexts; - } - return null; -} -exports.render = function (model, destination, config, options) { - model = createRequest( - model, - config, - options ? options.onError : void 0, - void 0, - options ? options.identifierPrefix : void 0 - ); - model.flushScheduled = null !== model.destination; - performWork(model); - if (1 === model.status) - (model.status = 2), ReactFlightDOMRelayServerIntegration.close(destination); - else if (2 !== model.status && null === model.destination) { - model.destination = destination; - try { - flushCompletedChunks(model, destination); - } catch (error) { - logRecoverableError(model, error), fatalError(model, error); - } - } -}; diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.modern.js b/compiled/facebook-www/ReactFlightDOMRelayServer-prod.modern.js deleted file mode 100644 index 3d4b22dbbdc3e..0000000000000 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.modern.js +++ /dev/null @@ -1,1089 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @noflow - * @nolint - * @preventMunge - * @preserve-invariant-messages - */ - -"use strict"; -var JSResourceReferenceImpl = require("JSResourceReferenceImpl"), - ReactFlightDOMRelayServerIntegration = require("ReactFlightDOMRelayServerIntegration"), - ReactDOM = require("react-dom"), - React = require("react"), - hasOwnProperty = Object.prototype.hasOwnProperty, - isArrayImpl = Array.isArray; -function convertModelToJSON(request, parent, key, model) { - parent = resolveModelToJSON(request, parent, key, model); - if ("object" === typeof parent && null !== parent) { - if (isArrayImpl(parent)) { - var jsonArray = []; - for (key = 0; key < parent.length; key++) - jsonArray[key] = convertModelToJSON( - request, - parent, - "" + key, - parent[key] - ); - return jsonArray; - } - key = {}; - for (jsonArray in parent) - hasOwnProperty.call(parent, jsonArray) && - (key[jsonArray] = convertModelToJSON( - request, - parent, - jsonArray, - parent[jsonArray] - )); - return key; - } - return parent; -} -function writeChunkAndReturn(destination, chunk) { - ReactFlightDOMRelayServerIntegration.emitRow(destination, chunk); - return !0; -} -var ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; -require("ReactFeatureFlags"); -var ReactDOMFlightServerDispatcher = { - prefetchDNS: prefetchDNS, - preconnect: preconnect, - preload: preload, - preinit: preinit -}; -function prefetchDNS(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - key = "D" + href; - hints.has(key) || - (hints.add(key), - options - ? emitHintChunk(request, "D", [href, options]) - : emitHintChunk(request, "D", href), - enqueueFlush(request)); - } - } -} -function preconnect(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - crossOrigin = - null == options || "string" !== typeof options.crossOrigin - ? null - : "use-credentials" === options.crossOrigin - ? "use-credentials" - : ""; - crossOrigin = - "C" + (null === crossOrigin ? "null" : crossOrigin) + "|" + href; - hints.has(crossOrigin) || - (hints.add(crossOrigin), - options - ? emitHintChunk(request, "C", [href, options]) - : emitHintChunk(request, "C", href), - enqueueFlush(request)); - } - } -} -function preload(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - key = "L" + href; - hints.has(key) || - (hints.add(key), - emitHintChunk(request, "L", [href, options]), - enqueueFlush(request)); - } - } -} -function preinit(href, options) { - if ("string" === typeof href) { - var request = currentRequest ? currentRequest : null; - if (request) { - var hints = request.hints, - key = "I" + href; - hints.has(key) || - (hints.add(key), - emitHintChunk(request, "I", [href, options]), - enqueueFlush(request)); - } - } -} -var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher, - REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_PROVIDER_TYPE = Symbol.for("react.provider"), - REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( - "react.default_value" - ), - REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator, - currentActiveSnapshot = null; -function popToNearestCommonAncestor(prev, next) { - if (prev !== next) { - prev.context._currentValue = prev.parentValue; - prev = prev.parent; - var parentNext = next.parent; - if (null === prev) { - if (null !== parentNext) - throw Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - } else { - if (null === parentNext) - throw Error( - "The stacks must reach the root at the same time. This is a bug in React." - ); - popToNearestCommonAncestor(prev, parentNext); - next.context._currentValue = next.value; - } - } -} -function popAllPrevious(prev) { - prev.context._currentValue = prev.parentValue; - prev = prev.parent; - null !== prev && popAllPrevious(prev); -} -function pushAllNext(next) { - var parentNext = next.parent; - null !== parentNext && pushAllNext(parentNext); - next.context._currentValue = next.value; -} -function popPreviousToCommonLevel(prev, next) { - prev.context._currentValue = prev.parentValue; - prev = prev.parent; - if (null === prev) - throw Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - prev.depth === next.depth - ? popToNearestCommonAncestor(prev, next) - : popPreviousToCommonLevel(prev, next); -} -function popNextToCommonLevel(prev, next) { - var parentNext = next.parent; - if (null === parentNext) - throw Error( - "The depth must equal at least at zero before reaching the root. This is a bug in React." - ); - prev.depth === parentNext.depth - ? popToNearestCommonAncestor(prev, parentNext) - : popNextToCommonLevel(prev, parentNext); - next.context._currentValue = next.value; -} -function switchContext(newSnapshot) { - var prev = currentActiveSnapshot; - prev !== newSnapshot && - (null === prev - ? pushAllNext(newSnapshot) - : null === newSnapshot - ? popAllPrevious(prev) - : prev.depth === newSnapshot.depth - ? popToNearestCommonAncestor(prev, newSnapshot) - : prev.depth > newSnapshot.depth - ? popPreviousToCommonLevel(prev, newSnapshot) - : popNextToCommonLevel(prev, newSnapshot), - (currentActiveSnapshot = newSnapshot)); -} -function pushProvider(context, nextValue) { - var prevValue = context._currentValue; - context._currentValue = nextValue; - var prevNode = currentActiveSnapshot; - return (currentActiveSnapshot = context = - { - parent: prevNode, - depth: null === prevNode ? 0 : prevNode.depth + 1, - context: context, - parentValue: prevValue, - value: nextValue - }); -} -var SuspenseException = Error( - "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`" -); -function noop() {} -function trackUsedThenable(thenableState, thenable, index) { - index = thenableState[index]; - void 0 === index - ? thenableState.push(thenable) - : index !== thenable && (thenable.then(noop, noop), (thenable = index)); - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), - (thenableState.status = "pending"), - thenableState.then( - function (fulfilledValue) { - if ("pending" === thenable.status) { - var fulfilledThenable = thenable; - fulfilledThenable.status = "fulfilled"; - fulfilledThenable.value = fulfilledValue; - } - }, - function (error) { - if ("pending" === thenable.status) { - var rejectedThenable = thenable; - rejectedThenable.status = "rejected"; - rejectedThenable.reason = error; - } - } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } - suspendedThenable = thenable; - throw SuspenseException; - } -} -var suspendedThenable = null; -function getSuspendedThenable() { - if (null === suspendedThenable) - throw Error( - "Expected a suspended thenable. This is a bug in React. Please file an issue." - ); - var thenable = suspendedThenable; - suspendedThenable = null; - return thenable; -} -var currentRequest$1 = null, - thenableIndexCounter = 0, - thenableState = null; -function getThenableStateAfterSuspending() { - var state = thenableState; - thenableState = null; - return state; -} -function readContext(context) { - return context._currentValue; -} -var HooksDispatcher = { - useMemo: function (nextCreate) { - return nextCreate(); - }, - useCallback: function (callback) { - return callback; - }, - useDebugValue: function () {}, - useDeferredValue: unsupportedHook, - useTransition: unsupportedHook, - readContext: readContext, - useContext: readContext, - useReducer: unsupportedHook, - useRef: unsupportedHook, - useState: unsupportedHook, - useInsertionEffect: unsupportedHook, - useLayoutEffect: unsupportedHook, - useImperativeHandle: unsupportedHook, - useEffect: unsupportedHook, - useId: useId, - useMutableSource: unsupportedHook, - useSyncExternalStore: unsupportedHook, - useCacheRefresh: function () { - return unsupportedRefresh; - }, - useMemoCache: function (size) { - for (var data = Array(size), i = 0; i < size; i++) - data[i] = REACT_MEMO_CACHE_SENTINEL; - return data; - }, - use: use -}; -function unsupportedHook() { - throw Error("This Hook is not supported in Server Components."); -} -function unsupportedRefresh() { - throw Error("Refreshing the cache is not supported in Server Components."); -} -function useId() { - if (null === currentRequest$1) - throw Error("useId can only be used while React is rendering"); - var id = currentRequest$1.identifierCount++; - return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":"; -} -function use(usable) { - if ( - (null !== usable && "object" === typeof usable) || - "function" === typeof usable - ) { - if ("function" === typeof usable.then) { - var index = thenableIndexCounter; - thenableIndexCounter += 1; - null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index); - } - if (usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) - return usable._currentValue; - } - throw Error("An unsupported type was passed to use(): " + String(usable)); -} -function createSignal() { - return new AbortController().signal; -} -function resolveCache() { - var request = currentRequest ? currentRequest : null; - return request ? request.cache : new Map(); -} -var DefaultCacheDispatcher = { - getCacheSignal: function () { - var cache = resolveCache(), - entry = cache.get(createSignal); - void 0 === entry && - ((entry = createSignal()), cache.set(createSignal, entry)); - return entry; - }, - getCacheForType: function (resourceType) { - var cache = resolveCache(), - entry = cache.get(resourceType); - void 0 === entry && - ((entry = resourceType()), cache.set(resourceType, entry)); - return entry; - } -}; -function objectName(object) { - return Object.prototype.toString - .call(object) - .replace(/^\[object (.*)\]$/, function (m, p0) { - return p0; - }); -} -function describeValueForErrorMessage(value) { - switch (typeof value) { - case "string": - return JSON.stringify( - 10 >= value.length ? value : value.slice(0, 10) + "..." - ); - case "object": - if (isArrayImpl(value)) return "[...]"; - value = objectName(value); - return "Object" === value ? "{...}" : value; - case "function": - return "function"; - default: - return String(value); - } -} -function describeElementType(type) { - if ("string" === typeof type) return type; - switch (type) { - case REACT_SUSPENSE_TYPE: - return "Suspense"; - case REACT_SUSPENSE_LIST_TYPE: - return "SuspenseList"; - } - if ("object" === typeof type) - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeElementType(type.render); - case REACT_MEMO_TYPE: - return describeElementType(type.type); - case REACT_LAZY_TYPE: - var payload = type._payload; - type = type._init; - try { - return describeElementType(type(payload)); - } catch (x) {} - } - return ""; -} -function describeObjectForErrorMessage(objectOrArray, expandedName) { - var objKind = objectName(objectOrArray); - if ("Object" !== objKind && "Array" !== objKind) return objKind; - objKind = -1; - var length = 0; - if (isArrayImpl(objectOrArray)) { - var str = "["; - for (var i = 0; i < objectOrArray.length; i++) { - 0 < i && (str += ", "); - var value = objectOrArray[i]; - value = - "object" === typeof value && null !== value - ? describeObjectForErrorMessage(value) - : describeValueForErrorMessage(value); - "" + i === expandedName - ? ((objKind = str.length), (length = value.length), (str += value)) - : (str = - 10 > value.length && 40 > str.length + value.length - ? str + value - : str + "..."); - } - str += "]"; - } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) - str = "<" + describeElementType(objectOrArray.type) + "/>"; - else { - str = "{"; - i = Object.keys(objectOrArray); - for (value = 0; value < i.length; value++) { - 0 < value && (str += ", "); - var name = i[value], - encodedKey = JSON.stringify(name); - str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": "; - encodedKey = objectOrArray[name]; - encodedKey = - "object" === typeof encodedKey && null !== encodedKey - ? describeObjectForErrorMessage(encodedKey) - : describeValueForErrorMessage(encodedKey); - name === expandedName - ? ((objKind = str.length), - (length = encodedKey.length), - (str += encodedKey)) - : (str = - 10 > encodedKey.length && 40 > str.length + encodedKey.length - ? str + encodedKey - : str + "..."); - } - str += "}"; - } - return void 0 === expandedName - ? str - : -1 < objKind && 0 < length - ? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)), - "\n " + str + "\n " + objectOrArray) - : "\n " + str; -} -var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, - ContextRegistry = ReactSharedInternals.ContextRegistry, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache; -function defaultErrorHandler(error) { - console.error(error); -} -function createRequest( - model, - bundlerConfig, - onError, - context, - identifierPrefix -) { - if ( - null !== ReactCurrentCache.current && - ReactCurrentCache.current !== DefaultCacheDispatcher - ) - throw Error("Currently React only supports one RSC renderer at a time."); - ReactDOMCurrentDispatcher.current = ReactDOMFlightServerDispatcher; - ReactCurrentCache.current = DefaultCacheDispatcher; - var abortSet = new Set(), - pingedTasks = [], - hints = new Set(), - request = { - status: 0, - flushScheduled: !1, - fatalError: null, - destination: null, - bundlerConfig: bundlerConfig, - cache: new Map(), - nextChunkId: 0, - pendingChunks: 0, - hints: hints, - abortableTasks: abortSet, - pingedTasks: pingedTasks, - completedImportChunks: [], - completedHintChunks: [], - completedJSONChunks: [], - completedErrorChunks: [], - writtenSymbols: new Map(), - writtenClientReferences: new Map(), - writtenServerReferences: new Map(), - writtenProviders: new Map(), - identifierPrefix: identifierPrefix || "", - identifierCount: 1, - onError: void 0 === onError ? defaultErrorHandler : onError, - toJSON: function (key, value) { - return resolveModelToJSON(request, this, key, value); - } - }; - request.pendingChunks++; - bundlerConfig = importServerContexts(context); - model = createTask(request, model, bundlerConfig, abortSet); - pingedTasks.push(model); - return request; -} -var currentRequest = null, - POP = {}; -function serializeThenable(request, thenable) { - request.pendingChunks++; - var newTask = createTask( - request, - null, - currentActiveSnapshot, - request.abortableTasks - ); - switch (thenable.status) { - case "fulfilled": - return ( - (newTask.model = thenable.value), pingTask(request, newTask), newTask.id - ); - case "rejected": - var digest = logRecoverableError(request, thenable.reason); - emitErrorChunkProd(request, newTask.id, digest); - return newTask.id; - default: - "string" !== typeof thenable.status && - ((thenable.status = "pending"), - thenable.then( - function (fulfilledValue) { - "pending" === thenable.status && - ((thenable.status = "fulfilled"), - (thenable.value = fulfilledValue)); - }, - function (error) { - "pending" === thenable.status && - ((thenable.status = "rejected"), (thenable.reason = error)); - } - )); - } - thenable.then( - function (value) { - newTask.model = value; - pingTask(request, newTask); - }, - function (reason) { - newTask.status = 4; - reason = logRecoverableError(request, reason); - emitErrorChunkProd(request, newTask.id, reason); - null !== request.destination && - flushCompletedChunks(request, request.destination); - } - ); - return newTask.id; -} -function readThenable(thenable) { - if ("fulfilled" === thenable.status) return thenable.value; - if ("rejected" === thenable.status) throw thenable.reason; - throw thenable; -} -function createLazyWrapperAroundWakeable(wakeable) { - switch (wakeable.status) { - case "fulfilled": - case "rejected": - break; - default: - "string" !== typeof wakeable.status && - ((wakeable.status = "pending"), - wakeable.then( - function (fulfilledValue) { - "pending" === wakeable.status && - ((wakeable.status = "fulfilled"), - (wakeable.value = fulfilledValue)); - }, - function (error) { - "pending" === wakeable.status && - ((wakeable.status = "rejected"), (wakeable.reason = error)); - } - )); - } - return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; -} -function attemptResolveElement( - request, - type, - key, - ref, - props, - prevThenableState -) { - if (null !== ref && void 0 !== ref) - throw Error( - "Refs cannot be used in Server Components, nor passed to Client Components." - ); - if ("function" === typeof type) { - if (type instanceof JSResourceReferenceImpl) - return [REACT_ELEMENT_TYPE, type, key, props]; - thenableIndexCounter = 0; - thenableState = prevThenableState; - props = type(props); - return "object" === typeof props && - null !== props && - "function" === typeof props.then - ? "fulfilled" === props.status - ? props.value - : createLazyWrapperAroundWakeable(props) - : props; - } - if ("string" === typeof type) return [REACT_ELEMENT_TYPE, type, key, props]; - if ("symbol" === typeof type) - return type === REACT_FRAGMENT_TYPE - ? props.children - : [REACT_ELEMENT_TYPE, type, key, props]; - if (null != type && "object" === typeof type) { - if (type instanceof JSResourceReferenceImpl) - return [REACT_ELEMENT_TYPE, type, key, props]; - switch (type.$$typeof) { - case REACT_LAZY_TYPE: - var init = type._init; - type = init(type._payload); - return attemptResolveElement( - request, - type, - key, - ref, - props, - prevThenableState - ); - case REACT_FORWARD_REF_TYPE: - return ( - (request = type.render), - (thenableIndexCounter = 0), - (thenableState = prevThenableState), - request(props, void 0) - ); - case REACT_MEMO_TYPE: - return attemptResolveElement( - request, - type.type, - key, - ref, - props, - prevThenableState - ); - case REACT_PROVIDER_TYPE: - return ( - pushProvider(type._context, props.value), - [ - REACT_ELEMENT_TYPE, - type, - key, - { value: props.value, children: props.children, __pop: POP } - ] - ); - } - } - throw Error( - "Unsupported Server Component type: " + describeValueForErrorMessage(type) - ); -} -function pingTask(request, task) { - var pingedTasks = request.pingedTasks; - pingedTasks.push(task); - 1 === pingedTasks.length && - ((request.flushScheduled = null !== request.destination), - performWork(request)); -} -function createTask(request, model, context, abortSet) { - var task = { - id: request.nextChunkId++, - status: 0, - model: model, - context: context, - ping: function () { - return pingTask(request, task); - }, - thenableState: null - }; - abortSet.add(task); - return task; -} -function serializeClientReference(request, parent, key, clientReference) { - var writtenClientReferences = request.writtenClientReferences, - existingId = writtenClientReferences.get(clientReference); - if (void 0 !== existingId) - return parent[0] === REACT_ELEMENT_TYPE && "1" === key - ? "$L" + existingId.toString(16) - : "$" + existingId.toString(16); - try { - var clientReferenceMetadata = - ReactFlightDOMRelayServerIntegration.resolveClientReferenceMetadata( - request.bundlerConfig, - clientReference - ); - request.pendingChunks++; - var importId = request.nextChunkId++; - request.completedImportChunks.push([ - "I", - importId, - clientReferenceMetadata - ]); - writtenClientReferences.set(clientReference, importId); - return parent[0] === REACT_ELEMENT_TYPE && "1" === key - ? "$L" + importId.toString(16) - : "$" + importId.toString(16); - } catch (x) { - return ( - request.pendingChunks++, - (parent = request.nextChunkId++), - (key = logRecoverableError(request, x)), - emitErrorChunkProd(request, parent, key), - "$" + parent.toString(16) - ); - } -} -function resolveModelToJSON(request, parent, key, value) { - switch (value) { - case REACT_ELEMENT_TYPE: - return "$"; - } - for ( - ; - "object" === typeof value && - null !== value && - (value.$$typeof === REACT_ELEMENT_TYPE || - value.$$typeof === REACT_LAZY_TYPE); - - ) - try { - switch (value.$$typeof) { - case REACT_ELEMENT_TYPE: - var element = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - ); - break; - case REACT_LAZY_TYPE: - var init = value._init; - value = init(value._payload); - } - } catch (thrownValue) { - key = - thrownValue === SuspenseException - ? getSuspendedThenable() - : thrownValue; - if ( - "object" === typeof key && - null !== key && - "function" === typeof key.then - ) - return ( - request.pendingChunks++, - (request = createTask( - request, - value, - currentActiveSnapshot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - "$L" + request.id.toString(16) - ); - request.pendingChunks++; - value = request.nextChunkId++; - key = logRecoverableError(request, key); - emitErrorChunkProd(request, value, key); - return "$L" + value.toString(16); - } - if (null === value) return null; - if ("object" === typeof value) { - if (value instanceof JSResourceReferenceImpl) - return serializeClientReference(request, parent, key, value); - if ("function" === typeof value.then) - return "$@" + serializeThenable(request, value).toString(16); - if (value.$$typeof === REACT_PROVIDER_TYPE) - return ( - (value = value._context._globalName), - (parent = request.writtenProviders), - (key = parent.get(key)), - void 0 === key && - (request.pendingChunks++, - (key = request.nextChunkId++), - parent.set(value, key), - request.completedJSONChunks.push(["O", key, "$P" + value])), - "$" + key.toString(16) - ); - if (value === POP) { - request = currentActiveSnapshot; - if (null === request) - throw Error( - "Tried to pop a Context at the root of the app. This is a bug in React." - ); - value = request.parentValue; - request.context._currentValue = - value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? request.context._defaultValue - : value; - currentActiveSnapshot = request.parent; - return; - } - return !isArrayImpl(value) && - (null === value || "object" !== typeof value - ? (request = null) - : ((request = - (MAYBE_ITERATOR_SYMBOL && value[MAYBE_ITERATOR_SYMBOL]) || - value["@@iterator"]), - (request = "function" === typeof request ? request : null)), - request) - ? Array.from(value) - : value; - } - if ("string" === typeof value) { - if ("Z" === value[value.length - 1] && parent[key] instanceof Date) - return "$D" + value; - request = "$" === value[0] ? "$" + value : value; - return request; - } - if ("boolean" === typeof value) return value; - if ("number" === typeof value) - return ( - (request = value), - Number.isFinite(request) - ? 0 === request && -Infinity === 1 / request - ? "$-0" - : request - : Infinity === request - ? "$Infinity" - : -Infinity === request - ? "$-Infinity" - : "$NaN" - ); - if ("undefined" === typeof value) return "$undefined"; - if ("function" === typeof value) { - if (value instanceof JSResourceReferenceImpl) - return serializeClientReference(request, parent, key, value); - if (/^on[A-Z]/.test(key)) - throw Error( - "Event handlers cannot be passed to Client Component props." + - describeObjectForErrorMessage(parent, key) + - "\nIf you need interactivity, consider converting part of this to a Client Component." - ); - throw Error( - 'Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server".' + - describeObjectForErrorMessage(parent, key) - ); - } - if ("symbol" === typeof value) { - element = request.writtenSymbols; - init = element.get(value); - if (void 0 !== init) return "$" + init.toString(16); - init = value.description; - if (Symbol.for(init) !== value) - throw Error( - "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + - (value.description + ") cannot be found among global symbols.") + - describeObjectForErrorMessage(parent, key) - ); - request.pendingChunks++; - key = request.nextChunkId++; - request.completedImportChunks.push(["O", key, "$S" + init]); - element.set(value, key); - return "$" + key.toString(16); - } - if ("bigint" === typeof value) return "$n" + value.toString(10); - throw Error( - "Type " + - typeof value + - " is not supported in Client Component props." + - describeObjectForErrorMessage(parent, key) - ); -} -function logRecoverableError(request, error) { - request = request.onError; - error = request(error); - if (null != error && "string" !== typeof error) - throw Error( - 'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + - typeof error + - '" instead' - ); - return error || ""; -} -function fatalError(request, error) { - null !== request.destination - ? ((request.status = 2), - ReactFlightDOMRelayServerIntegration.close(request.destination)) - : ((request.status = 1), (request.fatalError = error)); -} -function emitErrorChunkProd(request, id, digest) { - request.completedErrorChunks.push(["E", id, { digest: digest }]); -} -function emitHintChunk(request, code, model) { - request.nextChunkId++; - request.completedHintChunks.push(["H", code, model]); -} -function performWork(request$jscomp$0) { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = HooksDispatcher; - var prevRequest = currentRequest; - currentRequest$1 = currentRequest = request$jscomp$0; - try { - var pingedTasks = request$jscomp$0.pingedTasks; - request$jscomp$0.pingedTasks = []; - for (var i = 0; i < pingedTasks.length; i++) { - var task = pingedTasks[i]; - var request = request$jscomp$0; - if (0 === task.status) { - switchContext(task.context); - try { - var value = task.model; - if ( - "object" === typeof value && - null !== value && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - var element = value, - prevThenableState = task.thenableState; - task.model = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - prevThenableState - ); - for ( - task.thenableState = null; - "object" === typeof value && - null !== value && - value.$$typeof === REACT_ELEMENT_TYPE; - - ) - (element = value), - (task.model = value), - (value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - )); - } - var id = task.id, - json = convertModelToJSON(request, {}, "", value); - request.completedJSONChunks.push(["O", id, json]); - request.abortableTasks.delete(task); - task.status = 1; - } catch (thrownValue) { - var x = - thrownValue === SuspenseException - ? getSuspendedThenable() - : thrownValue; - if ( - "object" === typeof x && - null !== x && - "function" === typeof x.then - ) { - var ping = task.ping; - x.then(ping, ping); - task.thenableState = getThenableStateAfterSuspending(); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x); - emitErrorChunkProd(request, task.id, digest); - } - } - } - } - null !== request$jscomp$0.destination && - flushCompletedChunks(request$jscomp$0, request$jscomp$0.destination); - } catch (error) { - logRecoverableError(request$jscomp$0, error), - fatalError(request$jscomp$0, error); - } finally { - (ReactCurrentDispatcher.current = prevDispatcher), - (currentRequest$1 = null), - (currentRequest = prevRequest); - } -} -function flushCompletedChunks(request, destination) { - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var jsonChunks = request.completedJSONChunks; - for (i = 0; i < jsonChunks.length; i++) - request.pendingChunks--, writeChunkAndReturn(destination, jsonChunks[i]); - jsonChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - request.flushScheduled = !1; - } - 0 === request.pendingChunks && - ReactFlightDOMRelayServerIntegration.close(destination); -} -function enqueueFlush(request) { - if ( - !1 === request.flushScheduled && - 0 === request.pingedTasks.length && - null !== request.destination - ) { - var destination = request.destination; - request.flushScheduled = !0; - flushCompletedChunks(request, destination); - } -} -function importServerContexts(contexts) { - if (contexts) { - var prevContext = currentActiveSnapshot; - switchContext(null); - for (var i = 0; i < contexts.length; i++) { - var _contexts$i = contexts[i], - name = _contexts$i[0]; - _contexts$i = _contexts$i[1]; - ContextRegistry[name] || - (ContextRegistry[name] = React.createServerContext( - name, - REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - )); - pushProvider(ContextRegistry[name], _contexts$i); - } - contexts = currentActiveSnapshot; - switchContext(prevContext); - return contexts; - } - return null; -} -exports.render = function (model, destination, config, options) { - model = createRequest( - model, - config, - options ? options.onError : void 0, - void 0, - options ? options.identifierPrefix : void 0 - ); - model.flushScheduled = null !== model.destination; - performWork(model); - if (1 === model.status) - (model.status = 2), ReactFlightDOMRelayServerIntegration.close(destination); - else if (2 !== model.status && null === model.destination) { - model.destination = destination; - try { - flushCompletedChunks(model, destination); - } catch (error) { - logRecoverableError(model, error), fatalError(model, error); - } - } -}; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 72417c572bdeb..713fe62c39411 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -24561,7 +24561,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-0768a1ed"; +var ReactVersion = "18.3.0-www-classic-dce737e6"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 8b2677c795015..5a095ad462b24 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -24561,7 +24561,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-761d713e"; +var ReactVersion = "18.3.0-www-modern-dce737e6"; // Might add PROFILE later.