UNPKG

react-test-renderer

Version:

React package for snapshot testing.

1,488 lines (1,479 loc) • 313 kB
/** * @license React * react-test-renderer.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; var React = require("react"), Scheduler = require("scheduler/unstable_mock"), Scheduler$1 = require("scheduler"); function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1; descriptor.configurable = !0; "value" in descriptor && (descriptor.writable = !0); var JSCompiler_temp_const = Object, JSCompiler_temp_const$jscomp$0 = JSCompiler_temp_const.defineProperty; a: { var i$jscomp$0 = descriptor.key; if ("object" == typeof i$jscomp$0 && i$jscomp$0) { var e = i$jscomp$0[Symbol.toPrimitive]; if (void 0 !== e) { i$jscomp$0 = e.call(i$jscomp$0, "string"); if ("object" != typeof i$jscomp$0) break a; throw new TypeError("@@toPrimitive must return a primitive value."); } i$jscomp$0 = String(i$jscomp$0); } } JSCompiler_temp_const$jscomp$0.call( JSCompiler_temp_const, target, "symbol" == typeof i$jscomp$0 ? i$jscomp$0 : i$jscomp$0 + "", descriptor ); } } function _createClass(Constructor, protoProps, staticProps) { protoProps && _defineProperties(Constructor.prototype, protoProps); staticProps && _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: !1 }); return Constructor; } var assign = Object.assign; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; if (fiber.alternate) for (; node.return; ) node = node.return; else { fiber = node; do (node = fiber), 0 !== (node.flags & 4098) && (nearestMounted = node.return), (fiber = node.return); while (fiber); } return 3 === node.tag ? nearestMounted : null; } function assertIsMounted(fiber) { if (getNearestMountedFiber(fiber) !== fiber) throw Error("Unable to find node on an unmounted component."); } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { alternate = getNearestMountedFiber(fiber); if (null === alternate) throw Error("Unable to find node on an unmounted component."); return alternate !== fiber ? null : fiber; } for (var a = fiber, b = alternate; ; ) { var parentA = a.return; if (null === parentA) break; var parentB = parentA.alternate; if (null === parentB) { b = parentA.return; if (null !== b) { a = b; continue; } break; } if (parentA.child === parentB.child) { for (parentB = parentA.child; parentB; ) { if (parentB === a) return assertIsMounted(parentA), fiber; if (parentB === b) return assertIsMounted(parentA), alternate; parentB = parentB.sibling; } throw Error("Unable to find node on an unmounted component."); } if (a.return !== b.return) (a = parentA), (b = parentB); else { for (var didFindChild = !1, child$0 = parentA.child; child$0; ) { if (child$0 === a) { didFindChild = !0; a = parentA; b = parentB; break; } if (child$0 === b) { didFindChild = !0; b = parentA; a = parentB; break; } child$0 = child$0.sibling; } if (!didFindChild) { for (child$0 = parentB.child; child$0; ) { if (child$0 === a) { didFindChild = !0; a = parentB; b = parentA; break; } if (child$0 === b) { didFindChild = !0; b = parentB; a = parentA; break; } child$0 = child$0.sibling; } if (!didFindChild) throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." ); } } if (a.alternate !== b) throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." ); } if (3 !== a.tag) throw Error("Unable to find node on an unmounted component."); return a.stateNode.current === a ? fiber : alternate; } var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"); Symbol.for("react.scope"); var REACT_ACTIVITY_TYPE = Symbol.for("react.activity"); Symbol.for("react.legacy_hidden"); Symbol.for("react.tracing_marker"); var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); Symbol.for("react.view_transition"); var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; maybeIterable = (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || maybeIterable["@@iterator"]; return "function" === typeof maybeIterable ? maybeIterable : null; } var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; case REACT_ACTIVITY_TYPE: return "Activity"; } if ("object" === typeof type) switch (type.$$typeof) { case REACT_PORTAL_TYPE: return "Portal"; case REACT_CONTEXT_TYPE: return (type.displayName || "Context") + ".Provider"; case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer"; case REACT_FORWARD_REF_TYPE: var innerType = type.render; type = type.displayName; type || ((type = innerType.displayName || innerType.name || ""), (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); return type; case REACT_MEMO_TYPE: return ( (innerType = type.displayName || null), null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo" ); case REACT_LAZY_TYPE: innerType = type._payload; type = type._init; try { return getComponentNameFromType(type(innerType)); } catch (x) {} } return null; } var isArrayImpl = Array.isArray, ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, scheduleCallback$2 = Scheduler$1.unstable_scheduleCallback, cancelCallback$1 = Scheduler$1.unstable_cancelCallback, shouldYield = Scheduler$1.unstable_shouldYield, requestPaint = Scheduler$1.unstable_requestPaint, now = Scheduler$1.unstable_now, ImmediatePriority = Scheduler$1.unstable_ImmediatePriority, UserBlockingPriority = Scheduler$1.unstable_UserBlockingPriority, NormalPriority$1 = Scheduler$1.unstable_NormalPriority, IdlePriority = Scheduler$1.unstable_IdlePriority, log$1 = Scheduler$1.log, unstable_setDisableYieldValue = Scheduler$1.unstable_setDisableYieldValue, rendererID = null, injectedHook = null; function setIsStrictModeForDevtools(newIsStrictMode) { "function" === typeof log$1 && unstable_setDisableYieldValue(newIsStrictMode); if (injectedHook && "function" === typeof injectedHook.setStrictMode) try { injectedHook.setStrictMode(rendererID, newIsStrictMode); } catch (err) {} } var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log = Math.log, LN2 = Math.LN2; function clz32Fallback(x) { x >>>= 0; return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; } var nextTransitionLane = 256, nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { var pendingSyncLanes = lanes & 42; if (0 !== pendingSyncLanes) return pendingSyncLanes; switch (lanes & -lanes) { case 1: return 1; case 2: return 2; case 4: return 4; case 8: return 8; case 16: return 16; case 32: return 32; case 64: return 64; case 128: return 128; case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return lanes & 4194048; case 4194304: case 8388608: case 16777216: case 33554432: return lanes & 62914560; case 67108864: return 67108864; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 0; default: return lanes; } } function getNextLanes(root, wipLanes, rootHasPendingCommit) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; root = root.warmLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) : ((pingedLanes &= nonIdlePendingLanes), 0 !== pingedLanes ? (nextLanes = getHighestPriorityLanes(pingedLanes)) : rootHasPendingCommit || ((rootHasPendingCommit = nonIdlePendingLanes & ~root), 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit))))) : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), 0 !== nonIdlePendingLanes ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) : 0 !== pingedLanes ? (nextLanes = getHighestPriorityLanes(pingedLanes)) : rootHasPendingCommit || ((rootHasPendingCommit = pendingLanes & ~root), 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), (rootHasPendingCommit = wipLanes & -wipLanes), suspendedLanes >= rootHasPendingCommit || (32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048))) ? wipLanes : nextLanes; } function checkIfRootIsPrerendering(root, renderLanes) { return ( 0 === (root.pendingLanes & ~(root.suspendedLanes & ~root.pingedLanes) & renderLanes) ); } function computeExpirationTime(lane, currentTime) { switch (lane) { case 1: case 2: case 4: case 8: case 64: return currentTime + 250; case 16: case 32: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return currentTime + 5e3; case 4194304: case 8388608: case 16777216: case 33554432: return -1; case 67108864: case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return -1; } } function claimNextTransitionLane() { var lane = nextTransitionLane; nextTransitionLane <<= 1; 0 === (nextTransitionLane & 4194048) && (nextTransitionLane = 256); return lane; } function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } function markRootUpdated$1(root, updateLane) { root.pendingLanes |= updateLane; 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; root.suspendedLanes &= ~spawnedLane; var spawnedLaneIndex = 31 - clz32(spawnedLane); root.entangledLanes |= spawnedLane; root.entanglements[spawnedLaneIndex] = root.entanglements[spawnedLaneIndex] | 1073741824 | (entangledLanes & 4194090); } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { var index$6 = 31 - clz32(rootEntangledLanes), lane = 1 << index$6; (lane & entangledLanes) | (root[index$6] & entangledLanes) && (root[index$6] |= entangledLanes); rootEntangledLanes &= ~lane; } } function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes ? 0 !== (lanes & 134217727) ? 32 : 268435456 : 8 : 2; } function shim$1() { throw Error( "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." ); } function shim() { throw Error( "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." ); } var NO_CONTEXT = {}, nodeToInstanceMap = new WeakMap(); function getPublicInstance(inst) { switch (inst.tag) { case "INSTANCE": var createNodeMock = inst.rootContainerInstance.createNodeMock; createNodeMock = createNodeMock({ type: inst.type, props: inst.props }); "object" === typeof createNodeMock && null !== createNodeMock && nodeToInstanceMap.set(createNodeMock, inst); return createNodeMock; default: return inst; } } function appendChild(parentInstance, child) { var index = parentInstance.children.indexOf(child); -1 !== index && parentInstance.children.splice(index, 1); parentInstance.children.push(child); } function insertBefore(parentInstance, child, beforeChild) { var index = parentInstance.children.indexOf(child); -1 !== index && parentInstance.children.splice(index, 1); beforeChild = parentInstance.children.indexOf(beforeChild); parentInstance.children.splice(beforeChild, 0, child); } var currentUpdatePriority = 0, scheduleTimeout = setTimeout, cancelTimeout = clearTimeout, HostTransitionContext = { $$typeof: REACT_CONTEXT_TYPE, Provider: null, Consumer: null, _currentValue: null, _currentValue2: null, _threadCount: 0 }, valueStack = [], index = -1; function createCursor(defaultValue) { return { current: defaultValue }; } function pop(cursor) { 0 > index || ((cursor.current = valueStack[index]), (valueStack[index] = null), index--); } function push(cursor, value) { index++; valueStack[index] = cursor.current; cursor.current = value; } var emptyContextObject = {}, prefix, suffix; function describeBuiltInComponentFrame(name) { if (void 0 === prefix) try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = (match && match[1]) || ""; suffix = -1 < x.stack.indexOf("\n at") ? " (<anonymous>)" : -1 < x.stack.indexOf("@") ? "@unknown:0:0" : ""; } return "\n" + prefix + name + suffix; } var reentry = !1; function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) return ""; reentry = !0; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { var RunInRootFrame = { DetermineComponentFrameRoot: function () { try { if (construct) { var Fake = function () { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function () { throw Error(); } }); if ("object" === typeof Reflect && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x) { var control = x; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x$7) { control = x$7; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x$8) { control = x$8; } (Fake = fn()) && "function" === typeof Fake.catch && Fake.catch(function () {}); } } catch (sample) { if (sample && control && "string" === typeof sample.stack) return [sample.stack, control.stack]; } return [null, null]; } }; RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; var namePropDescriptor = Object.getOwnPropertyDescriptor( RunInRootFrame.DetermineComponentFrameRoot, "name" ); namePropDescriptor && namePropDescriptor.configurable && Object.defineProperty( RunInRootFrame.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" } ); var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), sampleStack = _RunInRootFrame$Deter[0], controlStack = _RunInRootFrame$Deter[1]; if (sampleStack && controlStack) { var sampleLines = sampleStack.split("\n"), controlLines = controlStack.split("\n"); for ( namePropDescriptor = RunInRootFrame = 0; RunInRootFrame < sampleLines.length && !sampleLines[RunInRootFrame].includes("DetermineComponentFrameRoot"); ) RunInRootFrame++; for ( ; namePropDescriptor < controlLines.length && !controlLines[namePropDescriptor].includes( "DetermineComponentFrameRoot" ); ) namePropDescriptor++; if ( RunInRootFrame === sampleLines.length || namePropDescriptor === controlLines.length ) for ( RunInRootFrame = sampleLines.length - 1, namePropDescriptor = controlLines.length - 1; 1 <= RunInRootFrame && 0 <= namePropDescriptor && sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]; ) namePropDescriptor--; for ( ; 1 <= RunInRootFrame && 0 <= namePropDescriptor; RunInRootFrame--, namePropDescriptor-- ) if (sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) { if (1 !== RunInRootFrame || 1 !== namePropDescriptor) { do if ( (RunInRootFrame--, namePropDescriptor--, 0 > namePropDescriptor || sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) ) { var frame = "\n" + sampleLines[RunInRootFrame].replace(" at new ", " at "); fn.displayName && frame.includes("<anonymous>") && (frame = frame.replace("<anonymous>", fn.displayName)); return frame; } while (1 <= RunInRootFrame && 0 <= namePropDescriptor); } break; } } } finally { (reentry = !1), (Error.prepareStackTrace = previousPrepareStackTrace); } return (previousPrepareStackTrace = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; } function describeFiber(fiber) { switch (fiber.tag) { case 26: case 27: case 5: return describeBuiltInComponentFrame(fiber.type); case 16: return describeBuiltInComponentFrame("Lazy"); case 13: return describeBuiltInComponentFrame("Suspense"); case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: case 15: return describeNativeComponentFrame(fiber.type, !1); case 11: return describeNativeComponentFrame(fiber.type.render, !1); case 1: return describeNativeComponentFrame(fiber.type, !0); case 31: return describeBuiltInComponentFrame("Activity"); default: return ""; } } function getStackByFiberInDevAndProd(workInProgress) { try { var info = ""; do (info += describeFiber(workInProgress)), (workInProgress = workInProgress.return); while (workInProgress); return info; } catch (x) { return "\nError generating stack: " + x.message + "\n" + x.stack; } } var CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var existing = CapturedStacks.get(value); if (void 0 !== existing) return existing; source = { value: value, source: source, stack: getStackByFiberInDevAndProd(source) }; CapturedStacks.set(value, source); return source; } return { value: value, source: source, stack: getStackByFiberInDevAndProd(source) }; } var contextStackCursor = createCursor(null), contextFiberStackCursor = createCursor(null), rootInstanceStackCursor = createCursor(null), hostTransitionProviderCursor = createCursor(null); function pushHostContainer(fiber, nextRootInstance) { push(rootInstanceStackCursor, nextRootInstance); push(contextFiberStackCursor, fiber); push(contextStackCursor, null); pop(contextStackCursor); push(contextStackCursor, NO_CONTEXT); } function popHostContainer() { pop(contextStackCursor); pop(contextFiberStackCursor); pop(rootInstanceStackCursor); } function pushHostContext(fiber) { null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber); contextStackCursor.current !== NO_CONTEXT && (push(contextFiberStackCursor, fiber), push(contextStackCursor, NO_CONTEXT)); } function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor), pop(contextFiberStackCursor)); hostTransitionProviderCursor.current === fiber && (pop(hostTransitionProviderCursor), (HostTransitionContext._currentValue2 = null)); } var hydrationErrors = null; function upgradeHydrationErrorsToRecoverable() { var queuedErrors = hydrationErrors; null !== queuedErrors && (null === workInProgressRootRecoverableErrors ? (workInProgressRootRecoverableErrors = queuedErrors) : workInProgressRootRecoverableErrors.push.apply( workInProgressRootRecoverableErrors, queuedErrors ), (hydrationErrors = null)); return queuedErrors; } function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } var objectIs = "function" === typeof Object.is ? Object.is : is, valueCursor = createCursor(null), currentlyRenderingFiber$1 = null, lastContextDependency = null; function pushProvider(providerFiber, context, nextValue) { push(valueCursor, context._currentValue2); context._currentValue2 = nextValue; } function popProvider(context) { context._currentValue2 = valueCursor.current; pop(valueCursor); } 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 propagateContextChanges( workInProgress, contexts, renderLanes, forcePropagateEntireTree ) { 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( "We just came from a parent so we must have had a parent. This is a bug in React." ); 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 ) { current = null; for ( var parent = workInProgress, isInsidePropagationBailout = !1; null !== parent; ) { if (!isInsidePropagationBailout) if (0 !== (parent.flags & 524288)) isInsidePropagationBailout = !0; else if (0 !== (parent.flags & 262144)) break; if (10 === parent.tag) { var currentParent = parent.alternate; if (null === currentParent) throw Error("Should have a current fiber. This is a bug in React."); currentParent = currentParent.memoizedProps; if (null !== currentParent) { var context = parent.type; objectIs(parent.pendingProps.value, currentParent.value) || (null !== current ? current.push(context) : (current = [context])); } } else if (parent === hostTransitionProviderCursor.current) { currentParent = parent.alternate; if (null === currentParent) throw Error("Should have a current fiber. This is a bug in React."); currentParent.memoizedState.memoizedState !== parent.memoizedState.memoizedState && (null !== current ? current.push(HostTransitionContext) : (current = [HostTransitionContext])); } parent = parent.return; } null !== current && propagateContextChanges( workInProgress, current, renderLanes, forcePropagateEntireTree ); workInProgress.flags |= 262144; } function checkIfContextChanged(currentDependencies) { for ( currentDependencies = currentDependencies.firstContext; null !== currentDependencies; ) { if ( !objectIs( currentDependencies.context._currentValue2, currentDependencies.memoizedValue ) ) return !0; currentDependencies = currentDependencies.next; } return !1; } function prepareToReadContext(workInProgress) { currentlyRenderingFiber$1 = workInProgress; lastContextDependency = null; workInProgress = workInProgress.dependencies; null !== workInProgress && (workInProgress.firstContext = null); } function readContext(context) { return readContextForConsumer(currentlyRenderingFiber$1, context); } function readContextDuringReconciliation(consumer, context) { null === currentlyRenderingFiber$1 && prepareToReadContext(consumer); return readContextForConsumer(consumer, context); } function readContextForConsumer(consumer, context) { var value = context._currentValue2; context = { context: context, memoizedValue: value, next: null }; if (null === lastContextDependency) { if (null === consumer) throw 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()." ); lastContextDependency = context; consumer.dependencies = { lanes: 0, firstContext: context }; consumer.flags |= 524288; } 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$1.unstable_scheduleCallback, NormalPriority = Scheduler$1.unstable_NormalPriority, CacheContext = { $$typeof: REACT_CONTEXT_TYPE, Consumer: null, Provider: null, _currentValue: null, _currentValue2: null, _threadCount: 0 }; function createCache() { return { controller: new AbortControllerLocal(), data: new Map(), refCount: 0 }; } function releaseCache(cache) { cache.refCount--; 0 === cache.refCount && scheduleCallback$1(NormalPriority, function () { cache.controller.abort(); }); } var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, isFlushingWork = !1, currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && (null === lastScheduledRoot ? (firstScheduledRoot = lastScheduledRoot = root) : (lastScheduledRoot = lastScheduledRoot.next = root)); mightHavePendingSyncWork = !0; didScheduleMicrotask || ((didScheduleMicrotask = !0), scheduleCallback$2(ImmediatePriority, processRootScheduleInImmediateTask)); } function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= pendingLanes & ~(suspendedLanes & ~pingedLanes); JSCompiler_inline_result = JSCompiler_inline_result & 201326741 ? (JSCompiler_inline_result & 201326741) | 1 : JSCompiler_inline_result ? JSCompiler_inline_result | 2 : 0; } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), performSyncWorkOnRoot(root, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( root, root === workInProgressRoot ? JSCompiler_inline_result : 0, null !== root.cancelPendingCommit || -1 !== root.timeoutHandle )), 0 === (JSCompiler_inline_result & 3) || checkIfRootIsPrerendering(root, JSCompiler_inline_result) || ((didPerformSomeWork = !0), performSyncWorkOnRoot(root, JSCompiler_inline_result)); root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; } } function processRootScheduleInImmediateTask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; 0 !== currentEventTransitionLane && (currentEventTransitionLane = 0); for ( var currentTime = now(), prev = null, root = firstScheduledRoot; null !== root; ) { var next = root.next, nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), null === next && (lastScheduledRoot = prev)) : ((prev = root), 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } flushSyncWorkAcrossRoots_impl(0, !1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { for ( var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, lanes = root.pendingLanes & -62914561; 0 < lanes; ) { var index$3 = 31 - clz32(lanes), lane = 1 << index$3, expirationTime = expirationTimes[index$3]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) expirationTimes[index$3] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } suspendedLanes = pendingEffectsLanes; currentTime = workInProgressRoot; pingedLanes = workInProgressRootRenderLanes; expirationTimes = null !== root.cancelPendingCommit || -1 !== root.timeoutHandle; suspendedLanes = root === (5 === pendingEffectsStatus ? pendingEffectsRoot : null) ? suspendedLanes : getNextLanes( root, root === currentTime ? pingedLanes : 0, expirationTimes ); pingedLanes = root.callbackNode; if ( 0 === suspendedLanes || (root === currentTime && (2 === workInProgressSuspendedReason || 9 === workInProgressSuspendedReason)) || null !== root.cancelPendingCommit ) return ( null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes), (root.callbackNode = null), (root.callbackPriority = 0) ); if ( 0 !== (suspendedLanes & 3) && !checkIfRootIsPrerendering(root, suspendedLanes) ) return ( null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes), (root.callbackPriority = 2), (root.callbackNode = null), 2 ); currentTime = suspendedLanes & -suspendedLanes; if (currentTime === root.callbackPriority) return currentTime; null !== pingedLanes && cancelCallback$1(pingedLanes); switch (lanesToEventPriority(suspendedLanes)) { case 2: case 8: suspendedLanes = UserBlockingPriority; break; case 32: suspendedLanes = NormalPriority$1; break; case 268435456: suspendedLanes = IdlePriority; break; default: suspendedLanes = NormalPriority$1; } pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); suspendedLanes = scheduleCallback$2(suspendedLanes, pingedLanes); root.callbackPriority = currentTime; root.callbackNode = suspendedLanes; return currentTime; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { if (0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) return (root.callbackNode = null), (root.callbackPriority = 0), null; var originalCallbackNode = root.callbackNode; if (flushPendingEffects(!0) && root.callbackNode !== originalCallbackNode) return null; var workInProgressRootRenderLanes$jscomp$0 = workInProgressRootRenderLanes; workInProgressRootRenderLanes$jscomp$0 = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes$jscomp$0 : 0, null !== root.cancelPendingCommit || -1 !== root.timeoutHandle ); if (0 === workInProgressRootRenderLanes$jscomp$0) return null; performWorkOnRoot(root, workInProgressRootRenderLanes$jscomp$0, didTimeout); scheduleTaskForRootDuringMicrotask(root, now()); return null != root.callbackNode && root.callbackNode === originalCallbackNode ? performWorkOnRootViaSchedulerTask.bind(null, root) : null; } function performSyncWorkOnRoot(root, lanes) { if (flushPendingEffects()) return null; performWorkOnRoot(root, lanes, !0); } function requestTransitionLane() { 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()); return currentEventTransitionLane; } var currentEntangledListeners = null, currentEntangledPendingCount = 0, currentEntangledLane = 0, currentEntangledActionThenable = null; function entangleAsyncAction(transition, thenable) { if (null === currentEntangledListeners) { var entangledListeners = (currentEntangledListeners = []); currentEntangledPendingCount = 0; currentEntangledLane = requestTransitionLane(); currentEntangledActionThenable = { status: "pending", value: void 0, then: function (resolve) { entangledListeners.push(resolve); } }; } currentEntangledPendingCount++; thenable.then(pingEngtangledActionScope, pingEngtangledActionScope); return thenable; } function pingEngtangledActionScope() { if ( 0 === --currentEntangledPendingCount && null !== currentEntangledListeners ) { null !== currentEntangledActionThenable && (currentEntangledActionThenable.status = "fulfilled"); var listeners = currentEntangledListeners; currentEntangledListeners = null; currentEntangledLane = 0; currentEntangledActionThenable = null; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(); } } function chainThenableValue(thenable, result) { var listeners = [], thenableWithOverride = { status: "pending", value: null, reason: null, then: function (resolve) { listeners.push(resolve); } }; thenable.then( function () { thenableWithOverride.status = "fulfilled"; thenableWithOverride.value = result; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(result); }, function (error) { thenableWithOverride.status = "rejected"; thenableWithOverride.reason = error; for (error = 0; error < listeners.length; error++) (0, listeners[error])(void 0); } ); return thenableWithOverride; } var prevOnStartTransitionFinish = ReactSharedInternals.S; ReactSharedInternals.S = function (transition, returnValue) { "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && entangleAsyncAction(transition, returnValue); null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); }; 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._currentValue2, pool: cacheFromPool }; } var hasOwnProperty = Object.prototype.hasOwnProperty; function shallowEqual(objA, objB) { if (objectIs(objA, objB)) return !0; if ( "object" !== typeof objA || null === objA || "object" !== typeof objB || null === objB ) return !1; var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; for (keysB = 0; keysB < keysA.length; keysB++) { var currentKey = keysA[keysB]; if ( !hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey]) ) return !1; } return !0; } var SuspenseException = Error( "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`." ), SuspenseyCommitException = Error( "Suspense Exception: This is not a real error, and should not leak into userspace. If you're seeing this, it's likely a bug in React." ), SuspenseActionException = Error( "Suspense Exception: This is not a real error! It's an implementation detail of `useActionState` to interrupt the current render. You must either rethrow it immediately, or move the `useActionState` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary." ), noopSuspenseyCommitThenable = { then: function () {} }; function isThenableResolved(thenable) { thenable = thenable.status; return "fulfilled" === thenable || "rejected" === thenable; } function noop() {} function trackUsedThenable(thenableState, thenable, index) { index = thenableState[index]; void 0 === index ? thenableState.push(thenable) : index !== thenable && (thenable.then(noop, noop), (thenable = index)); switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw ( ((thenableState = thenable.reason), checkIfUseWrappedInAsyncCatch(thenableState), thenableState) ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { thenableState = workInProgressRoot; if (null !== thenableState && 100 < thenableState.shellSuspendCounter) throw Error( "An unknown Component is an async Client Component. Only Server Components can be async at the moment. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." ); thenableState = thenable; thenableState.status = "pending"; thenableState.then( function (fulfilledValue) { if ("pending" === thenable.status) { var fulfilledThenable = thenable; fulfilledThenable.status = "fulfilled"; fulfilledThenable.value = fulfilledValue; } }, function (error) { if ("pending" === thenable.status) { var rejectedThenable = thenable; rejectedThenable.status = "rejected"; rejectedThenable.reason = error; } } ); } switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw ( ((thenableState = thenable.reason), checkIfUseWrappedInAsyncCatch(thenableState), thenableState) ); } suspendedThenable = thenable; throw SuspenseException; } } var suspendedThenable = null; function getSuspendedThenable() { if (null === suspendedThenable) throw Error( "Expected a suspended thenable. This is a bug in React. Please file an issue." ); var thenable = suspendedThenable; suspendedThenable = null; return thenable; } function checkIfUseWrappedInAsyncCatch(rejectedReason) { if ( rejectedReason === SuspenseException || rejectedReason === SuspenseActionException ) throw Error( "Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." ); } 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$1(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 enqueueConcurrentHookUpdate(fiber, queue, update, lane) { enqueueUpdate$1(fiber, queue, update, lane); return getRootForUpdatedFiber(fiber); } function enqueueConcurrentRenderForLane(fiber, lane) { enqueueUpdate$1(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); return 3 === sourceFiber.tag ? ((parent = sourceFiber.stateNode), isHidden && null !== update && ((isHidden = 31 - clz32(lane)), (sourceFiber = parent.hiddenUpdates), (alternate = sourceFiber[isHidden]), null === alternate ? (sourceFiber[isHidden] = [update]) : alternate.push(update), (update.lane = lane | 536870912)), parent) : null; } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) throw ( ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." )) ); 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(lane) { return { lane: lane, tag: 0, payload: null, callback: null, next: null }; } function enqueueUpdate(fiber, update, lane) { var updateQueue = fiber.updateQueue; if (null === updateQueue) return null; updateQueue = updateQueue.shared; if (0 !== (executionContext & 2)) { var pending = update