From a94afbd444b67e72cba2d3964db6eae3ffe40ee0 Mon Sep 17 00:00:00 2001 From: kassens Date: Fri, 2 Dec 2022 15:29:15 +0000 Subject: [PATCH] Build for 420f0b7fa1fcc609fc7b438c4599d0f76fab4bc0 --- compiled/facebook-www/React-dev.classic.js | 2 +- compiled/facebook-www/React-dev.modern.js | 2 +- compiled/facebook-www/React-prod.classic.js | 2 +- compiled/facebook-www/React-prod.modern.js | 2 +- .../facebook-www/React-profiling.classic.js | 2 +- .../facebook-www/React-profiling.modern.js | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 3421 ++++++++-------- compiled/facebook-www/ReactART-dev.modern.js | 3421 ++++++++-------- .../facebook-www/ReactART-prod.classic.js | 1409 ++++--- compiled/facebook-www/ReactART-prod.modern.js | 1409 ++++--- compiled/facebook-www/ReactDOM-dev.classic.js | 3430 ++++++++--------- compiled/facebook-www/ReactDOM-dev.modern.js | 3430 ++++++++--------- .../facebook-www/ReactDOM-prod.classic.js | 1476 ++++--- compiled/facebook-www/ReactDOM-prod.modern.js | 1476 ++++--- .../ReactDOM-profiling.classic.js | 1476 ++++--- .../facebook-www/ReactDOM-profiling.modern.js | 1476 ++++--- .../ReactDOMForked-dev.classic.js | 3430 ++++++++--------- .../facebook-www/ReactDOMForked-dev.modern.js | 3430 ++++++++--------- .../ReactDOMForked-prod.classic.js | 1476 ++++--- .../ReactDOMForked-prod.modern.js | 1476 ++++--- .../ReactDOMForked-profiling.classic.js | 1476 ++++--- .../ReactDOMForked-profiling.modern.js | 1476 ++++--- .../ReactDOMServer-dev.classic.js | 2 +- .../facebook-www/ReactDOMServer-dev.modern.js | 2 +- .../ReactDOMServer-prod.classic.js | 2 +- .../ReactDOMServer-prod.modern.js | 2 +- .../ReactDOMTesting-dev.classic.js | 2673 +++++++------ .../ReactDOMTesting-dev.modern.js | 2673 +++++++------ .../ReactDOMTesting-prod.classic.js | 1230 +++--- .../ReactDOMTesting-prod.modern.js | 1198 +++--- .../ReactTestRenderer-dev.classic.js | 2664 +++++++------ .../ReactTestRenderer-dev.modern.js | 2664 +++++++------ 32 files changed, 24036 insertions(+), 24274 deletions(-) diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index 4d7f4ac0c9..0e78e89432 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-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-classic-420f0b7fa-20221201"; // 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 9329f0be71..87e4cb895d 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-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-modern-420f0b7fa-20221201"; // 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 158abb38c0..132755edae 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -643,4 +643,4 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-030dae2f4-20221201"; +exports.version = "18.3.0-www-classic-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 978612d051..bb39b57bde 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -635,4 +635,4 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-030dae2f4-20221201"; +exports.version = "18.3.0-www-modern-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index 09edbc86e8..a30bda35bd 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -654,7 +654,7 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-030dae2f4-20221201"; +exports.version = "18.3.0-www-classic-420f0b7fa-20221201"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 08f09179fd..97e8628cf6 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -646,7 +646,7 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-030dae2f4-20221201"; +exports.version = "18.3.0-www-modern-420f0b7fa-20221201"; /* 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 d277dc6af8..687a2764f2 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-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-classic-420f0b7fa-20221201"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -204,10 +204,6 @@ var enableProfilerNestedUpdateScheduledHook = var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler; // Note: we'll want to remove this when we to userland implementation. var warnAboutStringRefs = true; -// don't have to add another test dimension. The build system will compile this -// to the correct value. - -var enableNewReconciler = false; var FunctionComponent = 0; var ClassComponent = 1; @@ -4130,10 +4126,787 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate(fiber)) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + _payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } /** @@ -6056,1405 +6829,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue2, providerFiber); - context._currentValue2 = nextValue; - - { - if ( - context._currentRenderer2 !== undefined && - context._currentRenderer2 !== null && - context._currentRenderer2 !== rendererSigil - ) { - error( - "Detected multiple renderers concurrently rendering the " + - "same context provider. This is currently unsupported." - ); - } - - context._currentRenderer2 = rendererSigil; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue2 = context._defaultValue; - } else { - context._currentValue2 = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) { - // TODO: This path is only used by Cache components. Update - // lazilyPropagateParentContextChanges to look for Cache components so they - // can take advantage of lazy propagation. - var forcePropagateEntireTree = true; - propagateContextChanges( - workInProgress, - [context], - renderLanes, - forcePropagateEntireTree - ); - } else { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - // Only used by eager implementation - if (enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - // Only used by lazy implementation - if (!enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dep = list.firstContext; - - findChangedDep: while (dep !== null) { - // Assigning these to constants to help Flow - var dependency = dep; - var consumer = fiber; - - for (var i = 0; i < contexts.length; i++) { - var context = contexts[i]; // Check if the context matches. - // TODO: Compare selected values to bail out early. - - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - // In the lazy implementation, don't mark a dirty flag on the - // dependency itself. Not all changes are propagated, so we can't - // rely on the propagation function alone to determine whether - // something has changed; the consumer will check. In the future, we - // could add back a dirty flag as an optimization to avoid double - // checking, but until we have selectors it's not really worth - // the trouble. - consumer.lanes = mergeLanes(consumer.lanes, renderLanes); - var alternate = consumer.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - consumer.return, - renderLanes, - workInProgress - ); - - if (!forcePropagateEntireTree) { - // During lazy propagation, when we find a match, we can defer - // propagating changes to the children, because we're going to - // visit them during render. We should continue propagating the - // siblings, though - nextFiber = null; - } // Since we already found a match, we can stop traversing the - // dependency list. - - break findChangedDep; - } - } - - dep = dependency.next; - } - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate2 = parentSuspense.alternate; - - if (_alternate2 !== null) { - _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = null; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function lazilyPropagateParentContextChanges( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = false; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate -// to the entire subtree, because we won't revisit it until after the current -// render has completed, at which point we'll have lost track of which providers -// have changed. - -function propagateParentContextChangesToDeferredTree( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = true; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} - -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (!enableLazyContextPropagation) { - return; - } // Collect all the parent providers that changed. Since this is usually small - // number, we use an Array instead of Set. - - var contexts = null; - var parent = workInProgress; - var isInsidePropagationBailout = false; - - while (parent !== null) { - if (!isInsidePropagationBailout) { - if ((parent.flags & NeedsPropagation) !== NoFlags) { - isInsidePropagationBailout = true; - } else if ((parent.flags & DidPropagateContext) !== NoFlags) { - break; - } - } - - if (parent.tag === ContextProvider) { - var currentParent = parent.alternate; - - if (currentParent === null) { - throw new Error("Should have a current fiber. This is a bug in React."); - } - - var oldProps = currentParent.memoizedProps; - - if (oldProps !== null) { - var providerType = parent.type; - var context = providerType._context; - var newProps = parent.pendingProps; - var newValue = newProps.value; - var oldValue = oldProps.value; - - if (!objectIs(newValue, oldValue)) { - if (contexts !== null) { - contexts.push(context); - } else { - contexts = [context]; - } - } - } - } - - parent = parent.return; - } - - if (contexts !== null) { - // If there were any changed providers, search through the children and - // propagate their changes. - propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree - ); - } // This is an optimization so that we only propagate once per subtree. If a - // deeply nested child bails out, and it calls this propagation function, it - // uses this flag to know that the remaining ancestor providers have already - // been propagated. - // - // NOTE: This optimization is only necessary because we sometimes enter the - // begin phase of nodes that don't have any work scheduled on them — - // specifically, the siblings of a node that _does_ have scheduled work. The - // siblings will bail out and call this function again, even though we already - // propagated content changes to it and its subtree. So we use this flag to - // mark that the parent providers already propagated. - // - // Unfortunately, though, we need to ignore this flag when we're inside a - // tree whose context propagation was deferred — that's what the - // `NeedsPropagation` flag is for. - // - // If we could instead bail out before entering the siblings' begin phase, - // then we could remove both `DidPropagateContext` and `NeedsPropagation`. - // Consider this as part of the next refactor to the fiber tree structure. - - workInProgress.flags |= DidPropagateContext; -} - -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) { - return false; - } // Iterate over the current dependencies to see if something changed. This - // only gets called if props and state has already bailed out, so it's a - // relatively uncommon path, except at the root of a changed subtree. - // Alternatively, we could move these comparisons into `readContext`, but - // that's a much hotter path, so I think this is an appropriate trade off. - - var dependency = currentDependencies.firstContext; - - while (dependency !== null) { - var context = dependency.context; - var newValue = context._currentValue2; - var oldValue = dependency.memoizedValue; - - if (!objectIs(newValue, oldValue)) { - return true; - } - - dependency = dependency.next; - } - - return false; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - if (enableLazyContextPropagation) { - // Reset the work-in-progress list - dependencies.firstContext = null; - } else { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue2; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - - if (enableLazyContextPropagation) { - currentlyRenderingFiber.flags |= NeedsPropagation; - } - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate(fiber)) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - _payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -7682,11 +7056,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -7719,8 +7093,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentSecondaryRenderer == null) { - mutableSource._currentSecondaryRenderer = rendererSigil$1; - } else if (mutableSource._currentSecondaryRenderer !== rendererSigil$1) { + mutableSource._currentSecondaryRenderer = rendererSigil; + } else if (mutableSource._currentSecondaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -7730,97 +7104,6 @@ function warnAboutMultipleRenderersDEV(mutableSource) { } } // Eager reads the version of a mutable source and stores it on the root. -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -7973,7 +7256,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -7987,7 +7270,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -8068,7 +7351,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -8177,7 +7460,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -8292,7 +7575,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -8491,7 +7774,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -8507,7 +7790,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -8533,7 +7816,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -8551,7 +7834,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -8565,7 +7848,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -8578,7 +7861,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -8608,7 +7891,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -8662,14 +7945,14 @@ function use(usable) { function useMemoCache(size) { var memoCache = null; // Fast-path, load memo cache from wip fiber if already prepared - var updateQueue = currentlyRenderingFiber$1.updateQueue; + var updateQueue = currentlyRenderingFiber.updateQueue; if (updateQueue !== null) { memoCache = updateQueue.memoCache; } // Otherwise clone from the current fiber if (memoCache == null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { var currentUpdateQueue = current.updateQueue; @@ -8698,7 +7981,7 @@ function useMemoCache(size) { if (updateQueue === null) { updateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = updateQueue; + currentlyRenderingFiber.updateQueue = updateQueue; } updateQueue.memoCache = memoCache; @@ -8752,7 +8035,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -8844,8 +8127,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -9072,7 +8355,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -9181,7 +8464,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -9212,7 +8495,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; @@ -9280,7 +8563,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -9356,11 +8639,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -9439,7 +8722,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -9462,11 +8745,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -9519,7 +8802,7 @@ function mountRef(initialValue) { if (!hasBeenInitialized) { didCheckForLazyInit = true; lazyInitGetterStack = getCallerStackFrame(); - } else if (currentlyRenderingFiber$1 !== null && !didWarnAboutRead) { + } else if (currentlyRenderingFiber !== null && !didWarnAboutRead) { if ( lazyInitGetterStack === null || lazyInitGetterStack !== getCallerStackFrame() @@ -9531,8 +8814,7 @@ function mountRef(initialValue) { "Reading from a ref during render is only safe if:\n" + "1. The ref value has not been updated, or\n" + "2. The ref holds a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -9541,7 +8823,7 @@ function mountRef(initialValue) { }, set current(value) { - if (currentlyRenderingFiber$1 !== null && !didWarnAboutWrite) { + if (currentlyRenderingFiber !== null && !didWarnAboutWrite) { if (hasBeenInitialized || !didCheckForLazyInit) { didWarnAboutWrite = true; @@ -9549,8 +8831,7 @@ function mountRef(initialValue) { "%s: Unsafe write of a mutable value during render.\n\n" + "Writing to a ref during render is only safe if the ref holds " + "a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -9580,7 +8861,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -9608,7 +8889,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -9618,7 +8899,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -9635,12 +8916,12 @@ function updateEffect(create, deps) { } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= Update; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= Update; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.events = [payload]; } else { var events = componentUpdateQueue.events; @@ -9701,7 +8982,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -9759,7 +9040,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -9900,8 +9181,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -9939,19 +9220,19 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; - var currentTransition = ReactCurrentBatchConfig$1.transition; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; + var currentTransition = ReactCurrentBatchConfig.transition; if (enableTransitionTracing) { if (options !== undefined && options.name !== undefined) { - ReactCurrentBatchConfig$1.transition.name = options.name; - ReactCurrentBatchConfig$1.transition.startTime = now(); + ReactCurrentBatchConfig.transition.name = options.name; + ReactCurrentBatchConfig.transition.startTime = now(); } } { - ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } try { @@ -9959,7 +9240,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$1.transition = prevTransition; + ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -10039,7 +9320,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -10215,8 +9496,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -10289,8 +9570,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -10446,8 +9726,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10578,8 +9857,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10712,8 +9990,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10844,8 +10121,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10993,8 +10269,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -11151,8 +10426,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -11309,8 +10583,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -13252,149 +12525,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the -// transitions. Therefore, we want to lazily combine transitions. Instead of -// comparing the arrays of transitions when we combine them and storing them -// and filtering out the duplicates, we will instead store the unprocessed transitions -// in an array and actually filter them in the passive phase. - -var transitionStack = createCursor(null); - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - var rootTransitions = getWorkInProgressTransitions(); - push(transitionStack, rootTransitions, workInProgress); - } -} -function popRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } - - if (enableTransitionTracing) { - if (transitionStack.current === null) { - push(transitionStack, newTransitions, offscreenWorkInProgress); - } else if (newTransitions === null) { - push(transitionStack, transitionStack.current, offscreenWorkInProgress); - } else { - push( - transitionStack, - transitionStack.current.concat(newTransitions), - offscreenWorkInProgress - ); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } - - { - pop(resumedCache, workInProgress); - } - } -} -function getPendingTransitions() { - if (!enableTransitionTracing) { - return null; - } - - return transitionStack.current; -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} - var TransitionRoot = 0; var TransitionTracingMarker = 1; function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { @@ -17143,6 +16273,861 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue2, providerFiber); + context._currentValue2 = nextValue; + + { + if ( + context._currentRenderer2 !== undefined && + context._currentRenderer2 !== null && + context._currentRenderer2 !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer2 = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue2 = context._defaultValue; + } else { + context._currentValue2 = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) { + // TODO: This path is only used by Cache components. Update + // lazilyPropagateParentContextChanges to look for Cache components so they + // can take advantage of lazy propagation. + var forcePropagateEntireTree = true; + propagateContextChanges( + workInProgress, + [context], + renderLanes, + forcePropagateEntireTree + ); + } else { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + // Only used by eager implementation + if (enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + // Only used by lazy implementation + if (!enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dep = list.firstContext; + + findChangedDep: while (dep !== null) { + // Assigning these to constants to help Flow + var dependency = dep; + var consumer = fiber; + + for (var i = 0; i < contexts.length; i++) { + var context = contexts[i]; // Check if the context matches. + // TODO: Compare selected values to bail out early. + + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + // In the lazy implementation, don't mark a dirty flag on the + // dependency itself. Not all changes are propagated, so we can't + // rely on the propagation function alone to determine whether + // something has changed; the consumer will check. In the future, we + // could add back a dirty flag as an optimization to avoid double + // checking, but until we have selectors it's not really worth + // the trouble. + consumer.lanes = mergeLanes(consumer.lanes, renderLanes); + var alternate = consumer.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + consumer.return, + renderLanes, + workInProgress + ); + + if (!forcePropagateEntireTree) { + // During lazy propagation, when we find a match, we can defer + // propagating changes to the children, because we're going to + // visit them during render. We should continue propagating the + // siblings, though + nextFiber = null; + } // Since we already found a match, we can stop traversing the + // dependency list. + + break findChangedDep; + } + } + + dep = dependency.next; + } + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate2 = parentSuspense.alternate; + + if (_alternate2 !== null) { + _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = null; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function lazilyPropagateParentContextChanges( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = false; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate +// to the entire subtree, because we won't revisit it until after the current +// render has completed, at which point we'll have lost track of which providers +// have changed. + +function propagateParentContextChangesToDeferredTree( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = true; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} + +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (!enableLazyContextPropagation) { + return; + } // Collect all the parent providers that changed. Since this is usually small + // number, we use an Array instead of Set. + + var contexts = null; + var parent = workInProgress; + var isInsidePropagationBailout = false; + + while (parent !== null) { + if (!isInsidePropagationBailout) { + if ((parent.flags & NeedsPropagation) !== NoFlags) { + isInsidePropagationBailout = true; + } else if ((parent.flags & DidPropagateContext) !== NoFlags) { + break; + } + } + + if (parent.tag === ContextProvider) { + var currentParent = parent.alternate; + + if (currentParent === null) { + throw new Error("Should have a current fiber. This is a bug in React."); + } + + var oldProps = currentParent.memoizedProps; + + if (oldProps !== null) { + var providerType = parent.type; + var context = providerType._context; + var newProps = parent.pendingProps; + var newValue = newProps.value; + var oldValue = oldProps.value; + + if (!objectIs(newValue, oldValue)) { + if (contexts !== null) { + contexts.push(context); + } else { + contexts = [context]; + } + } + } + } + + parent = parent.return; + } + + if (contexts !== null) { + // If there were any changed providers, search through the children and + // propagate their changes. + propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree + ); + } // This is an optimization so that we only propagate once per subtree. If a + // deeply nested child bails out, and it calls this propagation function, it + // uses this flag to know that the remaining ancestor providers have already + // been propagated. + // + // NOTE: This optimization is only necessary because we sometimes enter the + // begin phase of nodes that don't have any work scheduled on them — + // specifically, the siblings of a node that _does_ have scheduled work. The + // siblings will bail out and call this function again, even though we already + // propagated content changes to it and its subtree. So we use this flag to + // mark that the parent providers already propagated. + // + // Unfortunately, though, we need to ignore this flag when we're inside a + // tree whose context propagation was deferred — that's what the + // `NeedsPropagation` flag is for. + // + // If we could instead bail out before entering the siblings' begin phase, + // then we could remove both `DidPropagateContext` and `NeedsPropagation`. + // Consider this as part of the next refactor to the fiber tree structure. + + workInProgress.flags |= DidPropagateContext; +} + +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) { + return false; + } // Iterate over the current dependencies to see if something changed. This + // only gets called if props and state has already bailed out, so it's a + // relatively uncommon path, except at the root of a changed subtree. + // Alternatively, we could move these comparisons into `readContext`, but + // that's a much hotter path, so I think this is an appropriate trade off. + + var dependency = currentDependencies.firstContext; + + while (dependency !== null) { + var context = dependency.context; + var newValue = context._currentValue2; + var oldValue = dependency.memoizedValue; + + if (!objectIs(newValue, oldValue)) { + return true; + } + + dependency = dependency.next; + } + + return false; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + if (enableLazyContextPropagation) { + // Reset the work-in-progress list + dependencies.firstContext = null; + } else { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue2; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + + if (enableLazyContextPropagation) { + currentlyRenderingFiber$1.flags |= NeedsPropagation; + } + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$1.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the +// transitions. Therefore, we want to lazily combine transitions. Instead of +// comparing the arrays of transitions when we combine them and storing them +// and filtering out the duplicates, we will instead store the unprocessed transitions +// in an array and actually filter them in the passive phase. + +var transitionStack = createCursor(null); + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + var rootTransitions = getWorkInProgressTransitions(); + push(transitionStack, rootTransitions, workInProgress); + } +} +function popRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } + + if (enableTransitionTracing) { + if (transitionStack.current === null) { + push(transitionStack, newTransitions, offscreenWorkInProgress); + } else if (newTransitions === null) { + push(transitionStack, transitionStack.current, offscreenWorkInProgress); + } else { + push( + transitionStack, + transitionStack.current.concat(newTransitions), + offscreenWorkInProgress + ); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } + + { + pop(resumedCache, workInProgress); + } + } +} +function getPendingTransitions() { + if (!enableTransitionTracing) { + return null; + } + + return transitionStack.current; +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -26531,10 +26516,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 0e0b98feb7..d4c84828a9 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-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-modern-420f0b7fa-20221201"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -204,10 +204,6 @@ var enableProfilerNestedUpdateScheduledHook = var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler; // Note: we'll want to remove this when we to userland implementation. var warnAboutStringRefs = true; -// don't have to add another test dimension. The build system will compile this -// to the correct value. - -var enableNewReconciler = false; var FunctionComponent = 0; var ClassComponent = 1; @@ -3892,10 +3888,787 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate(fiber)) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + _payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } /** @@ -5818,1405 +6591,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue2, providerFiber); - context._currentValue2 = nextValue; - - { - if ( - context._currentRenderer2 !== undefined && - context._currentRenderer2 !== null && - context._currentRenderer2 !== rendererSigil - ) { - error( - "Detected multiple renderers concurrently rendering the " + - "same context provider. This is currently unsupported." - ); - } - - context._currentRenderer2 = rendererSigil; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue2 = context._defaultValue; - } else { - context._currentValue2 = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) { - // TODO: This path is only used by Cache components. Update - // lazilyPropagateParentContextChanges to look for Cache components so they - // can take advantage of lazy propagation. - var forcePropagateEntireTree = true; - propagateContextChanges( - workInProgress, - [context], - renderLanes, - forcePropagateEntireTree - ); - } else { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - // Only used by eager implementation - if (enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - // Only used by lazy implementation - if (!enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dep = list.firstContext; - - findChangedDep: while (dep !== null) { - // Assigning these to constants to help Flow - var dependency = dep; - var consumer = fiber; - - for (var i = 0; i < contexts.length; i++) { - var context = contexts[i]; // Check if the context matches. - // TODO: Compare selected values to bail out early. - - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - // In the lazy implementation, don't mark a dirty flag on the - // dependency itself. Not all changes are propagated, so we can't - // rely on the propagation function alone to determine whether - // something has changed; the consumer will check. In the future, we - // could add back a dirty flag as an optimization to avoid double - // checking, but until we have selectors it's not really worth - // the trouble. - consumer.lanes = mergeLanes(consumer.lanes, renderLanes); - var alternate = consumer.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - consumer.return, - renderLanes, - workInProgress - ); - - if (!forcePropagateEntireTree) { - // During lazy propagation, when we find a match, we can defer - // propagating changes to the children, because we're going to - // visit them during render. We should continue propagating the - // siblings, though - nextFiber = null; - } // Since we already found a match, we can stop traversing the - // dependency list. - - break findChangedDep; - } - } - - dep = dependency.next; - } - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate2 = parentSuspense.alternate; - - if (_alternate2 !== null) { - _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = null; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function lazilyPropagateParentContextChanges( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = false; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate -// to the entire subtree, because we won't revisit it until after the current -// render has completed, at which point we'll have lost track of which providers -// have changed. - -function propagateParentContextChangesToDeferredTree( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = true; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} - -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (!enableLazyContextPropagation) { - return; - } // Collect all the parent providers that changed. Since this is usually small - // number, we use an Array instead of Set. - - var contexts = null; - var parent = workInProgress; - var isInsidePropagationBailout = false; - - while (parent !== null) { - if (!isInsidePropagationBailout) { - if ((parent.flags & NeedsPropagation) !== NoFlags) { - isInsidePropagationBailout = true; - } else if ((parent.flags & DidPropagateContext) !== NoFlags) { - break; - } - } - - if (parent.tag === ContextProvider) { - var currentParent = parent.alternate; - - if (currentParent === null) { - throw new Error("Should have a current fiber. This is a bug in React."); - } - - var oldProps = currentParent.memoizedProps; - - if (oldProps !== null) { - var providerType = parent.type; - var context = providerType._context; - var newProps = parent.pendingProps; - var newValue = newProps.value; - var oldValue = oldProps.value; - - if (!objectIs(newValue, oldValue)) { - if (contexts !== null) { - contexts.push(context); - } else { - contexts = [context]; - } - } - } - } - - parent = parent.return; - } - - if (contexts !== null) { - // If there were any changed providers, search through the children and - // propagate their changes. - propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree - ); - } // This is an optimization so that we only propagate once per subtree. If a - // deeply nested child bails out, and it calls this propagation function, it - // uses this flag to know that the remaining ancestor providers have already - // been propagated. - // - // NOTE: This optimization is only necessary because we sometimes enter the - // begin phase of nodes that don't have any work scheduled on them — - // specifically, the siblings of a node that _does_ have scheduled work. The - // siblings will bail out and call this function again, even though we already - // propagated content changes to it and its subtree. So we use this flag to - // mark that the parent providers already propagated. - // - // Unfortunately, though, we need to ignore this flag when we're inside a - // tree whose context propagation was deferred — that's what the - // `NeedsPropagation` flag is for. - // - // If we could instead bail out before entering the siblings' begin phase, - // then we could remove both `DidPropagateContext` and `NeedsPropagation`. - // Consider this as part of the next refactor to the fiber tree structure. - - workInProgress.flags |= DidPropagateContext; -} - -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) { - return false; - } // Iterate over the current dependencies to see if something changed. This - // only gets called if props and state has already bailed out, so it's a - // relatively uncommon path, except at the root of a changed subtree. - // Alternatively, we could move these comparisons into `readContext`, but - // that's a much hotter path, so I think this is an appropriate trade off. - - var dependency = currentDependencies.firstContext; - - while (dependency !== null) { - var context = dependency.context; - var newValue = context._currentValue2; - var oldValue = dependency.memoizedValue; - - if (!objectIs(newValue, oldValue)) { - return true; - } - - dependency = dependency.next; - } - - return false; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - if (enableLazyContextPropagation) { - // Reset the work-in-progress list - dependencies.firstContext = null; - } else { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue2; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - - if (enableLazyContextPropagation) { - currentlyRenderingFiber.flags |= NeedsPropagation; - } - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate(fiber)) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - _payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -7444,11 +6818,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -7481,8 +6855,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentSecondaryRenderer == null) { - mutableSource._currentSecondaryRenderer = rendererSigil$1; - } else if (mutableSource._currentSecondaryRenderer !== rendererSigil$1) { + mutableSource._currentSecondaryRenderer = rendererSigil; + } else if (mutableSource._currentSecondaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -7492,97 +6866,6 @@ function warnAboutMultipleRenderersDEV(mutableSource) { } } // Eager reads the version of a mutable source and stores it on the root. -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -7735,7 +7018,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -7749,7 +7032,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -7830,7 +7113,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -7939,7 +7222,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -8054,7 +7337,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -8253,7 +7536,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -8269,7 +7552,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -8295,7 +7578,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -8313,7 +7596,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -8327,7 +7610,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -8340,7 +7623,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -8370,7 +7653,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -8424,14 +7707,14 @@ function use(usable) { function useMemoCache(size) { var memoCache = null; // Fast-path, load memo cache from wip fiber if already prepared - var updateQueue = currentlyRenderingFiber$1.updateQueue; + var updateQueue = currentlyRenderingFiber.updateQueue; if (updateQueue !== null) { memoCache = updateQueue.memoCache; } // Otherwise clone from the current fiber if (memoCache == null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { var currentUpdateQueue = current.updateQueue; @@ -8460,7 +7743,7 @@ function useMemoCache(size) { if (updateQueue === null) { updateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = updateQueue; + currentlyRenderingFiber.updateQueue = updateQueue; } updateQueue.memoCache = memoCache; @@ -8514,7 +7797,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -8606,8 +7889,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -8834,7 +8117,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -8943,7 +8226,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -8974,7 +8257,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; @@ -9042,7 +8325,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -9118,11 +8401,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -9201,7 +8484,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -9224,11 +8507,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -9281,7 +8564,7 @@ function mountRef(initialValue) { if (!hasBeenInitialized) { didCheckForLazyInit = true; lazyInitGetterStack = getCallerStackFrame(); - } else if (currentlyRenderingFiber$1 !== null && !didWarnAboutRead) { + } else if (currentlyRenderingFiber !== null && !didWarnAboutRead) { if ( lazyInitGetterStack === null || lazyInitGetterStack !== getCallerStackFrame() @@ -9293,8 +8576,7 @@ function mountRef(initialValue) { "Reading from a ref during render is only safe if:\n" + "1. The ref value has not been updated, or\n" + "2. The ref holds a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -9303,7 +8585,7 @@ function mountRef(initialValue) { }, set current(value) { - if (currentlyRenderingFiber$1 !== null && !didWarnAboutWrite) { + if (currentlyRenderingFiber !== null && !didWarnAboutWrite) { if (hasBeenInitialized || !didCheckForLazyInit) { didWarnAboutWrite = true; @@ -9311,8 +8593,7 @@ function mountRef(initialValue) { "%s: Unsafe write of a mutable value during render.\n\n" + "Writing to a ref during render is only safe if the ref holds " + "a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -9342,7 +8623,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -9370,7 +8651,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -9380,7 +8661,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -9397,12 +8678,12 @@ function updateEffect(create, deps) { } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= Update; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= Update; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.events = [payload]; } else { var events = componentUpdateQueue.events; @@ -9463,7 +8744,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -9521,7 +8802,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -9662,8 +8943,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -9701,19 +8982,19 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; - var currentTransition = ReactCurrentBatchConfig$1.transition; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; + var currentTransition = ReactCurrentBatchConfig.transition; if (enableTransitionTracing) { if (options !== undefined && options.name !== undefined) { - ReactCurrentBatchConfig$1.transition.name = options.name; - ReactCurrentBatchConfig$1.transition.startTime = now(); + ReactCurrentBatchConfig.transition.name = options.name; + ReactCurrentBatchConfig.transition.startTime = now(); } } { - ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } try { @@ -9721,7 +9002,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$1.transition = prevTransition; + ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -9801,7 +9082,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -9977,8 +9258,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -10051,8 +9332,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -10208,8 +9488,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10340,8 +9619,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10474,8 +9752,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10606,8 +9883,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10755,8 +10031,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -10913,8 +10188,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -11071,8 +10345,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -12980,149 +12253,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the -// transitions. Therefore, we want to lazily combine transitions. Instead of -// comparing the arrays of transitions when we combine them and storing them -// and filtering out the duplicates, we will instead store the unprocessed transitions -// in an array and actually filter them in the passive phase. - -var transitionStack = createCursor(null); - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - var rootTransitions = getWorkInProgressTransitions(); - push(transitionStack, rootTransitions, workInProgress); - } -} -function popRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } - - if (enableTransitionTracing) { - if (transitionStack.current === null) { - push(transitionStack, newTransitions, offscreenWorkInProgress); - } else if (newTransitions === null) { - push(transitionStack, transitionStack.current, offscreenWorkInProgress); - } else { - push( - transitionStack, - transitionStack.current.concat(newTransitions), - offscreenWorkInProgress - ); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } - - { - pop(resumedCache, workInProgress); - } - } -} -function getPendingTransitions() { - if (!enableTransitionTracing) { - return null; - } - - return transitionStack.current; -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} - var TransitionRoot = 0; var TransitionTracingMarker = 1; function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { @@ -16851,6 +15981,861 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue2, providerFiber); + context._currentValue2 = nextValue; + + { + if ( + context._currentRenderer2 !== undefined && + context._currentRenderer2 !== null && + context._currentRenderer2 !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer2 = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue2 = context._defaultValue; + } else { + context._currentValue2 = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) { + // TODO: This path is only used by Cache components. Update + // lazilyPropagateParentContextChanges to look for Cache components so they + // can take advantage of lazy propagation. + var forcePropagateEntireTree = true; + propagateContextChanges( + workInProgress, + [context], + renderLanes, + forcePropagateEntireTree + ); + } else { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + // Only used by eager implementation + if (enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + // Only used by lazy implementation + if (!enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dep = list.firstContext; + + findChangedDep: while (dep !== null) { + // Assigning these to constants to help Flow + var dependency = dep; + var consumer = fiber; + + for (var i = 0; i < contexts.length; i++) { + var context = contexts[i]; // Check if the context matches. + // TODO: Compare selected values to bail out early. + + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + // In the lazy implementation, don't mark a dirty flag on the + // dependency itself. Not all changes are propagated, so we can't + // rely on the propagation function alone to determine whether + // something has changed; the consumer will check. In the future, we + // could add back a dirty flag as an optimization to avoid double + // checking, but until we have selectors it's not really worth + // the trouble. + consumer.lanes = mergeLanes(consumer.lanes, renderLanes); + var alternate = consumer.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + consumer.return, + renderLanes, + workInProgress + ); + + if (!forcePropagateEntireTree) { + // During lazy propagation, when we find a match, we can defer + // propagating changes to the children, because we're going to + // visit them during render. We should continue propagating the + // siblings, though + nextFiber = null; + } // Since we already found a match, we can stop traversing the + // dependency list. + + break findChangedDep; + } + } + + dep = dependency.next; + } + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate2 = parentSuspense.alternate; + + if (_alternate2 !== null) { + _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = null; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function lazilyPropagateParentContextChanges( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = false; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate +// to the entire subtree, because we won't revisit it until after the current +// render has completed, at which point we'll have lost track of which providers +// have changed. + +function propagateParentContextChangesToDeferredTree( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = true; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} + +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (!enableLazyContextPropagation) { + return; + } // Collect all the parent providers that changed. Since this is usually small + // number, we use an Array instead of Set. + + var contexts = null; + var parent = workInProgress; + var isInsidePropagationBailout = false; + + while (parent !== null) { + if (!isInsidePropagationBailout) { + if ((parent.flags & NeedsPropagation) !== NoFlags) { + isInsidePropagationBailout = true; + } else if ((parent.flags & DidPropagateContext) !== NoFlags) { + break; + } + } + + if (parent.tag === ContextProvider) { + var currentParent = parent.alternate; + + if (currentParent === null) { + throw new Error("Should have a current fiber. This is a bug in React."); + } + + var oldProps = currentParent.memoizedProps; + + if (oldProps !== null) { + var providerType = parent.type; + var context = providerType._context; + var newProps = parent.pendingProps; + var newValue = newProps.value; + var oldValue = oldProps.value; + + if (!objectIs(newValue, oldValue)) { + if (contexts !== null) { + contexts.push(context); + } else { + contexts = [context]; + } + } + } + } + + parent = parent.return; + } + + if (contexts !== null) { + // If there were any changed providers, search through the children and + // propagate their changes. + propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree + ); + } // This is an optimization so that we only propagate once per subtree. If a + // deeply nested child bails out, and it calls this propagation function, it + // uses this flag to know that the remaining ancestor providers have already + // been propagated. + // + // NOTE: This optimization is only necessary because we sometimes enter the + // begin phase of nodes that don't have any work scheduled on them — + // specifically, the siblings of a node that _does_ have scheduled work. The + // siblings will bail out and call this function again, even though we already + // propagated content changes to it and its subtree. So we use this flag to + // mark that the parent providers already propagated. + // + // Unfortunately, though, we need to ignore this flag when we're inside a + // tree whose context propagation was deferred — that's what the + // `NeedsPropagation` flag is for. + // + // If we could instead bail out before entering the siblings' begin phase, + // then we could remove both `DidPropagateContext` and `NeedsPropagation`. + // Consider this as part of the next refactor to the fiber tree structure. + + workInProgress.flags |= DidPropagateContext; +} + +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) { + return false; + } // Iterate over the current dependencies to see if something changed. This + // only gets called if props and state has already bailed out, so it's a + // relatively uncommon path, except at the root of a changed subtree. + // Alternatively, we could move these comparisons into `readContext`, but + // that's a much hotter path, so I think this is an appropriate trade off. + + var dependency = currentDependencies.firstContext; + + while (dependency !== null) { + var context = dependency.context; + var newValue = context._currentValue2; + var oldValue = dependency.memoizedValue; + + if (!objectIs(newValue, oldValue)) { + return true; + } + + dependency = dependency.next; + } + + return false; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + if (enableLazyContextPropagation) { + // Reset the work-in-progress list + dependencies.firstContext = null; + } else { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue2; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + + if (enableLazyContextPropagation) { + currentlyRenderingFiber$1.flags |= NeedsPropagation; + } + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$1.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the +// transitions. Therefore, we want to lazily combine transitions. Instead of +// comparing the arrays of transitions when we combine them and storing them +// and filtering out the duplicates, we will instead store the unprocessed transitions +// in an array and actually filter them in the passive phase. + +var transitionStack = createCursor(null); + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + var rootTransitions = getWorkInProgressTransitions(); + push(transitionStack, rootTransitions, workInProgress); + } +} +function popRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } + + if (enableTransitionTracing) { + if (transitionStack.current === null) { + push(transitionStack, newTransitions, offscreenWorkInProgress); + } else if (newTransitions === null) { + push(transitionStack, transitionStack.current, offscreenWorkInProgress); + } else { + push( + transitionStack, + transitionStack.current.concat(newTransitions), + offscreenWorkInProgress + ); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } + + { + pop(resumedCache, workInProgress); + } + } +} +function getPendingTransitions() { + if (!enableTransitionTracing) { + return null; + } + + return transitionStack.current; +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -26220,10 +26205,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index 7be893808c..d04b268063 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -1055,7 +1055,333 @@ function popHostContext(fiber) { (pop(contextStackCursor$1), pop(contextFiberStackCursor)); } var hydrationErrors = null, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; + concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function shallowEqual(objA, objB) { if (objectIs(objA, objB)) return !0; if ( @@ -1763,580 +2089,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue2); - context._currentValue2 = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue2 = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue2, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue2; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -2424,50 +2177,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionSecondary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -2518,9 +2227,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -2547,7 +2256,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -2572,7 +2281,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -2606,7 +2315,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -2614,7 +2323,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = 0; thenableState = null; @@ -2628,26 +2337,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -2665,7 +2374,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -2677,10 +2386,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$31 = thenableIndexCounter; + var index$29 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$31); + return trackUsedThenable(thenableState, usable, index$29); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -2692,10 +2401,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -2711,7 +2420,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -2782,7 +2491,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -2851,7 +2560,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -2898,7 +2607,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -2912,7 +2621,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -2947,10 +2656,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -2995,17 +2704,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -3021,7 +2730,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -3041,7 +2750,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -3051,11 +2760,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -3142,7 +2851,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -3152,18 +2861,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$1.transition.name = options.name), - (ReactCurrentBatchConfig$1.transition.startTime = now())); + ((ReactCurrentBatchConfig.transition.name = options.name), + (ReactCurrentBatchConfig.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$1.transition = prevTransition); + (ReactCurrentBatchConfig.transition = prevTransition); } } function updateId() { @@ -3256,8 +2965,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -3294,8 +3003,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -3349,7 +3057,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -3386,7 +3094,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); var nextSnapshot = getSnapshot(); var root = workInProgressRoot; @@ -3416,11 +3124,10 @@ var HooksDispatcherOnMount = { ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":"; return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -3461,8 +3168,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -3496,8 +3202,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -3748,39 +3453,6 @@ function createClassErrorUpdate(fiber, errorInfo, lane) { }); return lane; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue2, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -5115,6 +4787,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue2); + context._currentValue2 = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue2 = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue2, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue2, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -7710,7 +7707,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig.transition) + if (null !== ReactCurrentBatchConfig$1.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -8479,10 +8476,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$37 = offscreenQueue.wakeables; - null === wakeables$37 + var wakeables$35 = offscreenQueue.wakeables; + null === wakeables$35 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$37.add(wakeable); + : wakeables$35.add(wakeable); } break; } @@ -9806,7 +9803,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-classic-030dae2f4-20221201", + version: "18.3.0-www-classic-420f0b7fa-20221201", rendererPackageName: "react-art" }; var internals$jscomp$inline_1336 = { @@ -9837,7 +9834,7 @@ var internals$jscomp$inline_1336 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1337 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index 1c636c46c1..2478184347 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -862,7 +862,333 @@ function popHostContext(fiber) { (pop(contextStackCursor), pop(contextFiberStackCursor)); } var hydrationErrors = null, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; + concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function shallowEqual(objA, objB) { if (objectIs(objA, objB)) return !0; if ( @@ -1570,580 +1896,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue2); - context._currentValue2 = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue2 = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue2, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue2; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -2231,50 +1984,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionSecondary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -2325,9 +2034,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -2354,7 +2063,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -2379,7 +2088,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -2413,7 +2122,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -2421,7 +2130,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = 0; thenableState = null; @@ -2435,26 +2144,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -2472,7 +2181,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -2484,10 +2193,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$31 = thenableIndexCounter; + var index$29 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$31); + return trackUsedThenable(thenableState, usable, index$29); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -2499,10 +2208,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -2518,7 +2227,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -2589,7 +2298,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -2658,7 +2367,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -2705,7 +2414,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -2719,7 +2428,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -2754,10 +2463,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -2802,17 +2511,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -2828,7 +2537,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -2848,7 +2557,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -2858,11 +2567,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -2949,7 +2658,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -2959,18 +2668,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$1.transition.name = options.name), - (ReactCurrentBatchConfig$1.transition.startTime = now())); + ((ReactCurrentBatchConfig.transition.name = options.name), + (ReactCurrentBatchConfig.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$1.transition = prevTransition); + (ReactCurrentBatchConfig.transition = prevTransition); } } function updateId() { @@ -3063,8 +2772,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -3101,8 +2810,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -3156,7 +2864,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -3193,7 +2901,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); var nextSnapshot = getSnapshot(); var root = workInProgressRoot; @@ -3223,11 +2931,10 @@ var HooksDispatcherOnMount = { ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":"; return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -3268,8 +2975,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -3303,8 +3009,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -3541,39 +3246,6 @@ function createClassErrorUpdate(fiber, errorInfo, lane) { }); return lane; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue2, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -4868,6 +4540,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue2); + context._currentValue2 = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue2 = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue2, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue2, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -7444,7 +7441,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig.transition) + if (null !== ReactCurrentBatchConfig$1.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -8213,10 +8210,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$37 = offscreenQueue.wakeables; - null === wakeables$37 + var wakeables$35 = offscreenQueue.wakeables; + null === wakeables$35 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$37.add(wakeable); + : wakeables$35.add(wakeable); } break; } @@ -9473,7 +9470,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-modern-030dae2f4-20221201", + version: "18.3.0-www-modern-420f0b7fa-20221201", rendererPackageName: "react-art" }; var internals$jscomp$inline_1327 = { @@ -9504,7 +9501,7 @@ var internals$jscomp$inline_1327 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1328 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index cf7ee4f901..3db8e92e2c 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -75,10 +75,6 @@ var enableProfilerNestedUpdateScheduledHook = var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler; // Note: we'll want to remove this when we to userland implementation. var warnAboutStringRefs = true; var enableSuspenseCallback = true; -// don't have to add another test dimension. The build system will compile this -// to the correct value. - -var enableNewReconciler = false; var enableCustomElementPropertySupport = false; // This refers to a WWW module. @@ -9724,10 +9720,6 @@ function popHostContext(fiber) { pop(contextFiberStackCursor, fiber); } -function getCurrentRootHostContainer$1() { - return getCurrentRootHostContainer(); -} - var Dispatcher = Internals.Dispatcher; // In the future this may need to change, especially when modules / scripts are supported @@ -9769,7 +9761,7 @@ function getRootNode(container) { } function getCurrentResourceRoot() { - var currentContainer = getCurrentRootHostContainer$1(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode + var currentContainer = getCurrentRootHostContainer(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode return currentContainer ? getRootNode(currentContainer) : null; } // This resource type constraint can be loosened. It really is everything except PreloadResource @@ -18550,10 +18542,787 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig$1.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate(fiber)) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + _payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } var ReactStrictModeWarnings = { @@ -20282,1405 +21051,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue, providerFiber); - 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; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue = context._defaultValue; - } else { - context._currentValue = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) { - // TODO: This path is only used by Cache components. Update - // lazilyPropagateParentContextChanges to look for Cache components so they - // can take advantage of lazy propagation. - var forcePropagateEntireTree = true; - propagateContextChanges( - workInProgress, - [context], - renderLanes, - forcePropagateEntireTree - ); - } else { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - // Only used by eager implementation - if (enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - // Only used by lazy implementation - if (!enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dep = list.firstContext; - - findChangedDep: while (dep !== null) { - // Assigning these to constants to help Flow - var dependency = dep; - var consumer = fiber; - - for (var i = 0; i < contexts.length; i++) { - var context = contexts[i]; // Check if the context matches. - // TODO: Compare selected values to bail out early. - - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - // In the lazy implementation, don't mark a dirty flag on the - // dependency itself. Not all changes are propagated, so we can't - // rely on the propagation function alone to determine whether - // something has changed; the consumer will check. In the future, we - // could add back a dirty flag as an optimization to avoid double - // checking, but until we have selectors it's not really worth - // the trouble. - consumer.lanes = mergeLanes(consumer.lanes, renderLanes); - var alternate = consumer.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - consumer.return, - renderLanes, - workInProgress - ); - - if (!forcePropagateEntireTree) { - // During lazy propagation, when we find a match, we can defer - // propagating changes to the children, because we're going to - // visit them during render. We should continue propagating the - // siblings, though - nextFiber = null; - } // Since we already found a match, we can stop traversing the - // dependency list. - - break findChangedDep; - } - } - - dep = dependency.next; - } - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate2 = parentSuspense.alternate; - - if (_alternate2 !== null) { - _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = null; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function lazilyPropagateParentContextChanges( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = false; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate -// to the entire subtree, because we won't revisit it until after the current -// render has completed, at which point we'll have lost track of which providers -// have changed. - -function propagateParentContextChangesToDeferredTree( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = true; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} - -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (!enableLazyContextPropagation) { - return; - } // Collect all the parent providers that changed. Since this is usually small - // number, we use an Array instead of Set. - - var contexts = null; - var parent = workInProgress; - var isInsidePropagationBailout = false; - - while (parent !== null) { - if (!isInsidePropagationBailout) { - if ((parent.flags & NeedsPropagation) !== NoFlags) { - isInsidePropagationBailout = true; - } else if ((parent.flags & DidPropagateContext) !== NoFlags) { - break; - } - } - - if (parent.tag === ContextProvider) { - var currentParent = parent.alternate; - - if (currentParent === null) { - throw new Error("Should have a current fiber. This is a bug in React."); - } - - var oldProps = currentParent.memoizedProps; - - if (oldProps !== null) { - var providerType = parent.type; - var context = providerType._context; - var newProps = parent.pendingProps; - var newValue = newProps.value; - var oldValue = oldProps.value; - - if (!objectIs(newValue, oldValue)) { - if (contexts !== null) { - contexts.push(context); - } else { - contexts = [context]; - } - } - } - } - - parent = parent.return; - } - - if (contexts !== null) { - // If there were any changed providers, search through the children and - // propagate their changes. - propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree - ); - } // This is an optimization so that we only propagate once per subtree. If a - // deeply nested child bails out, and it calls this propagation function, it - // uses this flag to know that the remaining ancestor providers have already - // been propagated. - // - // NOTE: This optimization is only necessary because we sometimes enter the - // begin phase of nodes that don't have any work scheduled on them — - // specifically, the siblings of a node that _does_ have scheduled work. The - // siblings will bail out and call this function again, even though we already - // propagated content changes to it and its subtree. So we use this flag to - // mark that the parent providers already propagated. - // - // Unfortunately, though, we need to ignore this flag when we're inside a - // tree whose context propagation was deferred — that's what the - // `NeedsPropagation` flag is for. - // - // If we could instead bail out before entering the siblings' begin phase, - // then we could remove both `DidPropagateContext` and `NeedsPropagation`. - // Consider this as part of the next refactor to the fiber tree structure. - - workInProgress.flags |= DidPropagateContext; -} - -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) { - return false; - } // Iterate over the current dependencies to see if something changed. This - // only gets called if props and state has already bailed out, so it's a - // relatively uncommon path, except at the root of a changed subtree. - // Alternatively, we could move these comparisons into `readContext`, but - // that's a much hotter path, so I think this is an appropriate trade off. - - var dependency = currentDependencies.firstContext; - - while (dependency !== null) { - var context = dependency.context; - var newValue = context._currentValue; - var oldValue = dependency.memoizedValue; - - if (!objectIs(newValue, oldValue)) { - return true; - } - - dependency = dependency.next; - } - - return false; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - if (enableLazyContextPropagation) { - // Reset the work-in-progress list - dependencies.firstContext = null; - } else { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - - if (enableLazyContextPropagation) { - currentlyRenderingFiber.flags |= NeedsPropagation; - } - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate(fiber)) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - _payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -21908,11 +21278,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -21945,8 +21315,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentPrimaryRenderer == null) { - mutableSource._currentPrimaryRenderer = rendererSigil$1; - } else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) { + mutableSource._currentPrimaryRenderer = rendererSigil; + } else if (mutableSource._currentPrimaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -21971,97 +21341,6 @@ function registerMutableSourceForHydration(root, mutableSource) { } } -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -22214,7 +21493,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -22228,7 +21507,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -22311,7 +21590,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -22420,7 +21699,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -22535,7 +21814,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22743,7 +22022,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -22759,7 +22038,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22786,7 +22065,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -22804,7 +22083,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -22818,7 +22097,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -22831,7 +22110,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -22861,7 +22140,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -22915,14 +22194,14 @@ function use(usable) { function useMemoCache(size) { var memoCache = null; // Fast-path, load memo cache from wip fiber if already prepared - var updateQueue = currentlyRenderingFiber$1.updateQueue; + var updateQueue = currentlyRenderingFiber.updateQueue; if (updateQueue !== null) { memoCache = updateQueue.memoCache; } // Otherwise clone from the current fiber if (memoCache == null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { var currentUpdateQueue = current.updateQueue; @@ -22951,7 +22230,7 @@ function useMemoCache(size) { if (updateQueue === null) { updateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = updateQueue; + currentlyRenderingFiber.updateQueue = updateQueue; } updateQueue.memoCache = memoCache; @@ -23005,7 +22284,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -23097,8 +22376,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -23325,7 +22604,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -23434,7 +22713,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -23465,7 +22744,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; var isHydrating = getIsHydrating(); @@ -23555,7 +22834,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -23631,11 +22910,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -23714,7 +22993,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -23737,11 +23016,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -23794,7 +23073,7 @@ function mountRef(initialValue) { if (!hasBeenInitialized) { didCheckForLazyInit = true; lazyInitGetterStack = getCallerStackFrame(); - } else if (currentlyRenderingFiber$1 !== null && !didWarnAboutRead) { + } else if (currentlyRenderingFiber !== null && !didWarnAboutRead) { if ( lazyInitGetterStack === null || lazyInitGetterStack !== getCallerStackFrame() @@ -23806,8 +23085,7 @@ function mountRef(initialValue) { "Reading from a ref during render is only safe if:\n" + "1. The ref value has not been updated, or\n" + "2. The ref holds a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23816,7 +23094,7 @@ function mountRef(initialValue) { }, set current(value) { - if (currentlyRenderingFiber$1 !== null && !didWarnAboutWrite) { + if (currentlyRenderingFiber !== null && !didWarnAboutWrite) { if (hasBeenInitialized || !didCheckForLazyInit) { didWarnAboutWrite = true; @@ -23824,8 +23102,7 @@ function mountRef(initialValue) { "%s: Unsafe write of a mutable value during render.\n\n" + "Writing to a ref during render is only safe if the ref holds " + "a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23855,7 +23132,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23883,7 +23160,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23893,7 +23170,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -23910,12 +23187,12 @@ function updateEffect(create, deps) { } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= Update; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= Update; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.events = [payload]; } else { var events = componentUpdateQueue.events; @@ -23976,7 +23253,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -24034,7 +23311,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -24175,8 +23452,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -24214,19 +23491,19 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; - var currentTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; + var currentTransition = ReactCurrentBatchConfig$1.transition; if (enableTransitionTracing) { if (options !== undefined && options.name !== undefined) { - ReactCurrentBatchConfig$2.transition.name = options.name; - ReactCurrentBatchConfig$2.transition.startTime = now(); + ReactCurrentBatchConfig$1.transition.name = options.name; + ReactCurrentBatchConfig$1.transition.startTime = now(); } } { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); } try { @@ -24234,7 +23511,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactCurrentBatchConfig$1.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -24328,7 +23605,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -24504,8 +23781,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -24578,8 +23855,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -24735,8 +24011,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24867,8 +24142,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25001,8 +24275,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25133,8 +24406,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25282,8 +24554,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25440,8 +24711,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25598,8 +24868,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -27577,149 +26846,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the -// transitions. Therefore, we want to lazily combine transitions. Instead of -// comparing the arrays of transitions when we combine them and storing them -// and filtering out the duplicates, we will instead store the unprocessed transitions -// in an array and actually filter them in the passive phase. - -var transitionStack = createCursor(null); - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - var rootTransitions = getWorkInProgressTransitions(); - push(transitionStack, rootTransitions, workInProgress); - } -} -function popRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } - - if (enableTransitionTracing) { - if (transitionStack.current === null) { - push(transitionStack, newTransitions, offscreenWorkInProgress); - } else if (newTransitions === null) { - push(transitionStack, transitionStack.current, offscreenWorkInProgress); - } else { - push( - transitionStack, - transitionStack.current.concat(newTransitions), - offscreenWorkInProgress - ); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } - - { - pop(resumedCache, workInProgress); - } - } -} -function getPendingTransitions() { - if (!enableTransitionTracing) { - return null; - } - - return transitionStack.current; -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} - var TransitionRoot = 0; var TransitionTracingMarker = 1; function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { @@ -31746,6 +30872,861 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; + + { + if ( + context._currentRenderer !== undefined && + context._currentRenderer !== null && + context._currentRenderer !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue = context._defaultValue; + } else { + context._currentValue = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) { + // TODO: This path is only used by Cache components. Update + // lazilyPropagateParentContextChanges to look for Cache components so they + // can take advantage of lazy propagation. + var forcePropagateEntireTree = true; + propagateContextChanges( + workInProgress, + [context], + renderLanes, + forcePropagateEntireTree + ); + } else { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + // Only used by eager implementation + if (enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + // Only used by lazy implementation + if (!enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dep = list.firstContext; + + findChangedDep: while (dep !== null) { + // Assigning these to constants to help Flow + var dependency = dep; + var consumer = fiber; + + for (var i = 0; i < contexts.length; i++) { + var context = contexts[i]; // Check if the context matches. + // TODO: Compare selected values to bail out early. + + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + // In the lazy implementation, don't mark a dirty flag on the + // dependency itself. Not all changes are propagated, so we can't + // rely on the propagation function alone to determine whether + // something has changed; the consumer will check. In the future, we + // could add back a dirty flag as an optimization to avoid double + // checking, but until we have selectors it's not really worth + // the trouble. + consumer.lanes = mergeLanes(consumer.lanes, renderLanes); + var alternate = consumer.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + consumer.return, + renderLanes, + workInProgress + ); + + if (!forcePropagateEntireTree) { + // During lazy propagation, when we find a match, we can defer + // propagating changes to the children, because we're going to + // visit them during render. We should continue propagating the + // siblings, though + nextFiber = null; + } // Since we already found a match, we can stop traversing the + // dependency list. + + break findChangedDep; + } + } + + dep = dependency.next; + } + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate2 = parentSuspense.alternate; + + if (_alternate2 !== null) { + _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = null; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function lazilyPropagateParentContextChanges( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = false; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate +// to the entire subtree, because we won't revisit it until after the current +// render has completed, at which point we'll have lost track of which providers +// have changed. + +function propagateParentContextChangesToDeferredTree( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = true; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} + +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (!enableLazyContextPropagation) { + return; + } // Collect all the parent providers that changed. Since this is usually small + // number, we use an Array instead of Set. + + var contexts = null; + var parent = workInProgress; + var isInsidePropagationBailout = false; + + while (parent !== null) { + if (!isInsidePropagationBailout) { + if ((parent.flags & NeedsPropagation) !== NoFlags) { + isInsidePropagationBailout = true; + } else if ((parent.flags & DidPropagateContext) !== NoFlags) { + break; + } + } + + if (parent.tag === ContextProvider) { + var currentParent = parent.alternate; + + if (currentParent === null) { + throw new Error("Should have a current fiber. This is a bug in React."); + } + + var oldProps = currentParent.memoizedProps; + + if (oldProps !== null) { + var providerType = parent.type; + var context = providerType._context; + var newProps = parent.pendingProps; + var newValue = newProps.value; + var oldValue = oldProps.value; + + if (!objectIs(newValue, oldValue)) { + if (contexts !== null) { + contexts.push(context); + } else { + contexts = [context]; + } + } + } + } + + parent = parent.return; + } + + if (contexts !== null) { + // If there were any changed providers, search through the children and + // propagate their changes. + propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree + ); + } // This is an optimization so that we only propagate once per subtree. If a + // deeply nested child bails out, and it calls this propagation function, it + // uses this flag to know that the remaining ancestor providers have already + // been propagated. + // + // NOTE: This optimization is only necessary because we sometimes enter the + // begin phase of nodes that don't have any work scheduled on them — + // specifically, the siblings of a node that _does_ have scheduled work. The + // siblings will bail out and call this function again, even though we already + // propagated content changes to it and its subtree. So we use this flag to + // mark that the parent providers already propagated. + // + // Unfortunately, though, we need to ignore this flag when we're inside a + // tree whose context propagation was deferred — that's what the + // `NeedsPropagation` flag is for. + // + // If we could instead bail out before entering the siblings' begin phase, + // then we could remove both `DidPropagateContext` and `NeedsPropagation`. + // Consider this as part of the next refactor to the fiber tree structure. + + workInProgress.flags |= DidPropagateContext; +} + +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) { + return false; + } // Iterate over the current dependencies to see if something changed. This + // only gets called if props and state has already bailed out, so it's a + // relatively uncommon path, except at the root of a changed subtree. + // Alternatively, we could move these comparisons into `readContext`, but + // that's a much hotter path, so I think this is an appropriate trade off. + + var dependency = currentDependencies.firstContext; + + while (dependency !== null) { + var context = dependency.context; + var newValue = context._currentValue; + var oldValue = dependency.memoizedValue; + + if (!objectIs(newValue, oldValue)) { + return true; + } + + dependency = dependency.next; + } + + return false; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + if (enableLazyContextPropagation) { + // Reset the work-in-progress list + dependencies.firstContext = null; + } else { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + + if (enableLazyContextPropagation) { + currentlyRenderingFiber$1.flags |= NeedsPropagation; + } + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$2.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the +// transitions. Therefore, we want to lazily combine transitions. Instead of +// comparing the arrays of transitions when we combine them and storing them +// and filtering out the duplicates, we will instead store the unprocessed transitions +// in an array and actually filter them in the passive phase. + +var transitionStack = createCursor(null); + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + var rootTransitions = getWorkInProgressTransitions(); + push(transitionStack, rootTransitions, workInProgress); + } +} +function popRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } + + if (enableTransitionTracing) { + if (transitionStack.current === null) { + push(transitionStack, newTransitions, offscreenWorkInProgress); + } else if (newTransitions === null) { + push(transitionStack, transitionStack.current, offscreenWorkInProgress); + } else { + push( + transitionStack, + transitionStack.current.concat(newTransitions), + offscreenWorkInProgress + ); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } + + { + pop(resumedCache, workInProgress); + } + } +} +function getPendingTransitions() { + if (!enableTransitionTracing) { + return null; + } + + return transitionStack.current; +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -41558,10 +41539,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -42595,7 +42576,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-classic-420f0b7fa-20221201"; function createPortal( children, @@ -44268,8 +44249,6 @@ var foundDevTools = injectIntoDevTools({ } } -var unstable_isNewReconciler = enableNewReconciler; - assign(Internals, { ReactBrowserEventEmitter: { isEnabled: isEnabled @@ -44290,7 +44269,6 @@ exports.unmountComponentAtNode = unmountComponentAtNode; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = createEventHandle; exports.unstable_flushControlled = flushControlled; -exports.unstable_isNewReconciler = unstable_isNewReconciler; exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; exports.unstable_runWithPriority = runWithPriority; exports.version = ReactVersion; diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index d4b82b441a..4c32ee6510 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -179,10 +179,6 @@ var enableProfilerNestedUpdateScheduledHook = var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler; // Note: we'll want to remove this when we to userland implementation. var warnAboutStringRefs = true; var enableSuspenseCallback = true; -// don't have to add another test dimension. The build system will compile this -// to the correct value. - -var enableNewReconciler = false; var enableCustomElementPropertySupport = true; var allNativeEvents = new Set(); @@ -14228,10 +14224,6 @@ function popHostContext(fiber) { pop(contextFiberStackCursor, fiber); } -function getCurrentRootHostContainer$1() { - return getCurrentRootHostContainer(); -} - var Dispatcher = Internals.Dispatcher; // In the future this may need to change, especially when modules / scripts are supported @@ -14273,7 +14265,7 @@ function getRootNode(container) { } function getCurrentResourceRoot() { - var currentContainer = getCurrentRootHostContainer$1(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode + var currentContainer = getCurrentRootHostContainer(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode return currentContainer ? getRootNode(currentContainer) : null; } // This resource type constraint can be loosened. It really is everything except PreloadResource @@ -18347,10 +18339,787 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig$1.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate(fiber)) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + _payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } var ReactStrictModeWarnings = { @@ -20079,1405 +20848,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue, providerFiber); - 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; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue = context._defaultValue; - } else { - context._currentValue = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) { - // TODO: This path is only used by Cache components. Update - // lazilyPropagateParentContextChanges to look for Cache components so they - // can take advantage of lazy propagation. - var forcePropagateEntireTree = true; - propagateContextChanges( - workInProgress, - [context], - renderLanes, - forcePropagateEntireTree - ); - } else { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - // Only used by eager implementation - if (enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - // Only used by lazy implementation - if (!enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dep = list.firstContext; - - findChangedDep: while (dep !== null) { - // Assigning these to constants to help Flow - var dependency = dep; - var consumer = fiber; - - for (var i = 0; i < contexts.length; i++) { - var context = contexts[i]; // Check if the context matches. - // TODO: Compare selected values to bail out early. - - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - // In the lazy implementation, don't mark a dirty flag on the - // dependency itself. Not all changes are propagated, so we can't - // rely on the propagation function alone to determine whether - // something has changed; the consumer will check. In the future, we - // could add back a dirty flag as an optimization to avoid double - // checking, but until we have selectors it's not really worth - // the trouble. - consumer.lanes = mergeLanes(consumer.lanes, renderLanes); - var alternate = consumer.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - consumer.return, - renderLanes, - workInProgress - ); - - if (!forcePropagateEntireTree) { - // During lazy propagation, when we find a match, we can defer - // propagating changes to the children, because we're going to - // visit them during render. We should continue propagating the - // siblings, though - nextFiber = null; - } // Since we already found a match, we can stop traversing the - // dependency list. - - break findChangedDep; - } - } - - dep = dependency.next; - } - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate2 = parentSuspense.alternate; - - if (_alternate2 !== null) { - _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = null; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function lazilyPropagateParentContextChanges( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = false; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate -// to the entire subtree, because we won't revisit it until after the current -// render has completed, at which point we'll have lost track of which providers -// have changed. - -function propagateParentContextChangesToDeferredTree( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = true; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} - -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (!enableLazyContextPropagation) { - return; - } // Collect all the parent providers that changed. Since this is usually small - // number, we use an Array instead of Set. - - var contexts = null; - var parent = workInProgress; - var isInsidePropagationBailout = false; - - while (parent !== null) { - if (!isInsidePropagationBailout) { - if ((parent.flags & NeedsPropagation) !== NoFlags) { - isInsidePropagationBailout = true; - } else if ((parent.flags & DidPropagateContext) !== NoFlags) { - break; - } - } - - if (parent.tag === ContextProvider) { - var currentParent = parent.alternate; - - if (currentParent === null) { - throw new Error("Should have a current fiber. This is a bug in React."); - } - - var oldProps = currentParent.memoizedProps; - - if (oldProps !== null) { - var providerType = parent.type; - var context = providerType._context; - var newProps = parent.pendingProps; - var newValue = newProps.value; - var oldValue = oldProps.value; - - if (!objectIs(newValue, oldValue)) { - if (contexts !== null) { - contexts.push(context); - } else { - contexts = [context]; - } - } - } - } - - parent = parent.return; - } - - if (contexts !== null) { - // If there were any changed providers, search through the children and - // propagate their changes. - propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree - ); - } // This is an optimization so that we only propagate once per subtree. If a - // deeply nested child bails out, and it calls this propagation function, it - // uses this flag to know that the remaining ancestor providers have already - // been propagated. - // - // NOTE: This optimization is only necessary because we sometimes enter the - // begin phase of nodes that don't have any work scheduled on them — - // specifically, the siblings of a node that _does_ have scheduled work. The - // siblings will bail out and call this function again, even though we already - // propagated content changes to it and its subtree. So we use this flag to - // mark that the parent providers already propagated. - // - // Unfortunately, though, we need to ignore this flag when we're inside a - // tree whose context propagation was deferred — that's what the - // `NeedsPropagation` flag is for. - // - // If we could instead bail out before entering the siblings' begin phase, - // then we could remove both `DidPropagateContext` and `NeedsPropagation`. - // Consider this as part of the next refactor to the fiber tree structure. - - workInProgress.flags |= DidPropagateContext; -} - -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) { - return false; - } // Iterate over the current dependencies to see if something changed. This - // only gets called if props and state has already bailed out, so it's a - // relatively uncommon path, except at the root of a changed subtree. - // Alternatively, we could move these comparisons into `readContext`, but - // that's a much hotter path, so I think this is an appropriate trade off. - - var dependency = currentDependencies.firstContext; - - while (dependency !== null) { - var context = dependency.context; - var newValue = context._currentValue; - var oldValue = dependency.memoizedValue; - - if (!objectIs(newValue, oldValue)) { - return true; - } - - dependency = dependency.next; - } - - return false; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - if (enableLazyContextPropagation) { - // Reset the work-in-progress list - dependencies.firstContext = null; - } else { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - - if (enableLazyContextPropagation) { - currentlyRenderingFiber.flags |= NeedsPropagation; - } - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate(fiber)) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - _payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -21705,11 +21075,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -21742,8 +21112,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentPrimaryRenderer == null) { - mutableSource._currentPrimaryRenderer = rendererSigil$1; - } else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) { + mutableSource._currentPrimaryRenderer = rendererSigil; + } else if (mutableSource._currentPrimaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -21768,97 +21138,6 @@ function registerMutableSourceForHydration(root, mutableSource) { } } -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -22011,7 +21290,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -22025,7 +21304,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -22108,7 +21387,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -22217,7 +21496,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -22332,7 +21611,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22540,7 +21819,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -22556,7 +21835,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22583,7 +21862,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -22601,7 +21880,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -22615,7 +21894,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -22628,7 +21907,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -22658,7 +21937,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -22712,14 +21991,14 @@ function use(usable) { function useMemoCache(size) { var memoCache = null; // Fast-path, load memo cache from wip fiber if already prepared - var updateQueue = currentlyRenderingFiber$1.updateQueue; + var updateQueue = currentlyRenderingFiber.updateQueue; if (updateQueue !== null) { memoCache = updateQueue.memoCache; } // Otherwise clone from the current fiber if (memoCache == null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { var currentUpdateQueue = current.updateQueue; @@ -22748,7 +22027,7 @@ function useMemoCache(size) { if (updateQueue === null) { updateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = updateQueue; + currentlyRenderingFiber.updateQueue = updateQueue; } updateQueue.memoCache = memoCache; @@ -22802,7 +22081,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -22894,8 +22173,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -23122,7 +22401,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -23231,7 +22510,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -23262,7 +22541,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; var isHydrating = getIsHydrating(); @@ -23352,7 +22631,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -23428,11 +22707,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -23511,7 +22790,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -23534,11 +22813,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -23591,7 +22870,7 @@ function mountRef(initialValue) { if (!hasBeenInitialized) { didCheckForLazyInit = true; lazyInitGetterStack = getCallerStackFrame(); - } else if (currentlyRenderingFiber$1 !== null && !didWarnAboutRead) { + } else if (currentlyRenderingFiber !== null && !didWarnAboutRead) { if ( lazyInitGetterStack === null || lazyInitGetterStack !== getCallerStackFrame() @@ -23603,8 +22882,7 @@ function mountRef(initialValue) { "Reading from a ref during render is only safe if:\n" + "1. The ref value has not been updated, or\n" + "2. The ref holds a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23613,7 +22891,7 @@ function mountRef(initialValue) { }, set current(value) { - if (currentlyRenderingFiber$1 !== null && !didWarnAboutWrite) { + if (currentlyRenderingFiber !== null && !didWarnAboutWrite) { if (hasBeenInitialized || !didCheckForLazyInit) { didWarnAboutWrite = true; @@ -23621,8 +22899,7 @@ function mountRef(initialValue) { "%s: Unsafe write of a mutable value during render.\n\n" + "Writing to a ref during render is only safe if the ref holds " + "a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23652,7 +22929,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23680,7 +22957,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23690,7 +22967,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -23707,12 +22984,12 @@ function updateEffect(create, deps) { } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= Update; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= Update; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.events = [payload]; } else { var events = componentUpdateQueue.events; @@ -23773,7 +23050,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -23831,7 +23108,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -23972,8 +23249,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -24011,19 +23288,19 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; - var currentTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; + var currentTransition = ReactCurrentBatchConfig$1.transition; if (enableTransitionTracing) { if (options !== undefined && options.name !== undefined) { - ReactCurrentBatchConfig$2.transition.name = options.name; - ReactCurrentBatchConfig$2.transition.startTime = now(); + ReactCurrentBatchConfig$1.transition.name = options.name; + ReactCurrentBatchConfig$1.transition.startTime = now(); } } { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); } try { @@ -24031,7 +23308,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactCurrentBatchConfig$1.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -24125,7 +23402,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -24301,8 +23578,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -24375,8 +23652,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -24532,8 +23808,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24664,8 +23939,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24798,8 +24072,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24930,8 +24203,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25079,8 +24351,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25237,8 +24508,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25395,8 +24665,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -27340,149 +26609,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the -// transitions. Therefore, we want to lazily combine transitions. Instead of -// comparing the arrays of transitions when we combine them and storing them -// and filtering out the duplicates, we will instead store the unprocessed transitions -// in an array and actually filter them in the passive phase. - -var transitionStack = createCursor(null); - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - var rootTransitions = getWorkInProgressTransitions(); - push(transitionStack, rootTransitions, workInProgress); - } -} -function popRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } - - if (enableTransitionTracing) { - if (transitionStack.current === null) { - push(transitionStack, newTransitions, offscreenWorkInProgress); - } else if (newTransitions === null) { - push(transitionStack, transitionStack.current, offscreenWorkInProgress); - } else { - push( - transitionStack, - transitionStack.current.concat(newTransitions), - offscreenWorkInProgress - ); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } - - { - pop(resumedCache, workInProgress); - } - } -} -function getPendingTransitions() { - if (!enableTransitionTracing) { - return null; - } - - return transitionStack.current; -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} - var TransitionRoot = 0; var TransitionTracingMarker = 1; function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { @@ -31489,6 +30615,861 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; + + { + if ( + context._currentRenderer !== undefined && + context._currentRenderer !== null && + context._currentRenderer !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue = context._defaultValue; + } else { + context._currentValue = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) { + // TODO: This path is only used by Cache components. Update + // lazilyPropagateParentContextChanges to look for Cache components so they + // can take advantage of lazy propagation. + var forcePropagateEntireTree = true; + propagateContextChanges( + workInProgress, + [context], + renderLanes, + forcePropagateEntireTree + ); + } else { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + // Only used by eager implementation + if (enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + // Only used by lazy implementation + if (!enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dep = list.firstContext; + + findChangedDep: while (dep !== null) { + // Assigning these to constants to help Flow + var dependency = dep; + var consumer = fiber; + + for (var i = 0; i < contexts.length; i++) { + var context = contexts[i]; // Check if the context matches. + // TODO: Compare selected values to bail out early. + + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + // In the lazy implementation, don't mark a dirty flag on the + // dependency itself. Not all changes are propagated, so we can't + // rely on the propagation function alone to determine whether + // something has changed; the consumer will check. In the future, we + // could add back a dirty flag as an optimization to avoid double + // checking, but until we have selectors it's not really worth + // the trouble. + consumer.lanes = mergeLanes(consumer.lanes, renderLanes); + var alternate = consumer.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + consumer.return, + renderLanes, + workInProgress + ); + + if (!forcePropagateEntireTree) { + // During lazy propagation, when we find a match, we can defer + // propagating changes to the children, because we're going to + // visit them during render. We should continue propagating the + // siblings, though + nextFiber = null; + } // Since we already found a match, we can stop traversing the + // dependency list. + + break findChangedDep; + } + } + + dep = dependency.next; + } + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate2 = parentSuspense.alternate; + + if (_alternate2 !== null) { + _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = null; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function lazilyPropagateParentContextChanges( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = false; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate +// to the entire subtree, because we won't revisit it until after the current +// render has completed, at which point we'll have lost track of which providers +// have changed. + +function propagateParentContextChangesToDeferredTree( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = true; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} + +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (!enableLazyContextPropagation) { + return; + } // Collect all the parent providers that changed. Since this is usually small + // number, we use an Array instead of Set. + + var contexts = null; + var parent = workInProgress; + var isInsidePropagationBailout = false; + + while (parent !== null) { + if (!isInsidePropagationBailout) { + if ((parent.flags & NeedsPropagation) !== NoFlags) { + isInsidePropagationBailout = true; + } else if ((parent.flags & DidPropagateContext) !== NoFlags) { + break; + } + } + + if (parent.tag === ContextProvider) { + var currentParent = parent.alternate; + + if (currentParent === null) { + throw new Error("Should have a current fiber. This is a bug in React."); + } + + var oldProps = currentParent.memoizedProps; + + if (oldProps !== null) { + var providerType = parent.type; + var context = providerType._context; + var newProps = parent.pendingProps; + var newValue = newProps.value; + var oldValue = oldProps.value; + + if (!objectIs(newValue, oldValue)) { + if (contexts !== null) { + contexts.push(context); + } else { + contexts = [context]; + } + } + } + } + + parent = parent.return; + } + + if (contexts !== null) { + // If there were any changed providers, search through the children and + // propagate their changes. + propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree + ); + } // This is an optimization so that we only propagate once per subtree. If a + // deeply nested child bails out, and it calls this propagation function, it + // uses this flag to know that the remaining ancestor providers have already + // been propagated. + // + // NOTE: This optimization is only necessary because we sometimes enter the + // begin phase of nodes that don't have any work scheduled on them — + // specifically, the siblings of a node that _does_ have scheduled work. The + // siblings will bail out and call this function again, even though we already + // propagated content changes to it and its subtree. So we use this flag to + // mark that the parent providers already propagated. + // + // Unfortunately, though, we need to ignore this flag when we're inside a + // tree whose context propagation was deferred — that's what the + // `NeedsPropagation` flag is for. + // + // If we could instead bail out before entering the siblings' begin phase, + // then we could remove both `DidPropagateContext` and `NeedsPropagation`. + // Consider this as part of the next refactor to the fiber tree structure. + + workInProgress.flags |= DidPropagateContext; +} + +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) { + return false; + } // Iterate over the current dependencies to see if something changed. This + // only gets called if props and state has already bailed out, so it's a + // relatively uncommon path, except at the root of a changed subtree. + // Alternatively, we could move these comparisons into `readContext`, but + // that's a much hotter path, so I think this is an appropriate trade off. + + var dependency = currentDependencies.firstContext; + + while (dependency !== null) { + var context = dependency.context; + var newValue = context._currentValue; + var oldValue = dependency.memoizedValue; + + if (!objectIs(newValue, oldValue)) { + return true; + } + + dependency = dependency.next; + } + + return false; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + if (enableLazyContextPropagation) { + // Reset the work-in-progress list + dependencies.firstContext = null; + } else { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + + if (enableLazyContextPropagation) { + currentlyRenderingFiber$1.flags |= NeedsPropagation; + } + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$2.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the +// transitions. Therefore, we want to lazily combine transitions. Instead of +// comparing the arrays of transitions when we combine them and storing them +// and filtering out the duplicates, we will instead store the unprocessed transitions +// in an array and actually filter them in the passive phase. + +var transitionStack = createCursor(null); + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + var rootTransitions = getWorkInProgressTransitions(); + push(transitionStack, rootTransitions, workInProgress); + } +} +function popRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } + + if (enableTransitionTracing) { + if (transitionStack.current === null) { + push(transitionStack, newTransitions, offscreenWorkInProgress); + } else if (newTransitions === null) { + push(transitionStack, transitionStack.current, offscreenWorkInProgress); + } else { + push( + transitionStack, + transitionStack.current.concat(newTransitions), + offscreenWorkInProgress + ); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } + + { + pop(resumedCache, workInProgress); + } + } +} +function getPendingTransitions() { + if (!enableTransitionTracing) { + return null; + } + + return transitionStack.current; +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -41282,10 +41263,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -42319,7 +42300,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-modern-420f0b7fa-20221201"; function createPortal( children, @@ -43452,8 +43433,6 @@ var foundDevTools = injectIntoDevTools({ } } -var unstable_isNewReconciler = enableNewReconciler; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = createPortal$1; exports.createRoot = createRoot$1; @@ -43464,7 +43443,6 @@ exports.preload = preload$1; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = createEventHandle; exports.unstable_flushControlled = flushControlled; -exports.unstable_isNewReconciler = unstable_isNewReconciler; exports.unstable_runWithPriority = runWithPriority; exports.version = ReactVersion; diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index bcea277666..9f85504e76 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -5694,7 +5694,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6364,580 +6690,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -7029,50 +6782,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -7123,9 +6832,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7153,7 +6862,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7178,7 +6887,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7217,7 +6926,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7225,7 +6934,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7239,26 +6948,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7276,7 +6985,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7288,10 +6997,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$91 = thenableIndexCounter; + var index$89 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$91); + return trackUsedThenable(thenableState, usable, index$89); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7303,10 +7012,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7322,7 +7031,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7393,7 +7102,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7462,7 +7171,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7509,7 +7218,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7523,7 +7232,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7558,10 +7267,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7606,17 +7315,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7632,7 +7341,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7652,7 +7361,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7662,11 +7371,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7753,7 +7462,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7763,18 +7472,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7791,14 +7500,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$97 = enqueueUpdate$1(provider, fiber, lane); - null !== root$97 && - (scheduleUpdateOnFiber(root$97, provider, lane, eventTime), - entangleTransitions(root$97, provider, lane)); + var root$95 = enqueueUpdate$1(provider, fiber, lane); + null !== root$95 && + (scheduleUpdateOnFiber(root$95, provider, lane, eventTime), + entangleTransitions(root$95, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$97 && + null !== root$95 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -7867,8 +7576,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -7905,8 +7614,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -7960,7 +7668,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -7997,7 +7705,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -8005,15 +7713,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$93 = workInProgressRoot; - if (null === root$93) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$93, renderLanes) || + var root$91 = workInProgressRoot; + if (null === root$91) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$91, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$93 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$93; - mountEffect(subscribeToStore.bind(null, fiber, root$93, subscribe), [ + root$91 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$91; + mountEffect(subscribeToStore.bind(null, fiber, root$91, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -8022,7 +7730,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$93, + root$91, getServerSnapshot, getSnapshot ), @@ -8057,11 +7765,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -8102,8 +7809,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -8137,8 +7843,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8343,9 +8048,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$102) { + } catch (e$100) { setTimeout(function() { - throw e$102; + throw e$100; }); } } @@ -8416,39 +8121,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8556,10 +8228,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$108 = workInProgress.stateNode; + root$106 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$108.incompleteTransitions.has(transition)) { + if (!root$106.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8567,11 +8239,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$108.incompleteTransitions.set(transition, markerInstance); + root$106.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$108.incompleteTransitions.forEach(function(markerInstance) { + root$106.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9242,14 +8914,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$115 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$115) + var dehydrated$113 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$113) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$115, + dehydrated$113, JSCompiler_temp, renderLanes ); @@ -9259,7 +8931,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$115 = JSCompiler_temp.sibling; + dehydrated$113 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9268,8 +8940,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$115 - ? (showFallback = createWorkInProgress(dehydrated$115, showFallback)) + null !== dehydrated$113 + ? (showFallback = createWorkInProgress(dehydrated$113, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9288,10 +8960,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$115 = CacheContext._currentValue), + ? ((dehydrated$113 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$115 - ? { parent: dehydrated$115, pool: dehydrated$115 } + JSCompiler_temp.parent !== dehydrated$113 + ? { parent: dehydrated$113, pool: dehydrated$113 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9305,23 +8977,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$115 = showFallback.updateQueue), + (dehydrated$113 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$115 + null === dehydrated$113 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$115 === primaryChildProps + : dehydrated$113 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$115.transitions = didSuspend), - (dehydrated$115.markerInstances = JSCompiler_temp)))); + : ((dehydrated$113.transitions = didSuspend), + (dehydrated$113.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -9838,6 +9510,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -13018,7 +13015,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -13798,10 +13795,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$103 = offscreenQueue.wakeables; - null === wakeables$103 + var wakeables$101 = offscreenQueue.wakeables; + null === wakeables$101 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$103.add(wakeable); + : wakeables$101.add(wakeable); } break; } @@ -15556,7 +15553,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1773 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-030dae2f4-20221201", + version: "18.3.0-www-classic-420f0b7fa-20221201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2154 = { @@ -15586,7 +15583,7 @@ var internals$jscomp$inline_2154 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15809,7 +15806,6 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !1; exports.unstable_renderSubtreeIntoContainer = function( parentComponent, element, @@ -15829,4 +15825,4 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index e39eb6082c..dff43cfc41 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -5545,7 +5545,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6215,580 +6541,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -6880,50 +6633,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -6974,9 +6683,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7004,7 +6713,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7029,7 +6738,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7068,7 +6777,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7076,7 +6785,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7090,26 +6799,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7127,7 +6836,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7139,10 +6848,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$92 = thenableIndexCounter; + var index$90 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$92); + return trackUsedThenable(thenableState, usable, index$90); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7154,10 +6863,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7173,7 +6882,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7244,7 +6953,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7313,7 +7022,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7360,7 +7069,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7374,7 +7083,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7409,10 +7118,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7457,17 +7166,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7483,7 +7192,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7503,7 +7212,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7513,11 +7222,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7604,7 +7313,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7614,18 +7323,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7642,14 +7351,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$98 = enqueueUpdate$1(provider, fiber, lane); - null !== root$98 && - (scheduleUpdateOnFiber(root$98, provider, lane, eventTime), - entangleTransitions(root$98, provider, lane)); + var root$96 = enqueueUpdate$1(provider, fiber, lane); + null !== root$96 && + (scheduleUpdateOnFiber(root$96, provider, lane, eventTime), + entangleTransitions(root$96, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$98 && + null !== root$96 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -7718,8 +7427,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -7756,8 +7465,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -7811,7 +7519,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -7848,7 +7556,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -7856,15 +7564,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$94 = workInProgressRoot; - if (null === root$94) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$94, renderLanes) || + var root$92 = workInProgressRoot; + if (null === root$92) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$92, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$94 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$94; - mountEffect(subscribeToStore.bind(null, fiber, root$94, subscribe), [ + root$92 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$92; + mountEffect(subscribeToStore.bind(null, fiber, root$92, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -7873,7 +7581,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$94, + root$92, getServerSnapshot, getSnapshot ), @@ -7908,11 +7616,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -7953,8 +7660,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -7988,8 +7694,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8180,9 +7885,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$103) { + } catch (e$101) { setTimeout(function() { - throw e$103; + throw e$101; }); } } @@ -8253,39 +7958,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8393,10 +8065,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$109 = workInProgress.stateNode; + root$107 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$109.incompleteTransitions.has(transition)) { + if (!root$107.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8404,11 +8076,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$109.incompleteTransitions.set(transition, markerInstance); + root$107.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$109.incompleteTransitions.forEach(function(markerInstance) { + root$107.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9043,14 +8715,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$116 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$116) + var dehydrated$114 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$114) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$116, + dehydrated$114, JSCompiler_temp, renderLanes ); @@ -9060,7 +8732,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$116 = JSCompiler_temp.sibling; + dehydrated$114 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9069,8 +8741,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$116 - ? (showFallback = createWorkInProgress(dehydrated$116, showFallback)) + null !== dehydrated$114 + ? (showFallback = createWorkInProgress(dehydrated$114, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9089,10 +8761,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$116 = CacheContext._currentValue), + ? ((dehydrated$114 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$116 - ? { parent: dehydrated$116, pool: dehydrated$116 } + JSCompiler_temp.parent !== dehydrated$114 + ? { parent: dehydrated$114, pool: dehydrated$114 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9106,23 +8778,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$116 = showFallback.updateQueue), + (dehydrated$114 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$116 + null === dehydrated$114 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$116 === primaryChildProps + : dehydrated$114 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$116.transitions = didSuspend), - (dehydrated$116.markerInstances = JSCompiler_temp)))); + : ((dehydrated$114.transitions = didSuspend), + (dehydrated$114.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -9635,6 +9307,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -12796,7 +12793,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -13576,10 +13573,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$104 = offscreenQueue.wakeables; - null === wakeables$104 + var wakeables$102 = offscreenQueue.wakeables; + null === wakeables$102 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$104.add(wakeable); + : wakeables$102.add(wakeable); } break; } @@ -15117,7 +15114,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1741 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-030dae2f4-20221201", + version: "18.3.0-www-modern-420f0b7fa-20221201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2129 = { @@ -15148,7 +15145,7 @@ var internals$jscomp$inline_2129 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2130 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15335,6 +15332,5 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !1; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 10b3eb1de5..321b35927a 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -5842,7 +5842,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6512,580 +6838,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -7177,50 +6930,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -7271,9 +6980,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7301,7 +7010,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7326,7 +7035,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7365,7 +7074,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7373,7 +7082,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7387,26 +7096,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7424,7 +7133,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7436,10 +7145,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$94 = thenableIndexCounter; + var index$92 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$94); + return trackUsedThenable(thenableState, usable, index$92); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7451,10 +7160,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7470,7 +7179,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7541,7 +7250,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7610,7 +7319,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7657,7 +7366,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7671,7 +7380,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7706,10 +7415,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7754,17 +7463,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7780,7 +7489,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7800,7 +7509,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7810,11 +7519,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7901,7 +7610,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7911,18 +7620,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7939,14 +7648,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$100 = enqueueUpdate$1(provider, fiber, lane); - null !== root$100 && - (scheduleUpdateOnFiber(root$100, provider, lane, eventTime), - entangleTransitions(root$100, provider, lane)); + var root$98 = enqueueUpdate$1(provider, fiber, lane); + null !== root$98 && + (scheduleUpdateOnFiber(root$98, provider, lane, eventTime), + entangleTransitions(root$98, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$100 && + null !== root$98 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -8017,8 +7726,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -8055,8 +7764,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -8110,7 +7818,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -8147,7 +7855,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -8155,15 +7863,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$96 = workInProgressRoot; - if (null === root$96) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$96, renderLanes) || + var root$94 = workInProgressRoot; + if (null === root$94) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$94, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$96 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$96; - mountEffect(subscribeToStore.bind(null, fiber, root$96, subscribe), [ + root$94 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$94; + mountEffect(subscribeToStore.bind(null, fiber, root$94, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -8172,7 +7880,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$96, + root$94, getServerSnapshot, getSnapshot ), @@ -8207,11 +7915,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -8252,8 +7959,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -8287,8 +7993,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8562,9 +8267,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$107) { + } catch (e$105) { setTimeout(function() { - throw e$107; + throw e$105; }); } } @@ -8635,39 +8340,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8775,10 +8447,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$113 = workInProgress.stateNode; + root$111 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$113.incompleteTransitions.has(transition)) { + if (!root$111.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8786,11 +8458,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$113.incompleteTransitions.set(transition, markerInstance); + root$111.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$113.incompleteTransitions.forEach(function(markerInstance) { + root$111.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9474,14 +9146,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$120 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$120) + var dehydrated$118 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$118) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$120, + dehydrated$118, JSCompiler_temp, renderLanes ); @@ -9491,7 +9163,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$120 = JSCompiler_temp.sibling; + dehydrated$118 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9505,8 +9177,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$120 - ? (showFallback = createWorkInProgress(dehydrated$120, showFallback)) + null !== dehydrated$118 + ? (showFallback = createWorkInProgress(dehydrated$118, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9525,10 +9197,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$120 = CacheContext._currentValue), + ? ((dehydrated$118 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$120 - ? { parent: dehydrated$120, pool: dehydrated$120 } + JSCompiler_temp.parent !== dehydrated$118 + ? { parent: dehydrated$118, pool: dehydrated$118 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9542,23 +9214,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$120 = showFallback.updateQueue), + (dehydrated$118 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$120 + null === dehydrated$118 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$120 === primaryChildProps + : dehydrated$118 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$120.transitions = didSuspend), - (dehydrated$120.markerInstances = JSCompiler_temp)))); + : ((dehydrated$118.transitions = didSuspend), + (dehydrated$118.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -10088,6 +9760,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -13612,7 +13609,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -14473,10 +14470,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$108 = offscreenQueue.wakeables; - null === wakeables$108 + var wakeables$106 = offscreenQueue.wakeables; + null === wakeables$106 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$108.add(wakeable); + : wakeables$106.add(wakeable); } break; } @@ -16329,7 +16326,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1847 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-030dae2f4-20221201", + version: "18.3.0-www-classic-420f0b7fa-20221201", rendererPackageName: "react-dom" }; (function(internals) { @@ -16373,7 +16370,7 @@ var devToolsConfig$jscomp$inline_1847 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -16583,7 +16580,6 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !1; exports.unstable_renderSubtreeIntoContainer = function( parentComponent, element, @@ -16603,7 +16599,7 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; /* 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 44e04db7bf..28ec081b8b 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -5689,7 +5689,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6359,580 +6685,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -7024,50 +6777,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -7118,9 +6827,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7148,7 +6857,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7173,7 +6882,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7212,7 +6921,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7220,7 +6929,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7234,26 +6943,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7271,7 +6980,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7283,10 +6992,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$95 = thenableIndexCounter; + var index$93 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$95); + return trackUsedThenable(thenableState, usable, index$93); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7298,10 +7007,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7317,7 +7026,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7388,7 +7097,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7457,7 +7166,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7504,7 +7213,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7518,7 +7227,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7553,10 +7262,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7601,17 +7310,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7627,7 +7336,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7647,7 +7356,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7657,11 +7366,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7748,7 +7457,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7758,18 +7467,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7786,14 +7495,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$101 = enqueueUpdate$1(provider, fiber, lane); - null !== root$101 && - (scheduleUpdateOnFiber(root$101, provider, lane, eventTime), - entangleTransitions(root$101, provider, lane)); + var root$99 = enqueueUpdate$1(provider, fiber, lane); + null !== root$99 && + (scheduleUpdateOnFiber(root$99, provider, lane, eventTime), + entangleTransitions(root$99, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$101 && + null !== root$99 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -7864,8 +7573,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -7902,8 +7611,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -7957,7 +7665,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -7994,7 +7702,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -8002,15 +7710,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$97 = workInProgressRoot; - if (null === root$97) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$97, renderLanes) || + var root$95 = workInProgressRoot; + if (null === root$95) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$95, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$97 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$97; - mountEffect(subscribeToStore.bind(null, fiber, root$97, subscribe), [ + root$95 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$95; + mountEffect(subscribeToStore.bind(null, fiber, root$95, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -8019,7 +7727,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$97, + root$95, getServerSnapshot, getSnapshot ), @@ -8054,11 +7762,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -8099,8 +7806,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -8134,8 +7840,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8395,9 +8100,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$108) { + } catch (e$106) { setTimeout(function() { - throw e$108; + throw e$106; }); } } @@ -8468,39 +8173,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8608,10 +8280,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$114 = workInProgress.stateNode; + root$112 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$114.incompleteTransitions.has(transition)) { + if (!root$112.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8619,11 +8291,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$114.incompleteTransitions.set(transition, markerInstance); + root$112.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$114.incompleteTransitions.forEach(function(markerInstance) { + root$112.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9265,14 +8937,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$121 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$121) + var dehydrated$119 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$119) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$121, + dehydrated$119, JSCompiler_temp, renderLanes ); @@ -9282,7 +8954,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$121 = JSCompiler_temp.sibling; + dehydrated$119 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9296,8 +8968,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$121 - ? (showFallback = createWorkInProgress(dehydrated$121, showFallback)) + null !== dehydrated$119 + ? (showFallback = createWorkInProgress(dehydrated$119, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9316,10 +8988,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$121 = CacheContext._currentValue), + ? ((dehydrated$119 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$121 - ? { parent: dehydrated$121, pool: dehydrated$121 } + JSCompiler_temp.parent !== dehydrated$119 + ? { parent: dehydrated$119, pool: dehydrated$119 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9333,23 +9005,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$121 = showFallback.updateQueue), + (dehydrated$119 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$121 + null === dehydrated$119 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$121 === primaryChildProps + : dehydrated$119 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$121.transitions = didSuspend), - (dehydrated$121.markerInstances = JSCompiler_temp)))); + : ((dehydrated$119.transitions = didSuspend), + (dehydrated$119.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -9875,6 +9547,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -13380,7 +13377,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -14241,10 +14238,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$109 = offscreenQueue.wakeables; - null === wakeables$109 + var wakeables$107 = offscreenQueue.wakeables; + null === wakeables$107 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$109.add(wakeable); + : wakeables$107.add(wakeable); } break; } @@ -15880,7 +15877,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1815 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-030dae2f4-20221201", + version: "18.3.0-www-modern-420f0b7fa-20221201", rendererPackageName: "react-dom" }; (function(internals) { @@ -15925,7 +15922,7 @@ var devToolsConfig$jscomp$inline_1815 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function(children, container) { @@ -16099,9 +16096,8 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !1; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMForked-dev.classic.js b/compiled/facebook-www/ReactDOMForked-dev.classic.js index 17b3b89166..3db8e92e2c 100644 --- a/compiled/facebook-www/ReactDOMForked-dev.classic.js +++ b/compiled/facebook-www/ReactDOMForked-dev.classic.js @@ -75,10 +75,6 @@ var enableProfilerNestedUpdateScheduledHook = var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler; // Note: we'll want to remove this when we to userland implementation. var warnAboutStringRefs = true; var enableSuspenseCallback = true; -// don't have to add another test dimension. The build system will compile this -// to the correct value. - -var enableNewReconciler = true; var enableCustomElementPropertySupport = false; // This refers to a WWW module. @@ -9724,10 +9720,6 @@ function popHostContext(fiber) { pop(contextFiberStackCursor, fiber); } -function getCurrentRootHostContainer$1() { - return getCurrentRootHostContainer(); -} - var Dispatcher = Internals.Dispatcher; // In the future this may need to change, especially when modules / scripts are supported @@ -9769,7 +9761,7 @@ function getRootNode(container) { } function getCurrentResourceRoot() { - var currentContainer = getCurrentRootHostContainer$1(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode + var currentContainer = getCurrentRootHostContainer(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode return currentContainer ? getRootNode(currentContainer) : null; } // This resource type constraint can be loosened. It really is everything except PreloadResource @@ -18550,10 +18542,787 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig$1.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate(fiber)) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + _payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } var ReactStrictModeWarnings = { @@ -20282,1405 +21051,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue, providerFiber); - 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; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue = context._defaultValue; - } else { - context._currentValue = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) { - // TODO: This path is only used by Cache components. Update - // lazilyPropagateParentContextChanges to look for Cache components so they - // can take advantage of lazy propagation. - var forcePropagateEntireTree = true; - propagateContextChanges( - workInProgress, - [context], - renderLanes, - forcePropagateEntireTree - ); - } else { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - // Only used by eager implementation - if (enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - // Only used by lazy implementation - if (!enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dep = list.firstContext; - - findChangedDep: while (dep !== null) { - // Assigning these to constants to help Flow - var dependency = dep; - var consumer = fiber; - - for (var i = 0; i < contexts.length; i++) { - var context = contexts[i]; // Check if the context matches. - // TODO: Compare selected values to bail out early. - - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - // In the lazy implementation, don't mark a dirty flag on the - // dependency itself. Not all changes are propagated, so we can't - // rely on the propagation function alone to determine whether - // something has changed; the consumer will check. In the future, we - // could add back a dirty flag as an optimization to avoid double - // checking, but until we have selectors it's not really worth - // the trouble. - consumer.lanes = mergeLanes(consumer.lanes, renderLanes); - var alternate = consumer.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - consumer.return, - renderLanes, - workInProgress - ); - - if (!forcePropagateEntireTree) { - // During lazy propagation, when we find a match, we can defer - // propagating changes to the children, because we're going to - // visit them during render. We should continue propagating the - // siblings, though - nextFiber = null; - } // Since we already found a match, we can stop traversing the - // dependency list. - - break findChangedDep; - } - } - - dep = dependency.next; - } - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate2 = parentSuspense.alternate; - - if (_alternate2 !== null) { - _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = null; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function lazilyPropagateParentContextChanges( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = false; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate -// to the entire subtree, because we won't revisit it until after the current -// render has completed, at which point we'll have lost track of which providers -// have changed. - -function propagateParentContextChangesToDeferredTree( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = true; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} - -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (!enableLazyContextPropagation) { - return; - } // Collect all the parent providers that changed. Since this is usually small - // number, we use an Array instead of Set. - - var contexts = null; - var parent = workInProgress; - var isInsidePropagationBailout = false; - - while (parent !== null) { - if (!isInsidePropagationBailout) { - if ((parent.flags & NeedsPropagation) !== NoFlags) { - isInsidePropagationBailout = true; - } else if ((parent.flags & DidPropagateContext) !== NoFlags) { - break; - } - } - - if (parent.tag === ContextProvider) { - var currentParent = parent.alternate; - - if (currentParent === null) { - throw new Error("Should have a current fiber. This is a bug in React."); - } - - var oldProps = currentParent.memoizedProps; - - if (oldProps !== null) { - var providerType = parent.type; - var context = providerType._context; - var newProps = parent.pendingProps; - var newValue = newProps.value; - var oldValue = oldProps.value; - - if (!objectIs(newValue, oldValue)) { - if (contexts !== null) { - contexts.push(context); - } else { - contexts = [context]; - } - } - } - } - - parent = parent.return; - } - - if (contexts !== null) { - // If there were any changed providers, search through the children and - // propagate their changes. - propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree - ); - } // This is an optimization so that we only propagate once per subtree. If a - // deeply nested child bails out, and it calls this propagation function, it - // uses this flag to know that the remaining ancestor providers have already - // been propagated. - // - // NOTE: This optimization is only necessary because we sometimes enter the - // begin phase of nodes that don't have any work scheduled on them — - // specifically, the siblings of a node that _does_ have scheduled work. The - // siblings will bail out and call this function again, even though we already - // propagated content changes to it and its subtree. So we use this flag to - // mark that the parent providers already propagated. - // - // Unfortunately, though, we need to ignore this flag when we're inside a - // tree whose context propagation was deferred — that's what the - // `NeedsPropagation` flag is for. - // - // If we could instead bail out before entering the siblings' begin phase, - // then we could remove both `DidPropagateContext` and `NeedsPropagation`. - // Consider this as part of the next refactor to the fiber tree structure. - - workInProgress.flags |= DidPropagateContext; -} - -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) { - return false; - } // Iterate over the current dependencies to see if something changed. This - // only gets called if props and state has already bailed out, so it's a - // relatively uncommon path, except at the root of a changed subtree. - // Alternatively, we could move these comparisons into `readContext`, but - // that's a much hotter path, so I think this is an appropriate trade off. - - var dependency = currentDependencies.firstContext; - - while (dependency !== null) { - var context = dependency.context; - var newValue = context._currentValue; - var oldValue = dependency.memoizedValue; - - if (!objectIs(newValue, oldValue)) { - return true; - } - - dependency = dependency.next; - } - - return false; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - if (enableLazyContextPropagation) { - // Reset the work-in-progress list - dependencies.firstContext = null; - } else { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - - if (enableLazyContextPropagation) { - currentlyRenderingFiber.flags |= NeedsPropagation; - } - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate(fiber)) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - _payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -21908,11 +21278,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -21945,8 +21315,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentPrimaryRenderer == null) { - mutableSource._currentPrimaryRenderer = rendererSigil$1; - } else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) { + mutableSource._currentPrimaryRenderer = rendererSigil; + } else if (mutableSource._currentPrimaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -21971,97 +21341,6 @@ function registerMutableSourceForHydration(root, mutableSource) { } } -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -22214,7 +21493,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -22228,7 +21507,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -22311,7 +21590,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -22420,7 +21699,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -22535,7 +21814,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22743,7 +22022,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -22759,7 +22038,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22786,7 +22065,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -22804,7 +22083,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -22818,7 +22097,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -22831,7 +22110,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -22861,7 +22140,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -22915,14 +22194,14 @@ function use(usable) { function useMemoCache(size) { var memoCache = null; // Fast-path, load memo cache from wip fiber if already prepared - var updateQueue = currentlyRenderingFiber$1.updateQueue; + var updateQueue = currentlyRenderingFiber.updateQueue; if (updateQueue !== null) { memoCache = updateQueue.memoCache; } // Otherwise clone from the current fiber if (memoCache == null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { var currentUpdateQueue = current.updateQueue; @@ -22951,7 +22230,7 @@ function useMemoCache(size) { if (updateQueue === null) { updateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = updateQueue; + currentlyRenderingFiber.updateQueue = updateQueue; } updateQueue.memoCache = memoCache; @@ -23005,7 +22284,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -23097,8 +22376,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -23325,7 +22604,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -23434,7 +22713,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -23465,7 +22744,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; var isHydrating = getIsHydrating(); @@ -23555,7 +22834,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -23631,11 +22910,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -23714,7 +22993,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -23737,11 +23016,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -23794,7 +23073,7 @@ function mountRef(initialValue) { if (!hasBeenInitialized) { didCheckForLazyInit = true; lazyInitGetterStack = getCallerStackFrame(); - } else if (currentlyRenderingFiber$1 !== null && !didWarnAboutRead) { + } else if (currentlyRenderingFiber !== null && !didWarnAboutRead) { if ( lazyInitGetterStack === null || lazyInitGetterStack !== getCallerStackFrame() @@ -23806,8 +23085,7 @@ function mountRef(initialValue) { "Reading from a ref during render is only safe if:\n" + "1. The ref value has not been updated, or\n" + "2. The ref holds a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23816,7 +23094,7 @@ function mountRef(initialValue) { }, set current(value) { - if (currentlyRenderingFiber$1 !== null && !didWarnAboutWrite) { + if (currentlyRenderingFiber !== null && !didWarnAboutWrite) { if (hasBeenInitialized || !didCheckForLazyInit) { didWarnAboutWrite = true; @@ -23824,8 +23102,7 @@ function mountRef(initialValue) { "%s: Unsafe write of a mutable value during render.\n\n" + "Writing to a ref during render is only safe if the ref holds " + "a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23855,7 +23132,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23883,7 +23160,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23893,7 +23170,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -23910,12 +23187,12 @@ function updateEffect(create, deps) { } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= Update; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= Update; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.events = [payload]; } else { var events = componentUpdateQueue.events; @@ -23976,7 +23253,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -24034,7 +23311,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -24175,8 +23452,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -24214,19 +23491,19 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; - var currentTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; + var currentTransition = ReactCurrentBatchConfig$1.transition; if (enableTransitionTracing) { if (options !== undefined && options.name !== undefined) { - ReactCurrentBatchConfig$2.transition.name = options.name; - ReactCurrentBatchConfig$2.transition.startTime = now(); + ReactCurrentBatchConfig$1.transition.name = options.name; + ReactCurrentBatchConfig$1.transition.startTime = now(); } } { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); } try { @@ -24234,7 +23511,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactCurrentBatchConfig$1.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -24328,7 +23605,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -24504,8 +23781,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -24578,8 +23855,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -24735,8 +24011,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24867,8 +24142,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25001,8 +24275,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25133,8 +24406,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25282,8 +24554,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25440,8 +24711,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25598,8 +24868,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -27577,149 +26846,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the -// transitions. Therefore, we want to lazily combine transitions. Instead of -// comparing the arrays of transitions when we combine them and storing them -// and filtering out the duplicates, we will instead store the unprocessed transitions -// in an array and actually filter them in the passive phase. - -var transitionStack = createCursor(null); - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - var rootTransitions = getWorkInProgressTransitions(); - push(transitionStack, rootTransitions, workInProgress); - } -} -function popRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } - - if (enableTransitionTracing) { - if (transitionStack.current === null) { - push(transitionStack, newTransitions, offscreenWorkInProgress); - } else if (newTransitions === null) { - push(transitionStack, transitionStack.current, offscreenWorkInProgress); - } else { - push( - transitionStack, - transitionStack.current.concat(newTransitions), - offscreenWorkInProgress - ); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } - - { - pop(resumedCache, workInProgress); - } - } -} -function getPendingTransitions() { - if (!enableTransitionTracing) { - return null; - } - - return transitionStack.current; -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} - var TransitionRoot = 0; var TransitionTracingMarker = 1; function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { @@ -31746,6 +30872,861 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; + + { + if ( + context._currentRenderer !== undefined && + context._currentRenderer !== null && + context._currentRenderer !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue = context._defaultValue; + } else { + context._currentValue = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) { + // TODO: This path is only used by Cache components. Update + // lazilyPropagateParentContextChanges to look for Cache components so they + // can take advantage of lazy propagation. + var forcePropagateEntireTree = true; + propagateContextChanges( + workInProgress, + [context], + renderLanes, + forcePropagateEntireTree + ); + } else { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + // Only used by eager implementation + if (enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + // Only used by lazy implementation + if (!enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dep = list.firstContext; + + findChangedDep: while (dep !== null) { + // Assigning these to constants to help Flow + var dependency = dep; + var consumer = fiber; + + for (var i = 0; i < contexts.length; i++) { + var context = contexts[i]; // Check if the context matches. + // TODO: Compare selected values to bail out early. + + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + // In the lazy implementation, don't mark a dirty flag on the + // dependency itself. Not all changes are propagated, so we can't + // rely on the propagation function alone to determine whether + // something has changed; the consumer will check. In the future, we + // could add back a dirty flag as an optimization to avoid double + // checking, but until we have selectors it's not really worth + // the trouble. + consumer.lanes = mergeLanes(consumer.lanes, renderLanes); + var alternate = consumer.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + consumer.return, + renderLanes, + workInProgress + ); + + if (!forcePropagateEntireTree) { + // During lazy propagation, when we find a match, we can defer + // propagating changes to the children, because we're going to + // visit them during render. We should continue propagating the + // siblings, though + nextFiber = null; + } // Since we already found a match, we can stop traversing the + // dependency list. + + break findChangedDep; + } + } + + dep = dependency.next; + } + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate2 = parentSuspense.alternate; + + if (_alternate2 !== null) { + _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = null; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function lazilyPropagateParentContextChanges( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = false; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate +// to the entire subtree, because we won't revisit it until after the current +// render has completed, at which point we'll have lost track of which providers +// have changed. + +function propagateParentContextChangesToDeferredTree( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = true; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} + +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (!enableLazyContextPropagation) { + return; + } // Collect all the parent providers that changed. Since this is usually small + // number, we use an Array instead of Set. + + var contexts = null; + var parent = workInProgress; + var isInsidePropagationBailout = false; + + while (parent !== null) { + if (!isInsidePropagationBailout) { + if ((parent.flags & NeedsPropagation) !== NoFlags) { + isInsidePropagationBailout = true; + } else if ((parent.flags & DidPropagateContext) !== NoFlags) { + break; + } + } + + if (parent.tag === ContextProvider) { + var currentParent = parent.alternate; + + if (currentParent === null) { + throw new Error("Should have a current fiber. This is a bug in React."); + } + + var oldProps = currentParent.memoizedProps; + + if (oldProps !== null) { + var providerType = parent.type; + var context = providerType._context; + var newProps = parent.pendingProps; + var newValue = newProps.value; + var oldValue = oldProps.value; + + if (!objectIs(newValue, oldValue)) { + if (contexts !== null) { + contexts.push(context); + } else { + contexts = [context]; + } + } + } + } + + parent = parent.return; + } + + if (contexts !== null) { + // If there were any changed providers, search through the children and + // propagate their changes. + propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree + ); + } // This is an optimization so that we only propagate once per subtree. If a + // deeply nested child bails out, and it calls this propagation function, it + // uses this flag to know that the remaining ancestor providers have already + // been propagated. + // + // NOTE: This optimization is only necessary because we sometimes enter the + // begin phase of nodes that don't have any work scheduled on them — + // specifically, the siblings of a node that _does_ have scheduled work. The + // siblings will bail out and call this function again, even though we already + // propagated content changes to it and its subtree. So we use this flag to + // mark that the parent providers already propagated. + // + // Unfortunately, though, we need to ignore this flag when we're inside a + // tree whose context propagation was deferred — that's what the + // `NeedsPropagation` flag is for. + // + // If we could instead bail out before entering the siblings' begin phase, + // then we could remove both `DidPropagateContext` and `NeedsPropagation`. + // Consider this as part of the next refactor to the fiber tree structure. + + workInProgress.flags |= DidPropagateContext; +} + +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) { + return false; + } // Iterate over the current dependencies to see if something changed. This + // only gets called if props and state has already bailed out, so it's a + // relatively uncommon path, except at the root of a changed subtree. + // Alternatively, we could move these comparisons into `readContext`, but + // that's a much hotter path, so I think this is an appropriate trade off. + + var dependency = currentDependencies.firstContext; + + while (dependency !== null) { + var context = dependency.context; + var newValue = context._currentValue; + var oldValue = dependency.memoizedValue; + + if (!objectIs(newValue, oldValue)) { + return true; + } + + dependency = dependency.next; + } + + return false; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + if (enableLazyContextPropagation) { + // Reset the work-in-progress list + dependencies.firstContext = null; + } else { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + + if (enableLazyContextPropagation) { + currentlyRenderingFiber$1.flags |= NeedsPropagation; + } + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$2.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the +// transitions. Therefore, we want to lazily combine transitions. Instead of +// comparing the arrays of transitions when we combine them and storing them +// and filtering out the duplicates, we will instead store the unprocessed transitions +// in an array and actually filter them in the passive phase. + +var transitionStack = createCursor(null); + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + var rootTransitions = getWorkInProgressTransitions(); + push(transitionStack, rootTransitions, workInProgress); + } +} +function popRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } + + if (enableTransitionTracing) { + if (transitionStack.current === null) { + push(transitionStack, newTransitions, offscreenWorkInProgress); + } else if (newTransitions === null) { + push(transitionStack, transitionStack.current, offscreenWorkInProgress); + } else { + push( + transitionStack, + transitionStack.current.concat(newTransitions), + offscreenWorkInProgress + ); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } + + { + pop(resumedCache, workInProgress); + } + } +} +function getPendingTransitions() { + if (!enableTransitionTracing) { + return null; + } + + return transitionStack.current; +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -41558,10 +41539,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -42595,7 +42576,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-classic-420f0b7fa-20221201"; function createPortal( children, @@ -44268,8 +44249,6 @@ var foundDevTools = injectIntoDevTools({ } } -var unstable_isNewReconciler = enableNewReconciler; - assign(Internals, { ReactBrowserEventEmitter: { isEnabled: isEnabled @@ -44290,7 +44269,6 @@ exports.unmountComponentAtNode = unmountComponentAtNode; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = createEventHandle; exports.unstable_flushControlled = flushControlled; -exports.unstable_isNewReconciler = unstable_isNewReconciler; exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; exports.unstable_runWithPriority = runWithPriority; exports.version = ReactVersion; diff --git a/compiled/facebook-www/ReactDOMForked-dev.modern.js b/compiled/facebook-www/ReactDOMForked-dev.modern.js index 24d663c6c7..4c32ee6510 100644 --- a/compiled/facebook-www/ReactDOMForked-dev.modern.js +++ b/compiled/facebook-www/ReactDOMForked-dev.modern.js @@ -179,10 +179,6 @@ var enableProfilerNestedUpdateScheduledHook = var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler; // Note: we'll want to remove this when we to userland implementation. var warnAboutStringRefs = true; var enableSuspenseCallback = true; -// don't have to add another test dimension. The build system will compile this -// to the correct value. - -var enableNewReconciler = true; var enableCustomElementPropertySupport = true; var allNativeEvents = new Set(); @@ -14228,10 +14224,6 @@ function popHostContext(fiber) { pop(contextFiberStackCursor, fiber); } -function getCurrentRootHostContainer$1() { - return getCurrentRootHostContainer(); -} - var Dispatcher = Internals.Dispatcher; // In the future this may need to change, especially when modules / scripts are supported @@ -14273,7 +14265,7 @@ function getRootNode(container) { } function getCurrentResourceRoot() { - var currentContainer = getCurrentRootHostContainer$1(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode + var currentContainer = getCurrentRootHostContainer(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode return currentContainer ? getRootNode(currentContainer) : null; } // This resource type constraint can be loosened. It really is everything except PreloadResource @@ -18347,10 +18339,787 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig$1.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate(fiber)) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + if (workInProgress.mode & StrictLegacyMode) { + setIsStrictModeForDevtools(true); + + try { + _payload.call(instance, prevState, nextProps); + } finally { + setIsStrictModeForDevtools(false); + } + } + + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } var ReactStrictModeWarnings = { @@ -20079,1405 +20848,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue, providerFiber); - 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; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue = context._defaultValue; - } else { - context._currentValue = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) { - // TODO: This path is only used by Cache components. Update - // lazilyPropagateParentContextChanges to look for Cache components so they - // can take advantage of lazy propagation. - var forcePropagateEntireTree = true; - propagateContextChanges( - workInProgress, - [context], - renderLanes, - forcePropagateEntireTree - ); - } else { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - // Only used by eager implementation - if (enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - // Only used by lazy implementation - if (!enableLazyContextPropagation) { - return; - } - - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dep = list.firstContext; - - findChangedDep: while (dep !== null) { - // Assigning these to constants to help Flow - var dependency = dep; - var consumer = fiber; - - for (var i = 0; i < contexts.length; i++) { - var context = contexts[i]; // Check if the context matches. - // TODO: Compare selected values to bail out early. - - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - // In the lazy implementation, don't mark a dirty flag on the - // dependency itself. Not all changes are propagated, so we can't - // rely on the propagation function alone to determine whether - // something has changed; the consumer will check. In the future, we - // could add back a dirty flag as an optimization to avoid double - // checking, but until we have selectors it's not really worth - // the trouble. - consumer.lanes = mergeLanes(consumer.lanes, renderLanes); - var alternate = consumer.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - consumer.return, - renderLanes, - workInProgress - ); - - if (!forcePropagateEntireTree) { - // During lazy propagation, when we find a match, we can defer - // propagating changes to the children, because we're going to - // visit them during render. We should continue propagating the - // siblings, though - nextFiber = null; - } // Since we already found a match, we can stop traversing the - // dependency list. - - break findChangedDep; - } - } - - dep = dependency.next; - } - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate2 = parentSuspense.alternate; - - if (_alternate2 !== null) { - _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = null; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} - -function lazilyPropagateParentContextChanges( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = false; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate -// to the entire subtree, because we won't revisit it until after the current -// render has completed, at which point we'll have lost track of which providers -// have changed. - -function propagateParentContextChangesToDeferredTree( - current, - workInProgress, - renderLanes -) { - var forcePropagateEntireTree = true; - propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree - ); -} - -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (!enableLazyContextPropagation) { - return; - } // Collect all the parent providers that changed. Since this is usually small - // number, we use an Array instead of Set. - - var contexts = null; - var parent = workInProgress; - var isInsidePropagationBailout = false; - - while (parent !== null) { - if (!isInsidePropagationBailout) { - if ((parent.flags & NeedsPropagation) !== NoFlags) { - isInsidePropagationBailout = true; - } else if ((parent.flags & DidPropagateContext) !== NoFlags) { - break; - } - } - - if (parent.tag === ContextProvider) { - var currentParent = parent.alternate; - - if (currentParent === null) { - throw new Error("Should have a current fiber. This is a bug in React."); - } - - var oldProps = currentParent.memoizedProps; - - if (oldProps !== null) { - var providerType = parent.type; - var context = providerType._context; - var newProps = parent.pendingProps; - var newValue = newProps.value; - var oldValue = oldProps.value; - - if (!objectIs(newValue, oldValue)) { - if (contexts !== null) { - contexts.push(context); - } else { - contexts = [context]; - } - } - } - } - - parent = parent.return; - } - - if (contexts !== null) { - // If there were any changed providers, search through the children and - // propagate their changes. - propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree - ); - } // This is an optimization so that we only propagate once per subtree. If a - // deeply nested child bails out, and it calls this propagation function, it - // uses this flag to know that the remaining ancestor providers have already - // been propagated. - // - // NOTE: This optimization is only necessary because we sometimes enter the - // begin phase of nodes that don't have any work scheduled on them — - // specifically, the siblings of a node that _does_ have scheduled work. The - // siblings will bail out and call this function again, even though we already - // propagated content changes to it and its subtree. So we use this flag to - // mark that the parent providers already propagated. - // - // Unfortunately, though, we need to ignore this flag when we're inside a - // tree whose context propagation was deferred — that's what the - // `NeedsPropagation` flag is for. - // - // If we could instead bail out before entering the siblings' begin phase, - // then we could remove both `DidPropagateContext` and `NeedsPropagation`. - // Consider this as part of the next refactor to the fiber tree structure. - - workInProgress.flags |= DidPropagateContext; -} - -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) { - return false; - } // Iterate over the current dependencies to see if something changed. This - // only gets called if props and state has already bailed out, so it's a - // relatively uncommon path, except at the root of a changed subtree. - // Alternatively, we could move these comparisons into `readContext`, but - // that's a much hotter path, so I think this is an appropriate trade off. - - var dependency = currentDependencies.firstContext; - - while (dependency !== null) { - var context = dependency.context; - var newValue = context._currentValue; - var oldValue = dependency.memoizedValue; - - if (!objectIs(newValue, oldValue)) { - return true; - } - - dependency = dependency.next; - } - - return false; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - if (enableLazyContextPropagation) { - // Reset the work-in-progress list - dependencies.firstContext = null; - } else { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - - if (enableLazyContextPropagation) { - currentlyRenderingFiber.flags |= NeedsPropagation; - } - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate(fiber)) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - if (workInProgress.mode & StrictLegacyMode) { - setIsStrictModeForDevtools(true); - - try { - _payload.call(instance, prevState, nextProps); - } finally { - setIsStrictModeForDevtools(false); - } - } - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -21705,11 +21075,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -21742,8 +21112,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentPrimaryRenderer == null) { - mutableSource._currentPrimaryRenderer = rendererSigil$1; - } else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) { + mutableSource._currentPrimaryRenderer = rendererSigil; + } else if (mutableSource._currentPrimaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -21768,97 +21138,6 @@ function registerMutableSourceForHydration(root, mutableSource) { } } -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -22011,7 +21290,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -22025,7 +21304,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -22108,7 +21387,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -22217,7 +21496,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -22332,7 +21611,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22540,7 +21819,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -22556,7 +21835,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -22583,7 +21862,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -22601,7 +21880,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -22615,7 +21894,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -22628,7 +21907,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -22658,7 +21937,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -22712,14 +21991,14 @@ function use(usable) { function useMemoCache(size) { var memoCache = null; // Fast-path, load memo cache from wip fiber if already prepared - var updateQueue = currentlyRenderingFiber$1.updateQueue; + var updateQueue = currentlyRenderingFiber.updateQueue; if (updateQueue !== null) { memoCache = updateQueue.memoCache; } // Otherwise clone from the current fiber if (memoCache == null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { var currentUpdateQueue = current.updateQueue; @@ -22748,7 +22027,7 @@ function useMemoCache(size) { if (updateQueue === null) { updateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = updateQueue; + currentlyRenderingFiber.updateQueue = updateQueue; } updateQueue.memoCache = memoCache; @@ -22802,7 +22081,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -22894,8 +22173,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -23122,7 +22401,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -23231,7 +22510,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -23262,7 +22541,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; var isHydrating = getIsHydrating(); @@ -23352,7 +22631,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -23428,11 +22707,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -23511,7 +22790,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -23534,11 +22813,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -23591,7 +22870,7 @@ function mountRef(initialValue) { if (!hasBeenInitialized) { didCheckForLazyInit = true; lazyInitGetterStack = getCallerStackFrame(); - } else if (currentlyRenderingFiber$1 !== null && !didWarnAboutRead) { + } else if (currentlyRenderingFiber !== null && !didWarnAboutRead) { if ( lazyInitGetterStack === null || lazyInitGetterStack !== getCallerStackFrame() @@ -23603,8 +22882,7 @@ function mountRef(initialValue) { "Reading from a ref during render is only safe if:\n" + "1. The ref value has not been updated, or\n" + "2. The ref holds a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23613,7 +22891,7 @@ function mountRef(initialValue) { }, set current(value) { - if (currentlyRenderingFiber$1 !== null && !didWarnAboutWrite) { + if (currentlyRenderingFiber !== null && !didWarnAboutWrite) { if (hasBeenInitialized || !didCheckForLazyInit) { didWarnAboutWrite = true; @@ -23621,8 +22899,7 @@ function mountRef(initialValue) { "%s: Unsafe write of a mutable value during render.\n\n" + "Writing to a ref during render is only safe if the ref holds " + "a lazily-initialized value that is only set once.\n", - getComponentNameFromFiber(currentlyRenderingFiber$1) || - "Unknown" + getComponentNameFromFiber(currentlyRenderingFiber) || "Unknown" ); } } @@ -23652,7 +22929,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23680,7 +22957,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -23690,7 +22967,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -23707,12 +22984,12 @@ function updateEffect(create, deps) { } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= Update; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= Update; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.events = [payload]; } else { var events = componentUpdateQueue.events; @@ -23773,7 +23050,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -23831,7 +23108,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -23972,8 +23249,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -24011,19 +23288,19 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; - var currentTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; + var currentTransition = ReactCurrentBatchConfig$1.transition; if (enableTransitionTracing) { if (options !== undefined && options.name !== undefined) { - ReactCurrentBatchConfig$2.transition.name = options.name; - ReactCurrentBatchConfig$2.transition.startTime = now(); + ReactCurrentBatchConfig$1.transition.name = options.name; + ReactCurrentBatchConfig$1.transition.startTime = now(); } } { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); } try { @@ -24031,7 +23308,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactCurrentBatchConfig$1.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -24125,7 +23402,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -24301,8 +23578,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -24375,8 +23652,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -24532,8 +23808,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24664,8 +23939,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24798,8 +24072,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -24930,8 +24203,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25079,8 +24351,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25237,8 +24508,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25395,8 +24665,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -27340,149 +26609,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the -// transitions. Therefore, we want to lazily combine transitions. Instead of -// comparing the arrays of transitions when we combine them and storing them -// and filtering out the duplicates, we will instead store the unprocessed transitions -// in an array and actually filter them in the passive phase. - -var transitionStack = createCursor(null); - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - var rootTransitions = getWorkInProgressTransitions(); - push(transitionStack, rootTransitions, workInProgress); - } -} -function popRootTransition(workInProgress, root, renderLanes) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } - - if (enableTransitionTracing) { - if (transitionStack.current === null) { - push(transitionStack, newTransitions, offscreenWorkInProgress); - } else if (newTransitions === null) { - push(transitionStack, transitionStack.current, offscreenWorkInProgress); - } else { - push( - transitionStack, - transitionStack.current.concat(newTransitions), - offscreenWorkInProgress - ); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - if (enableTransitionTracing) { - pop(transitionStack, workInProgress); - } - - { - pop(resumedCache, workInProgress); - } - } -} -function getPendingTransitions() { - if (!enableTransitionTracing) { - return null; - } - - return transitionStack.current; -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} - var TransitionRoot = 0; var TransitionTracingMarker = 1; function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { @@ -31489,6 +30615,861 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; + + { + if ( + context._currentRenderer !== undefined && + context._currentRenderer !== null && + context._currentRenderer !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue = context._defaultValue; + } else { + context._currentValue = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) { + // TODO: This path is only used by Cache components. Update + // lazilyPropagateParentContextChanges to look for Cache components so they + // can take advantage of lazy propagation. + var forcePropagateEntireTree = true; + propagateContextChanges( + workInProgress, + [context], + renderLanes, + forcePropagateEntireTree + ); + } else { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + // Only used by eager implementation + if (enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + // Only used by lazy implementation + if (!enableLazyContextPropagation) { + return; + } + + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dep = list.firstContext; + + findChangedDep: while (dep !== null) { + // Assigning these to constants to help Flow + var dependency = dep; + var consumer = fiber; + + for (var i = 0; i < contexts.length; i++) { + var context = contexts[i]; // Check if the context matches. + // TODO: Compare selected values to bail out early. + + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + // In the lazy implementation, don't mark a dirty flag on the + // dependency itself. Not all changes are propagated, so we can't + // rely on the propagation function alone to determine whether + // something has changed; the consumer will check. In the future, we + // could add back a dirty flag as an optimization to avoid double + // checking, but until we have selectors it's not really worth + // the trouble. + consumer.lanes = mergeLanes(consumer.lanes, renderLanes); + var alternate = consumer.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + consumer.return, + renderLanes, + workInProgress + ); + + if (!forcePropagateEntireTree) { + // During lazy propagation, when we find a match, we can defer + // propagating changes to the children, because we're going to + // visit them during render. We should continue propagating the + // siblings, though + nextFiber = null; + } // Since we already found a match, we can stop traversing the + // dependency list. + + break findChangedDep; + } + } + + dep = dependency.next; + } + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate2 = parentSuspense.alternate; + + if (_alternate2 !== null) { + _alternate2.lanes = mergeLanes(_alternate2.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = null; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} + +function lazilyPropagateParentContextChanges( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = false; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} // Used for propagating a deferred tree (Suspense, Offscreen). We must propagate +// to the entire subtree, because we won't revisit it until after the current +// render has completed, at which point we'll have lost track of which providers +// have changed. + +function propagateParentContextChangesToDeferredTree( + current, + workInProgress, + renderLanes +) { + var forcePropagateEntireTree = true; + propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree + ); +} + +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (!enableLazyContextPropagation) { + return; + } // Collect all the parent providers that changed. Since this is usually small + // number, we use an Array instead of Set. + + var contexts = null; + var parent = workInProgress; + var isInsidePropagationBailout = false; + + while (parent !== null) { + if (!isInsidePropagationBailout) { + if ((parent.flags & NeedsPropagation) !== NoFlags) { + isInsidePropagationBailout = true; + } else if ((parent.flags & DidPropagateContext) !== NoFlags) { + break; + } + } + + if (parent.tag === ContextProvider) { + var currentParent = parent.alternate; + + if (currentParent === null) { + throw new Error("Should have a current fiber. This is a bug in React."); + } + + var oldProps = currentParent.memoizedProps; + + if (oldProps !== null) { + var providerType = parent.type; + var context = providerType._context; + var newProps = parent.pendingProps; + var newValue = newProps.value; + var oldValue = oldProps.value; + + if (!objectIs(newValue, oldValue)) { + if (contexts !== null) { + contexts.push(context); + } else { + contexts = [context]; + } + } + } + } + + parent = parent.return; + } + + if (contexts !== null) { + // If there were any changed providers, search through the children and + // propagate their changes. + propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree + ); + } // This is an optimization so that we only propagate once per subtree. If a + // deeply nested child bails out, and it calls this propagation function, it + // uses this flag to know that the remaining ancestor providers have already + // been propagated. + // + // NOTE: This optimization is only necessary because we sometimes enter the + // begin phase of nodes that don't have any work scheduled on them — + // specifically, the siblings of a node that _does_ have scheduled work. The + // siblings will bail out and call this function again, even though we already + // propagated content changes to it and its subtree. So we use this flag to + // mark that the parent providers already propagated. + // + // Unfortunately, though, we need to ignore this flag when we're inside a + // tree whose context propagation was deferred — that's what the + // `NeedsPropagation` flag is for. + // + // If we could instead bail out before entering the siblings' begin phase, + // then we could remove both `DidPropagateContext` and `NeedsPropagation`. + // Consider this as part of the next refactor to the fiber tree structure. + + workInProgress.flags |= DidPropagateContext; +} + +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) { + return false; + } // Iterate over the current dependencies to see if something changed. This + // only gets called if props and state has already bailed out, so it's a + // relatively uncommon path, except at the root of a changed subtree. + // Alternatively, we could move these comparisons into `readContext`, but + // that's a much hotter path, so I think this is an appropriate trade off. + + var dependency = currentDependencies.firstContext; + + while (dependency !== null) { + var context = dependency.context; + var newValue = context._currentValue; + var oldValue = dependency.memoizedValue; + + if (!objectIs(newValue, oldValue)) { + return true; + } + + dependency = dependency.next; + } + + return false; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + if (enableLazyContextPropagation) { + // Reset the work-in-progress list + dependencies.firstContext = null; + } else { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + + if (enableLazyContextPropagation) { + currentlyRenderingFiber$1.flags |= NeedsPropagation; + } + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$2.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the +// transitions. Therefore, we want to lazily combine transitions. Instead of +// comparing the arrays of transitions when we combine them and storing them +// and filtering out the duplicates, we will instead store the unprocessed transitions +// in an array and actually filter them in the passive phase. + +var transitionStack = createCursor(null); + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + var rootTransitions = getWorkInProgressTransitions(); + push(transitionStack, rootTransitions, workInProgress); + } +} +function popRootTransition(workInProgress, root, renderLanes) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } + + if (enableTransitionTracing) { + if (transitionStack.current === null) { + push(transitionStack, newTransitions, offscreenWorkInProgress); + } else if (newTransitions === null) { + push(transitionStack, transitionStack.current, offscreenWorkInProgress); + } else { + push( + transitionStack, + transitionStack.current.concat(newTransitions), + offscreenWorkInProgress + ); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + if (enableTransitionTracing) { + pop(transitionStack, workInProgress); + } + + { + pop(resumedCache, workInProgress); + } + } +} +function getPendingTransitions() { + if (!enableTransitionTracing) { + return null; + } + + return transitionStack.current; +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -41282,10 +41263,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -42319,7 +42300,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-modern-420f0b7fa-20221201"; function createPortal( children, @@ -43452,8 +43433,6 @@ var foundDevTools = injectIntoDevTools({ } } -var unstable_isNewReconciler = enableNewReconciler; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = createPortal$1; exports.createRoot = createRoot$1; @@ -43464,7 +43443,6 @@ exports.preload = preload$1; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = createEventHandle; exports.unstable_flushControlled = flushControlled; -exports.unstable_isNewReconciler = unstable_isNewReconciler; exports.unstable_runWithPriority = runWithPriority; exports.version = ReactVersion; diff --git a/compiled/facebook-www/ReactDOMForked-prod.classic.js b/compiled/facebook-www/ReactDOMForked-prod.classic.js index b7a742e834..9f85504e76 100644 --- a/compiled/facebook-www/ReactDOMForked-prod.classic.js +++ b/compiled/facebook-www/ReactDOMForked-prod.classic.js @@ -5694,7 +5694,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6364,580 +6690,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -7029,50 +6782,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -7123,9 +6832,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7153,7 +6862,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7178,7 +6887,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7217,7 +6926,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7225,7 +6934,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7239,26 +6948,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7276,7 +6985,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7288,10 +6997,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$91 = thenableIndexCounter; + var index$89 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$91); + return trackUsedThenable(thenableState, usable, index$89); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7303,10 +7012,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7322,7 +7031,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7393,7 +7102,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7462,7 +7171,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7509,7 +7218,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7523,7 +7232,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7558,10 +7267,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7606,17 +7315,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7632,7 +7341,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7652,7 +7361,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7662,11 +7371,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7753,7 +7462,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7763,18 +7472,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7791,14 +7500,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$97 = enqueueUpdate$1(provider, fiber, lane); - null !== root$97 && - (scheduleUpdateOnFiber(root$97, provider, lane, eventTime), - entangleTransitions(root$97, provider, lane)); + var root$95 = enqueueUpdate$1(provider, fiber, lane); + null !== root$95 && + (scheduleUpdateOnFiber(root$95, provider, lane, eventTime), + entangleTransitions(root$95, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$97 && + null !== root$95 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -7867,8 +7576,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -7905,8 +7614,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !0 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -7960,7 +7668,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -7997,7 +7705,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -8005,15 +7713,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$93 = workInProgressRoot; - if (null === root$93) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$93, renderLanes) || + var root$91 = workInProgressRoot; + if (null === root$91) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$91, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$93 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$93; - mountEffect(subscribeToStore.bind(null, fiber, root$93, subscribe), [ + root$91 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$91; + mountEffect(subscribeToStore.bind(null, fiber, root$91, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -8022,7 +7730,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$93, + root$91, getServerSnapshot, getSnapshot ), @@ -8057,11 +7765,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !0, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -8102,8 +7809,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -8137,8 +7843,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8343,9 +8048,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$102) { + } catch (e$100) { setTimeout(function() { - throw e$102; + throw e$100; }); } } @@ -8416,39 +8121,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8556,10 +8228,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$108 = workInProgress.stateNode; + root$106 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$108.incompleteTransitions.has(transition)) { + if (!root$106.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8567,11 +8239,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$108.incompleteTransitions.set(transition, markerInstance); + root$106.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$108.incompleteTransitions.forEach(function(markerInstance) { + root$106.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9242,14 +8914,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$115 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$115) + var dehydrated$113 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$113) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$115, + dehydrated$113, JSCompiler_temp, renderLanes ); @@ -9259,7 +8931,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$115 = JSCompiler_temp.sibling; + dehydrated$113 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9268,8 +8940,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$115 - ? (showFallback = createWorkInProgress(dehydrated$115, showFallback)) + null !== dehydrated$113 + ? (showFallback = createWorkInProgress(dehydrated$113, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9288,10 +8960,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$115 = CacheContext._currentValue), + ? ((dehydrated$113 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$115 - ? { parent: dehydrated$115, pool: dehydrated$115 } + JSCompiler_temp.parent !== dehydrated$113 + ? { parent: dehydrated$113, pool: dehydrated$113 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9305,23 +8977,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$115 = showFallback.updateQueue), + (dehydrated$113 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$115 + null === dehydrated$113 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$115 === primaryChildProps + : dehydrated$113 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$115.transitions = didSuspend), - (dehydrated$115.markerInstances = JSCompiler_temp)))); + : ((dehydrated$113.transitions = didSuspend), + (dehydrated$113.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -9838,6 +9510,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -13018,7 +13015,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -13798,10 +13795,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$103 = offscreenQueue.wakeables; - null === wakeables$103 + var wakeables$101 = offscreenQueue.wakeables; + null === wakeables$101 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$103.add(wakeable); + : wakeables$101.add(wakeable); } break; } @@ -15556,7 +15553,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1773 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-030dae2f4-20221201", + version: "18.3.0-www-classic-420f0b7fa-20221201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2154 = { @@ -15586,7 +15583,7 @@ var internals$jscomp$inline_2154 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15809,7 +15806,6 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !0; exports.unstable_renderSubtreeIntoContainer = function( parentComponent, element, @@ -15829,4 +15825,4 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactDOMForked-prod.modern.js b/compiled/facebook-www/ReactDOMForked-prod.modern.js index e9050f41fc..dff43cfc41 100644 --- a/compiled/facebook-www/ReactDOMForked-prod.modern.js +++ b/compiled/facebook-www/ReactDOMForked-prod.modern.js @@ -5545,7 +5545,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6215,580 +6541,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -6880,50 +6633,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -6974,9 +6683,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7004,7 +6713,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7029,7 +6738,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7068,7 +6777,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7076,7 +6785,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7090,26 +6799,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7127,7 +6836,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7139,10 +6848,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$92 = thenableIndexCounter; + var index$90 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$92); + return trackUsedThenable(thenableState, usable, index$90); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7154,10 +6863,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7173,7 +6882,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7244,7 +6953,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7313,7 +7022,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7360,7 +7069,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7374,7 +7083,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7409,10 +7118,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7457,17 +7166,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7483,7 +7192,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7503,7 +7212,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7513,11 +7222,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7604,7 +7313,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7614,18 +7323,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7642,14 +7351,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$98 = enqueueUpdate$1(provider, fiber, lane); - null !== root$98 && - (scheduleUpdateOnFiber(root$98, provider, lane, eventTime), - entangleTransitions(root$98, provider, lane)); + var root$96 = enqueueUpdate$1(provider, fiber, lane); + null !== root$96 && + (scheduleUpdateOnFiber(root$96, provider, lane, eventTime), + entangleTransitions(root$96, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$98 && + null !== root$96 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -7718,8 +7427,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -7756,8 +7465,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !0 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -7811,7 +7519,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -7848,7 +7556,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -7856,15 +7564,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$94 = workInProgressRoot; - if (null === root$94) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$94, renderLanes) || + var root$92 = workInProgressRoot; + if (null === root$92) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$92, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$94 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$94; - mountEffect(subscribeToStore.bind(null, fiber, root$94, subscribe), [ + root$92 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$92; + mountEffect(subscribeToStore.bind(null, fiber, root$92, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -7873,7 +7581,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$94, + root$92, getServerSnapshot, getSnapshot ), @@ -7908,11 +7616,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !0, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -7953,8 +7660,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -7988,8 +7694,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8180,9 +7885,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$103) { + } catch (e$101) { setTimeout(function() { - throw e$103; + throw e$101; }); } } @@ -8253,39 +7958,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8393,10 +8065,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$109 = workInProgress.stateNode; + root$107 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$109.incompleteTransitions.has(transition)) { + if (!root$107.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8404,11 +8076,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$109.incompleteTransitions.set(transition, markerInstance); + root$107.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$109.incompleteTransitions.forEach(function(markerInstance) { + root$107.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9043,14 +8715,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$116 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$116) + var dehydrated$114 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$114) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$116, + dehydrated$114, JSCompiler_temp, renderLanes ); @@ -9060,7 +8732,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$116 = JSCompiler_temp.sibling; + dehydrated$114 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9069,8 +8741,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$116 - ? (showFallback = createWorkInProgress(dehydrated$116, showFallback)) + null !== dehydrated$114 + ? (showFallback = createWorkInProgress(dehydrated$114, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9089,10 +8761,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$116 = CacheContext._currentValue), + ? ((dehydrated$114 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$116 - ? { parent: dehydrated$116, pool: dehydrated$116 } + JSCompiler_temp.parent !== dehydrated$114 + ? { parent: dehydrated$114, pool: dehydrated$114 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9106,23 +8778,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$116 = showFallback.updateQueue), + (dehydrated$114 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$116 + null === dehydrated$114 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$116 === primaryChildProps + : dehydrated$114 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$116.transitions = didSuspend), - (dehydrated$116.markerInstances = JSCompiler_temp)))); + : ((dehydrated$114.transitions = didSuspend), + (dehydrated$114.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -9635,6 +9307,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -12796,7 +12793,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -13576,10 +13573,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$104 = offscreenQueue.wakeables; - null === wakeables$104 + var wakeables$102 = offscreenQueue.wakeables; + null === wakeables$102 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$104.add(wakeable); + : wakeables$102.add(wakeable); } break; } @@ -15117,7 +15114,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1741 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-030dae2f4-20221201", + version: "18.3.0-www-modern-420f0b7fa-20221201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2129 = { @@ -15148,7 +15145,7 @@ var internals$jscomp$inline_2129 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2130 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15335,6 +15332,5 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !0; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactDOMForked-profiling.classic.js b/compiled/facebook-www/ReactDOMForked-profiling.classic.js index ab468f9358..321b35927a 100644 --- a/compiled/facebook-www/ReactDOMForked-profiling.classic.js +++ b/compiled/facebook-www/ReactDOMForked-profiling.classic.js @@ -5842,7 +5842,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6512,580 +6838,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -7177,50 +6930,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -7271,9 +6980,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7301,7 +7010,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7326,7 +7035,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7365,7 +7074,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7373,7 +7082,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7387,26 +7096,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7424,7 +7133,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7436,10 +7145,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$94 = thenableIndexCounter; + var index$92 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$94); + return trackUsedThenable(thenableState, usable, index$92); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7451,10 +7160,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7470,7 +7179,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7541,7 +7250,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7610,7 +7319,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7657,7 +7366,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7671,7 +7380,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7706,10 +7415,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7754,17 +7463,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7780,7 +7489,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7800,7 +7509,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7810,11 +7519,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7901,7 +7610,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7911,18 +7620,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7939,14 +7648,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$100 = enqueueUpdate$1(provider, fiber, lane); - null !== root$100 && - (scheduleUpdateOnFiber(root$100, provider, lane, eventTime), - entangleTransitions(root$100, provider, lane)); + var root$98 = enqueueUpdate$1(provider, fiber, lane); + null !== root$98 && + (scheduleUpdateOnFiber(root$98, provider, lane, eventTime), + entangleTransitions(root$98, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$100 && + null !== root$98 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -8017,8 +7726,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -8055,8 +7764,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !0 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -8110,7 +7818,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -8147,7 +7855,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -8155,15 +7863,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$96 = workInProgressRoot; - if (null === root$96) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$96, renderLanes) || + var root$94 = workInProgressRoot; + if (null === root$94) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$94, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$96 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$96; - mountEffect(subscribeToStore.bind(null, fiber, root$96, subscribe), [ + root$94 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$94; + mountEffect(subscribeToStore.bind(null, fiber, root$94, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -8172,7 +7880,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$96, + root$94, getServerSnapshot, getSnapshot ), @@ -8207,11 +7915,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !0, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -8252,8 +7959,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -8287,8 +7993,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8562,9 +8267,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$107) { + } catch (e$105) { setTimeout(function() { - throw e$107; + throw e$105; }); } } @@ -8635,39 +8340,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8775,10 +8447,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$113 = workInProgress.stateNode; + root$111 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$113.incompleteTransitions.has(transition)) { + if (!root$111.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8786,11 +8458,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$113.incompleteTransitions.set(transition, markerInstance); + root$111.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$113.incompleteTransitions.forEach(function(markerInstance) { + root$111.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9474,14 +9146,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$120 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$120) + var dehydrated$118 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$118) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$120, + dehydrated$118, JSCompiler_temp, renderLanes ); @@ -9491,7 +9163,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$120 = JSCompiler_temp.sibling; + dehydrated$118 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9505,8 +9177,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$120 - ? (showFallback = createWorkInProgress(dehydrated$120, showFallback)) + null !== dehydrated$118 + ? (showFallback = createWorkInProgress(dehydrated$118, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9525,10 +9197,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$120 = CacheContext._currentValue), + ? ((dehydrated$118 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$120 - ? { parent: dehydrated$120, pool: dehydrated$120 } + JSCompiler_temp.parent !== dehydrated$118 + ? { parent: dehydrated$118, pool: dehydrated$118 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9542,23 +9214,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$120 = showFallback.updateQueue), + (dehydrated$118 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$120 + null === dehydrated$118 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$120 === primaryChildProps + : dehydrated$118 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$120.transitions = didSuspend), - (dehydrated$120.markerInstances = JSCompiler_temp)))); + : ((dehydrated$118.transitions = didSuspend), + (dehydrated$118.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -10088,6 +9760,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -13612,7 +13609,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -14473,10 +14470,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$108 = offscreenQueue.wakeables; - null === wakeables$108 + var wakeables$106 = offscreenQueue.wakeables; + null === wakeables$106 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$108.add(wakeable); + : wakeables$106.add(wakeable); } break; } @@ -16329,7 +16326,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1847 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-030dae2f4-20221201", + version: "18.3.0-www-classic-420f0b7fa-20221201", rendererPackageName: "react-dom" }; (function(internals) { @@ -16373,7 +16370,7 @@ var devToolsConfig$jscomp$inline_1847 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -16583,7 +16580,6 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !0; exports.unstable_renderSubtreeIntoContainer = function( parentComponent, element, @@ -16603,7 +16599,7 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMForked-profiling.modern.js b/compiled/facebook-www/ReactDOMForked-profiling.modern.js index f51766778c..28ec081b8b 100644 --- a/compiled/facebook-www/ReactDOMForked-profiling.modern.js +++ b/compiled/facebook-www/ReactDOMForked-profiling.modern.js @@ -5689,7 +5689,333 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if ( + (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || + 0 === (executionContext & 2) + ) + return ( + enqueueUpdate(fiber, updateQueue, update, lane), + getRootForUpdatedFiber(fiber) + ); + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6359,580 +6685,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - if (enableLazyContextPropagation) - propagateContextChanges(workInProgress, [context], renderLanes, !0); - else if (!enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateContextChanges( - workInProgress, - contexts, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - list = list.firstContext; - a: for (; null !== list; ) { - var dependency = list; - list = fiber; - for (var i = 0; i < contexts.length; i++) - if (dependency.context === contexts[i]) { - list.lanes |= renderLanes; - dependency = list.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - list.return, - renderLanes, - workInProgress - ); - forcePropagateEntireTree || (nextFiber = null); - break a; - } - list = dependency.next; - } - } else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = null; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } - } -} -function propagateParentContextChanges( - current, - workInProgress, - renderLanes, - forcePropagateEntireTree -) { - if (enableLazyContextPropagation) { - current = null; - for ( - var parent = workInProgress, isInsidePropagationBailout = !1; - null !== parent; - - ) { - if (!isInsidePropagationBailout) - if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; - else if (0 !== (parent.flags & 131072)) break; - if (10 === parent.tag) { - var currentParent = parent.alternate; - if (null === currentParent) throw Error(formatProdErrorMessage(387)); - currentParent = currentParent.memoizedProps; - if (null !== currentParent) { - var context = parent.type._context; - objectIs(parent.pendingProps.value, currentParent.value) || - (null !== current ? current.push(context) : (current = [context])); - } - } - parent = parent.return; - } - null !== current && - propagateContextChanges( - workInProgress, - current, - renderLanes, - forcePropagateEntireTree - ); - workInProgress.flags |= 131072; - } -} -function checkIfContextChanged(currentDependencies) { - if (!enableLazyContextPropagation) return !1; - for ( - currentDependencies = currentDependencies.firstContext; - null !== currentDependencies; - - ) { - if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue - ) - ) - return !0; - currentDependencies = currentDependencies.next; - } - return !1; -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - (enableLazyContextPropagation - ? (workInProgress.firstContext = null) - : null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null))); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - enableLazyContextPropagation && (currentlyRenderingFiber.flags |= 262144); - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if ( - (deferRenderPhaseUpdateToNextBatch && 0 !== (fiber.mode & 1)) || - 0 === (executionContext & 2) - ) - return ( - enqueueUpdate(fiber, updateQueue, update, lane), - getRootForUpdatedFiber(fiber) - ); - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -7024,50 +6777,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -7118,9 +6827,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -7148,7 +6857,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -7173,7 +6882,7 @@ function finishRenderingHooks(current) { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -7212,7 +6921,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -7220,7 +6929,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -7234,26 +6943,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -7271,7 +6980,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -7283,10 +6992,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$95 = thenableIndexCounter; + var index$93 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$95); + return trackUsedThenable(thenableState, usable, index$93); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -7298,10 +7007,10 @@ function use(usable) { } function useMemoCache(size) { var memoCache = null, - updateQueue = currentlyRenderingFiber$1.updateQueue; + updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; null !== current && ((current = current.updateQueue), null !== current && @@ -7317,7 +7026,7 @@ function useMemoCache(size) { null == memoCache && (memoCache = { data: [], index: 0 }); null === updateQueue && ((updateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = updateQueue)); + (currentlyRenderingFiber.updateQueue = updateQueue)); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) @@ -7388,7 +7097,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -7457,7 +7166,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7504,7 +7213,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7518,7 +7227,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7553,10 +7262,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7601,17 +7310,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7627,7 +7336,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7647,7 +7356,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7657,11 +7366,11 @@ function updateEffect(create, deps) { return updateEffectImpl(1024, 8, create, deps); } function useEventImpl(payload) { - currentlyRenderingFiber$1.flags |= 4; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) (componentUpdateQueue = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = componentUpdateQueue), + (currentlyRenderingFiber.updateQueue = componentUpdateQueue), (componentUpdateQueue.events = [payload]); else { var events = componentUpdateQueue.events; @@ -7748,7 +7457,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7758,18 +7467,18 @@ function startTransition(setPending, callback, options) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; enableTransitionTracing && void 0 !== options && void 0 !== options.name && - ((ReactCurrentBatchConfig$2.transition.name = options.name), - (ReactCurrentBatchConfig$2.transition.startTime = now())); + ((ReactCurrentBatchConfig$1.transition.name = options.name), + (ReactCurrentBatchConfig$1.transition.startTime = now())); try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7786,14 +7495,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$101 = enqueueUpdate$1(provider, fiber, lane); - null !== root$101 && - (scheduleUpdateOnFiber(root$101, provider, lane, eventTime), - entangleTransitions(root$101, provider, lane)); + var root$99 = enqueueUpdate$1(provider, fiber, lane); + null !== root$99 && + (scheduleUpdateOnFiber(root$99, provider, lane, eventTime), + entangleTransitions(root$99, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$101 && + null !== root$99 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -7864,8 +7573,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -7902,8 +7611,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !0 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -7957,7 +7665,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -7994,7 +7702,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -8002,15 +7710,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$97 = workInProgressRoot; - if (null === root$97) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$97, renderLanes) || + var root$95 = workInProgressRoot; + if (null === root$95) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$95, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$97 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$97; - mountEffect(subscribeToStore.bind(null, fiber, root$97, subscribe), [ + root$95 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$95; + mountEffect(subscribeToStore.bind(null, fiber, root$95, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -8019,7 +7727,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$97, + root$95, getServerSnapshot, getSnapshot ), @@ -8054,11 +7762,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !0, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -8099,8 +7806,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.useMemoCache = useMemoCache; @@ -8134,8 +7840,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !0 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -8395,9 +8100,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$108) { + } catch (e$106) { setTimeout(function() { - throw e$108; + throw e$106; }); } } @@ -8468,39 +8173,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null), - transitionStack = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); - enableTransitionTracing && - (null === transitionStack.current - ? push(transitionStack, newTransitions) - : null === newTransitions - ? push(transitionStack, transitionStack.current) - : push(transitionStack, transitionStack.current.concat(newTransitions))); -} -function popTransition(workInProgress, current) { - null !== current && - (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} function processTransitionCallbacks(pendingTransitions, endTime, callbacks) { if (enableTransitionTracing && null !== pendingTransitions) { var transitionStart = pendingTransitions.transitionStart, @@ -8608,10 +8280,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$114 = workInProgress.stateNode; + root$112 = workInProgress.stateNode; null !== transitions && transitions.forEach(function(transition) { - if (!root$114.incompleteTransitions.has(transition)) { + if (!root$112.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -8619,11 +8291,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$114.incompleteTransitions.set(transition, markerInstance); + root$112.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$114.incompleteTransitions.forEach(function(markerInstance) { + root$112.incompleteTransitions.forEach(function(markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -9265,14 +8937,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$121 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$121) + var dehydrated$119 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$119) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$121, + dehydrated$119, JSCompiler_temp, renderLanes ); @@ -9282,7 +8954,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$121 = JSCompiler_temp.sibling; + dehydrated$119 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -9296,8 +8968,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$121 - ? (showFallback = createWorkInProgress(dehydrated$121, showFallback)) + null !== dehydrated$119 + ? (showFallback = createWorkInProgress(dehydrated$119, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -9316,10 +8988,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$121 = CacheContext._currentValue), + ? ((dehydrated$119 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$121 - ? { parent: dehydrated$121, pool: dehydrated$121 } + JSCompiler_temp.parent !== dehydrated$119 + ? { parent: dehydrated$119, pool: dehydrated$119 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9333,23 +9005,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$121 = showFallback.updateQueue), + (dehydrated$119 = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$121 + null === dehydrated$119 ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null }) - : dehydrated$121 === primaryChildProps + : dehydrated$119 === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, markerInstances: JSCompiler_temp, wakeables: null !== primaryChildProps ? primaryChildProps.wakeables : null }) - : ((dehydrated$121.transitions = didSuspend), - (dehydrated$121.markerInstances = JSCompiler_temp)))); + : ((dehydrated$119.transitions = didSuspend), + (dehydrated$119.markerInstances = JSCompiler_temp)))); showFallback.childLanes = current.childLanes & ~renderLanes; workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; @@ -9875,6 +9547,331 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + if (enableLazyContextPropagation) + propagateContextChanges(workInProgress, [context], renderLanes, !0); + else if (!enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateContextChanges( + workInProgress, + contexts, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list; ) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) + if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + list.return, + renderLanes, + workInProgress + ); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } +} +function propagateParentContextChanges( + current, + workInProgress, + renderLanes, + forcePropagateEntireTree +) { + if (enableLazyContextPropagation) { + current = null; + for ( + var parent = workInProgress, isInsidePropagationBailout = !1; + null !== parent; + + ) { + if (!isInsidePropagationBailout) + if (0 !== (parent.flags & 262144)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 131072)) break; + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type._context; + objectIs(parent.pendingProps.value, currentParent.value) || + (null !== current ? current.push(context) : (current = [context])); + } + } + parent = parent.return; + } + null !== current && + propagateContextChanges( + workInProgress, + current, + renderLanes, + forcePropagateEntireTree + ); + workInProgress.flags |= 131072; + } +} +function checkIfContextChanged(currentDependencies) { + if (!enableLazyContextPropagation) return !1; + for ( + currentDependencies = currentDependencies.firstContext; + null !== currentDependencies; + + ) { + if ( + !objectIs( + currentDependencies.context._currentValue, + currentDependencies.memoizedValue + ) + ) + return !0; + currentDependencies = currentDependencies.next; + } + return !1; +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + (enableLazyContextPropagation + ? (workInProgress.firstContext = null) + : null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null))); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + enableLazyContextPropagation && + (currentlyRenderingFiber$1.flags |= 262144); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null), + transitionStack = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); + enableTransitionTracing && + (null === transitionStack.current + ? push(transitionStack, newTransitions) + : null === newTransitions + ? push(transitionStack, transitionStack.current) + : push(transitionStack, transitionStack.current.concat(newTransitions))); +} +function popTransition(workInProgress, current) { + null !== current && + (enableTransitionTracing && pop(transitionStack), pop(resumedCache)); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -13380,7 +13377,7 @@ function requestUpdateLane(fiber) { 0 !== workInProgressRootRenderLanes ) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -14241,10 +14238,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$109 = offscreenQueue.wakeables; - null === wakeables$109 + var wakeables$107 = offscreenQueue.wakeables; + null === wakeables$107 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$109.add(wakeable); + : wakeables$107.add(wakeable); } break; } @@ -15880,7 +15877,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1815 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-030dae2f4-20221201", + version: "18.3.0-www-modern-420f0b7fa-20221201", rendererPackageName: "react-dom" }; (function(internals) { @@ -15925,7 +15922,7 @@ var devToolsConfig$jscomp$inline_1815 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function(children, container) { @@ -16099,9 +16096,8 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !0; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; /* 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 88832154f8..077106d712 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-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-classic-420f0b7fa-20221201"; // 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 cb3e40f74c..b6edd52bb8 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-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-modern-420f0b7fa-20221201"; // 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 a864a1c406..4db21e70bc 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -3621,4 +3621,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-030dae2f4-20221201"; +exports.version = "18.3.0-www-classic-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index dd84a3043d..06e01a7e01 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -3534,4 +3534,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-030dae2f4-20221201"; +exports.version = "18.3.0-www-modern-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index 98efe2a12f..055f85e1e4 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -28,7 +28,6 @@ var disableCommentsAsDOMContainers = true; var enableSuspenseCallback = true; var warnAboutStringRefs = true; var enableClientRenderFallbackOnTextMismatch = true; -var enableNewReconciler = false; var createRootStrictEffectsByDefault = false; var enableLazyContextPropagation = false; var enableLegacyHidden = false; @@ -9858,10 +9857,767 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate()) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } /** @@ -11631,1083 +12387,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue, providerFiber); - 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; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue = context._defaultValue; - } else { - context._currentValue = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate()) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -12935,11 +12614,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -12972,8 +12651,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentPrimaryRenderer == null) { - mutableSource._currentPrimaryRenderer = rendererSigil$1; - } else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) { + mutableSource._currentPrimaryRenderer = rendererSigil; + } else if (mutableSource._currentPrimaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -12998,97 +12677,6 @@ function registerMutableSourceForHydration(root, mutableSource) { } } -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -13241,7 +12829,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -13255,7 +12843,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -13338,7 +12926,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -13447,7 +13035,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -13545,7 +13133,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -13731,7 +13319,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -13747,7 +13335,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -13774,7 +13362,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -13792,7 +13380,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -13806,7 +13394,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -13819,7 +13407,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -13849,7 +13437,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -13925,7 +13513,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -14017,8 +13605,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -14245,7 +13833,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -14354,7 +13942,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -14385,7 +13973,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; var isHydrating = getIsHydrating(); @@ -14475,7 +14063,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -14551,11 +14139,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -14634,7 +14222,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -14657,11 +14245,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -14699,7 +14287,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -14727,7 +14315,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -14737,7 +14325,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -14764,7 +14352,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -14822,7 +14410,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -14963,8 +14551,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -15002,12 +14590,12 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; - var currentTransition = ReactCurrentBatchConfig$1.transition; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; + var currentTransition = ReactCurrentBatchConfig.transition; { - ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } try { @@ -15015,7 +14603,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$1.transition = prevTransition; + ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -15109,7 +14697,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -15281,8 +14869,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -15340,8 +14928,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -15489,8 +15076,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -15609,8 +15195,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -15729,8 +15314,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -15849,8 +15433,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -15986,8 +15569,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -16126,8 +15708,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -16266,8 +15847,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -17954,107 +17534,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - { - pop(resumedCache, workInProgress); - } - } -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; // A special exception that's used to unwind the stack when an update flows // into a dehydrated boundary. @@ -21536,6 +21015,517 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; + + { + if ( + context._currentRenderer !== undefined && + context._currentRenderer !== null && + context._currentRenderer !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue = context._defaultValue; + } else { + context._currentValue = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$1.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + { + pop(resumedCache, workInProgress); + } + } +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -30290,10 +30280,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -31140,7 +31130,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-classic-420f0b7fa-20221201"; function createPortal( children, @@ -32903,8 +32893,6 @@ var foundDevTools = injectIntoDevTools({ } } -var unstable_isNewReconciler = enableNewReconciler; - var ReactDOMSharedInternals = Internals; function warnOnMissingHrefAndRel(pendingProps, currentProps) { @@ -33551,10 +33539,6 @@ function getValueDescriptorExpectingEnumForWarning(thing) { : 'something with type "' + typeof thing + '"'; } -function getCurrentRootHostContainer$1() { - return getCurrentRootHostContainer(); -} - var Dispatcher$1 = ReactDOMSharedInternals.Dispatcher; // In the future this may need to change, especially when modules / scripts are supported @@ -33596,7 +33580,7 @@ function getRootNode(container) { } function getCurrentResourceRoot() { - var currentContainer = getCurrentRootHostContainer$1(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode + var currentContainer = getCurrentRootHostContainer(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode return currentContainer ? getRootNode(currentContainer) : null; } // This resource type constraint can be loosened. It really is everything except PreloadResource @@ -40532,7 +40516,6 @@ exports.unmountComponentAtNode = unmountComponentAtNode; exports.unstable_batchedUpdates = batchedUpdates; exports.unstable_createEventHandle = createEventHandle; exports.unstable_flushControlled = flushControlled; -exports.unstable_isNewReconciler = unstable_isNewReconciler; exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; exports.unstable_runWithPriority = runWithPriority; exports.version = ReactVersion; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index ea69bf60c1..d75042a46c 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -270,7 +270,6 @@ var disableCommentsAsDOMContainers = true; var enableSuspenseCallback = true; var warnAboutStringRefs = true; var enableClientRenderFallbackOnTextMismatch = true; -var enableNewReconciler = false; var createRootStrictEffectsByDefault = false; var enableLazyContextPropagation = false; var enableLegacyHidden = false; @@ -13349,10 +13348,6 @@ function popHostContext(fiber) { pop(contextFiberStackCursor, fiber); } -function getCurrentRootHostContainer$1() { - return getCurrentRootHostContainer(); -} - var Dispatcher = ReactDOMSharedInternals.Dispatcher; // In the future this may need to change, especially when modules / scripts are supported @@ -13394,7 +13389,7 @@ function getRootNode(container) { } function getCurrentResourceRoot() { - var currentContainer = getCurrentRootHostContainer$1(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode + var currentContainer = getCurrentRootHostContainer(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode return currentContainer ? getRootNode(currentContainer) : null; } // This resource type constraint can be loosened. It really is everything except PreloadResource @@ -17367,10 +17362,767 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig$1.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate()) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } var ReactStrictModeWarnings = { @@ -19099,1083 +19851,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue, providerFiber); - 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; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue = context._defaultValue; - } else { - context._currentValue = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate()) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -20403,11 +20078,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -20440,8 +20115,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentPrimaryRenderer == null) { - mutableSource._currentPrimaryRenderer = rendererSigil$1; - } else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) { + mutableSource._currentPrimaryRenderer = rendererSigil; + } else if (mutableSource._currentPrimaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -20466,97 +20141,6 @@ function registerMutableSourceForHydration(root, mutableSource) { } } -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -20709,7 +20293,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -20723,7 +20307,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -20806,7 +20390,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -20915,7 +20499,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -21013,7 +20597,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -21199,7 +20783,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -21215,7 +20799,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -21242,7 +20826,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -21260,7 +20844,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -21274,7 +20858,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -21287,7 +20871,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -21317,7 +20901,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -21393,7 +20977,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -21485,8 +21069,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -21713,7 +21297,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -21822,7 +21406,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -21853,7 +21437,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; var isHydrating = getIsHydrating(); @@ -21943,7 +21527,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -22019,11 +21603,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -22102,7 +21686,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -22125,11 +21709,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -22167,7 +21751,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -22195,7 +21779,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -22205,7 +21789,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -22232,7 +21816,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -22290,7 +21874,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -22431,8 +22015,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -22470,12 +22054,12 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; - var currentTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; + var currentTransition = ReactCurrentBatchConfig$1.transition; { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); } try { @@ -22483,7 +22067,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactCurrentBatchConfig$1.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -22577,7 +22161,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -22749,8 +22333,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -22808,8 +22392,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -22957,8 +22540,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -23077,8 +22659,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -23197,8 +22778,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -23317,8 +22897,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -23454,8 +23033,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -23594,8 +23172,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -23734,8 +23311,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -25388,107 +24964,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - { - pop(resumedCache, workInProgress); - } - } -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue, - pool: cacheFromPool - }; -} - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; // A special exception that's used to unwind the stack when an update flows // into a dehydrated boundary. @@ -28950,6 +28425,517 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; + + { + if ( + context._currentRenderer !== undefined && + context._currentRenderer !== null && + context._currentRenderer !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue = context._defaultValue; + } else { + context._currentValue = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$2.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + { + pop(resumedCache, workInProgress); + } + } +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -37571,10 +37557,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -38421,7 +38407,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-modern-420f0b7fa-20221201"; function createPortal( children, @@ -39524,8 +39510,6 @@ var foundDevTools = injectIntoDevTools({ } } -var unstable_isNewReconciler = enableNewReconciler; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createComponentSelector = createComponentSelector; exports.createHasPseudoClassSelector = createHasPseudoClassSelector; @@ -39546,7 +39530,6 @@ exports.preload = preload$1; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = createEventHandle; exports.unstable_flushControlled = flushControlled; -exports.unstable_isNewReconciler = unstable_isNewReconciler; exports.unstable_runWithPriority = runWithPriority; exports.version = ReactVersion; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 306fed2781..bc137ebc76 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -2369,7 +2369,329 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if (0 !== (executionContext & 2)) { + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; + } + enqueueUpdate(fiber, updateQueue, update, lane); + return getRootForUpdatedFiber(fiber); +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function shallowEqual(objA, objB) { if (objectIs(objA, objB)) return !0; if ( @@ -3061,453 +3383,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange_eager(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if (0 !== (executionContext & 2)) { - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; - } - enqueueUpdate(fiber, updateQueue, update, lane); - return getRootForUpdatedFiber(fiber); -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -3599,50 +3475,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -3693,9 +3525,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -3723,7 +3555,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -3748,7 +3580,7 @@ function finishRenderingHooks() { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -3780,7 +3612,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -3788,7 +3620,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -3802,26 +3634,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -3839,7 +3671,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -3851,10 +3683,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$42 = thenableIndexCounter; + var index$41 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$42); + return trackUsedThenable(thenableState, usable, index$41); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -3922,7 +3754,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -3991,7 +3823,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -4038,7 +3870,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -4052,7 +3884,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -4087,10 +3919,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -4135,17 +3967,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -4161,7 +3993,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -4181,7 +4013,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -4260,7 +4092,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -4270,13 +4102,13 @@ function startTransition(setPending, callback) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$1.transition = prevTransition); + (ReactCurrentBatchConfig.transition = prevTransition); } } function updateId() { @@ -4293,14 +4125,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$47 = enqueueUpdate$1(provider, fiber, lane); - null !== root$47 && - (scheduleUpdateOnFiber(root$47, provider, lane, eventTime), - entangleTransitions(root$47, provider, lane)); + var root$46 = enqueueUpdate$1(provider, fiber, lane); + null !== root$46 && + (scheduleUpdateOnFiber(root$46, provider, lane, eventTime), + entangleTransitions(root$46, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$47 && + null !== root$46 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -4369,8 +4201,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -4407,8 +4239,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -4460,7 +4291,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -4492,7 +4323,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -4500,15 +4331,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$44 = workInProgressRoot; - if (null === root$44) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$44, renderLanes) || + var root$43 = workInProgressRoot; + if (null === root$43) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$43, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$44 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$44; - mountEffect(subscribeToStore.bind(null, fiber, root$44, subscribe), [ + root$43 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$43; + mountEffect(subscribeToStore.bind(null, fiber, root$43, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -4517,7 +4348,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$44, + root$43, getServerSnapshot, getSnapshot ), @@ -4552,11 +4383,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -4587,8 +4417,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.use = use; @@ -4620,8 +4449,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -4897,24 +4725,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition(offscreenWorkInProgress, prevCachePool) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, SelectiveHydrationException = Error(formatProdErrorMessage(461)), didReceiveUpdate = !1; @@ -5526,14 +5336,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$63 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$63) + var dehydrated$62 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$62) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$63, + dehydrated$62, JSCompiler_temp, renderLanes ); @@ -5543,7 +5353,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$63 = JSCompiler_temp.sibling; + dehydrated$62 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -5552,8 +5362,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$63 - ? (showFallback = createWorkInProgress(dehydrated$63, showFallback)) + null !== dehydrated$62 + ? (showFallback = createWorkInProgress(dehydrated$62, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -5572,10 +5382,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$63 = CacheContext._currentValue), + ? ((dehydrated$62 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$63 - ? { parent: dehydrated$63, pool: dehydrated$63 } + JSCompiler_temp.parent !== dehydrated$62 + ? { parent: dehydrated$62, pool: dehydrated$62 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -6058,6 +5868,192 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition(offscreenWorkInProgress, prevCachePool) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -8946,7 +8942,7 @@ function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig.transition) + if (null !== ReactCurrentBatchConfig$1.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -9698,10 +9694,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$52 = offscreenQueue.wakeables; - null === wakeables$52 + var wakeables$51 = offscreenQueue.wakeables; + null === wakeables$51 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$52.add(wakeable); + : wakeables$51.add(wakeable); } break; } @@ -10260,11 +10256,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { Component = nextState.cache; pushProvider(workInProgress, CacheContext, Component); Component !== prevState.cache && - propagateContextChange_eager( - workInProgress, - CacheContext, - renderLanes - ); + propagateContextChange(workInProgress, CacheContext, renderLanes); Component = nextState.element; if (prevState.isDehydrated) if ( @@ -10482,12 +10474,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange_eager( - workInProgress, - Component, - renderLanes - ); + } else propagateContextChange(workInProgress, Component, renderLanes); reconcileChildren( current, workInProgress, @@ -10601,7 +10588,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { : ((Component = prevState.cache), pushProvider(workInProgress, CacheContext, Component), Component !== context.cache && - propagateContextChange_eager( + propagateContextChange( workInProgress, CacheContext, renderLanes @@ -11365,17 +11352,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates ]; -var devToolsConfig$jscomp$inline_1514 = { +var devToolsConfig$jscomp$inline_1531 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-030dae2f4-20221201", + version: "18.3.0-www-classic-420f0b7fa-20221201", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2054 = { - bundleType: devToolsConfig$jscomp$inline_1514.bundleType, - version: devToolsConfig$jscomp$inline_1514.version, - rendererPackageName: devToolsConfig$jscomp$inline_1514.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1514.rendererConfig, +var internals$jscomp$inline_2057 = { + bundleType: devToolsConfig$jscomp$inline_1531.bundleType, + version: devToolsConfig$jscomp$inline_1531.version, + rendererPackageName: devToolsConfig$jscomp$inline_1531.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1531.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11391,26 +11378,26 @@ var internals$jscomp$inline_2054 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1514.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1531.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2055 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2058 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2055.isDisabled && - hook$jscomp$inline_2055.supportsFiber + !hook$jscomp$inline_2058.isDisabled && + hook$jscomp$inline_2058.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2055.inject( - internals$jscomp$inline_2054 + (rendererID = hook$jscomp$inline_2058.inject( + internals$jscomp$inline_2057 )), - (injectedHook = hook$jscomp$inline_2055); + (injectedHook = hook$jscomp$inline_2058); } catch (err) {} } var Dispatcher$1 = Internals.Dispatcher, @@ -13023,14 +13010,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$305; if (canUseDOM) { - var isSupported$jscomp$inline_1613 = "oninput" in document; - if (!isSupported$jscomp$inline_1613) { - var element$jscomp$inline_1614 = document.createElement("div"); - element$jscomp$inline_1614.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1613 = - "function" === typeof element$jscomp$inline_1614.oninput; + var isSupported$jscomp$inline_1630 = "oninput" in document; + if (!isSupported$jscomp$inline_1630) { + var element$jscomp$inline_1631 = document.createElement("div"); + element$jscomp$inline_1631.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1630 = + "function" === typeof element$jscomp$inline_1631.oninput; } - JSCompiler_inline_result$jscomp$305 = isSupported$jscomp$inline_1613; + JSCompiler_inline_result$jscomp$305 = isSupported$jscomp$inline_1630; } else JSCompiler_inline_result$jscomp$305 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$305 && @@ -13170,19 +13157,19 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1626 = 0; - i$jscomp$inline_1626 < simpleEventPluginEvents.length; - i$jscomp$inline_1626++ + var i$jscomp$inline_1643 = 0; + i$jscomp$inline_1643 < simpleEventPluginEvents.length; + i$jscomp$inline_1643++ ) { - var eventName$jscomp$inline_1627 = - simpleEventPluginEvents[i$jscomp$inline_1626], - domEventName$jscomp$inline_1628 = eventName$jscomp$inline_1627.toLowerCase(), - capitalizedEvent$jscomp$inline_1629 = - eventName$jscomp$inline_1627[0].toUpperCase() + - eventName$jscomp$inline_1627.slice(1); + var eventName$jscomp$inline_1644 = + simpleEventPluginEvents[i$jscomp$inline_1643], + domEventName$jscomp$inline_1645 = eventName$jscomp$inline_1644.toLowerCase(), + capitalizedEvent$jscomp$inline_1646 = + eventName$jscomp$inline_1644[0].toUpperCase() + + eventName$jscomp$inline_1644.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1628, - "on" + capitalizedEvent$jscomp$inline_1629 + domEventName$jscomp$inline_1645, + "on" + capitalizedEvent$jscomp$inline_1646 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -14860,7 +14847,6 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !1; exports.unstable_renderSubtreeIntoContainer = function( parentComponent, element, @@ -14880,4 +14866,4 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 137a39ff3d..9109397f1e 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -5389,7 +5389,329 @@ function queueHydrationError(error) { ? (hydrationErrors = [error]) : hydrationErrors.push(error); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var concurrentQueues = [], + concurrentQueuesIndex = 0, + concurrentlyUpdatedLanes = 0; +function finishQueueingConcurrentUpdates() { + for ( + var endIndex = concurrentQueuesIndex, + i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); + i < endIndex; + + ) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } +} +function enqueueUpdate(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) + (parent.childLanes |= lane), + (alternate = parent.alternate), + null !== alternate && (alternate.childLanes |= lane), + 22 === parent.tag && + ((sourceFiber = parent.stateNode), + null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), + (sourceFiber = parent), + (parent = parent.return); + isHidden && + null !== update && + 3 === sourceFiber.tag && + ((parent = sourceFiber.stateNode), + (isHidden = 31 - clz32(lane)), + (parent = parent.hiddenUpdates), + (sourceFiber = parent[isHidden]), + null === sourceFiber + ? (parent[isHidden] = [update]) + : sourceFiber.push(update), + (update.lane = lane | 1073741824)); +} +function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))); + for (var parent = sourceFiber.return; null !== parent; ) + (sourceFiber = parent), (parent = sourceFiber.return); + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; +} +var hasForceUpdate = !1; +function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { pending: null, lanes: 0, hiddenCallbacks: null }, + callbacks: null + }; +} +function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && + (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); +} +function createUpdate(eventTime, lane) { + return { + eventTime: eventTime, + lane: lane, + tag: 0, + payload: null, + callback: null, + next: null + }; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if (0 !== (executionContext & 2)) { + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; + } + enqueueUpdate(fiber, updateQueue, update, lane); + return getRootForUpdatedFiber(fiber); +} +function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, + current = workInProgress.alternate; + if ( + null !== current && + ((current = current.updateQueue), queue === current) + ) { + var newFirst = null, + newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + eventTime: queue.eventTime, + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast + ? (newFirst = newLast = clone) + : (newLast = newLast.next = clone); + queue = queue.next; + } while (null !== queue); + null === newLast + ? (newFirst = newLast = capturedUpdate) + : (newLast = newLast.next = capturedUpdate); + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress + ? (queue.firstBaseUpdate = capturedUpdate) + : (workInProgress.next = capturedUpdate); + queue.lastBaseUpdate = capturedUpdate; +} +function processUpdateQueue( + workInProgress$jscomp$0, + props, + instance, + renderLanes +) { + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, + lastBaseUpdate = queue.lastBaseUpdate, + pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, + firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate + ? (firstBaseUpdate = firstPendingUpdate) + : (lastBaseUpdate.next = firstPendingUpdate); + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && + ((current = current.updateQueue), + (pendingQueue = current.lastBaseUpdate), + pendingQueue !== lastBaseUpdate && + (null === pendingQueue + ? (current.firstBaseUpdate = firstPendingUpdate) + : (pendingQueue.next = firstPendingUpdate), + (current.lastBaseUpdate = lastPendingUpdate))); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateEventTime = pendingQueue.eventTime, + updateLane = pendingQueue.lane & -1073741825, + isHiddenUpdate = updateLane !== pendingQueue.lane; + if ( + isHiddenUpdate + ? (workInProgressRootRenderLanes & updateLane) === updateLane + : (renderLanes & updateLane) === updateLane + ) { + null !== current && + (current = current.next = { + eventTime: updateEventTime, + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, + update = pendingQueue; + updateLane = props; + updateEventTime = instance; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call( + updateEventTime, + newState, + updateLane + ); + break a; + } + newState = workInProgress; + break a; + case 3: + workInProgress.flags = (workInProgress.flags & -32769) | 64; + case 0: + workInProgress = update.payload; + updateLane = + "function" === typeof workInProgress + ? workInProgress.call(updateEventTime, newState, updateLane) + : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: + hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && + ((workInProgress$jscomp$0.flags |= 32), + isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), + (isHiddenUpdate = queue.callbacks), + null === isHiddenUpdate + ? (queue.callbacks = [updateLane]) + : isHiddenUpdate.push(updateLane)); + } else + (isHiddenUpdate = { + eventTime: updateEventTime, + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }), + null === current + ? ((firstPendingUpdate = current = isHiddenUpdate), + (lastPendingUpdate = newState)) + : (current = current.next = isHiddenUpdate), + (lastBaseUpdate |= updateLane); + pendingQueue = pendingQueue.next; + if (null === pendingQueue) + if (((pendingQueue = queue.shared.pending), null === pendingQueue)) + break; + else + (isHiddenUpdate = pendingQueue), + (pendingQueue = isHiddenUpdate.next), + (isHiddenUpdate.next = null), + (queue.lastBaseUpdate = isHiddenUpdate), + (queue.shared.pending = null); + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } +} +function callCallback(callback, context) { + if ("function" !== typeof callback) + throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) + for ( + updateQueue.callbacks = null, updateQueue = 0; + updateQueue < callbacks.length; + updateQueue++ + ) + callCallback(callbacks[updateQueue], context); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -6059,453 +6381,7 @@ function createChildReconciler(shouldTrackSideEffects) { } var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), - valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - var currentValue = valueCursor.current; - pop(valueCursor); - context._currentValue = - currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED - ? context._defaultValue - : currentValue; -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - for (; null !== parent; ) { - var alternate = parent.alternate; - (parent.childLanes & renderLanes) !== renderLanes - ? ((parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes)) - : null !== alternate && - (alternate.childLanes & renderLanes) !== renderLanes && - (alternate.childLanes |= renderLanes); - if (parent === propagationRoot) break; - parent = parent.return; - } -} -function propagateContextChange_eager(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(-1, renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) throw Error(formatProdErrorMessage(341)); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } else nextFiber = fiber.child; - if (null !== nextFiber) nextFiber.return = fiber; - else - for (nextFiber = fiber; null !== nextFiber; ) { - if (nextFiber === workInProgress) { - nextFiber = null; - break; - } - fiber = nextFiber.sibling; - if (null !== fiber) { - fiber.return = nextFiber.return; - nextFiber = fiber; - break; - } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === currentlyRenderingFiber) - throw Error(formatProdErrorMessage(308)); - lastContextDependency = context; - currentlyRenderingFiber.dependencies = { - lanes: 0, - firstContext: context - }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var concurrentQueues = [], - concurrentQueuesIndex = 0, - concurrentlyUpdatedLanes = 0; -function finishQueueingConcurrentUpdates() { - for ( - var endIndex = concurrentQueuesIndex, - i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); - i < endIndex; - - ) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - if (null !== queue && null !== update) { - var pending = queue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - queue.pending = update; - } - 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); - } -} -function enqueueUpdate(fiber, queue, update, lane) { - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes |= lane; - fiber.lanes |= lane; - fiber = fiber.alternate; - null !== fiber && (fiber.lanes |= lane); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) - (parent.childLanes |= lane), - (alternate = parent.alternate), - null !== alternate && (alternate.childLanes |= lane), - 22 === parent.tag && - ((sourceFiber = parent.stateNode), - null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), - (sourceFiber = parent), - (parent = parent.return); - isHidden && - null !== update && - 3 === sourceFiber.tag && - ((parent = sourceFiber.stateNode), - (isHidden = 31 - clz32(lane)), - (parent = parent.hiddenUpdates), - (sourceFiber = parent[isHidden]), - null === sourceFiber - ? (parent[isHidden] = [update]) - : sourceFiber.push(update), - (update.lane = lane | 1073741824)); -} -function getRootForUpdatedFiber(sourceFiber) { - if (50 < nestedUpdateCount) - throw ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - Error(formatProdErrorMessage(185))); - for (var parent = sourceFiber.return; null !== parent; ) - (sourceFiber = parent), (parent = sourceFiber.return); - return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; -} -var hasForceUpdate = !1; -function initializeUpdateQueue(fiber) { - fiber.updateQueue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { pending: null, lanes: 0, hiddenCallbacks: null }, - callbacks: null - }; -} -function cloneUpdateQueue(current, workInProgress) { - current = current.updateQueue; - workInProgress.updateQueue === current && - (workInProgress.updateQueue = { - baseState: current.baseState, - firstBaseUpdate: current.firstBaseUpdate, - lastBaseUpdate: current.lastBaseUpdate, - shared: current.shared, - callbacks: null - }); -} -function createUpdate(eventTime, lane) { - return { - eventTime: eventTime, - lane: lane, - tag: 0, - payload: null, - callback: null, - next: null - }; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - if (null === updateQueue) return null; - updateQueue = updateQueue.shared; - if (0 !== (executionContext & 2)) { - var pending = updateQueue.pending; - null === pending - ? (update.next = update) - : ((update.next = pending.next), (pending.next = update)); - updateQueue.pending = update; - update = getRootForUpdatedFiber(fiber); - markUpdateLaneFromFiberToRoot(fiber, null, lane); - return update; - } - enqueueUpdate(fiber, updateQueue, update, lane); - return getRootForUpdatedFiber(fiber); -} -function entangleTransitions(root, fiber, lane) { - fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { - var queueLanes = fiber.lanes; - queueLanes &= root.pendingLanes; - lane |= queueLanes; - fiber.lanes = lane; - markRootEntangled(root, lane); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - var queue = workInProgress.updateQueue, - current = workInProgress.alternate; - if ( - null !== current && - ((current = current.updateQueue), queue === current) - ) { - var newFirst = null, - newLast = null; - queue = queue.firstBaseUpdate; - if (null !== queue) { - do { - var clone = { - eventTime: queue.eventTime, - lane: queue.lane, - tag: queue.tag, - payload: queue.payload, - callback: null, - next: null - }; - null === newLast - ? (newFirst = newLast = clone) - : (newLast = newLast.next = clone); - queue = queue.next; - } while (null !== queue); - null === newLast - ? (newFirst = newLast = capturedUpdate) - : (newLast = newLast.next = capturedUpdate); - } else newFirst = newLast = capturedUpdate; - queue = { - baseState: current.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: current.shared, - callbacks: current.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - workInProgress = queue.lastBaseUpdate; - null === workInProgress - ? (queue.firstBaseUpdate = capturedUpdate) - : (workInProgress.next = capturedUpdate); - queue.lastBaseUpdate = capturedUpdate; -} -function processUpdateQueue( - workInProgress$jscomp$0, - props, - instance, - renderLanes -) { - var queue = workInProgress$jscomp$0.updateQueue; - hasForceUpdate = !1; - var firstBaseUpdate = queue.firstBaseUpdate, - lastBaseUpdate = queue.lastBaseUpdate, - pendingQueue = queue.shared.pending; - if (null !== pendingQueue) { - queue.shared.pending = null; - var lastPendingUpdate = pendingQueue, - firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; - null === lastBaseUpdate - ? (firstBaseUpdate = firstPendingUpdate) - : (lastBaseUpdate.next = firstPendingUpdate); - lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), - pendingQueue !== lastBaseUpdate && - (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) - : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); - } - if (null !== firstBaseUpdate) { - var newState = queue.baseState; - lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; - pendingQueue = firstBaseUpdate; - do { - var updateEventTime = pendingQueue.eventTime, - updateLane = pendingQueue.lane & -1073741825, - isHiddenUpdate = updateLane !== pendingQueue.lane; - if ( - isHiddenUpdate - ? (workInProgressRootRenderLanes & updateLane) === updateLane - : (renderLanes & updateLane) === updateLane - ) { - null !== current && - (current = current.next = { - eventTime: updateEventTime, - lane: 0, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: null, - next: null - }); - a: { - var workInProgress = workInProgress$jscomp$0, - update = pendingQueue; - updateLane = props; - updateEventTime = instance; - switch (update.tag) { - case 1: - workInProgress = update.payload; - if ("function" === typeof workInProgress) { - newState = workInProgress.call( - updateEventTime, - newState, - updateLane - ); - break a; - } - newState = workInProgress; - break a; - case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 64; - case 0: - workInProgress = update.payload; - updateLane = - "function" === typeof workInProgress - ? workInProgress.call(updateEventTime, newState, updateLane) - : workInProgress; - if (null === updateLane || void 0 === updateLane) break a; - newState = assign({}, newState, updateLane); - break a; - case 2: - hasForceUpdate = !0; - } - } - updateLane = pendingQueue.callback; - null !== updateLane && - ((workInProgress$jscomp$0.flags |= 32), - isHiddenUpdate && (workInProgress$jscomp$0.flags |= 4096), - (isHiddenUpdate = queue.callbacks), - null === isHiddenUpdate - ? (queue.callbacks = [updateLane]) - : isHiddenUpdate.push(updateLane)); - } else - (isHiddenUpdate = { - eventTime: updateEventTime, - lane: updateLane, - tag: pendingQueue.tag, - payload: pendingQueue.payload, - callback: pendingQueue.callback, - next: null - }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), - (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), - (lastBaseUpdate |= updateLane); - pendingQueue = pendingQueue.next; - if (null === pendingQueue) - if (((pendingQueue = queue.shared.pending), null === pendingQueue)) - break; - else - (isHiddenUpdate = pendingQueue), - (pendingQueue = isHiddenUpdate.next), - (isHiddenUpdate.next = null), - (queue.lastBaseUpdate = isHiddenUpdate), - (queue.shared.pending = null); - } while (1); - null === current && (lastPendingUpdate = newState); - queue.baseState = lastPendingUpdate; - queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; - null === firstBaseUpdate && (queue.shared.lanes = 0); - workInProgressRootSkippedLanes |= lastBaseUpdate; - workInProgress$jscomp$0.lanes = lastBaseUpdate; - workInProgress$jscomp$0.memoizedState = newState; - } -} -function callCallback(callback, context) { - if ("function" !== typeof callback) - throw Error(formatProdErrorMessage(191, callback)); - callback.call(context); -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - if (null !== callbacks) - for ( - updateQueue.callbacks = null, updateQueue = 0; - updateQueue < callbacks.length; - updateQueue++ - ) - callCallback(callbacks[updateQueue], context); -} -var currentTreeHiddenStackCursor = createCursor(null), + currentTreeHiddenStackCursor = createCursor(null), prevRenderLanesStackCursor = createCursor(0); function pushHiddenContext(fiber, context) { fiber = renderLanes$1; @@ -6597,50 +6473,6 @@ function resetWorkInProgressVersions() { workInProgressSources[i]._workInProgressVersionPrimary = null; workInProgressSources.length = 0; } -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function() { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - this.abort = function() { - signal.aborted = !0; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority$1 = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); -} var SuspenseException = Error(formatProdErrorMessage(460)); function isThenableResolved(thenable) { thenable = thenable.status; @@ -6691,9 +6523,9 @@ function trackUsedThenable(thenableState, thenable, index) { } var suspendedThenable = null, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes = 0, - currentlyRenderingFiber$1 = null, + currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, @@ -6721,7 +6553,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; @@ -6746,7 +6578,7 @@ function finishRenderingHooks() { ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; @@ -6778,7 +6610,7 @@ function bailoutHooks(current, workInProgress, lanes) { } function resetHooksOnUnwind() { if (didScheduleRenderPhaseUpdate) { - for (var hook = currentlyRenderingFiber$1.memoizedState; null !== hook; ) { + for (var hook = currentlyRenderingFiber.memoizedState; null !== hook; ) { var queue = hook.queue; null !== queue && (queue.pending = null); hook = hook.next; @@ -6786,7 +6618,7 @@ function resetHooksOnUnwind() { didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; - workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; + workInProgressHook = currentHook = currentlyRenderingFiber = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; @@ -6800,26 +6632,26 @@ function mountWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook) : (workInProgressHook = workInProgressHook.next = hook); return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { - var nextCurrentHook = currentlyRenderingFiber$1.alternate; + var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook - ? currentlyRenderingFiber$1.memoizedState + ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) (workInProgressHook = nextWorkInProgressHook), (currentHook = nextCurrentHook); else { if (null === nextCurrentHook) - if (null === currentlyRenderingFiber$1.alternate) + if (null === currentlyRenderingFiber.alternate) nextCurrentHook = { memoizedState: null, baseState: null, @@ -6837,7 +6669,7 @@ function updateWorkInProgressHook() { next: null }; null === workInProgressHook - ? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook) + ? (currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook) : (workInProgressHook = workInProgressHook.next = nextCurrentHook); } return workInProgressHook; @@ -6849,10 +6681,10 @@ createFunctionComponentUpdateQueue = function() { function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) { - var index$87 = thenableIndexCounter; + var index$86 = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = []); - return trackUsedThenable(thenableState, usable, index$87); + return trackUsedThenable(thenableState, usable, index$86); } if ( usable.$$typeof === REACT_CONTEXT_TYPE || @@ -6920,7 +6752,7 @@ function updateReducer(reducer) { ? ((newBaseQueueFirst = newBaseQueueLast = clone), (baseFirst = current)) : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; + currentlyRenderingFiber.lanes |= updateLane; workInProgressRootSkippedLanes |= updateLane; } update = update.next; @@ -6989,7 +6821,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { prevGetSnapshot = refs.getSnapshot, prevSource = memoizedState.source; memoizedState = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, subscribe: subscribe }; dispatcher.useEffect( function() { @@ -7036,7 +6868,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }), (hook.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, hook )), (_dispatcher$useState.queue = hook), @@ -7050,7 +6882,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } function updateSyncExternalStore(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), nextSnapshot = getSnapshot(), snapshotChanged = !objectIs( @@ -7085,10 +6917,10 @@ function updateSyncExternalStore(subscribe, getSnapshot) { function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 8192; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; - getSnapshot = currentlyRenderingFiber$1.updateQueue; + getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? ((getSnapshot = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = getSnapshot), + (currentlyRenderingFiber.updateQueue = getSnapshot), (getSnapshot.stores = [fiber])) : ((renderedSnapshot = getSnapshot.stores), null === renderedSnapshot @@ -7133,17 +6965,17 @@ function mountState(initialState) { hook.queue = initialState; initialState = initialState.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, initialState ); return [hook.memoizedState, initialState]; } function pushEffect(tag, create, destroy, deps) { tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; - create = currentlyRenderingFiber$1.updateQueue; + create = currentlyRenderingFiber.updateQueue; null === create ? ((create = createFunctionComponentUpdateQueue()), - (currentlyRenderingFiber$1.updateQueue = create), + (currentlyRenderingFiber.updateQueue = create), (create.lastEffect = tag.next = tag)) : ((destroy = create.lastEffect), null === destroy @@ -7159,7 +6991,7 @@ function updateRef() { } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( 1 | hookFlags, create, @@ -7179,7 +7011,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { return; } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { @@ -7258,7 +7090,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { ); objectIs(value, prevValue) || ((value = claimNextTransitionLane()), - (currentlyRenderingFiber$1.lanes |= value), + (currentlyRenderingFiber.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); return prevValue; @@ -7268,13 +7100,13 @@ function startTransition(setPending, callback) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; setPending(!0); - var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = {}; + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = {}; try { setPending(!1), callback(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactCurrentBatchConfig$1.transition = prevTransition); } } function updateId() { @@ -7291,14 +7123,14 @@ function refreshCache(fiber, seedKey, seedValue) { var lane = requestUpdateLane(provider), eventTime = requestEventTime(); fiber = createUpdate(eventTime, lane); - var root$92 = enqueueUpdate$1(provider, fiber, lane); - null !== root$92 && - (scheduleUpdateOnFiber(root$92, provider, lane, eventTime), - entangleTransitions(root$92, provider, lane)); + var root$91 = enqueueUpdate$1(provider, fiber, lane); + null !== root$91 && + (scheduleUpdateOnFiber(root$91, provider, lane, eventTime), + entangleTransitions(root$91, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$92 && + null !== root$91 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -7367,8 +7199,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (null !== alternate && alternate === currentlyRenderingFiber) ); } function enqueueRenderPhaseUpdate(queue, update) { @@ -7405,8 +7237,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: !1 + useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; ContextOnlyDispatcher.use = throwInvalidHookError; @@ -7458,7 +7289,7 @@ var HooksDispatcherOnMount = { hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, reducer ); return [hook.memoizedState, reducer]; @@ -7490,7 +7321,7 @@ var HooksDispatcherOnMount = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1, + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) @@ -7498,15 +7329,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$89 = workInProgressRoot; - if (null === root$89) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$89, renderLanes) || + var root$88 = workInProgressRoot; + if (null === root$88) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$88, renderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$89 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$89; - mountEffect(subscribeToStore.bind(null, fiber, root$89, subscribe), [ + root$88 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$88; + mountEffect(subscribeToStore.bind(null, fiber, root$88, subscribe), [ subscribe ]); fiber.flags |= 1024; @@ -7515,7 +7346,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$89, + root$88, getServerSnapshot, getSnapshot ), @@ -7550,11 +7381,10 @@ var HooksDispatcherOnMount = { ":"); return (hook.memoizedState = identifierPrefix); }, - unstable_isNewReconciler: !1, useCacheRefresh: function() { return (mountWorkInProgressHook().memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); } }; @@ -7585,8 +7415,7 @@ var HooksDispatcherOnUpdate = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; HooksDispatcherOnUpdate.use = use; @@ -7618,8 +7447,7 @@ var HooksDispatcherOnRerender = { }, useMutableSource: updateMutableSource, useSyncExternalStore: updateSyncExternalStore, - useId: updateId, - unstable_isNewReconciler: !1 + useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; HooksDispatcherOnRerender.use = use; @@ -7808,9 +7636,9 @@ function logCapturedError(boundary, errorInfo) { errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null }) && console.error(errorInfo.value); - } catch (e$97) { + } catch (e$96) { setTimeout(function() { - throw e$97; + throw e$96; }); } } @@ -7881,24 +7709,6 @@ function markSuspenseBoundaryShouldCapture( suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } -var resumedCache = createCursor(null); -function peekCacheFromPool() { - var cacheResumedFromPreviousRender = resumedCache.current; - return null !== cacheResumedFromPreviousRender - ? cacheResumedFromPreviousRender - : workInProgressRoot.pooledCache; -} -function pushTransition(offscreenWorkInProgress, prevCachePool) { - null === prevCachePool - ? push(resumedCache, resumedCache.current) - : push(resumedCache, prevCachePool.pool); -} -function getSuspendedCache() { - var cacheFromPool = peekCacheFromPool(); - return null === cacheFromPool - ? null - : { parent: CacheContext._currentValue, pool: cacheFromPool }; -} var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, SelectiveHydrationException = Error(formatProdErrorMessage(461)), didReceiveUpdate = !1; @@ -8474,14 +8284,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { } JSCompiler_temp = current.memoizedState; if (null !== JSCompiler_temp) { - var dehydrated$109 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$109) + var dehydrated$108 = JSCompiler_temp.dehydrated; + if (null !== dehydrated$108) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, nextProps, - dehydrated$109, + dehydrated$108, JSCompiler_temp, renderLanes ); @@ -8491,7 +8301,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { showFallback = nextProps.fallback; didSuspend = workInProgress.mode; JSCompiler_temp = current.child; - dehydrated$109 = JSCompiler_temp.sibling; + dehydrated$108 = JSCompiler_temp.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp ? ((nextProps = workInProgress.child), @@ -8500,8 +8310,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.deletions = null)) : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 7340032)); - null !== dehydrated$109 - ? (showFallback = createWorkInProgress(dehydrated$109, showFallback)) + null !== dehydrated$108 + ? (showFallback = createWorkInProgress(dehydrated$108, showFallback)) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -8520,10 +8330,10 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = didSuspend.cachePool), null !== JSCompiler_temp - ? ((dehydrated$109 = CacheContext._currentValue), + ? ((dehydrated$108 = CacheContext._currentValue), (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$109 - ? { parent: dehydrated$109, pool: dehydrated$109 } + JSCompiler_temp.parent !== dehydrated$108 + ? { parent: dehydrated$108, pool: dehydrated$108 } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), (didSuspend = { @@ -9002,6 +8812,192 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } +var valueCursor = createCursor(null), + currentlyRenderingFiber$1 = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber$1 = null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + var currentValue = valueCursor.current; + pop(valueCursor); + context._currentValue = + currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED + ? context._defaultValue + : currentValue; +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent; ) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(-1, renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else + for (nextFiber = fiber; null !== nextFiber; ) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === currentlyRenderingFiber$1) + throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + currentlyRenderingFiber$1.dependencies = { + lanes: 0, + firstContext: context + }; + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function() { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority$1 = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, + resumedCache = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; +} +function pushTransition(offscreenWorkInProgress, prevCachePool) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); +} +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue, pool: cacheFromPool }; +} var emptyObject = {}; function collectScopedNodesFromChildren( startingChild, @@ -11832,7 +11828,7 @@ function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== ReactCurrentBatchConfig$1.transition) + if (null !== ReactCurrentBatchConfig$2.transition) return ( 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()), @@ -12584,10 +12580,10 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var wakeables$98 = offscreenQueue.wakeables; - null === wakeables$98 + var wakeables$97 = offscreenQueue.wakeables; + null === wakeables$97 ? (offscreenQueue.wakeables = new Set([wakeable])) - : wakeables$98.add(wakeable); + : wakeables$97.add(wakeable); } break; } @@ -13142,11 +13138,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { Component = nextState.cache; pushProvider(workInProgress, CacheContext, Component); Component !== prevState.cache && - propagateContextChange_eager( - workInProgress, - CacheContext, - renderLanes - ); + propagateContextChange(workInProgress, CacheContext, renderLanes); Component = nextState.element; if (prevState.isDehydrated) if ( @@ -13354,12 +13346,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange_eager( - workInProgress, - Component, - renderLanes - ); + } else propagateContextChange(workInProgress, Component, renderLanes); reconcileChildren(current, workInProgress, init.children, renderLanes); workInProgress = workInProgress.child; } @@ -13462,7 +13449,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { : ((Component = prevState.cache), pushProvider(workInProgress, CacheContext, Component), Component !== init.cache && - propagateContextChange_eager( + propagateContextChange( workInProgress, CacheContext, renderLanes @@ -13989,17 +13976,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1669 = { +var devToolsConfig$jscomp$inline_1686 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-030dae2f4-20221201", + version: "18.3.0-www-modern-420f0b7fa-20221201", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2079 = { - bundleType: devToolsConfig$jscomp$inline_1669.bundleType, - version: devToolsConfig$jscomp$inline_1669.version, - rendererPackageName: devToolsConfig$jscomp$inline_1669.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1669.rendererConfig, +var internals$jscomp$inline_2082 = { + bundleType: devToolsConfig$jscomp$inline_1686.bundleType, + version: devToolsConfig$jscomp$inline_1686.version, + rendererPackageName: devToolsConfig$jscomp$inline_1686.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1686.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -14016,26 +14003,26 @@ var internals$jscomp$inline_2079 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1669.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1686.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-030dae2f4-20221201" + reconcilerVersion: "18.3.0-next-420f0b7fa-20221201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2080 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2083 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2080.isDisabled && - hook$jscomp$inline_2080.supportsFiber + !hook$jscomp$inline_2083.isDisabled && + hook$jscomp$inline_2083.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2080.inject( - internals$jscomp$inline_2079 + (rendererID = hook$jscomp$inline_2083.inject( + internals$jscomp$inline_2082 )), - (injectedHook = hook$jscomp$inline_2080); + (injectedHook = hook$jscomp$inline_2083); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -14345,6 +14332,5 @@ exports.unstable_flushControlled = function(fn) { 0 === executionContext && (resetRenderTimer(), flushSyncCallbacks()); } }; -exports.unstable_isNewReconciler = !1; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-030dae2f4-20221201"; +exports.version = "18.3.0-next-420f0b7fa-20221201"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 00d2988432..2c5a4a146d 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -138,7 +138,6 @@ var enableProfilerTimer = true; var enableProfilerCommitHooks = true; var enableProfilerNestedUpdatePhase = true; var warnAboutStringRefs = true; -var enableNewReconciler = false; var createRootStrictEffectsByDefault = false; var enableLazyContextPropagation = false; var enableLegacyHidden = false; @@ -3124,10 +3123,767 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate()) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } /** @@ -5050,1083 +5806,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue2, providerFiber); - context._currentValue2 = nextValue; - - { - if ( - context._currentRenderer2 !== undefined && - context._currentRenderer2 !== null && - context._currentRenderer2 !== rendererSigil - ) { - error( - "Detected multiple renderers concurrently rendering the " + - "same context provider. This is currently unsupported." - ); - } - - context._currentRenderer2 = rendererSigil; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue2 = context._defaultValue; - } else { - context._currentValue2 = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue2; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate()) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -6354,11 +6033,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -6391,8 +6070,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentSecondaryRenderer == null) { - mutableSource._currentSecondaryRenderer = rendererSigil$1; - } else if (mutableSource._currentSecondaryRenderer !== rendererSigil$1) { + mutableSource._currentSecondaryRenderer = rendererSigil; + } else if (mutableSource._currentSecondaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -6402,97 +6081,6 @@ function warnAboutMultipleRenderersDEV(mutableSource) { } } // Eager reads the version of a mutable source and stores it on the root. -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, - NormalPriority$1 = Scheduler$1.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -6645,7 +6233,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -6659,7 +6247,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -6740,7 +6328,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -6849,7 +6437,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -6947,7 +6535,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -7124,7 +6712,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -7140,7 +6728,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -7166,7 +6754,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -7184,7 +6772,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -7198,7 +6786,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -7211,7 +6799,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -7241,7 +6829,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -7317,7 +6905,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -7409,8 +6997,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -7637,7 +7225,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -7746,7 +7334,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -7777,7 +7365,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; @@ -7845,7 +7433,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -7921,11 +7509,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -8004,7 +7592,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -8027,11 +7615,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -8069,7 +7657,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -8097,7 +7685,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -8107,7 +7695,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -8134,7 +7722,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -8192,7 +7780,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -8333,8 +7921,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -8372,12 +7960,12 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; - var currentTransition = ReactCurrentBatchConfig$1.transition; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; + var currentTransition = ReactCurrentBatchConfig.transition; { - ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } try { @@ -8385,7 +7973,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$1.transition = prevTransition; + ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -8465,7 +8053,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -8637,8 +8225,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -8696,8 +8284,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -8845,8 +8432,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -8965,8 +8551,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9085,8 +8670,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9205,8 +8789,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9342,8 +8925,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9482,8 +9064,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9622,8 +9203,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -11429,107 +11009,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - { - pop(resumedCache, workInProgress); - } - } -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; // A special exception that's used to unwind the stack when an update flows // into a dehydrated boundary. @@ -14762,6 +14241,517 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue2, providerFiber); + context._currentValue2 = nextValue; + + { + if ( + context._currentRenderer2 !== undefined && + context._currentRenderer2 !== null && + context._currentRenderer2 !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer2 = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue2 = context._defaultValue; + } else { + context._currentValue2 = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue2; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, + NormalPriority$1 = Scheduler$1.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$1.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + { + pop(resumedCache, workInProgress); + } + } +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -22944,10 +22934,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -23844,7 +23834,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-classic-420f0b7fa-20221201"; var didWarnAboutNestedUpdates; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 72a0ced2ea..320f7e78b7 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -138,7 +138,6 @@ var enableProfilerTimer = true; var enableProfilerCommitHooks = true; var enableProfilerNestedUpdatePhase = true; var warnAboutStringRefs = true; -var enableNewReconciler = false; var createRootStrictEffectsByDefault = false; var enableLazyContextPropagation = false; var enableLegacyHidden = false; @@ -3124,10 +3123,767 @@ function queueHydrationError(error) { } } -var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = null; -function requestCurrentTransition() { - return ReactCurrentBatchConfig.transition; +// If a render is in progress, and we receive an update from a concurrent event, +// we wait until the current render is over (either finished or interrupted) +// before adding it to the fiber/hook queue. Push to this array so we can +// access the queue, fiber, update, et al later. +var concurrentQueues = []; +var concurrentQueuesIndex = 0; +var concurrentlyUpdatedLanes = NoLanes; +function finishQueueingConcurrentUpdates() { + var endIndex = concurrentQueuesIndex; + concurrentQueuesIndex = 0; + concurrentlyUpdatedLanes = NoLanes; + var i = 0; + + while (i < endIndex) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + + if (queue !== null && update !== null) { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; + } + + if (lane !== NoLane) { + markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } +} +function getConcurrentlyUpdatedLanes() { + return concurrentlyUpdatedLanes; +} + +function enqueueUpdate(fiber, queue, update, lane) { + // Don't update the `childLanes` on the return path yet. If we already in + // the middle of rendering, wait until after it has completed. + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is + // scheduled, to perform an eager bailout, so we need to update it immediately. + // TODO: We should probably move this to the "shared" queue instead. + + fiber.lanes = mergeLanes(fiber.lanes, lane); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } +} + +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { + // This function is used to queue an update that doesn't need a rerender. The + // only reason we queue it is in case there's a subsequent higher priority + // update that causes it to be rebased. + var lane = NoLane; + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent + // queue. However, since this is a bail out, we're not scheduling any work + // here. So the update we just queued will leak until something else happens + // to schedule work (if ever). + // + // Check if we're currently in the middle of rendering a tree, and if not, + // process the queue immediately to prevent a leak. + + var isConcurrentlyRendering = getWorkInProgressRoot() !== null; + + if (!isConcurrentlyRendering) { + finishQueueingConcurrentUpdates(); + } +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var concurrentQueue = queue; + var concurrentUpdate = update; + enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); + return getRootForUpdatedFiber(fiber); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it + // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is + // undefined behavior and we can change it if we need to; it just so happens + // that, at the time of this writing, there's an internal product test that + // happens to rely on this. + var root = getRootForUpdatedFiber(sourceFiber); + markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); + return root; +} + +function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } // Walk the parent path to the root and update the child lanes. + + var isHidden = false; + var parent = sourceFiber.return; + var node = sourceFiber; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } + + if (parent.tag === OffscreenComponent) { + // Check if this offscreen boundary is currently hidden. + // + // The instance may be null if the Offscreen parent was unmounted. Usually + // the parent wouldn't be reachable in that case because we disconnect + // fibers from the tree when they are deleted. However, there's a weird + // edge case where setState is called on a fiber that was interrupted + // before it ever mounted. Because it never mounts, it also never gets + // deleted. Because it never gets deleted, its return pointer never gets + // disconnected. Which means it may be attached to a deleted Offscreen + // parent node. (This discovery suggests it may be better for memory usage + // if we don't attach the `return` pointer until the commit phase, though + // in order to do that we'd need some other way to track the return + // pointer during the initial render, like on the stack.) + // + // This case is always accompanied by a warning, but we still need to + // account for it. (There may be other cases that we haven't discovered, + // too.) + var offscreenInstance = parent.stateNode; + + if ( + offscreenInstance !== null && + !(offscreenInstance._visibility & OffscreenVisible) + ) { + isHidden = true; + } + } + + node = parent; + parent = parent.return; + } + + if (isHidden && update !== null && node.tag === HostRoot) { + var root = node.stateNode; + markHiddenUpdate(root, update, lane); + } +} + +function getRootForUpdatedFiber(sourceFiber) { + // TODO: We will detect and infinite update loop and throw even if this fiber + // has already unmounted. This isn't really necessary but it happens to be the + // current behavior we've used for several release cycles. Consider not + // performing this check if the updated fiber already unmounted, since it's + // not possible for that to cause an infinite update loop. + throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because + // update queues do not have a backpointer to the root, the only way to do + // this currently is to walk up the return path. This used to not be a big + // deal because we would have to walk up the return path to set + // the `childLanes`, anyway, but now those two traversals happen at + // different times. + // TODO: Consider adding a `root` backpointer on the update queue. + + detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); + var node = sourceFiber; + var parent = node.return; + + while (parent !== null) { + detectUpdateOnUnmountedFiber(sourceFiber, node); + node = parent; + parent = node.return; + } + + return node.tag === HostRoot ? node.stateNode : null; +} + +function detectUpdateOnUnmountedFiber(sourceFiber, parent) { + { + var alternate = parent.alternate; + + if ( + alternate === null && + (parent.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } +} + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. + +var hasForceUpdate = false; +var didWarnUpdateInsideUpdate; +var currentlyProcessingQueue; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: NoLanes, + hiddenCallbacks: null + }, + callbacks: null + }; + fiber.updateQueue = queue; +} +function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + callbacks: null + }; + workInProgress.updateQueue = clone; + } +} +function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; +} +function enqueueUpdate$1(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return null; + } + + var sharedQueue = updateQueue.shared; + + { + if ( + currentlyProcessingQueue === sharedQueue && + !didWarnUpdateInsideUpdate + ) { + error( + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + + didWarnUpdateInsideUpdate = true; + } + } + + if (isUnsafeClassRenderPhaseUpdate()) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } +} +function entangleTransitions(root, fiber, lane) { + var updateQueue = fiber.updateQueue; + + if (updateQueue === null) { + // Only occurs if the fiber has been unmounted. + return; + } + + var sharedQueue = updateQueue.shared; + + if (isTransitionLane(lane)) { + var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must + // have finished. We can remove them from the shared queue, which represents + // a superset of the actually pending lanes. In some cases we may entangle + // more than we need to, but that's OK. In fact it's worse if we *don't* + // entangle when we should. + + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + + var newQueueLanes = mergeLanes(queueLanes, lane); + sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. + + markRootEntangled(root, newQueueLanes); + } +} +function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + + var current = workInProgress.alternate; + + if (current !== null) { + var currentQueue = current.updateQueue; + + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + + if (newLast === null) { + newFirst = newLast = clone; + } else { + newLast.next = clone; + newLast = clone; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + } while (update !== null); // Append the captured update the end of the cloned list. + + if (newLast === null) { + newFirst = newLast = capturedUpdate; + } else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else { + // There are no base updates. + newFirst = newLast = capturedUpdate; + } + + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + callbacks: currentQueue.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + + var lastBaseUpdate = queue.lastBaseUpdate; + + if (lastBaseUpdate === null) { + queue.firstBaseUpdate = capturedUpdate; + } else { + lastBaseUpdate.next = capturedUpdate; + } + + queue.lastBaseUpdate = capturedUpdate; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var payload = update.payload; + + if (typeof payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + var nextState = payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + + return nextState; + } // State object + + return payload; + } + + case CaptureUpdate: { + workInProgress.flags = + (workInProgress.flags & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + + case UpdateState: { + var _payload = update.payload; + var partialState; + + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + } + + partialState = _payload.call(instance, prevState, nextProps); + + { + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload; + } + + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } // Merge the partial state and the previous state. + + return assign({}, prevState, partialState); + } + + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + + return prevState; +} + +function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + + { + // $FlowFixMe[escaped-generic] discovered when updating Flow + currentlyProcessingQueue = queue.shared; + } + + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + + var pendingQueue = queue.shared.pending; + + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + + if (lastBaseUpdate === null) { + firstBaseUpdate = firstPendingUpdate; + } else { + lastBaseUpdate.next = firstPendingUpdate; + } + + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + + var current = workInProgress.alternate; + + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) { + currentQueue.firstBaseUpdate = firstPendingUpdate; + } else { + currentLastBaseUpdate.next = firstPendingUpdate; + } + + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + + do { + // TODO: Don't need this field anymore + var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to + // a hidden tree, so that we can distinguish them from updates that were + // already there when the tree was hidden. + + var updateLane = removeLanes(update.lane, OffscreenLane); + var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then + // it's not a "base" update and we should disregard the extra base lanes + // that were added to renderLanes when we entered the Offscreen tree. + + var shouldSkipUpdate = isHiddenUpdate + ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) + : !isSubsetOfLanes(renderLanes, updateLane); + + if (shouldSkipUpdate) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else { + newLastBaseUpdate = newLastBaseUpdate.next = clone; + } // Update the remaining priority in the queue. + + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + // When this update is rebased, we should not fire its + // callback again. + callback: null, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + + newState = getStateFromUpdate( + workInProgress, + queue, + update, + newState, + props, + instance + ); + var callback = update.callback; + + if (callback !== null) { + workInProgress.flags |= Callback; + + if (isHiddenUpdate) { + workInProgress.flags |= Visibility; + } + + var callbacks = queue.callbacks; + + if (callbacks === null) { + queue.callbacks = [callback]; + } else { + callbacks.push(callback); + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + update = update.next; + + if (update === null) { + pendingQueue = queue.shared.pending; + + if (pendingQueue === null) { + break; + } else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + } while (true); + + if (newLastBaseUpdate === null) { + newBaseState = newState; + } + + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; + + if (firstBaseUpdate === null) { + // `queue.lanes` is used for entangling transitions. We can set it back to + // zero once the queue is empty. + queue.shared.lanes = NoLanes; + } // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + if (typeof callback !== "function") { + throw new Error( + "Invalid argument passed as callback. Expected a function. Instead " + + ("received: " + callback) + ); + } + + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} +function deferHiddenCallbacks(updateQueue) { + // When an update finishes on a hidden component, its callback should not + // be fired until/unless the component is made visible again. Stash the + // callback on the shared queue object so it can be fired later. + var newHiddenCallbacks = updateQueue.callbacks; + + if (newHiddenCallbacks !== null) { + var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (existingHiddenCallbacks === null) { + updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; + } else { + updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( + newHiddenCallbacks + ); + } + } +} +function commitHiddenCallbacks(updateQueue, context) { + // This component is switching from hidden -> visible. Commit any callbacks + // that were previously deferred. + var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; + + if (hiddenCallbacks !== null) { + updateQueue.shared.hiddenCallbacks = null; + + for (var i = 0; i < hiddenCallbacks.length; i++) { + var callback = hiddenCallbacks[i]; + callCallback(callback, context); + } + } +} +function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + + if (callbacks !== null) { + updateQueue.callbacks = null; + + for (var i = 0; i < callbacks.length; i++) { + var callback = callbacks[i]; + callCallback(callback, context); + } + } } /** @@ -5050,1083 +5806,6 @@ function resetChildFibers(workInProgress, lanes) { } } -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastFullyObservedContext = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastFullyObservedContext = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, context, nextValue) { - { - push(valueCursor, context._currentValue2, providerFiber); - context._currentValue2 = nextValue; - - { - if ( - context._currentRenderer2 !== undefined && - context._currentRenderer2 !== null && - context._currentRenderer2 !== rendererSigil - ) { - error( - "Detected multiple renderers concurrently rendering the " + - "same context provider. This is currently unsupported." - ); - } - - context._currentRenderer2 = rendererSigil; - } - } -} -function popProvider(context, providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - - { - if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { - context._currentValue2 = context._defaultValue; - } else { - context._currentValue2 = currentValue; - } - } -} -function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if ( - alternate !== null && - !isSubsetOfLanes(alternate.childLanes, renderLanes) - ) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - - if (node === propagationRoot) { - break; - } - - node = node.return; - } - - { - if (node !== propagationRoot) { - error( - "Expected to find the propagation root when scheduling context work. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - } -} -function propagateContextChange(workInProgress, context, renderLanes) { - { - propagateContextChange_eager(workInProgress, context, renderLanes); - } -} - -function propagateContextChange_eager(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var lane = pickArbitraryLane(renderLanes); - var update = createUpdate(NoTimestamp, lane); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - // Inlined `enqueueUpdate` to remove interleaved update check - - var updateQueue = fiber.updateQueue; - - if (updateQueue === null); - else { - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else if (fiber.tag === DehydratedFragment) { - // If a dehydrated suspense boundary is in this subtree, we don't know - // if it will have any context consumers in it. The best we can do is - // mark it as having updates. - var parentSuspense = fiber.return; - - if (parentSuspense === null) { - throw new Error( - "We just came from a parent so we must have had a parent. This is a bug in React." - ); - } - - parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); - var _alternate = parentSuspense.alternate; - - if (_alternate !== null) { - _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); - } // This is intentionally passing this fiber as the parent - // because we want to schedule this fiber as having work - // on its children. We'll use the childLanes on - // this fiber to indicate that a context has changed. - - scheduleContextWorkOnParentPath( - parentSuspense, - renderLanes, - workInProgress - ); - nextFiber = fiber.sibling; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastFullyObservedContext = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - dependencies.firstContext = null; - } - } - } -} -function readContext(context) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - 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()." - ); - } - } - - var value = context._currentValue2; - - if (lastFullyObservedContext === context); - else { - var contextItem = { - context: context, - memoizedValue: value, - next: null - }; - - if (lastContextDependency === null) { - if (currentlyRenderingFiber === null) { - throw new 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()." - ); - } // This is the first dependency for this component. Create a new list. - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem - }; - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return value; -} - -// If a render is in progress, and we receive an update from a concurrent event, -// we wait until the current render is over (either finished or interrupted) -// before adding it to the fiber/hook queue. Push to this array so we can -// access the queue, fiber, update, et al later. -var concurrentQueues = []; -var concurrentQueuesIndex = 0; -var concurrentlyUpdatedLanes = NoLanes; -function finishQueueingConcurrentUpdates() { - var endIndex = concurrentQueuesIndex; - concurrentQueuesIndex = 0; - concurrentlyUpdatedLanes = NoLanes; - var i = 0; - - while (i < endIndex) { - var fiber = concurrentQueues[i]; - concurrentQueues[i++] = null; - var queue = concurrentQueues[i]; - concurrentQueues[i++] = null; - var update = concurrentQueues[i]; - concurrentQueues[i++] = null; - var lane = concurrentQueues[i]; - concurrentQueues[i++] = null; - - if (queue !== null && update !== null) { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } - - if (lane !== NoLane) { - markUpdateLaneFromFiberToRoot(fiber, update, lane); - } - } -} -function getConcurrentlyUpdatedLanes() { - return concurrentlyUpdatedLanes; -} - -function enqueueUpdate(fiber, queue, update, lane) { - // Don't update the `childLanes` on the return path yet. If we already in - // the middle of rendering, wait until after it has completed. - concurrentQueues[concurrentQueuesIndex++] = fiber; - concurrentQueues[concurrentQueuesIndex++] = queue; - concurrentQueues[concurrentQueuesIndex++] = update; - concurrentQueues[concurrentQueuesIndex++] = lane; - concurrentlyUpdatedLanes = mergeLanes(concurrentlyUpdatedLanes, lane); // The fiber's `lane` field is used in some places to check if any work is - // scheduled, to perform an eager bailout, so we need to update it immediately. - // TODO: We should probably move this to the "shared" queue instead. - - fiber.lanes = mergeLanes(fiber.lanes, lane); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } -} - -function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update) { - // This function is used to queue an update that doesn't need a rerender. The - // only reason we queue it is in case there's a subsequent higher priority - // update that causes it to be rebased. - var lane = NoLane; - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); // Usually we can rely on the upcoming render phase to process the concurrent - // queue. However, since this is a bail out, we're not scheduling any work - // here. So the update we just queued will leak until something else happens - // to schedule work (if ever). - // - // Check if we're currently in the middle of rendering a tree, and if not, - // process the queue immediately to prevent a leak. - - var isConcurrentlyRendering = getWorkInProgressRoot() !== null; - - if (!isConcurrentlyRendering) { - finishQueueingConcurrentUpdates(); - } -} -function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { - var concurrentQueue = queue; - var concurrentUpdate = update; - enqueueUpdate(fiber, concurrentQueue, concurrentUpdate, lane); - return getRootForUpdatedFiber(fiber); -} -function enqueueConcurrentRenderForLane(fiber, lane) { - enqueueUpdate(fiber, null, null, lane); - return getRootForUpdatedFiber(fiber); -} // Calling this function outside this module should only be done for backwards -// compatibility and should always be accompanied by a warning. - -function unsafe_markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // NOTE: For Hyrum's Law reasons, if an infinite update loop is detected, it - // should throw before `markUpdateLaneFromFiberToRoot` is called. But this is - // undefined behavior and we can change it if we need to; it just so happens - // that, at the time of this writing, there's an internal product test that - // happens to rely on this. - var root = getRootForUpdatedFiber(sourceFiber); - markUpdateLaneFromFiberToRoot(sourceFiber, null, lane); - return root; -} - -function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } // Walk the parent path to the root and update the child lanes. - - var isHidden = false; - var parent = sourceFiber.return; - var node = sourceFiber; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } - - if (parent.tag === OffscreenComponent) { - // Check if this offscreen boundary is currently hidden. - // - // The instance may be null if the Offscreen parent was unmounted. Usually - // the parent wouldn't be reachable in that case because we disconnect - // fibers from the tree when they are deleted. However, there's a weird - // edge case where setState is called on a fiber that was interrupted - // before it ever mounted. Because it never mounts, it also never gets - // deleted. Because it never gets deleted, its return pointer never gets - // disconnected. Which means it may be attached to a deleted Offscreen - // parent node. (This discovery suggests it may be better for memory usage - // if we don't attach the `return` pointer until the commit phase, though - // in order to do that we'd need some other way to track the return - // pointer during the initial render, like on the stack.) - // - // This case is always accompanied by a warning, but we still need to - // account for it. (There may be other cases that we haven't discovered, - // too.) - var offscreenInstance = parent.stateNode; - - if ( - offscreenInstance !== null && - !(offscreenInstance._visibility & OffscreenVisible) - ) { - isHidden = true; - } - } - - node = parent; - parent = parent.return; - } - - if (isHidden && update !== null && node.tag === HostRoot) { - var root = node.stateNode; - markHiddenUpdate(root, update, lane); - } -} - -function getRootForUpdatedFiber(sourceFiber) { - // TODO: We will detect and infinite update loop and throw even if this fiber - // has already unmounted. This isn't really necessary but it happens to be the - // current behavior we've used for several release cycles. Consider not - // performing this check if the updated fiber already unmounted, since it's - // not possible for that to cause an infinite update loop. - throwIfInfiniteUpdateLoopDetected(); // When a setState happens, we must ensure the root is scheduled. Because - // update queues do not have a backpointer to the root, the only way to do - // this currently is to walk up the return path. This used to not be a big - // deal because we would have to walk up the return path to set - // the `childLanes`, anyway, but now those two traversals happen at - // different times. - // TODO: Consider adding a `root` backpointer on the update queue. - - detectUpdateOnUnmountedFiber(sourceFiber, sourceFiber); - var node = sourceFiber; - var parent = node.return; - - while (parent !== null) { - detectUpdateOnUnmountedFiber(sourceFiber, node); - node = parent; - parent = node.return; - } - - return node.tag === HostRoot ? node.stateNode : null; -} - -function detectUpdateOnUnmountedFiber(sourceFiber, parent) { - { - var alternate = parent.alternate; - - if ( - alternate === null && - (parent.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null, - lanes: NoLanes, - hiddenCallbacks: null - }, - callbacks: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - callbacks: null - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate$1(fiber, update, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return null; - } - - var sharedQueue = updateQueue.shared; - - { - if ( - currentlyProcessingQueue === sharedQueue && - !didWarnUpdateInsideUpdate - ) { - error( - "An update (setState, replaceState, or forceUpdate) was scheduled " + - "from inside an update function. Update functions should be pure, " + - "with zero side-effects. Consider using componentDidUpdate or a " + - "callback." - ); - - didWarnUpdateInsideUpdate = true; - } - } - - if (isUnsafeClassRenderPhaseUpdate()) { - // This is an unsafe render phase update. Add directly to the update - // queue so we can process it immediately during the current render. - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering - // this fiber. This is for backwards compatibility in the case where you - // update a different component during render phase than the one that is - // currently renderings (a pattern that is accompanied by a warning). - - return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); - } else { - return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); - } -} -function entangleTransitions(root, fiber, lane) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - - if (isTransitionLane(lane)) { - var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must - // have finished. We can remove them from the shared queue, which represents - // a superset of the actually pending lanes. In some cases we may entangle - // more than we need to, but that's OK. In fact it's worse if we *don't* - // entangle when we should. - - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - - var newQueueLanes = mergeLanes(queueLanes, lane); - sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. - - markRootEntangled(root, newQueueLanes); - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - callbacks: currentQueue.callbacks - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate( - workInProgress, - queue, - update, - prevState, - nextProps, - instance -) { - switch (update.tag) { - case ReplaceState: { - var payload = update.payload; - - if (typeof payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - return payload; - } - - case CaptureUpdate: { - workInProgress.flags = - (workInProgress.flags & ~ShouldCapture) | DidCapture; - } - // Intentional fallthrough - - case UpdateState: { - var _payload = update.payload; - var partialState; - - if (typeof _payload === "function") { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - return assign({}, prevState, partialState); - } - - case ForceUpdate: { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - // $FlowFixMe[escaped-generic] discovered when updating Flow - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - // TODO: Don't need this field anymore - var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to - // a hidden tree, so that we can distinguish them from updates that were - // already there when the tree was hidden. - - var updateLane = removeLanes(update.lane, OffscreenLane); - var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then - // it's not a "base" update and we should disregard the extra base lanes - // that were added to renderLanes when we entered the Offscreen tree. - - var shouldSkipUpdate = isHiddenUpdate - ? !isSubsetOfLanes(getWorkInProgressRootRenderLanes(), updateLane) - : !isSubsetOfLanes(renderLanes, updateLane); - - if (shouldSkipUpdate) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - // When this update is rebased, we should not fire its - // callback again. - callback: null, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - newState = getStateFromUpdate( - workInProgress, - queue, - update, - newState, - props, - instance - ); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - - if (isHiddenUpdate) { - workInProgress.flags |= Visibility; - } - - var callbacks = queue.callbacks; - - if (callbacks === null) { - queue.callbacks = [callback]; - } else { - callbacks.push(callback); - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; - - if (firstBaseUpdate === null) { - // `queue.lanes` is used for entangling transitions. We can set it back to - // zero once the queue is empty. - queue.shared.lanes = NoLanes; - } // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (typeof callback !== "function") { - throw new Error( - "Invalid argument passed as callback. Expected a function. Instead " + - ("received: " + callback) - ); - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function deferHiddenCallbacks(updateQueue) { - // When an update finishes on a hidden component, its callback should not - // be fired until/unless the component is made visible again. Stash the - // callback on the shared queue object so it can be fired later. - var newHiddenCallbacks = updateQueue.callbacks; - - if (newHiddenCallbacks !== null) { - var existingHiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (existingHiddenCallbacks === null) { - updateQueue.shared.hiddenCallbacks = newHiddenCallbacks; - } else { - updateQueue.shared.hiddenCallbacks = existingHiddenCallbacks.concat( - newHiddenCallbacks - ); - } - } -} -function commitHiddenCallbacks(updateQueue, context) { - // This component is switching from hidden -> visible. Commit any callbacks - // that were previously deferred. - var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; - - if (hiddenCallbacks !== null) { - updateQueue.shared.hiddenCallbacks = null; - - for (var i = 0; i < hiddenCallbacks.length; i++) { - var callback = hiddenCallbacks[i]; - callCallback(callback, context); - } - } -} -function commitCallbacks(updateQueue, context) { - var callbacks = updateQueue.callbacks; - - if (callbacks !== null) { - updateQueue.callbacks = null; - - for (var i = 0; i < callbacks.length; i++) { - var callback = callbacks[i]; - callCallback(callback, context); - } - } -} - // TODO: This isn't being used yet, but it's intended to replace the // InvisibleParentContext that is currently managed by SuspenseContext. var currentTreeHiddenStackCursor = createCursor(null); @@ -6354,11 +6033,11 @@ var Passive$1 = // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; -var rendererSigil$1; +var rendererSigil; { // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; + rendererSigil = {}; } function markSourceAsDirty(mutableSource) { @@ -6391,8 +6070,8 @@ function warnAboutMultipleRenderersDEV(mutableSource) { { { if (mutableSource._currentSecondaryRenderer == null) { - mutableSource._currentSecondaryRenderer = rendererSigil$1; - } else if (mutableSource._currentSecondaryRenderer !== rendererSigil$1) { + mutableSource._currentSecondaryRenderer = rendererSigil; + } else if (mutableSource._currentSecondaryRenderer !== rendererSigil) { error( "Detected multiple renderers concurrently rendering the " + "same mutable source. This is currently unsupported." @@ -6402,97 +6081,6 @@ function warnAboutMultipleRenderersDEV(mutableSource) { } } // Eager reads the version of a mutable source and stores it on the root. -// replace it with a lightweight shim that only has the features we use. - -var AbortControllerLocal = - typeof AbortController !== "undefined" - ? AbortController - : function AbortControllerShim() { - var listeners = []; - var signal = (this.signal = { - aborted: false, - addEventListener: function(type, listener) { - listeners.push(listener); - } - }); - - this.abort = function() { - signal.aborted = true; - listeners.forEach(function(listener) { - return listener(); - }); - }; - }; -// Intentionally not named imports because Rollup would -// use dynamic dispatch for CommonJS interop named imports. -var scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, - NormalPriority$1 = Scheduler$1.unstable_NormalPriority; -var CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: null, - Provider: null, - // We'll initialize these at the root. - _currentValue: null, - _currentValue2: null, - _threadCount: 0, - _defaultValue: null, - _globalName: null -}; - -{ - CacheContext._currentRenderer = null; - CacheContext._currentRenderer2 = null; -} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible -// for retaining the cache once it is in use (retainCache), and releasing the cache -// once it is no longer needed (releaseCache). - -function createCache() { - var cache = { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; - return cache; -} -function retainCache(cache) { - { - if (cache.controller.signal.aborted) { - warn( - "A cache instance was retained after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - cache.refCount++; -} // Cleanup a cache instance, potentially freeing it if there are no more references - -function releaseCache(cache) { - cache.refCount--; - - { - if (cache.refCount < 0) { - warn( - "A cache instance was released after it was already freed. " + - "This likely indicates a bug in React." - ); - } - } - - if (cache.refCount === 0) { - scheduleCallback$1(NormalPriority$1, function() { - cache.controller.abort(); - }); - } -} -function pushCacheProvider(workInProgress, cache) { - pushProvider(workInProgress, CacheContext, cache); -} -function popCacheProvider(workInProgress, cache) { - popProvider(CacheContext, workInProgress); -} - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; // 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. @@ -6645,7 +6233,7 @@ function checkIfUseWrappedInTryCatch() { } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -6659,7 +6247,7 @@ var didWarnAboutUseWrappedInTryCatch; var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The +var currentlyRenderingFiber = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. @@ -6740,7 +6328,7 @@ function checkDepsAreArrayDev(deps) { function warnOnHookMismatchInDev(currentHookName) { { - var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); @@ -6849,7 +6437,7 @@ function renderWithHooks( nextRenderLanes ) { renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; + currentlyRenderingFiber = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; @@ -6947,7 +6535,7 @@ function finishRenderingHooks(current, workInProgress) { var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -7124,7 +6712,7 @@ function resetHooksOnUnwind() { // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; + var hook = currentlyRenderingFiber.memoizedState; while (hook !== null) { var queue = hook.queue; @@ -7140,7 +6728,7 @@ function resetHooksOnUnwind() { } renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; + currentlyRenderingFiber = null; currentHook = null; workInProgressHook = null; @@ -7166,7 +6754,7 @@ function mountWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + currentlyRenderingFiber.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; @@ -7184,7 +6772,7 @@ function updateWorkInProgressHook() { var nextCurrentHook; if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; + var current = currentlyRenderingFiber.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; @@ -7198,7 +6786,7 @@ function updateWorkInProgressHook() { var nextWorkInProgressHook; if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + nextWorkInProgressHook = currentlyRenderingFiber.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } @@ -7211,7 +6799,7 @@ function updateWorkInProgressHook() { } else { // Clone from the current hook. if (nextCurrentHook === null) { - var currentFiber = currentlyRenderingFiber$1.alternate; + var currentFiber = currentlyRenderingFiber.alternate; if (currentFiber === null) { // This is the initial render. This branch is reached when the component @@ -7241,7 +6829,7 @@ function updateWorkInProgressHook() { if (workInProgressHook === null) { // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + currentlyRenderingFiber.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; @@ -7317,7 +6905,7 @@ function mountReducer(reducer, initialArg, init) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -7409,8 +6997,8 @@ function updateReducer(reducer, initialArg, init) { // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, updateLane ); markSkippedUpdateLanes(updateLane); @@ -7637,7 +7225,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { var prevGetSnapshot = refs.getSnapshot; var prevSource = memoizedState.source; var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; hook.memoizedState = { refs: refs, source: source, @@ -7746,7 +7334,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { }; newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, newQueue ); stateHook.queue = newQueue; @@ -7777,7 +7365,7 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = mountWorkInProgressHook(); var nextSnapshot; @@ -7845,7 +7433,7 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var fiber = currentlyRenderingFiber$1; + var fiber = currentlyRenderingFiber; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. @@ -7921,11 +7509,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { getSnapshot: getSnapshot, value: renderedSnapshot }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; @@ -8004,7 +7592,7 @@ function mountState(initialState) { hook.queue = queue; var dispatch = (queue.dispatch = dispatchSetState.bind( null, - currentlyRenderingFiber$1, + currentlyRenderingFiber, queue )); return [hook.memoizedState, dispatch]; @@ -8027,11 +7615,11 @@ function pushEffect(tag, create, destroy, deps) { // Circular next: null }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + currentlyRenderingFiber.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; @@ -8069,7 +7657,7 @@ function updateRef(initialValue) { function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -8097,7 +7685,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } } - currentlyRenderingFiber$1.flags |= fiberFlags; + currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushEffect( HasEffect | hookFlags, create, @@ -8107,7 +7695,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, Passive$1, @@ -8134,7 +7722,7 @@ function updateInsertionEffect(create, deps) { function mountLayoutEffect(create, deps) { var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -8192,7 +7780,7 @@ function mountImperativeHandle(ref, create, deps) { deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update | LayoutStatic; - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { + if ((currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } @@ -8333,8 +7921,8 @@ function updateDeferredValueImpl(hook, prevValue, value) { if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); - currentlyRenderingFiber$1.lanes = mergeLanes( - currentlyRenderingFiber$1.lanes, + currentlyRenderingFiber.lanes = mergeLanes( + currentlyRenderingFiber.lanes, deferredLane ); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent @@ -8372,12 +7960,12 @@ function startTransition(setPending, callback, options) { higherEventPriority(previousPriority, ContinuousEventPriority) ); setPending(true); - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = {}; - var currentTransition = ReactCurrentBatchConfig$1.transition; + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; + var currentTransition = ReactCurrentBatchConfig.transition; { - ReactCurrentBatchConfig$1.transition._updatedFibers = new Set(); + ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } try { @@ -8385,7 +7973,7 @@ function startTransition(setPending, callback, options) { callback(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$1.transition = prevTransition; + ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -8465,7 +8053,7 @@ function mountRefresh() { var hook = mountWorkInProgressHook(); var refresh = (hook.memoizedState = refreshCache.bind( null, - currentlyRenderingFiber$1 + currentlyRenderingFiber )); return refresh; } @@ -8637,8 +8225,8 @@ function dispatchSetState(fiber, queue, action) { function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) + fiber === currentlyRenderingFiber || + (alternate !== null && alternate === currentlyRenderingFiber) ); } @@ -8696,8 +8284,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useId: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler + useId: throwInvalidHookError }; { @@ -8845,8 +8432,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -8965,8 +8551,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9085,8 +8670,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9205,8 +8789,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; currentHookNameInDev = "useId"; updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9342,8 +8925,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9482,8 +9064,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -9622,8 +9203,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); - }, - unstable_isNewReconciler: enableNewReconciler + } }; { @@ -11429,107 +11009,6 @@ function throwException( } while (workInProgress !== null); } -// used during the previous render by placing it here, on the stack. - -var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the - -function peekCacheFromPool() { - // If we're rendering inside a Suspense boundary that is currently hidden, - // we should use the same cache that we used during the previous render, if - // one exists. - - var cacheResumedFromPreviousRender = resumedCache.current; - - if (cacheResumedFromPreviousRender !== null) { - return cacheResumedFromPreviousRender; - } // Otherwise, check the root's cache pool. - - var root = getWorkInProgressRoot(); - var cacheFromRootCachePool = root.pooledCache; - return cacheFromRootCachePool; -} - -function requestCacheFromPool(renderLanes) { - // Similar to previous function, except if there's not already a cache in the - // pool, we allocate a new one. - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool !== null) { - return cacheFromPool; - } // Create a fresh cache and add it to the root cache pool. A cache can have - // multiple owners: - // - A cache pool that lives on the FiberRoot. This is where all fresh caches - // are originally created (TODO: except during refreshes, until we implement - // this correctly). The root takes ownership immediately when the cache is - // created. Conceptually, root.pooledCache is an Option> (owned), - // and the return value of this function is a &Arc (borrowed). - // - One of several fiber types: host root, cache boundary, suspense - // component. These retain and release in the commit phase. - - var root = getWorkInProgressRoot(); - var freshCache = createCache(); - root.pooledCache = freshCache; - retainCache(freshCache); - - if (freshCache !== null) { - root.pooledCacheLanes |= renderLanes; - } - - return freshCache; -} -function pushTransition( - offscreenWorkInProgress, - prevCachePool, - newTransitions -) { - { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } - } -} -function popTransition(workInProgress, current) { - if (current !== null) { - { - pop(resumedCache, workInProgress); - } - } -} -function getSuspendedCache() { - // cache that would have been used to render fresh data during this render, - // if there was any, so that we can resume rendering with the same cache when - // we receive more data. - - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also save the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} -function getOffscreenDeferredCache() { - var cacheFromPool = peekCacheFromPool(); - - if (cacheFromPool === null) { - return null; - } - - return { - // We must also store the parent, so that when we resume we can detect - // a refresh. - parent: CacheContext._currentValue2, - pool: cacheFromPool - }; -} - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; // A special exception that's used to unwind the stack when an update flows // into a dehydrated boundary. @@ -14762,6 +14241,517 @@ function beginWork(current, workInProgress, renderLanes) { ); } +var valueCursor = createCursor(null); +var rendererSigil$1; + +{ + // Use this to detect multiple renderers using the same context + rendererSigil$1 = {}; +} + +var currentlyRenderingFiber$1 = null; +var lastContextDependency = null; +var lastFullyObservedContext = null; +var isDisallowedContextReadInDEV = false; +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber$1 = null; + lastContextDependency = null; + lastFullyObservedContext = null; + + { + isDisallowedContextReadInDEV = false; + } +} +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} +function pushProvider(providerFiber, context, nextValue) { + { + push(valueCursor, context._currentValue2, providerFiber); + context._currentValue2 = nextValue; + + { + if ( + context._currentRenderer2 !== undefined && + context._currentRenderer2 !== null && + context._currentRenderer2 !== rendererSigil$1 + ) { + error( + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ); + } + + context._currentRenderer2 = rendererSigil$1; + } + } +} +function popProvider(context, providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + + { + if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) { + context._currentValue2 = context._defaultValue; + } else { + context._currentValue2 = currentValue; + } + } +} +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + + while (node !== null) { + var alternate = node.alternate; + + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + } else if ( + alternate !== null && + !isSubsetOfLanes(alternate.childLanes, renderLanes) + ) { + alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } + + if (node === propagationRoot) { + break; + } + + node = node.return; + } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } +} +function propagateContextChange(workInProgress, context, renderLanes) { + { + propagateContextChange_eager(workInProgress, context, renderLanes); + } +} + +function propagateContextChange_eager(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + + while (fiber !== null) { + var nextFiber = void 0; // Visit this fiber. + + var list = fiber.dependencies; + + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + + while (dependency !== null) { + // Check if the context matches. + if (dependency.context === context) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var lane = pickArbitraryLane(renderLanes); + var update = createUpdate(NoTimestamp, lane); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + // Inlined `enqueueUpdate` to remove interleaved update check + + var updateQueue = fiber.updateQueue; + + if (updateQueue === null); + else { + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; + } + } + + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + } + + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. + + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + // dependency list. + + break; + } + + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if (fiber.tag === DehydratedFragment) { + // If a dehydrated suspense boundary is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates. + var parentSuspense = fiber.return; + + if (parentSuspense === null) { + throw new Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + } + + parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); + var _alternate = parentSuspense.alternate; + + if (_alternate !== null) { + _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); + } // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childLanes on + // this fiber to indicate that a context has changed. + + scheduleContextWorkOnParentPath( + parentSuspense, + renderLanes, + workInProgress + ); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + + var sibling = nextFiber.sibling; + + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + + nextFiber = nextFiber.return; + } + } + + fiber = nextFiber; + } +} +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + lastFullyObservedContext = null; + var dependencies = workInProgress.dependencies; + + if (dependencies !== null) { + { + var firstContext = dependencies.firstContext; + + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } // Reset the work-in-progress list + + dependencies.firstContext = null; + } + } + } +} +function readContext(context) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) { + 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()." + ); + } + } + + var value = context._currentValue2; + + if (lastFullyObservedContext === context); + else { + var contextItem = { + context: context, + memoizedValue: value, + next: null + }; + + if (lastContextDependency === null) { + if (currentlyRenderingFiber$1 === null) { + throw new 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()." + ); + } // This is the first dependency for this component. Create a new list. + + lastContextDependency = contextItem; + currentlyRenderingFiber$1.dependencies = { + lanes: NoLanes, + firstContext: contextItem + }; + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + + return value; +} + +// replace it with a lightweight shim that only has the features we use. + +var AbortControllerLocal = + typeof AbortController !== "undefined" + ? AbortController + : function AbortControllerShim() { + var listeners = []; + var signal = (this.signal = { + aborted: false, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }); + + this.abort = function() { + signal.aborted = true; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; +// Intentionally not named imports because Rollup would +// use dynamic dispatch for CommonJS interop named imports. +var scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, + NormalPriority$1 = Scheduler$1.unstable_NormalPriority; +var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: null, + Provider: null, + // We'll initialize these at the root. + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + _defaultValue: null, + _globalName: null +}; + +{ + CacheContext._currentRenderer = null; + CacheContext._currentRenderer2 = null; +} // Creates a new empty Cache instance with a ref-count of 0. The caller is responsible +// for retaining the cache once it is in use (retainCache), and releasing the cache +// once it is no longer needed (releaseCache). + +function createCache() { + var cache = { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; + return cache; +} +function retainCache(cache) { + { + if (cache.controller.signal.aborted) { + warn( + "A cache instance was retained after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + cache.refCount++; +} // Cleanup a cache instance, potentially freeing it if there are no more references + +function releaseCache(cache) { + cache.refCount--; + + { + if (cache.refCount < 0) { + warn( + "A cache instance was released after it was already freed. " + + "This likely indicates a bug in React." + ); + } + } + + if (cache.refCount === 0) { + scheduleCallback$1(NormalPriority$1, function() { + cache.controller.abort(); + }); + } +} +function pushCacheProvider(workInProgress, cache) { + pushProvider(workInProgress, CacheContext, cache); +} +function popCacheProvider(workInProgress, cache) { + popProvider(CacheContext, workInProgress); +} + +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +var NoTransition = null; +function requestCurrentTransition() { + return ReactCurrentBatchConfig$1.transition; +} // When retrying a Suspense/Offscreen boundary, we restore the cache that was +// used during the previous render by placing it here, on the stack. + +var resumedCache = createCursor(null); // During the render/synchronous commit phase, we don't actually process the + +function peekCacheFromPool() { + // If we're rendering inside a Suspense boundary that is currently hidden, + // we should use the same cache that we used during the previous render, if + // one exists. + + var cacheResumedFromPreviousRender = resumedCache.current; + + if (cacheResumedFromPreviousRender !== null) { + return cacheResumedFromPreviousRender; + } // Otherwise, check the root's cache pool. + + var root = getWorkInProgressRoot(); + var cacheFromRootCachePool = root.pooledCache; + return cacheFromRootCachePool; +} + +function requestCacheFromPool(renderLanes) { + // Similar to previous function, except if there's not already a cache in the + // pool, we allocate a new one. + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool !== null) { + return cacheFromPool; + } // Create a fresh cache and add it to the root cache pool. A cache can have + // multiple owners: + // - A cache pool that lives on the FiberRoot. This is where all fresh caches + // are originally created (TODO: except during refreshes, until we implement + // this correctly). The root takes ownership immediately when the cache is + // created. Conceptually, root.pooledCache is an Option> (owned), + // and the return value of this function is a &Arc (borrowed). + // - One of several fiber types: host root, cache boundary, suspense + // component. These retain and release in the commit phase. + + var root = getWorkInProgressRoot(); + var freshCache = createCache(); + root.pooledCache = freshCache; + retainCache(freshCache); + + if (freshCache !== null) { + root.pooledCacheLanes |= renderLanes; + } + + return freshCache; +} +function pushTransition( + offscreenWorkInProgress, + prevCachePool, + newTransitions +) { + { + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); + } + } +} +function popTransition(workInProgress, current) { + if (current !== null) { + { + pop(resumedCache, workInProgress); + } + } +} +function getSuspendedCache() { + // cache that would have been used to render fresh data during this render, + // if there was any, so that we can resume rendering with the same cache when + // we receive more data. + + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also save the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} +function getOffscreenDeferredCache() { + var cacheFromPool = peekCacheFromPool(); + + if (cacheFromPool === null) { + return null; + } + + return { + // We must also store the parent, so that when we resume we can detect + // a refresh. + parent: CacheContext._currentValue2, + pool: cacheFromPool + }; +} + function getSuspenseFallbackChild(fiber) { return fiber.child.sibling.child; } @@ -22944,10 +22934,10 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } @@ -23844,7 +23834,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-030dae2f4-20221201"; +var ReactVersion = "18.3.0-www-modern-420f0b7fa-20221201"; var didWarnAboutNestedUpdates;